summaryrefslogtreecommitdiff
path: root/ndb/src/ndbapi
diff options
context:
space:
mode:
authorunknown <stewart@willster.(none)>2006-07-07 18:39:38 +1000
committerunknown <stewart@willster.(none)>2006-07-07 18:39:38 +1000
commit5a8919f290ab569e323d623b4da0714ed2d361da (patch)
tree51c46b1f5f17800cb0989fd489e283d8fdae4a41 /ndb/src/ndbapi
parentbd015e57dbbb8429eb40d59a875610ee5c38ae93 (diff)
downloadmariadb-git-5a8919f290ab569e323d623b4da0714ed2d361da.tar.gz
BUG#13985 Cluster: ndb_mgm "status" command can return incorrect data node status
use existing transporter mutex ndb/src/ndbapi/ClusterMgr.cpp: just use the transporter facade mutex. parallel 'show' will get woken up at the same time ndb/src/ndbapi/ClusterMgr.hpp: remove wait for heartbeat mutex
Diffstat (limited to 'ndb/src/ndbapi')
-rw-r--r--ndb/src/ndbapi/ClusterMgr.cpp25
-rw-r--r--ndb/src/ndbapi/ClusterMgr.hpp1
2 files changed, 11 insertions, 15 deletions
diff --git a/ndb/src/ndbapi/ClusterMgr.cpp b/ndb/src/ndbapi/ClusterMgr.cpp
index db169304acd..772cbaf99b5 100644
--- a/ndb/src/ndbapi/ClusterMgr.cpp
+++ b/ndb/src/ndbapi/ClusterMgr.cpp
@@ -69,7 +69,6 @@ ClusterMgr::ClusterMgr(TransporterFacade & _facade):
DBUG_ENTER("ClusterMgr::ClusterMgr");
ndbSetOwnVersion();
clusterMgrThreadMutex = NdbMutex_Create();
- waitForHBMutex= NdbMutex_Create();
waitForHBCond= NdbCondition_Create();
noOfAliveNodes= 0;
noOfConnectedNodes= 0;
@@ -83,7 +82,6 @@ ClusterMgr::~ClusterMgr()
DBUG_ENTER("ClusterMgr::~ClusterMgr");
doStop();
NdbCondition_Destroy(waitForHBCond);
- NdbMutex_Destroy(waitForHBMutex);
NdbMutex_Destroy(clusterMgrThreadMutex);
DBUG_VOID_RETURN;
}
@@ -172,8 +170,15 @@ ClusterMgr::doStop( ){
void
ClusterMgr::forceHB(NodeBitmask waitFor)
{
- NdbMutex_Lock(waitForHBMutex);
theFacade.lock_mutex();
+
+ if(!waitForHBFromNodes.isclear())
+ {
+ NdbCondition_WaitTimeout(waitForHBCond, theFacade.theMutexPtr, 1000);
+ theFacade.unlock_mutex();
+ return;
+ }
+
global_flag_send_heartbeat_now= 1;
waitForHBFromNodes= waitFor;
@@ -203,10 +208,8 @@ ClusterMgr::forceHB(NodeBitmask waitFor)
theFacade.sendSignalUnCond(&signal, nodeId);
}
+ NdbCondition_WaitTimeout(waitForHBCond, theFacade.theMutexPtr, 1000);
theFacade.unlock_mutex();
-
- NdbCondition_WaitTimeout(waitForHBCond, waitForHBMutex, 1000);
- NdbMutex_Unlock(waitForHBMutex);
#ifdef DEBUG_REG
ndbout << "Still waiting for HB from " << waitForHBFromNodes.getText(buf) << endl;
#endif
@@ -401,13 +404,10 @@ ClusterMgr::execAPI_REGCONF(const Uint32 * theData){
node.hbFrequency = (apiRegConf->apiHeartbeatFrequency * 10) - 50;
}
- NdbMutex_Lock(waitForHBMutex);
waitForHBFromNodes.clear(nodeId);
if(waitForHBFromNodes.isclear())
- NdbCondition_Signal(waitForHBCond);
-
- NdbMutex_Unlock(waitForHBMutex);
+ NdbCondition_Broadcast(waitForHBCond);
}
void
@@ -436,13 +436,10 @@ ClusterMgr::execAPI_REGREF(const Uint32 * theData){
default:
break;
}
+
waitForHBFromNodes.clear(nodeId);
if(waitForHBFromNodes.isclear())
- {
- NdbMutex_Lock(waitForHBMutex);
NdbCondition_Signal(waitForHBCond);
- NdbMutex_Unlock(waitForHBMutex);
- }
}
void
diff --git a/ndb/src/ndbapi/ClusterMgr.hpp b/ndb/src/ndbapi/ClusterMgr.hpp
index 6eda98c4773..3284fd8aa8a 100644
--- a/ndb/src/ndbapi/ClusterMgr.hpp
+++ b/ndb/src/ndbapi/ClusterMgr.hpp
@@ -89,7 +89,6 @@ private:
NdbThread* theClusterMgrThread;
NodeBitmask waitForHBFromNodes; // used in forcing HBs
- NdbMutex* waitForHBMutex;
NdbCondition* waitForHBCond;
/**