MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Stewart Smith Date:July 7 2006 10:10am
Subject:bk commit into 5.0 tree (stewart:1.2141) BUG#13985
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of stewart. When stewart does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2006-07-07 20:10:15+10:00, stewart@willster.(none) +5 -0
  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@stripped, 2006-07-07 20:10:12+10:00, stewart@willster.(none) +19 -0
    Add get_connected_ndb_nodes to check status for connected data nodes only

  ndb/src/mgmsrv/MgmtSrvr.hpp@stripped, 2006-07-07 20:10:12+10:00, stewart@willster.(none) +1 -0
    add prototype for get_connected_ndb_nodes

  ndb/src/mgmsrv/Services.cpp@stripped, 2006-07-07 20:10:12+10:00, stewart@willster.(none) +1 -1
    only force HB to NDBD nodes

  ndb/src/ndbapi/ClusterMgr.cpp@stripped, 2006-07-07 20:10:12+10:00, stewart@willster.(none) +14 -5
    flag to control if we send the condition

  ndb/src/ndbapi/ClusterMgr.hpp@stripped, 2006-07-07 20:10:12+10:00, stewart@willster.(none) +1 -0
    flag for if we broadcast condition on receipt of hb

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	stewart
# Host:	willster.(none)
# Root:	/home/stewart/Documents/MySQL/5.0/bug13985

--- 1.100/ndb/src/mgmsrv/MgmtSrvr.cpp	2006-07-07 20:10:19 +10:00
+++ 1.101/ndb/src/mgmsrv/MgmtSrvr.cpp	2006-07-07 20:10:19 +10:00
@@ -1941,6 +1941,25 @@
   }
 }
 
+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,

--- 1.44/ndb/src/mgmsrv/MgmtSrvr.hpp	2006-07-07 20:10:19 +10:00
+++ 1.45/ndb/src/mgmsrv/MgmtSrvr.hpp	2006-07-07 20:10:19 +10:00
@@ -485,6 +485,7 @@
 
   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);

--- 1.65/ndb/src/mgmsrv/Services.cpp	2006-07-07 20:10:19 +10:00
+++ 1.66/ndb/src/mgmsrv/Services.cpp	2006-07-07 20:10:19 +10:00
@@ -952,7 +952,7 @@
 		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;

--- 1.25/ndb/src/ndbapi/ClusterMgr.cpp	2006-07-07 20:10:19 +10:00
+++ 1.26/ndb/src/ndbapi/ClusterMgr.cpp	2006-07-07 20:10:19 +10:00
@@ -70,6 +70,7 @@
   ndbSetOwnVersion();
   clusterMgrThreadMutex = NdbMutex_Create();
   waitForHBCond= NdbCondition_Create();
+  waitingForHB= false;
   noOfAliveNodes= 0;
   noOfConnectedNodes= 0;
   theClusterMgrThread= 0;
@@ -172,7 +173,7 @@
 {
     theFacade.lock_mutex();
 
-    if(!waitForHBFromNodes.isclear())
+    if(waitingForHB)
     {
       NdbCondition_WaitTimeout(waitForHBCond, theFacade.theMutexPtr, 1000);
       theFacade.unlock_mutex();
@@ -180,6 +181,7 @@
     }
 
     global_flag_send_heartbeat_now= 1;
+    waitingForHB= true;
 
     waitForHBFromNodes= waitFor;
 #ifdef DEBUG_REG
@@ -209,10 +211,11 @@
     }
 
     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 @@
     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

--- 1.9/ndb/src/ndbapi/ClusterMgr.hpp	2006-07-07 20:10:19 +10:00
+++ 1.10/ndb/src/ndbapi/ClusterMgr.hpp	2006-07-07 20:10:19 +10:00
@@ -90,6 +90,7 @@
 
   NodeBitmask   waitForHBFromNodes; // used in forcing HBs
   NdbCondition* waitForHBCond;
+  bool          waitingForHB;
 
   /**
    * Used for controlling start/stop of the thread
Thread
bk commit into 5.0 tree (stewart:1.2141) BUG#13985Stewart Smith7 Jul