summaryrefslogtreecommitdiff
path: root/ndb/src/mgmapi/mgmapi.cpp
diff options
context:
space:
mode:
authorunknown <stewart@mysql.com>2005-02-23 21:07:22 +1100
committerunknown <stewart@mysql.com>2005-02-23 21:07:22 +1100
commitbb5a2f280f41178cb132e6c0e9db205cbc4abc9f (patch)
treeb190ad7e885c8a3df91a3ddc9345c780566a7e65 /ndb/src/mgmapi/mgmapi.cpp
parent3bd6f299fc3aa8c0908c64b643a7ef97a9f1c3af (diff)
downloadmariadb-git-bb5a2f280f41178cb132e6c0e9db205cbc4abc9f.tar.gz
Use the mgm connection used for fetching configuration as a transporter.
ndb/include/mgmapi/mgmapi.h: Add mgmapi call: ndb_mgm_get_mgmd_nodeid() - returns the node id that the handle is connected to. - returns 0 on error. ndb/include/transporter/TransporterRegistry.hpp: Add TransporterRegistry::connect_client(NdbMgmHandle h) - uses a connected NdbMgmHandle to connect to the mgm server as a client. - sets up a transporter connection - used to transform the initial mgm connection (used for fetching configuration) into a transporter connection Added connect_ndb_mgmd(NdbMgmHandle h) - turn the supplied mgm connection into a transporter connection - return the socket Improve comments on connect_ndb_mgmd(SocketClient) ndb/src/common/transporter/Transporter.cpp: Add Transporter::connect_client(NDB_SOCKET_TYPE) - use an existing socket to make a transporter connection ndb/src/common/transporter/Transporter.hpp: Add connect_client(NDB_SOCKET_TYPE) ndb/src/common/transporter/TransporterRegistry.cpp: Add TransporterRegistry::connect_client(NdbMgmHandle) - use an existing mgm connection to connect a transporter - used to change the mgm connection used for fetching configuration into a transporter Add connect_ndb_mgmd(NdbMgmHandle) - use existing NdbMgmHandle - convert to transporter - return socket ndb/src/kernel/vm/Configuration.cpp: After fetching configuration, use the mgm connection as a transporter. Fail fatally if this fails. ndb/src/mgmapi/mgmapi.cpp: Add ndb_mgm_get_mgmd_nodeid(h) - returns the node id of the mgm server you're connected to. ndb/src/mgmsrv/Services.cpp: Add "get mgmd nodeid" mgmd call returns 'nodeid' - the node id of the mgm server your connected to ndb/src/mgmsrv/Services.hpp: add prototype for get_mgmd_nodeid
Diffstat (limited to 'ndb/src/mgmapi/mgmapi.cpp')
-rw-r--r--ndb/src/mgmapi/mgmapi.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/ndb/src/mgmapi/mgmapi.cpp b/ndb/src/mgmapi/mgmapi.cpp
index bd4052f51d9..f326a77a8af 100644
--- a/ndb/src/mgmapi/mgmapi.cpp
+++ b/ndb/src/mgmapi/mgmapi.cpp
@@ -2208,4 +2208,35 @@ ndb_mgm_convert_to_transporter(NdbMgmHandle handle)
return s;
}
+extern "C"
+Uint32
+ndb_mgm_get_mgmd_nodeid(NdbMgmHandle handle)
+{
+ Uint32 nodeid=0;
+
+ DBUG_ENTER("ndb_mgm_get_mgmd_nodeid");
+ CHECK_HANDLE(handle, 0);
+ CHECK_CONNECTED(handle, 0);
+
+ Properties args;
+
+ const ParserRow<ParserDummy> reply[]= {
+ MGM_CMD("get mgmd nodeid reply", NULL, ""),
+ MGM_ARG("nodeid", Int, Mandatory, "Node ID"),
+ MGM_END()
+ };
+
+ const Properties *prop;
+ prop = ndb_mgm_call(handle, reply, "get mgmd nodeid", &args);
+ CHECK_REPLY(prop, 0);
+
+ if(!prop->get("nodeid",&nodeid)){
+ ndbout_c("Unable to get value");
+ return 0;
+ }
+
+ delete prop;
+ DBUG_RETURN(nodeid);
+}
+
template class Vector<const ParserRow<ParserDummy>*>;