Commit ff99dce1 authored by unknown's avatar unknown

Further work on WL2278

Add calls to mgmd after setting up connections.
(not fully functional yet, checkin for pull)


ndb/include/mgmcommon/ConfigRetriever.hpp:
  add get_mgmHandle() member function
ndb/include/transporter/TransporterRegistry.hpp:
  Add remoteNodeId parameter to add_transporter interface
  
  add get_transporter() and get_localNodeID()
  
  these are required for getting the right information out of TransporterRegistry to inform mgmd of what ports we use to connect to other nodes.
ndb/src/common/mgmcommon/IPCConfig.cpp:
  call add_transporter_interface with the new nodeId2 parameter
ndb/src/common/transporter/TransporterRegistry.cpp:
  Implement additional (remoteNodeId) parameter in add_transporter_interface
  
  Implement get_transporter()
ndb/src/kernel/main.cpp:
  Call ndb_mgm_set_connection_int_parameter() to tell mgmd what ports we use to connect to other nodes.
ndb/src/kernel/vm/Configuration.hpp:
  add get_config_retriever()
ndb/src/mgmapi/mgmapi.cpp:
  Add DBUG_ENTER call to ndb_mgm_set_connection_int_parameter
ndb/src/ndbapi/TransporterFacade.hpp:
  Add get_registry()
ndb/src/ndbapi/ndb_cluster_connection.cpp:
  Add call to ndb_mgm_set_connection_int_parameter to tell mgmd what ports we use to connect to other nodes.
