diff options
author | unknown <stewart@mysql.com> | 2005-01-07 12:05:56 +1100 |
---|---|---|
committer | unknown <stewart@mysql.com> | 2005-01-07 12:05:56 +1100 |
commit | 5de7459359fb6871c281624c693bf15f4765ca64 (patch) | |
tree | 44029873076e028099cb6316173d9624a422ac91 /ndb | |
parent | 85313326356cc3c859203425a907327ed8bafdcb (diff) | |
download | mariadb-git-5de7459359fb6871c281624c693bf15f4765ca64.tar.gz |
Along the road to a working Impl3 of WL2278.
ndb/src/common/transporter/TransporterRegistry.cpp:
Only try to get dynamic port number for TCP transporters.
ndb/src/mgmapi/mgmapi.cpp:
DBUG_RETURN in ndb_mgm_set_connection_int_parameter
Unique negative error codes for ndb_mgm_get_connection_int_parameter
ndb/src/mgmsrv/MgmtSrvr.cpp:
add MgmtSrvr::set_connect_string(const char *str)
ndb/src/mgmsrv/MgmtSrvr.hpp:
Add:
- prototype for set_connect_string
- get_config_retriever
ndb/src/mgmsrv/main.cpp:
Fake a connect string and connect back to ourselves.
This enables us to use mgmapi routines to get configuration information.
i.e. ndb_mgm_get_connection_int_parameter for getting dynamic port numbers to connect to.
Diffstat (limited to 'ndb')
-rw-r--r-- | ndb/src/common/transporter/TransporterRegistry.cpp | 13 | ||||
-rw-r--r-- | ndb/src/mgmapi/mgmapi.cpp | 8 | ||||
-rw-r--r-- | ndb/src/mgmsrv/MgmtSrvr.cpp | 6 | ||||
-rw-r--r-- | ndb/src/mgmsrv/MgmtSrvr.hpp | 4 | ||||
-rw-r--r-- | ndb/src/mgmsrv/main.cpp | 16 |
5 files changed, 36 insertions, 11 deletions
diff --git a/ndb/src/common/transporter/TransporterRegistry.cpp b/ndb/src/common/transporter/TransporterRegistry.cpp index 22ddc3b71e4..656fc1c19fc 100644 --- a/ndb/src/common/transporter/TransporterRegistry.cpp +++ b/ndb/src/common/transporter/TransporterRegistry.cpp @@ -1189,12 +1189,14 @@ TransporterRegistry::start_clients_thread() const NodeId nodeId = t->getRemoteNodeId(); switch(performStates[nodeId]){ case CONNECTING: - if(!t->isConnected() && !t->isServer) { + if(!t->isConnected() && !t->isServer + && theTransporterTypes[nodeId] == tt_TCP_TRANSPORTER) { if(t->get_r_port() <= 0) { // Port is dynamic - Uint32 server_port=0; + Uint32 server_port= 0; struct ndb_mgm_reply mgm_reply; int res; - res=ndb_mgm_get_connection_int_parameter(m_mgm_handle, + + res= ndb_mgm_get_connection_int_parameter(m_mgm_handle, t->getRemoteNodeId(), t->getLocalNodeId(), CFG_CONNECTION_SERVER_PORT, @@ -1206,9 +1208,10 @@ TransporterRegistry::start_clients_thread() if(res>=0) t->set_r_port(server_port); else - ndbout_c("Failed to get dynamic port to connect to."); + ndbout_c("Failed to get dynamic port to connect to: %d", res); } - if(t->get_r_port()>0) + if(theTransporterTypes[nodeId] != tt_TCP_TRANSPORTER + || t->get_r_port() > 0) t->connect_client(); else NdbSleep_MilliSleep(400); diff --git a/ndb/src/mgmapi/mgmapi.cpp b/ndb/src/mgmapi/mgmapi.cpp index 166bd45d48b..93ffeb8f2d3 100644 --- a/ndb/src/mgmapi/mgmapi.cpp +++ b/ndb/src/mgmapi/mgmapi.cpp @@ -2084,7 +2084,7 @@ ndb_mgm_set_connection_int_parameter(NdbMgmHandle handle, } while(0); delete prop; - return res; + DBUG_RETURN(res); } extern "C" @@ -2097,7 +2097,7 @@ ndb_mgm_get_connection_int_parameter(NdbMgmHandle handle, struct ndb_mgm_reply* mgmreply){ DBUG_ENTER("ndb_mgm_get_connection_int_parameter"); CHECK_HANDLE(handle, -1); - CHECK_CONNECTED(handle, -1); + CHECK_CONNECTED(handle, -2); Properties args; args.put("node1", node1); @@ -2113,7 +2113,7 @@ ndb_mgm_get_connection_int_parameter(NdbMgmHandle handle, const Properties *prop; prop = ndb_mgm_call(handle, reply, "get connection parameter", &args); - CHECK_REPLY(prop, -2); + CHECK_REPLY(prop, -3); int res= -1; do { @@ -2127,7 +2127,7 @@ ndb_mgm_get_connection_int_parameter(NdbMgmHandle handle, if(!prop->get("value",value)){ ndbout_c("Unable to get value"); - res = -3; + res = -4; } delete prop; diff --git a/ndb/src/mgmsrv/MgmtSrvr.cpp b/ndb/src/mgmsrv/MgmtSrvr.cpp index d29422c4b65..81d5779c4bf 100644 --- a/ndb/src/mgmsrv/MgmtSrvr.cpp +++ b/ndb/src/mgmsrv/MgmtSrvr.cpp @@ -2883,6 +2883,12 @@ MgmtSrvr::getConnectionDbParameter(int node1, DBUG_RETURN(1); } +int MgmtSrvr::set_connect_string(const char *str) +{ + return ndb_mgm_set_connectstring(m_config_retriever->get_mgmHandle(),str); +} + + template class Vector<SigMatch>; #if __SUNPRO_CC != 0x560 template bool SignalQueue::waitFor<SigMatch>(Vector<SigMatch>&, SigMatch**, NdbApiSignal**, unsigned); diff --git a/ndb/src/mgmsrv/MgmtSrvr.hpp b/ndb/src/mgmsrv/MgmtSrvr.hpp index 4742d5f6426..450dbf15160 100644 --- a/ndb/src/mgmsrv/MgmtSrvr.hpp +++ b/ndb/src/mgmsrv/MgmtSrvr.hpp @@ -512,8 +512,10 @@ public: int getConnectionDbParameter(int node1, int node2, int param, unsigned *value, BaseString& msg); + int set_connect_string(const char *str); + + ConfigRetriever *get_config_retriever() { return m_config_retriever; }; - const char *get_connect_address(Uint32 node_id) { return inet_ntoa(m_connect_address[node_id]); } void get_connected_nodes(NodeBitmask &connected_nodes) const; SocketServer *get_socket_server() { return m_socket_server; } diff --git a/ndb/src/mgmsrv/main.cpp b/ndb/src/mgmsrv/main.cpp index 5c289fc9d1c..998690c5c05 100644 --- a/ndb/src/mgmsrv/main.cpp +++ b/ndb/src/mgmsrv/main.cpp @@ -245,13 +245,27 @@ int main(int argc, char** argv) delete mapi; goto error_end; } - + + char connect_str[20]; + if(!opt_connect_str) { + snprintf(connect_str,20,"localhost:%u",glob.mgmObject->getPort()); + opt_connect_str= connect_str; + } + glob.mgmObject->set_connect_string(connect_str); + if(!glob.mgmObject->check_start()){ ndbout_c("Unable to check start management server."); ndbout_c("Probably caused by illegal initial configuration file."); goto error_end; } + /* + * Connect back to ourselves so we can use mgmapi to fetch + * config info + */ + DBUG_PRINT("info",("CONNECT RESULT: %d",glob.mgmObject->get_config_retriever()->do_connect(0,0,0))); + + if (glob.daemon) { // Become a daemon char *lockfile= NdbConfig_PidFileName(glob.localNodeId); |