List:Commits« Previous MessageNext Message »
From:justin.he Date:September 30 2007 8:10am
Subject:bk commit into 5.0 tree (Justin.He:1.2483) BUG#27999
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of justin.he. When justin.he does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-09-30 16:10:43+08:00, Justin.He@stripped +6 -0
  Bug#27999 Single User Mode: Management client should show API permitted to connect

  ndb/include/mgmapi/mgmapi.h@stripped, 2007-09-30 16:10:40+08:00, Justin.He@stripped +4 -0
    add a variable definition to get which node is permitted to connect to ndbd
    after enter single user mode

  ndb/src/mgmapi/mgmapi.cpp@stripped, 2007-09-30 16:10:41+08:00, Justin.He@stripped +2 -0
    parse single user api node id

  ndb/src/mgmclient/CommandInterpreter.cpp@stripped, 2007-09-30 16:10:41+08:00, Justin.He@stripped +22 -3
    print single user mode info for API nodes

  ndb/src/mgmsrv/MgmtSrvr.cpp@stripped, 2007-09-30 16:10:41+08:00, Justin.He@stripped +4 -1
    get node id of single user api node from API regconf

  ndb/src/mgmsrv/MgmtSrvr.hpp@stripped, 2007-09-30 16:10:41+08:00, Justin.He@stripped +2 -1
    add a variable definition regarding API node id

  ndb/src/mgmsrv/Services.cpp@stripped, 2007-09-30 16:10:41+08:00, Justin.He@stripped +4 -2
    send node status to mgmapi clients

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	Justin.He
# Host:	dev3-240.dev.cn.tlan
# Root:	/home/justin.he/mysql/mysql-5.0/bug27999-5.0-ndb

--- 1.55/ndb/include/mgmapi/mgmapi.h	2007-09-30 16:10:49 +08:00
+++ 1.56/ndb/include/mgmapi/mgmapi.h	2007-09-30 16:10:50 +08:00
@@ -352,6 +352,10 @@
 			 sizeof("000.000.000.000")+1
 #endif
     ];
+    /* the id of API node which is permitted only to connect to NDBD node
+     * after enter single user mode;
+     */
+    int single_user_api;
   };
 
   /**

--- 1.72/ndb/src/mgmapi/mgmapi.cpp	2007-09-30 16:10:50 +08:00
+++ 1.73/ndb/src/mgmapi/mgmapi.cpp	2007-09-30 16:10:50 +08:00
@@ -734,6 +734,8 @@
   } else if(strcmp("address", field) == 0){
     strncpy(state->connect_address, value, sizeof(state->connect_address));
     state->connect_address[sizeof(state->connect_address)-1]= 0;
+  } else if(strcmp("single_user_api", field) == 0){
+    state->single_user_api = atoi(value);
   } else {
     ndbout_c("Unknown field: %s", field);
   }

--- 1.80/ndb/src/mgmclient/CommandInterpreter.cpp	2007-09-30 16:10:50 +08:00
+++ 1.81/ndb/src/mgmclient/CommandInterpreter.cpp	2007-09-30 16:10:50 +08:00
@@ -1597,12 +1597,21 @@
 	    const char *proc_name, int no_proc, ndb_mgm_node_type type,
 	    int master_id)
 { 
-  int i;
+  int i, single_user_api=0;
   ndbout << "[" << proc_name
 	 << "(" << ndb_mgm_get_node_type_string(type) << ")]\t"
 	 << no_proc << " node(s)" << endl;
   for(i=0; i < state->no_of_nodes; i++) {
     struct ndb_mgm_node_state *node_state= &(state->node_states[i]);
+    if(node_state->node_type == NDB_MGM_NODE_TYPE_NDB) {
+      if(node_state->node_status == NDB_MGM_NODE_STATUS_SINGLEUSER) {
+        single_user_api = node_state->single_user_api;
+        break;
+      }
+    }
+  }
+  for(i=0; i < state->no_of_nodes; i++) {
+    struct ndb_mgm_node_state *node_state= &(state->node_states[i]);
     if(node_state->node_type == type) {
       int node_id= node_state->node_id;
       ndbout << "id=" << node_id;
@@ -1628,6 +1637,12 @@
 	      ndbout << ", Master";
 	  }
 	}
+	if (type == NDB_MGM_NODE_TYPE_API && single_user_api) {
+	  if (single_user_api == node_id)
+	    ndbout << ", " << status_string(NDB_MGM_NODE_STATUS_SINGLEUSER);
+	  else
+	    ndbout << ", " << "no operations allowed";
+	}
 	ndbout << ")" << endl;
       } else {
 	ndb_mgm_first(it);
@@ -1636,8 +1651,12 @@
 	  ndb_mgm_get_string_parameter(it, CFG_NODE_HOST, &config_hostname);
 	  if (config_hostname == 0 || config_hostname[0] == 0)
 	    config_hostname= "any host";
-	  ndbout_c(" (not connected, accepting connect from %s)",
-		   config_hostname);
+	  if (type == NDB_MGM_NODE_TYPE_API && single_user_api)
+	    ndbout_c(" (not connected, accepting connect from %s, no operations allowed)", 
+	             config_hostname);
+	  else 
+	    ndbout_c(" (not connected, accepting connect from %s)", 
+	             config_hostname);
 	}
 	else
 	{

--- 1.117/ndb/src/mgmsrv/MgmtSrvr.cpp	2007-09-30 16:10:50 +08:00
+++ 1.118/ndb/src/mgmsrv/MgmtSrvr.cpp	2007-09-30 16:10:50 +08:00
@@ -1492,7 +1492,8 @@
 		 Uint32 * dynamic,
 		 Uint32 * nodegroup,
 		 Uint32 * connectCount,
-		 const char **address)
+		 const char **address, 
+		 Uint32 * single_user_api)
 {
   if (getNodeType(nodeId) == NDB_MGM_NODE_TYPE_API ||
       getNodeType(nodeId) == NDB_MGM_NODE_TYPE_MGM) {
@@ -1516,6 +1517,8 @@
   * dynamic = node.m_state.dynamicId;
   * nodegroup = node.m_state.nodeGroup;
   * connectCount = node.m_info.m_connectCount;
+  if (single_user_api)
+    * single_user_api = node.m_state.singleUserApi;
   
   switch(node.m_state.startLevel){
   case NodeState::SL_CMVMI:

--- 1.53/ndb/src/mgmsrv/MgmtSrvr.hpp	2007-09-30 16:10:50 +08:00
+++ 1.54/ndb/src/mgmsrv/MgmtSrvr.hpp	2007-09-30 16:10:50 +08:00
@@ -221,7 +221,8 @@
 	     Uint32 * dynamicId,
 	     Uint32 * nodeGroup,
 	     Uint32 * connectCount,
-	     const char **address);
+	     const char **address,
+       Uint32 * single_user_api=NULL);
   
   // All the functions below may return any of this error codes:
   // NO_CONTACT_WITH_PROCESS, PROCESS_NOT_CONFIGURED, WRONG_PROCESS_TYPE,

--- 1.77/ndb/src/mgmsrv/Services.cpp	2007-09-30 16:10:50 +08:00
+++ 1.78/ndb/src/mgmsrv/Services.cpp	2007-09-30 16:10:50 +08:00
@@ -930,12 +930,13 @@
       version = 0, 
       dynamicId = 0, 
       nodeGroup = 0,
-      connectCount = 0;
+      connectCount = 0,
+      single_user_api = 0;
     bool system;
     const char *address= NULL;
     mgmsrv.status(nodeId, &status, &version, &startPhase,
 		  &system, &dynamicId, &nodeGroup, &connectCount,
-		  &address);
+		  &address, &single_user_api);
     output->println("node.%d.type: %s",
 		      nodeId,
 		      ndb_mgm_get_node_type_string(type));
@@ -948,6 +949,7 @@
     output->println("node.%d.node_group: %d", nodeId, nodeGroup);
     output->println("node.%d.connect_count: %d", nodeId, connectCount);
     output->println("node.%d.address: %s", nodeId, address ? address : "");
+    output->println("node.%d.single_user_api: %d", nodeId, single_user_api);
   }
 
 }
Thread
bk commit into 5.0 tree (Justin.He:1.2483) BUG#27999justin.he30 Sep
  • Re: bk commit into 5.0 tree (Justin.He:1.2483) BUG#27999Stewart Smith12 Oct