List:Commits« Previous MessageNext Message »
From:Stewart Smith Date:October 12 2007 7:21am
Subject:Re: bk commit into 5.0 tree (Justin.He:1.2483) BUG#27999
View as plain text  
Hi Justin!

A few thoughts:

- I think we should only have this in 5.1-telco, not critical for 5.0
(or 5.1)
- If Tomas is okay with it, telco-6.2

On Sun, 2007-09-30 at 16:10 +0800, justin.he@stripped wrote:
> --- 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;
>    };

I think we should have (and specify) the following behaviour:
- If single_user_api is zero, not in single user mode
- If single_user_api is > 0, in single user mode. Value is node id that
has access.

>    /**
> 
> --- 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);
>    }

Do we init single_user_api? I don't see it. We should, so then we
properly support querying old servers with new api.

> --- 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
>  	{

With my above suggestion, this changes slightly.

> --- 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);

I don't think we need the default here, I don't see status being called
anywhere else.

>    
>    // 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);
>    }
>  
>  }

ok.
-- 
Stewart Smith, Senior Software Engineer
MySQL AB, www.mysql.com
Office: +14082136540 Ext: 6616
VoIP: 6616@stripped
Mobile: +61 4 3 8844 332

Jumpstart your cluster:
http://www.mysql.com/consulting/packaged/cluster.html

Attachment: [application/pgp-signature] This is a digitally signed message part signature.asc
Attachment: [application/pgp-signature] This is a digitally signed message part signature.asc
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