Commit 6960e0a7 authored by stewart@mysql.com's avatar stewart@mysql.com

BUG#11595 ndb_mgm shows from IP for second mgmd

BUG#12037 ndb_mgmd IP address do not show in other ndb_mgmd processes

Extend ApiVersionConf to include address.
parent dcb3e597
...@@ -49,12 +49,11 @@ class ApiVersionConf { ...@@ -49,12 +49,11 @@ class ApiVersionConf {
*/ */
friend class MgmtSrv; friend class MgmtSrv;
public: public:
STATIC_CONST( SignalLength = 3 ); STATIC_CONST( SignalLength = 4 );
Uint32 senderRef; Uint32 senderRef;
Uint32 nodeId; //api node id Uint32 nodeId; //api node id
Uint32 version; // Version of API node Uint32 version; // Version of API node
Uint32 inet_addr;
}; };
#endif #endif
...@@ -2012,6 +2012,8 @@ Qmgr::execAPI_VERSION_REQ(Signal * signal) { ...@@ -2012,6 +2012,8 @@ Qmgr::execAPI_VERSION_REQ(Signal * signal) {
else else
conf->version = 0; conf->version = 0;
conf->nodeId = nodeId; conf->nodeId = nodeId;
struct in_addr in= globalTransporterRegistry.get_connect_address(nodeId);
conf->inet_addr= in.s_addr;
sendSignal(senderRef, sendSignal(senderRef,
GSN_API_VERSION_CONF, GSN_API_VERSION_CONF,
......
...@@ -690,30 +690,46 @@ MgmtSrvr::start(int nodeId) ...@@ -690,30 +690,46 @@ MgmtSrvr::start(int nodeId)
*****************************************************************************/ *****************************************************************************/
int int
MgmtSrvr::versionNode(int nodeId, Uint32 &version) MgmtSrvr::versionNode(int nodeId, Uint32 &version, const char **address)
{ {
version= 0; version= 0;
if (getOwnNodeId() == nodeId) if (getOwnNodeId() == nodeId)
{ {
sendVersionReq(nodeId, version, address);
version= NDB_VERSION; version= NDB_VERSION;
if(!*address)
{
ndb_mgm_configuration_iterator
iter(*_config->m_configValues, CFG_SECTION_NODE);
unsigned tmp= 0;
for(iter.first();iter.valid();iter.next())
{
if(iter.get(CFG_NODE_ID, &tmp)) require(false);
if((unsigned)nodeId!=tmp)
continue;
if(iter.get(CFG_NODE_HOST, address)) require(false);
break;
}
}
} }
else if (getNodeType(nodeId) == NDB_MGM_NODE_TYPE_NDB) else if (getNodeType(nodeId) == NDB_MGM_NODE_TYPE_NDB)
{ {
ClusterMgr::Node node= theFacade->theClusterMgr->getNodeInfo(nodeId); ClusterMgr::Node node= theFacade->theClusterMgr->getNodeInfo(nodeId);
if(node.connected) if(node.connected)
version= node.m_info.m_version; version= node.m_info.m_version;
*address= get_connect_address(nodeId);
} }
else if (getNodeType(nodeId) == NDB_MGM_NODE_TYPE_API || else if (getNodeType(nodeId) == NDB_MGM_NODE_TYPE_API ||
getNodeType(nodeId) == NDB_MGM_NODE_TYPE_MGM) getNodeType(nodeId) == NDB_MGM_NODE_TYPE_MGM)
{ {
return sendVersionReq(nodeId, version); return sendVersionReq(nodeId, version, address);
} }
return 0; return 0;
} }
int int
MgmtSrvr::sendVersionReq(int v_nodeId, Uint32 &version) MgmtSrvr::sendVersionReq(int v_nodeId, Uint32 &version, const char **address)
{ {
SignalSender ss(theFacade); SignalSender ss(theFacade);
ss.lock(); ss.lock();
...@@ -734,10 +750,23 @@ MgmtSrvr::sendVersionReq(int v_nodeId, Uint32 &version) ...@@ -734,10 +750,23 @@ MgmtSrvr::sendVersionReq(int v_nodeId, Uint32 &version)
{ {
bool next; bool next;
nodeId = 0; nodeId = 0;
while((next = getNextNodeId(&nodeId, NDB_MGM_NODE_TYPE_NDB)) == true && while((next = getNextNodeId(&nodeId, NDB_MGM_NODE_TYPE_NDB)) == true &&
okToSendTo(nodeId, true) != 0); okToSendTo(nodeId, true) != 0);
const ClusterMgr::Node &node=
theFacade->theClusterMgr->getNodeInfo(nodeId);
if(next && node.m_state.startLevel != NodeState::SL_STARTED)
{
NodeId tmp=nodeId;
while((next = getNextNodeId(&nodeId, NDB_MGM_NODE_TYPE_NDB)) == true &&
okToSendTo(nodeId, true) != 0);
if(!next)
nodeId= tmp;
}
if(!next) return NO_CONTACT_WITH_DB_NODES; if(!next) return NO_CONTACT_WITH_DB_NODES;
if (ss.sendSignal(nodeId, &ssig) != SEND_OK) { if (ss.sendSignal(nodeId, &ssig) != SEND_OK) {
return SEND_OR_RECEIVE_FAILED; return SEND_OR_RECEIVE_FAILED;
} }
...@@ -753,6 +782,9 @@ MgmtSrvr::sendVersionReq(int v_nodeId, Uint32 &version) ...@@ -753,6 +782,9 @@ MgmtSrvr::sendVersionReq(int v_nodeId, Uint32 &version)
CAST_CONSTPTR(ApiVersionConf, signal->getDataPtr()); CAST_CONSTPTR(ApiVersionConf, signal->getDataPtr());
assert(conf->nodeId == v_nodeId); assert(conf->nodeId == v_nodeId);
version = conf->version; version = conf->version;
struct in_addr in;
in.s_addr= conf->inet_addr;
*address= inet_ntoa(in);
return 0; return 0;
} }
case GSN_NF_COMPLETEREP:{ case GSN_NF_COMPLETEREP:{
...@@ -1060,8 +1092,9 @@ int MgmtSrvr::restart(bool nostart, bool initialStart, ...@@ -1060,8 +1092,9 @@ int MgmtSrvr::restart(bool nostart, bool initialStart,
Uint32 startPhase = 0, version = 0, dynamicId = 0, nodeGroup = 0; Uint32 startPhase = 0, version = 0, dynamicId = 0, nodeGroup = 0;
Uint32 connectCount = 0; Uint32 connectCount = 0;
bool system; bool system;
const char *address;
status(nodeId, &s, &version, &startPhase, status(nodeId, &s, &version, &startPhase,
&system, &dynamicId, &nodeGroup, &connectCount); &system, &dynamicId, &nodeGroup, &connectCount, &address);
NdbSleep_MilliSleep(100); NdbSleep_MilliSleep(100);
waitTime = (maxTime - NdbTick_CurrentMillisecond()); waitTime = (maxTime - NdbTick_CurrentMillisecond());
} }
...@@ -1137,11 +1170,14 @@ MgmtSrvr::status(int nodeId, ...@@ -1137,11 +1170,14 @@ MgmtSrvr::status(int nodeId,
bool * _system, bool * _system,
Uint32 * dynamic, Uint32 * dynamic,
Uint32 * nodegroup, Uint32 * nodegroup,
Uint32 * connectCount) Uint32 * connectCount,
const char **address)
{ {
if (getNodeType(nodeId) == NDB_MGM_NODE_TYPE_API || if (getNodeType(nodeId) == NDB_MGM_NODE_TYPE_API ||
getNodeType(nodeId) == NDB_MGM_NODE_TYPE_MGM) { getNodeType(nodeId) == NDB_MGM_NODE_TYPE_MGM) {
versionNode(nodeId, *version); versionNode(nodeId, *version, address);
} else {
*address= get_connect_address(nodeId);
} }
const ClusterMgr::Node node = const ClusterMgr::Node node =
......
...@@ -208,7 +208,8 @@ public: ...@@ -208,7 +208,8 @@ public:
bool * systemShutdown, bool * systemShutdown,
Uint32 * dynamicId, Uint32 * dynamicId,
Uint32 * nodeGroup, Uint32 * nodeGroup,
Uint32 * connectCount); Uint32 * connectCount,
const char **address);
// All the functions below may return any of this error codes: // All the functions below may return any of this error codes:
// NO_CONTACT_WITH_PROCESS, PROCESS_NOT_CONFIGURED, WRONG_PROCESS_TYPE, // NO_CONTACT_WITH_PROCESS, PROCESS_NOT_CONFIGURED, WRONG_PROCESS_TYPE,
...@@ -255,7 +256,7 @@ public: ...@@ -255,7 +256,7 @@ public:
* @param processId: Id of the DB process to stop * @param processId: Id of the DB process to stop
* @return 0 if succeeded, otherwise: as stated above, plus: * @return 0 if succeeded, otherwise: as stated above, plus:
*/ */
int versionNode(int nodeId, Uint32 &version); int versionNode(int nodeId, Uint32 &version, const char **address);
/** /**
* Maintenance on the system * Maintenance on the system
...@@ -611,7 +612,7 @@ private: ...@@ -611,7 +612,7 @@ private:
class TransporterFacade * theFacade; class TransporterFacade * theFacade;
int sendVersionReq( int processId, Uint32 &version); int sendVersionReq( int processId, Uint32 &version, const char **address);
int translateStopRef(Uint32 errCode); int translateStopRef(Uint32 errCode);
bool _isStopThread; bool _isStopThread;
......
...@@ -903,8 +903,10 @@ printNodeStatus(OutputStream *output, ...@@ -903,8 +903,10 @@ printNodeStatus(OutputStream *output,
nodeGroup = 0, nodeGroup = 0,
connectCount = 0; connectCount = 0;
bool system; bool system;
mgmsrv.status(nodeId, &status, &version, &startPhase, const char *address= NULL;
&system, &dynamicId, &nodeGroup, &connectCount); mgmsrv.status(nodeId, &status, &version, &startPhase,
&system, &dynamicId, &nodeGroup, &connectCount,
&address);
output->println("node.%d.type: %s", output->println("node.%d.type: %s",
nodeId, nodeId,
ndb_mgm_get_node_type_string(type)); ndb_mgm_get_node_type_string(type));
...@@ -916,7 +918,7 @@ printNodeStatus(OutputStream *output, ...@@ -916,7 +918,7 @@ printNodeStatus(OutputStream *output,
output->println("node.%d.dynamic_id: %d", nodeId, dynamicId); output->println("node.%d.dynamic_id: %d", nodeId, dynamicId);
output->println("node.%d.node_group: %d", nodeId, nodeGroup); output->println("node.%d.node_group: %d", nodeId, nodeGroup);
output->println("node.%d.connect_count: %d", nodeId, connectCount); output->println("node.%d.connect_count: %d", nodeId, connectCount);
output->println("node.%d.address: %s", nodeId, mgmsrv.get_connect_address(nodeId)); output->println("node.%d.address: %s", nodeId, address);
} }
} }
......
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