BUG#13985 Cluster: ndb_mgm "status" command can return incorrect data node status

use existing transporter mutex
parent b918bda2
...@@ -69,7 +69,6 @@ ClusterMgr::ClusterMgr(TransporterFacade & _facade): ...@@ -69,7 +69,6 @@ ClusterMgr::ClusterMgr(TransporterFacade & _facade):
DBUG_ENTER("ClusterMgr::ClusterMgr"); DBUG_ENTER("ClusterMgr::ClusterMgr");
ndbSetOwnVersion(); ndbSetOwnVersion();
clusterMgrThreadMutex = NdbMutex_Create(); clusterMgrThreadMutex = NdbMutex_Create();
waitForHBMutex= NdbMutex_Create();
waitForHBCond= NdbCondition_Create(); waitForHBCond= NdbCondition_Create();
noOfAliveNodes= 0; noOfAliveNodes= 0;
noOfConnectedNodes= 0; noOfConnectedNodes= 0;
...@@ -83,7 +82,6 @@ ClusterMgr::~ClusterMgr() ...@@ -83,7 +82,6 @@ ClusterMgr::~ClusterMgr()
DBUG_ENTER("ClusterMgr::~ClusterMgr"); DBUG_ENTER("ClusterMgr::~ClusterMgr");
doStop(); doStop();
NdbCondition_Destroy(waitForHBCond); NdbCondition_Destroy(waitForHBCond);
NdbMutex_Destroy(waitForHBMutex);
NdbMutex_Destroy(clusterMgrThreadMutex); NdbMutex_Destroy(clusterMgrThreadMutex);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
...@@ -172,8 +170,15 @@ ClusterMgr::doStop( ){ ...@@ -172,8 +170,15 @@ ClusterMgr::doStop( ){
void void
ClusterMgr::forceHB(NodeBitmask waitFor) ClusterMgr::forceHB(NodeBitmask waitFor)
{ {
NdbMutex_Lock(waitForHBMutex);
theFacade.lock_mutex(); theFacade.lock_mutex();
if(!waitForHBFromNodes.isclear())
{
NdbCondition_WaitTimeout(waitForHBCond, theFacade.theMutexPtr, 1000);
theFacade.unlock_mutex();
return;
}
global_flag_send_heartbeat_now= 1; global_flag_send_heartbeat_now= 1;
waitForHBFromNodes= waitFor; waitForHBFromNodes= waitFor;
...@@ -203,10 +208,8 @@ ClusterMgr::forceHB(NodeBitmask waitFor) ...@@ -203,10 +208,8 @@ ClusterMgr::forceHB(NodeBitmask waitFor)
theFacade.sendSignalUnCond(&signal, nodeId); theFacade.sendSignalUnCond(&signal, nodeId);
} }
NdbCondition_WaitTimeout(waitForHBCond, theFacade.theMutexPtr, 1000);
theFacade.unlock_mutex(); theFacade.unlock_mutex();
NdbCondition_WaitTimeout(waitForHBCond, waitForHBMutex, 1000);
NdbMutex_Unlock(waitForHBMutex);
#ifdef DEBUG_REG #ifdef DEBUG_REG
ndbout << "Still waiting for HB from " << waitForHBFromNodes.getText(buf) << endl; ndbout << "Still waiting for HB from " << waitForHBFromNodes.getText(buf) << endl;
#endif #endif
...@@ -401,13 +404,10 @@ ClusterMgr::execAPI_REGCONF(const Uint32 * theData){ ...@@ -401,13 +404,10 @@ ClusterMgr::execAPI_REGCONF(const Uint32 * theData){
node.hbFrequency = (apiRegConf->apiHeartbeatFrequency * 10) - 50; node.hbFrequency = (apiRegConf->apiHeartbeatFrequency * 10) - 50;
} }
NdbMutex_Lock(waitForHBMutex);
waitForHBFromNodes.clear(nodeId); waitForHBFromNodes.clear(nodeId);
if(waitForHBFromNodes.isclear()) if(waitForHBFromNodes.isclear())
NdbCondition_Signal(waitForHBCond); NdbCondition_Broadcast(waitForHBCond);
NdbMutex_Unlock(waitForHBMutex);
} }
void void
...@@ -436,13 +436,10 @@ ClusterMgr::execAPI_REGREF(const Uint32 * theData){ ...@@ -436,13 +436,10 @@ ClusterMgr::execAPI_REGREF(const Uint32 * theData){
default: default:
break; break;
} }
waitForHBFromNodes.clear(nodeId); waitForHBFromNodes.clear(nodeId);
if(waitForHBFromNodes.isclear()) if(waitForHBFromNodes.isclear())
{
NdbMutex_Lock(waitForHBMutex);
NdbCondition_Signal(waitForHBCond); NdbCondition_Signal(waitForHBCond);
NdbMutex_Unlock(waitForHBMutex);
}
} }
void void
......
...@@ -89,7 +89,6 @@ private: ...@@ -89,7 +89,6 @@ private:
NdbThread* theClusterMgrThread; NdbThread* theClusterMgrThread;
NodeBitmask waitForHBFromNodes; // used in forcing HBs NodeBitmask waitForHBFromNodes; // used in forcing HBs
NdbMutex* waitForHBMutex;
NdbCondition* waitForHBCond; NdbCondition* waitForHBCond;
/** /**
......
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