summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <stewart@mysql.com>2005-01-10 10:19:15 +1100
committerunknown <stewart@mysql.com>2005-01-10 10:19:15 +1100
commit69da579aeb1a40ece62b6d8cb268faa1e7dfbba8 (patch)
tree4abe8cadc21ceea3686ae66018cca6c7d747429b
parentccbadbc94af2f64b1261c13400fa3bf8299a42cd (diff)
downloadmariadb-git-69da579aeb1a40ece62b6d8cb268faa1e7dfbba8.tar.gz
Finish WL2278 Impl 3 - Dynamic port allocation of cluster nodes.
ndb/include/util/SocketClient.hpp: Add SocketClient::set_port(unsigned short port) - Sets both m_port and m_servaddr.sin_port ndb/src/common/transporter/Transporter.hpp: Fix set_r_port to call m_socket_client->set_port(port) (if there's a socket client). ndb/src/common/transporter/TransporterRegistry.cpp: Handle non-TCP Transporter nodes correctly ndb/src/mgmsrv/main.cpp: Better document and error check connecting back to our own ndb_mgmd
-rw-r--r--ndb/include/util/SocketClient.hpp4
-rw-r--r--ndb/src/common/transporter/Transporter.hpp6
-rw-r--r--ndb/src/common/transporter/TransporterRegistry.cpp5
-rw-r--r--ndb/src/mgmsrv/main.cpp11
4 files changed, 21 insertions, 5 deletions
diff --git a/ndb/include/util/SocketClient.hpp b/ndb/include/util/SocketClient.hpp
index de9a081464a..563544922dc 100644
--- a/ndb/include/util/SocketClient.hpp
+++ b/ndb/include/util/SocketClient.hpp
@@ -31,6 +31,10 @@ public:
SocketClient(const char *server_name, unsigned short port, SocketAuthenticator *sa = 0);
~SocketClient();
bool init();
+ void set_port(unsigned short port) {
+ m_port = port;
+ m_servaddr.sin_port = htons(m_port);
+ };
NDB_SOCKET_TYPE connect();
bool close();
};
diff --git a/ndb/src/common/transporter/Transporter.hpp b/ndb/src/common/transporter/Transporter.hpp
index 31c915c9b5d..12d991de681 100644
--- a/ndb/src/common/transporter/Transporter.hpp
+++ b/ndb/src/common/transporter/Transporter.hpp
@@ -77,7 +77,11 @@ public:
/**
* Set r_port to connect to
*/
- void set_r_port(unsigned int port) { m_r_port = port; };
+ void set_r_port(unsigned int port) {
+ m_r_port = port;
+ if(m_socket_client)
+ m_socket_client->set_port(port);
+ };
protected:
Transporter(TransporterRegistry &,
diff --git a/ndb/src/common/transporter/TransporterRegistry.cpp b/ndb/src/common/transporter/TransporterRegistry.cpp
index 656fc1c19fc..232aba13c79 100644
--- a/ndb/src/common/transporter/TransporterRegistry.cpp
+++ b/ndb/src/common/transporter/TransporterRegistry.cpp
@@ -1189,8 +1189,7 @@ TransporterRegistry::start_clients_thread()
const NodeId nodeId = t->getRemoteNodeId();
switch(performStates[nodeId]){
case CONNECTING:
- if(!t->isConnected() && !t->isServer
- && theTransporterTypes[nodeId] == tt_TCP_TRANSPORTER) {
+ if(!t->isConnected() && !t->isServer) {
if(t->get_r_port() <= 0) { // Port is dynamic
Uint32 server_port= 0;
struct ndb_mgm_reply mgm_reply;
@@ -1211,7 +1210,7 @@ TransporterRegistry::start_clients_thread()
ndbout_c("Failed to get dynamic port to connect to: %d", res);
}
if(theTransporterTypes[nodeId] != tt_TCP_TRANSPORTER
- || t->get_r_port() > 0)
+ || t->get_r_port() > 0)
t->connect_client();
else
NdbSleep_MilliSleep(400);
diff --git a/ndb/src/mgmsrv/main.cpp b/ndb/src/mgmsrv/main.cpp
index 998690c5c05..2227a7da7b9 100644
--- a/ndb/src/mgmsrv/main.cpp
+++ b/ndb/src/mgmsrv/main.cpp
@@ -246,6 +246,7 @@ int main(int argc, char** argv)
goto error_end;
}
+ /* Construct a fake connectstring to connect back to ourselves */
char connect_str[20];
if(!opt_connect_str) {
snprintf(connect_str,20,"localhost:%u",glob.mgmObject->getPort());
@@ -263,7 +264,15 @@ int main(int argc, char** argv)
* 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)));
+ int mgm_connect_result;
+ mgm_connect_result = glob.mgmObject->get_config_retriever()->
+ do_connect(0,0,0);
+
+ if(mgm_connect_result<0) {
+ ndbout_c("Unable to connect to our own ndb_mgmd (Error %d)",
+ mgm_connect_result);
+ ndbout_c("This is probably a bug.");
+ }
if (glob.daemon) {