summaryrefslogtreecommitdiff
path: root/ndb
diff options
context:
space:
mode:
authorunknown <stewart@willster.(none)>2006-07-07 20:10:15 +1000
committerunknown <stewart@willster.(none)>2006-07-07 20:10:15 +1000
commit9235bedbaf9083c560e5d6f1d7a1794eef9cd5ce (patch)
tree56ea745909c46ddad3b73498c73316e6922239aa /ndb
parentb6a6ffeb2093a84d547b915e43e6028ad5a502c4 (diff)
downloadmariadb-git-9235bedbaf9083c560e5d6f1d7a1794eef9cd5ce.tar.gz
BUG#13985: Cluster: ndb_mgm "status" command can return incorrect data node status
- only force HB to data nodes - flag for if we broadcast condition on receipt of HB ndb/src/mgmsrv/MgmtSrvr.cpp: Add get_connected_ndb_nodes to check status for connected data nodes only ndb/src/mgmsrv/MgmtSrvr.hpp: add prototype for get_connected_ndb_nodes ndb/src/mgmsrv/Services.cpp: only force HB to NDBD nodes ndb/src/ndbapi/ClusterMgr.cpp: flag to control if we send the condition ndb/src/ndbapi/ClusterMgr.hpp: flag for if we broadcast condition on receipt of hb
Diffstat (limited to 'ndb')
-rw-r--r--ndb/src/mgmsrv/MgmtSrvr.cpp19
-rw-r--r--ndb/src/mgmsrv/MgmtSrvr.hpp1
-rw-r--r--ndb/src/mgmsrv/Services.cpp2
-rw-r--r--ndb/src/ndbapi/ClusterMgr.cpp19
-rw-r--r--ndb/src/ndbapi/ClusterMgr.hpp1
5 files changed, 36 insertions, 6 deletions
diff --git a/ndb/src/mgmsrv/MgmtSrvr.cpp b/ndb/src/mgmsrv/MgmtSrvr.cpp
index f3e75f1afe4..793192dd487 100644
--- a/ndb/src/mgmsrv/MgmtSrvr.cpp
+++ b/ndb/src/mgmsrv/MgmtSrvr.cpp
@@ -1941,6 +1941,25 @@ MgmtSrvr::get_connected_nodes(NodeBitmask &connected_nodes) const
}
}
+void
+MgmtSrvr::get_connected_ndb_nodes(NodeBitmask &connected_nodes) const
+{
+ NodeBitmask ndb_nodes;
+ if (theFacade && theFacade->theClusterMgr)
+ {
+ for(Uint32 i = 0; i < MAX_NODES; i++)
+ {
+ if (getNodeType(i) == NDB_MGM_NODE_TYPE_NDB)
+ {
+ ndb_nodes.set(i);
+ const ClusterMgr::Node &node= theFacade->theClusterMgr->getNodeInfo(i);
+ connected_nodes.bitOR(node.m_state.m_connected_nodes);
+ }
+ }
+ }
+ connected_nodes.bitAND(ndb_nodes);
+}
+
bool
MgmtSrvr::alloc_node_id(NodeId * nodeId,
enum ndb_mgm_node_type type,
diff --git a/ndb/src/mgmsrv/MgmtSrvr.hpp b/ndb/src/mgmsrv/MgmtSrvr.hpp
index 1e59f32b76f..5bacf640a18 100644
--- a/ndb/src/mgmsrv/MgmtSrvr.hpp
+++ b/ndb/src/mgmsrv/MgmtSrvr.hpp
@@ -485,6 +485,7 @@ public:
const char *get_connect_address(Uint32 node_id);
void get_connected_nodes(NodeBitmask &connected_nodes) const;
+ void get_connected_ndb_nodes(NodeBitmask &connected_nodes) const;
SocketServer *get_socket_server() { return m_socket_server; }
void updateStatus(NodeBitmask nodes);
diff --git a/ndb/src/mgmsrv/Services.cpp b/ndb/src/mgmsrv/Services.cpp
index 1df7d9be7b4..ae3433fe95b 100644
--- a/ndb/src/mgmsrv/Services.cpp
+++ b/ndb/src/mgmsrv/Services.cpp
@@ -952,7 +952,7 @@ printNodeStatus(OutputStream *output,
enum ndb_mgm_node_type type) {
NodeId nodeId = 0;
NodeBitmask hbnodes;
- mgmsrv.get_connected_nodes(hbnodes);
+ mgmsrv.get_connected_ndb_nodes(hbnodes);
mgmsrv.updateStatus(hbnodes);
while(mgmsrv.getNextNodeId(&nodeId, type)) {
enum ndb_mgm_node_status status;
diff --git a/ndb/src/ndbapi/ClusterMgr.cpp b/ndb/src/ndbapi/ClusterMgr.cpp
index 772cbaf99b5..28f65eebde8 100644
--- a/ndb/src/ndbapi/ClusterMgr.cpp
+++ b/ndb/src/ndbapi/ClusterMgr.cpp
@@ -70,6 +70,7 @@ ClusterMgr::ClusterMgr(TransporterFacade & _facade):
ndbSetOwnVersion();
clusterMgrThreadMutex = NdbMutex_Create();
waitForHBCond= NdbCondition_Create();
+ waitingForHB= false;
noOfAliveNodes= 0;
noOfConnectedNodes= 0;
theClusterMgrThread= 0;
@@ -172,7 +173,7 @@ ClusterMgr::forceHB(NodeBitmask waitFor)
{
theFacade.lock_mutex();
- if(!waitForHBFromNodes.isclear())
+ if(waitingForHB)
{
NdbCondition_WaitTimeout(waitForHBCond, theFacade.theMutexPtr, 1000);
theFacade.unlock_mutex();
@@ -180,6 +181,7 @@ ClusterMgr::forceHB(NodeBitmask waitFor)
}
global_flag_send_heartbeat_now= 1;
+ waitingForHB= true;
waitForHBFromNodes= waitFor;
#ifdef DEBUG_REG
@@ -209,10 +211,11 @@ ClusterMgr::forceHB(NodeBitmask waitFor)
}
NdbCondition_WaitTimeout(waitForHBCond, theFacade.theMutexPtr, 1000);
- theFacade.unlock_mutex();
+ waitingForHB= false;
#ifdef DEBUG_REG
ndbout << "Still waiting for HB from " << waitForHBFromNodes.getText(buf) << endl;
#endif
+ theFacade.unlock_mutex();
}
void
@@ -404,10 +407,16 @@ ClusterMgr::execAPI_REGCONF(const Uint32 * theData){
node.hbFrequency = (apiRegConf->apiHeartbeatFrequency * 10) - 50;
}
- waitForHBFromNodes.clear(nodeId);
+ if(waitingForHB)
+ {
+ waitForHBFromNodes.clear(nodeId);
- if(waitForHBFromNodes.isclear())
- NdbCondition_Broadcast(waitForHBCond);
+ if(waitForHBFromNodes.isclear())
+ {
+ waitingForHB= false;
+ NdbCondition_Broadcast(waitForHBCond);
+ }
+ }
}
void
diff --git a/ndb/src/ndbapi/ClusterMgr.hpp b/ndb/src/ndbapi/ClusterMgr.hpp
index 3284fd8aa8a..b9863821b4f 100644
--- a/ndb/src/ndbapi/ClusterMgr.hpp
+++ b/ndb/src/ndbapi/ClusterMgr.hpp
@@ -90,6 +90,7 @@ private:
NodeBitmask waitForHBFromNodes; // used in forcing HBs
NdbCondition* waitForHBCond;
+ bool waitingForHB;
/**
* Used for controlling start/stop of the thread