parent eab8601c
...@@ -73,6 +73,7 @@ public: ...@@ -73,6 +73,7 @@ public:
Uint32 get_mgmd_port() const; Uint32 get_mgmd_port() const;
const char *get_mgmd_host() const; const char *get_mgmd_host() const;
const char *get_connectstring(char *buf, int buf_sz) const; const char *get_connectstring(char *buf, int buf_sz) const;
NdbMgmHandle get_mgmHandle() { return m_handle; };
Uint32 get_configuration_nodeid() const; Uint32 get_configuration_nodeid() const;
private: private:
......
...@@ -220,11 +220,16 @@ public: ...@@ -220,11 +220,16 @@ public:
class Transporter_interface { class Transporter_interface {
public: public:
NodeId m_remote_nodeId;
unsigned short m_service_port; unsigned short m_service_port;
const char *m_interface; const char *m_interface;
}; };
Vector<Transporter_interface> m_transporter_interface; Vector<Transporter_interface> m_transporter_interface;
void add_transporter_interface(const char *interface, unsigned short port); void add_transporter_interface(NodeId remoteNodeId,
const char *interface, unsigned short port);
Transporter* get_transporter(NodeId nodeId);
NodeId get_localNodeId() { return localNodeId; };
protected: protected:
private: private:
......
...@@ -367,7 +367,7 @@ IPCConfig::configureTransporters(Uint32 nodeId, ...@@ -367,7 +367,7 @@ IPCConfig::configureTransporters(Uint32 nodeId,
Uint32 server_port= 0; Uint32 server_port= 0;
if(iter.get(CFG_CONNECTION_SERVER_PORT, &server_port)) break; if(iter.get(CFG_CONNECTION_SERVER_PORT, &server_port)) break;
if (nodeId <= nodeId1 && nodeId <= nodeId2) { if (nodeId <= nodeId1 && nodeId <= nodeId2) {
tr.add_transporter_interface(localHostName, server_port); tr.add_transporter_interface(nodeId2, localHostName, server_port);
} }
DBUG_PRINT("info", ("Transporter between this node %d and node %d using port %d, signalId %d, checksum %d", DBUG_PRINT("info", ("Transporter between this node %d and node %d using port %d, signalId %d, checksum %d",
nodeId, remoteNodeId, server_port, sendSignalId, checksum)); nodeId, remoteNodeId, server_port, sendSignalId, checksum));
......
...@@ -1180,7 +1180,8 @@ TransporterRegistry::stop_clients() ...@@ -1180,7 +1180,8 @@ TransporterRegistry::stop_clients()
} }
void void
TransporterRegistry::add_transporter_interface(const char *interface, TransporterRegistry::add_transporter_interface(NodeId remoteNodeId,
const char *interface,
unsigned short port) unsigned short port)
{ {
DBUG_ENTER("TransporterRegistry::add_transporter_interface"); DBUG_ENTER("TransporterRegistry::add_transporter_interface");
...@@ -1204,6 +1205,7 @@ TransporterRegistry::add_transporter_interface(const char *interface, ...@@ -1204,6 +1205,7 @@ TransporterRegistry::add_transporter_interface(const char *interface,
} }
} }
Transporter_interface t; Transporter_interface t;
t.m_remote_nodeId= remoteNodeId;
t.m_service_port= port; t.m_service_port= port;
t.m_interface= interface; t.m_interface= interface;
m_transporter_interface.push_back(t); m_transporter_interface.push_back(t);
...@@ -1331,4 +1333,9 @@ NdbOut & operator <<(NdbOut & out, SignalHeader & sh){ ...@@ -1331,4 +1333,9 @@ NdbOut & operator <<(NdbOut & out, SignalHeader & sh){
return out; return out;
} }
Transporter*
TransporterRegistry::get_transporter(NodeId nodeId) {
return theTransporters[nodeId];
};
template class Vector<TransporterRegistry::Transporter_interface>; template class Vector<TransporterRegistry::Transporter_interface>;
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <ndb_version.h> #include <ndb_version.h>
#include "Configuration.hpp" #include "Configuration.hpp"
#include <ConfigRetriever.hpp>
#include <TransporterRegistry.hpp> #include <TransporterRegistry.hpp>
#include "vm/SimBlockList.hpp" #include "vm/SimBlockList.hpp"
...@@ -36,6 +37,8 @@ ...@@ -36,6 +37,8 @@
#include <NdbAutoPtr.hpp> #include <NdbAutoPtr.hpp>
#include <mgmapi_debug.h>
#if defined NDB_SOLARIS // ok #if defined NDB_SOLARIS // ok
#include <sys/processor.h> // For system informatio #include <sys/processor.h> // For system informatio
#endif #endif
...@@ -195,6 +198,17 @@ int main(int argc, char** argv) ...@@ -195,6 +198,17 @@ int main(int argc, char** argv)
socket_server.startServer(); socket_server.startServer();
struct ndb_mgm_reply mgm_reply;
for(unsigned int i=0;i<globalTransporterRegistry.m_transporter_interface.size();i++)
ndb_mgm_set_connection_int_parameter(theConfig->get_config_retriever()->get_mgmHandle(),
globalTransporterRegistry.get_localNodeId(),
globalTransporterRegistry.m_transporter_interface[i].m_remote_nodeId,
CFG_CONNECTION_SERVER_PORT,
globalTransporterRegistry.m_transporter_interface[i].m_service_port,
&mgm_reply);
// theConfig->closeConfiguration(); // theConfig->closeConfiguration();
globalEmulatorData.theThreadConfig->ipControlLoop(); globalEmulatorData.theThreadConfig->ipControlLoop();
......
...@@ -68,6 +68,7 @@ public: ...@@ -68,6 +68,7 @@ public:
Uint32 get_mgmd_port() const {return m_mgmd_port;}; Uint32 get_mgmd_port() const {return m_mgmd_port;};
const char *get_mgmd_host() const {return m_mgmd_host;}; const char *get_mgmd_host() const {return m_mgmd_host;};
ConfigRetriever* get_config_retriever() { return m_config_retriever; };
class LogLevel * m_logLevel; class LogLevel * m_logLevel;
private: private:
......
...@@ -1983,6 +1983,7 @@ ndb_mgm_set_connection_int_parameter(NdbMgmHandle handle, ...@@ -1983,6 +1983,7 @@ ndb_mgm_set_connection_int_parameter(NdbMgmHandle handle,
int param, int param,
unsigned value, unsigned value,
struct ndb_mgm_reply* mgmreply){ struct ndb_mgm_reply* mgmreply){
DBUG_ENTER("ndb_mgm_set_connection_int_parameter");
CHECK_HANDLE(handle, 0); CHECK_HANDLE(handle, 0);
CHECK_CONNECTED(handle, 0); CHECK_CONNECTED(handle, 0);
......
...@@ -111,6 +111,8 @@ public: ...@@ -111,6 +111,8 @@ public:
Uint32 get_batch_byte_size(); Uint32 get_batch_byte_size();
Uint32 get_batch_size(); Uint32 get_batch_size();
TransporterRegistry* get_registry() { return theTransporterRegistry;};
private: private:
/** /**
* Send a signal unconditional of node status (used by ClusterMgr) * Send a signal unconditional of node status (used by ClusterMgr)
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <ndb_limits.h> #include <ndb_limits.h>
#include <ConfigRetriever.hpp> #include <ConfigRetriever.hpp>
#include <ndb_version.h> #include <ndb_version.h>
#include <mgmapi_debug.h>
static int g_run_connect_thread= 0; static int g_run_connect_thread= 0;
...@@ -146,6 +147,8 @@ int Ndb_cluster_connection::start_connect_thread(int (*connect_callback)(void)) ...@@ -146,6 +147,8 @@ int Ndb_cluster_connection::start_connect_thread(int (*connect_callback)(void))
int Ndb_cluster_connection::connect(int no_retries, int retry_delay_in_seconds, int verbose) int Ndb_cluster_connection::connect(int no_retries, int retry_delay_in_seconds, int verbose)
{ {
struct ndb_mgm_reply mgm_reply;
DBUG_ENTER("Ndb_cluster_connection::connect"); DBUG_ENTER("Ndb_cluster_connection::connect");
const char* error = 0; const char* error = 0;
do { do {
...@@ -160,7 +163,19 @@ int Ndb_cluster_connection::connect(int no_retries, int retry_delay_in_seconds, ...@@ -160,7 +163,19 @@ int Ndb_cluster_connection::connect(int no_retries, int retry_delay_in_seconds,
ndb_mgm_configuration * props = m_config_retriever->getConfig(); ndb_mgm_configuration * props = m_config_retriever->getConfig();
if(props == 0) if(props == 0)
break; break;
DBUG_PRINT("Before start_instance",("Before start_instance2"));
m_facade->start_instance(nodeId, props); m_facade->start_instance(nodeId, props);
DBUG_PRINT("After start_instance",("before start_instance2"));
// report port here.
DBUG_PRINT("set_conn",("%d",m_facade->get_registry()->m_transporter_interface.size()));
for(int i=0;i<m_facade->get_registry()->m_transporter_interface.size();i++)
ndb_mgm_set_connection_int_parameter(m_config_retriever->get_mgmHandle(),
nodeId,
m_facade->get_registry()->m_transporter_interface[i].m_remote_nodeId,
CFG_CONNECTION_SERVER_PORT,
m_facade->get_registry()->m_transporter_interface[i].m_service_port,
&mgm_reply);
ndb_mgm_destroy_configuration(props); ndb_mgm_destroy_configuration(props);
m_facade->connected(); m_facade->connected();
DBUG_RETURN(0); DBUG_RETURN(0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment