enable setting api reg req frequency to be higher than heartbeat setting to...

enable setting api reg req frequency to be higher than heartbeat setting to ensure we have reasonably up-to-date info from ndb nodes
+ do this for management server
parent 9b115753
...@@ -627,6 +627,16 @@ MgmtSrvr::start(BaseString &error_string) ...@@ -627,6 +627,16 @@ MgmtSrvr::start(BaseString &error_string)
ndbout_c("This is probably a bug."); ndbout_c("This is probably a bug.");
} }
/*
set api reg req frequency quite high:
100 ms interval to make sure we have fairly up-to-date
info from the nodes. This to make sure that this info
is not dependent on heart beat settings in the
configuration
*/
theFacade->theClusterMgr->set_max_api_reg_req_interval(100);
TransporterRegistry *reg = theFacade->get_registry(); TransporterRegistry *reg = theFacade->get_registry();
for(unsigned int i=0;i<reg->m_transporter_interface.size();i++) { for(unsigned int i=0;i<reg->m_transporter_interface.size();i++) {
BaseString msg; BaseString msg;
......
...@@ -68,6 +68,7 @@ ClusterMgr::ClusterMgr(TransporterFacade & _facade): ...@@ -68,6 +68,7 @@ ClusterMgr::ClusterMgr(TransporterFacade & _facade):
clusterMgrThreadMutex = NdbMutex_Create(); clusterMgrThreadMutex = NdbMutex_Create();
waitForHBCond= NdbCondition_Create(); waitForHBCond= NdbCondition_Create();
waitingForHB= false; waitingForHB= false;
m_max_api_reg_req_interval= 0xFFFFFFFF; // MAX_INT
noOfAliveNodes= 0; noOfAliveNodes= 0;
noOfConnectedNodes= 0; noOfConnectedNodes= 0;
theClusterMgrThread= 0; theClusterMgrThread= 0;
...@@ -251,7 +252,7 @@ ClusterMgr::threadMain( ){ ...@@ -251,7 +252,7 @@ ClusterMgr::threadMain( ){
* Start of Secure area for use of Transporter * Start of Secure area for use of Transporter
*/ */
theFacade.lock_mutex(); theFacade.lock_mutex();
for (int i = 1; i < MAX_NODES; i++){ for (int i = 1; i < MAX_NDB_NODES; i++){
/** /**
* Send register request (heartbeat) to all available nodes * Send register request (heartbeat) to all available nodes
* at specified timing intervals * at specified timing intervals
...@@ -272,7 +273,8 @@ ClusterMgr::threadMain( ){ ...@@ -272,7 +273,8 @@ ClusterMgr::threadMain( ){
} }
theNode.hbCounter += timeSlept; theNode.hbCounter += timeSlept;
if (theNode.hbCounter >= theNode.hbFrequency) { if (theNode.hbCounter >= m_max_api_reg_req_interval ||
theNode.hbCounter >= theNode.hbFrequency) {
/** /**
* It is now time to send a new Heartbeat * It is now time to send a new Heartbeat
*/ */
...@@ -281,13 +283,6 @@ ClusterMgr::threadMain( ){ ...@@ -281,13 +283,6 @@ ClusterMgr::threadMain( ){
theNode.hbCounter = 0; theNode.hbCounter = 0;
} }
/**
* If the node is of type REP,
* then the receiver of the signal should be API_CLUSTERMGR
*/
if (theNode.m_info.m_type == NodeInfo::REP) {
signal.theReceiversBlockNumber = API_CLUSTERMGR;
}
#ifdef DEBUG_REG #ifdef DEBUG_REG
ndbout_c("ClusterMgr: Sending API_REGREQ to node %d", (int)nodeId); ndbout_c("ClusterMgr: Sending API_REGREQ to node %d", (int)nodeId);
#endif #endif
......
...@@ -50,6 +50,7 @@ public: ...@@ -50,6 +50,7 @@ public:
void startThread(); void startThread();
void forceHB(); void forceHB();
void set_max_api_reg_req_interval(unsigned int millisec) { m_max_api_reg_req_interval = millisec; }
private: private:
void threadMain(); void threadMain();
...@@ -83,6 +84,7 @@ public: ...@@ -83,6 +84,7 @@ public:
Uint32 m_connect_count; Uint32 m_connect_count;
private: private:
Uint32 m_max_api_reg_req_interval;
Uint32 noOfAliveNodes; Uint32 noOfAliveNodes;
Uint32 noOfConnectedNodes; Uint32 noOfConnectedNodes;
Node theNodes[MAX_NODES]; Node theNodes[MAX_NODES];
......
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