summaryrefslogtreecommitdiff
path: root/ndb/src/mgmapi
diff options
context:
space:
mode:
authorunknown <stewart@mysql.com>2004-12-23 16:23:32 +1100
committerunknown <stewart@mysql.com>2004-12-23 16:23:32 +1100
commit233a33da3a8d7457d5686139dac04e77a258e247 (patch)
treea1b18447178b08d8d59d989f2e82b855894d3233 /ndb/src/mgmapi
parent168e57197657ccd4babc4dfcc81e8f0216db0342 (diff)
downloadmariadb-git-233a33da3a8d7457d5686139dac04e77a258e247.tar.gz
Impl 2 of WL2278 - Dynamic port allocation of cluster nodes.
In "client connect thread", let the client read the port to connect to using ndb_mgm_get_connection_int_parameter. The request for the port is resent on every connect attempt. ndb/include/mgmapi/mgmapi_debug.h: Make ndb_mgm_get_connection_int_parameter return a Uint32 value - this is what Properties etc use, so we'll be consistent. ndb/include/transporter/TransporterRegistry.hpp: Add NdbMgmHandle to constructor. This is used to get the port number to connect to from mgmd. Defaults to NULL, although things will go badly if you don't change this (by calling the new set_mgm_handle method) pretty quickly. Add set_mgm_handle(NdbMgmHandle) method. - sets the MgmHandle to use when requesting from mgmd what port to connect to a node on. ndb/src/common/transporter/Transporter.hpp: Make remote port not a const. Add method to set remote port - set_r_port(unsigned int) Make getLocalNodeId return localNodeId, not remoteNodeId. ndb/src/common/transporter/TransporterRegistry.cpp: TransporterRegistry::TransporterRegistry() - accept NdbMgmHandle parameter - set m_mgm_handle to this TransporterRegistry::start_clients_thread() - If we're connecting to a node, and the server_port (from the config) is <=0, we request the port number to connect to from mgmd. (note: in testing, the <=0 check was commented out so the code was run. There is no harm in always running it, it's just an extra round-trip to mgmd that we may not need). ndb/src/kernel/main.cpp: Set the mgm_handle for globalTransporterRegistry soon after we have set up theConfig (which sets up the mgmHandle). ndb/src/mgmapi/mgmapi.cpp: - Remove dead #else on #if 1 - Print an error message and warning if the parser returns NULL. this will no longer silently fail, it will give output with information to help the programmer find out where things went wrong. In normal operation, this codepath should never be hit. - fix handlers for 'get|set connection parameter' calls. ndb/src/mgmsrv/MgmtSrvr.cpp: - Create TransporterFacade with the mgmHandle. - Don't worry about the order of node1 and node2 in getConnectionDbParameter - use a proper DBUG_RETURN in getConnectionParameter ndb/src/mgmsrv/Services.cpp: - fix reply to 'get connection parameter' - optimise reply size. ndb/src/ndbapi/TransporterFacade.cpp: - create TransporterRegistry with m_mgm_handle - set m_mgm_handle in constructor ndb/src/ndbapi/TransporterFacade.hpp: Introduce m_mgm_handle member. ndb/src/ndbapi/ndb_cluster_connection.cpp: create TransporterFacade (with mgmHandle) after the ConfigRetriever has been created
Diffstat (limited to 'ndb/src/mgmapi')
-rw-r--r--ndb/src/mgmapi/mgmapi.cpp32
1 files changed, 18 insertions, 14 deletions
diff --git a/ndb/src/mgmapi/mgmapi.cpp b/ndb/src/mgmapi/mgmapi.cpp
index 5721d359ecd..01eaf4badc8 100644
--- a/ndb/src/mgmapi/mgmapi.cpp
+++ b/ndb/src/mgmapi/mgmapi.cpp
@@ -307,14 +307,17 @@ ndb_mgm_call(NdbMgmHandle handle, const ParserRow<ParserDummy> *command_reply,
ParserDummy session(handle->socket);
Parser_t parser(command_reply, in, true, true, true);
-#if 1
const Properties* p = parser.parse(ctx, session);
if (p == NULL){
/**
* Print some info about why the parser returns NULL
*/
- //ndbout << " status=" << ctx.m_status << ", curr="
- //<< ctx.m_currentToken << endl;
+ ndbout << "Error in mgm protocol parser. "
+ << "cmd: '" << cmd
+ << "' status=" << ctx.m_status
+ << ", curr=" << ctx.m_currentToken
+ << endl;
+ DBUG_PRINT("info",("parser.parse returned NULL"));
}
#ifdef MGMAPI_LOG
else {
@@ -325,9 +328,6 @@ ndb_mgm_call(NdbMgmHandle handle, const ParserRow<ParserDummy> *command_reply,
}
#endif
return p;
-#else
- return parser.parse(ctx, session);
-#endif
}
/**
@@ -1998,7 +1998,8 @@ ndb_mgm_set_connection_int_parameter(NdbMgmHandle handle,
const ParserRow<ParserDummy> reply[]= {
MGM_CMD("set connection parameter reply", NULL, ""),
- MGM_ARG("result", String, Mandatory, "Error message"),
+ MGM_ARG("message", String, Mandatory, "Error Message"),
+ MGM_ARG("result", String, Mandatory, "Status Result"),
MGM_END()
};
@@ -2026,7 +2027,7 @@ ndb_mgm_get_connection_int_parameter(NdbMgmHandle handle,
int node1,
int node2,
int param,
- unsigned *value,
+ Uint32 *value,
struct ndb_mgm_reply* mgmreply){
DBUG_ENTER("ndb_mgm_get_connection_int_parameter");
CHECK_HANDLE(handle, -1);
@@ -2036,17 +2037,17 @@ ndb_mgm_get_connection_int_parameter(NdbMgmHandle handle,
args.put("node1", node1);
args.put("node2", node2);
args.put("param", param);
-
+
const ParserRow<ParserDummy> reply[]= {
MGM_CMD("get connection parameter reply", NULL, ""),
- MGM_ARG("result", String, Mandatory, "Error message"),
MGM_ARG("value", Int, Mandatory, "Current Value"),
+ MGM_ARG("result", String, Mandatory, "Result"),
MGM_END()
};
const Properties *prop;
- prop= ndb_mgm_call(handle, reply, "get connection parameter", &args);
- CHECK_REPLY(prop, -1);
+ prop = ndb_mgm_call(handle, reply, "get connection parameter", &args);
+ CHECK_REPLY(prop, -2);
int res= -1;
do {
@@ -2058,10 +2059,13 @@ ndb_mgm_get_connection_int_parameter(NdbMgmHandle handle,
res= 0;
} while(0);
- prop->get("value",value);
+ if(!prop->get("value",value)){
+ ndbout_c("Unable to get value");
+ res = -3;
+ }
delete prop;
- return res;
+ DBUG_RETURN(res);
}