summaryrefslogtreecommitdiff
path: root/ndb/src
diff options
context:
space:
mode:
authorunknown <stewart@mysql.com>2005-09-22 00:41:46 +1000
committerunknown <stewart@mysql.com>2005-09-22 00:41:46 +1000
commit90b102daa644cf26de29ca88a82ae1a0fd45fff6 (patch)
tree7215d6a637ea1ade3e9fa832be4dc9b95c304704 /ndb/src
parent8c963d39679dd8eb6fa7d09158e84c0672763c98 (diff)
downloadmariadb-git-90b102daa644cf26de29ca88a82ae1a0fd45fff6.tar.gz
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. ndb/include/kernel/signaldata/ApiVersion.hpp: Extend ApiVersionConf to include inet_addr. the address used for communication to this node. ndb/src/kernel/blocks/qmgr/QmgrMain.cpp: include connect address in ApiVersionConf ndb/src/mgmsrv/MgmtSrvr.cpp: ::status() now also returns char* address of the node. For API or MGM, this is in ApiVersionConf. For NDB, this is the standard get_connect_address. When sending ApiVersionReq, try to send to a STARTED node (as these have properly joined the cluster and know the connect addresses). If versionNode is called for getOwnNodeId()==nodeId, try to get the address via ApiVersionConf. If that fails, look it up in the configuration. ndb/src/mgmsrv/MgmtSrvr.hpp: Add char **address to prototypes. ndb/src/mgmsrv/Services.cpp: Get the connect address from mgmsrv.status()
Diffstat (limited to 'ndb/src')
-rw-r--r--ndb/src/kernel/blocks/qmgr/QmgrMain.cpp2
-rw-r--r--ndb/src/mgmsrv/MgmtSrvr.cpp50
-rw-r--r--ndb/src/mgmsrv/MgmtSrvr.hpp7
-rw-r--r--ndb/src/mgmsrv/Services.cpp8
4 files changed, 54 insertions, 13 deletions
diff --git a/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp b/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp
index 3770edff947..6095895e7c2 100644
--- a/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp
+++ b/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp
@@ -2012,6 +2012,8 @@ Qmgr::execAPI_VERSION_REQ(Signal * signal) {
else
conf->version = 0;
conf->nodeId = nodeId;
+ struct in_addr in= globalTransporterRegistry.get_connect_address(nodeId);
+ conf->inet_addr= in.s_addr;
sendSignal(senderRef,
GSN_API_VERSION_CONF,
diff --git a/ndb/src/mgmsrv/MgmtSrvr.cpp b/ndb/src/mgmsrv/MgmtSrvr.cpp
index c35b85dd595..ccff959f260 100644
--- a/ndb/src/mgmsrv/MgmtSrvr.cpp
+++ b/ndb/src/mgmsrv/MgmtSrvr.cpp
@@ -690,30 +690,46 @@ MgmtSrvr::start(int nodeId)
*****************************************************************************/
int
-MgmtSrvr::versionNode(int nodeId, Uint32 &version)
+MgmtSrvr::versionNode(int nodeId, Uint32 &version, const char **address)
{
version= 0;
if (getOwnNodeId() == nodeId)
{
+ sendVersionReq(nodeId, version, address);
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)
{
ClusterMgr::Node node= theFacade->theClusterMgr->getNodeInfo(nodeId);
if(node.connected)
version= node.m_info.m_version;
+ *address= get_connect_address(nodeId);
}
else if (getNodeType(nodeId) == NDB_MGM_NODE_TYPE_API ||
getNodeType(nodeId) == NDB_MGM_NODE_TYPE_MGM)
{
- return sendVersionReq(nodeId, version);
+ return sendVersionReq(nodeId, version, address);
}
return 0;
}
int
-MgmtSrvr::sendVersionReq(int v_nodeId, Uint32 &version)
+MgmtSrvr::sendVersionReq(int v_nodeId, Uint32 &version, const char **address)
{
SignalSender ss(theFacade);
ss.lock();
@@ -734,10 +750,23 @@ MgmtSrvr::sendVersionReq(int v_nodeId, Uint32 &version)
{
bool next;
nodeId = 0;
+
while((next = getNextNodeId(&nodeId, NDB_MGM_NODE_TYPE_NDB)) == true &&
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 (ss.sendSignal(nodeId, &ssig) != SEND_OK) {
return SEND_OR_RECEIVE_FAILED;
}
@@ -753,6 +782,9 @@ MgmtSrvr::sendVersionReq(int v_nodeId, Uint32 &version)
CAST_CONSTPTR(ApiVersionConf, signal->getDataPtr());
assert(conf->nodeId == v_nodeId);
version = conf->version;
+ struct in_addr in;
+ in.s_addr= conf->inet_addr;
+ *address= inet_ntoa(in);
return 0;
}
case GSN_NF_COMPLETEREP:{
@@ -1060,8 +1092,9 @@ int MgmtSrvr::restart(bool nostart, bool initialStart,
Uint32 startPhase = 0, version = 0, dynamicId = 0, nodeGroup = 0;
Uint32 connectCount = 0;
bool system;
+ const char *address;
status(nodeId, &s, &version, &startPhase,
- &system, &dynamicId, &nodeGroup, &connectCount);
+ &system, &dynamicId, &nodeGroup, &connectCount, &address);
NdbSleep_MilliSleep(100);
waitTime = (maxTime - NdbTick_CurrentMillisecond());
}
@@ -1137,11 +1170,14 @@ MgmtSrvr::status(int nodeId,
bool * _system,
Uint32 * dynamic,
Uint32 * nodegroup,
- Uint32 * connectCount)
+ Uint32 * connectCount,
+ const char **address)
{
if (getNodeType(nodeId) == NDB_MGM_NODE_TYPE_API ||
getNodeType(nodeId) == NDB_MGM_NODE_TYPE_MGM) {
- versionNode(nodeId, *version);
+ versionNode(nodeId, *version, address);
+ } else {
+ *address= get_connect_address(nodeId);
}
const ClusterMgr::Node node =
diff --git a/ndb/src/mgmsrv/MgmtSrvr.hpp b/ndb/src/mgmsrv/MgmtSrvr.hpp
index ff24e97ce02..8f16918b24a 100644
--- a/ndb/src/mgmsrv/MgmtSrvr.hpp
+++ b/ndb/src/mgmsrv/MgmtSrvr.hpp
@@ -208,7 +208,8 @@ public:
bool * systemShutdown,
Uint32 * dynamicId,
Uint32 * nodeGroup,
- Uint32 * connectCount);
+ Uint32 * connectCount,
+ const char **address);
// All the functions below may return any of this error codes:
// NO_CONTACT_WITH_PROCESS, PROCESS_NOT_CONFIGURED, WRONG_PROCESS_TYPE,
@@ -255,7 +256,7 @@ public:
* @param processId: Id of the DB process to stop
* @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
@@ -611,7 +612,7 @@ private:
class TransporterFacade * theFacade;
- int sendVersionReq( int processId, Uint32 &version);
+ int sendVersionReq( int processId, Uint32 &version, const char **address);
int translateStopRef(Uint32 errCode);
bool _isStopThread;
diff --git a/ndb/src/mgmsrv/Services.cpp b/ndb/src/mgmsrv/Services.cpp
index ef52729dd37..bcc18d75b09 100644
--- a/ndb/src/mgmsrv/Services.cpp
+++ b/ndb/src/mgmsrv/Services.cpp
@@ -903,8 +903,10 @@ printNodeStatus(OutputStream *output,
nodeGroup = 0,
connectCount = 0;
bool system;
- mgmsrv.status(nodeId, &status, &version, &startPhase,
- &system, &dynamicId, &nodeGroup, &connectCount);
+ const char *address= NULL;
+ mgmsrv.status(nodeId, &status, &version, &startPhase,
+ &system, &dynamicId, &nodeGroup, &connectCount,
+ &address);
output->println("node.%d.type: %s",
nodeId,
ndb_mgm_get_node_type_string(type));
@@ -916,7 +918,7 @@ printNodeStatus(OutputStream *output,
output->println("node.%d.dynamic_id: %d", nodeId, dynamicId);
output->println("node.%d.node_group: %d", nodeId, nodeGroup);
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);
}
}