List:Commits« Previous MessageNext Message »
From:tomas Date:May 15 2007 8:36am
Subject:bk commit into 5.1 tree (tomas:1.2521)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of tomas. When tomas 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, 2007-05-15 08:36:21+02:00, tomas@stripped +3 -0
  Merge whalegate.ndb.mysql.com:/home/tomas/mysql-5.0-ndb
  into  whalegate.ndb.mysql.com:/home/tomas/mysql-5.1-single-user
  MERGE: 1.1810.2870.45

  storage/ndb/include/mgmapi/ndbd_exit_codes.h@stripped, 2007-05-15 08:36:16+02:00,
tomas@stripped +1 -1
    manual merge
    MERGE: 1.2.6.2

  storage/ndb/include/mgmapi/ndbd_exit_codes.h@stripped, 2007-05-15 08:35:21+02:00,
tomas@stripped +0 -0
    Merge rename: ndb/include/mgmapi/ndbd_exit_codes.h ->
storage/ndb/include/mgmapi/ndbd_exit_codes.h

  storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp@stripped, 2007-05-15 08:35:22+02:00,
tomas@stripped +0 -0
    Auto merged
    MERGE: 1.13.33.2

  storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp@stripped, 2007-05-15 08:35:22+02:00,
tomas@stripped +0 -0
    Merge rename: ndb/src/kernel/blocks/qmgr/QmgrMain.cpp ->
storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp

  storage/ndb/src/kernel/error/ndbd_exit_codes.c@stripped, 2007-05-15 08:35:22+02:00,
tomas@stripped +0 -0
    Auto merged
    MERGE: 1.1.9.2

  storage/ndb/src/kernel/error/ndbd_exit_codes.c@stripped, 2007-05-15 08:35:22+02:00,
tomas@stripped +0 -0
    Merge rename: ndb/src/kernel/error/ndbd_exit_codes.c ->
storage/ndb/src/kernel/error/ndbd_exit_codes.c

# 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:	tomas
# Host:	whalegate.ndb.mysql.com
# Root:	/home/tomas/mysql-5.1-single-user/RESYNC

--- 1.13.33.1/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp	2007-05-15 08:34:36 +02:00
+++ 1.55/storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp	2007-05-15 08:35:22 +02:00
@@ -228,7 +228,7 @@
   Uint32 senderData = req->senderData;
 
   const ndb_mgm_configuration_iterator * p = 
-    theConfiguration.getOwnConfigIterator();
+    m_ctx.m_config.getOwnConfigIterator();
   ndbrequire(p != 0);
 
   ReadConfigConf * conf = (ReadConfigConf*)signal->getDataPtrSend();
@@ -259,6 +259,9 @@
   case 1:
     initData(signal);
     startphase1(signal);
+    recompute_version_info(NodeInfo::DB);
+    recompute_version_info(NodeInfo::API);
+    recompute_version_info(NodeInfo::MGM);
     return;
   case 7:
     cactivateApiCheck = 1;
@@ -764,6 +767,7 @@
    */
   UintR TdynId = ++c_maxDynamicId;
   setNodeInfo(addNodePtr.i).m_version = startingVersion;
+  recompute_version_info(NodeInfo::DB, startingVersion);
   addNodePtr.p->ndynamicId = TdynId;
   
   /**
@@ -861,7 +865,7 @@
   ptrCheckGuard(myNodePtr, MAX_NDB_NODES, nodeRec);
   
   ndbrequire(c_start.m_gsn == GSN_CM_REGREQ);
-  ndbrequire(myNodePtr.p->phase = ZSTARTING);
+  ndbrequire(myNodePtr.p->phase == ZSTARTING);
   
   cpdistref    = cmRegConf->presidentBlockRef;
   cpresident   = cmRegConf->presidentNodeId;
@@ -1088,7 +1092,8 @@
     jam();
     c_start.m_starting_nodes_w_log.set(TaddNodeno);
   }
-  
+  c_start.m_node_gci[TaddNodeno] = node_gci;
+
   skip_nodes.bitAND(c_definedNodes);
   c_start.m_skip_nodes.bitOR(skip_nodes);
   
@@ -1237,6 +1242,7 @@
   wait.bitANDC(tmp);
 
   Uint32 retVal = 0;
+  Uint32 incompleteng = MAX_NDB_NODES; // Illegal value
   NdbNodeBitmask report_mask;
 
   if ((c_start.m_latest_gci == 0) || 
@@ -1321,7 +1327,7 @@
         report_mask.assign(c_definedNodes);
         report_mask.bitANDC(c_start.m_starting_nodes);
         retVal = 1;
-        goto start_report;
+        goto check_log;
       case CheckNodeGroups::Partitioning:
         ndbrequire(result != CheckNodeGroups::Lose);
         signal->theData[1] = 
@@ -1329,7 +1335,7 @@
         report_mask.assign(c_definedNodes);
         report_mask.bitANDC(c_start.m_starting_nodes);
         retVal = 1;
-        goto start_report;
+        goto check_log;
       }
     }
 
@@ -1353,12 +1359,7 @@
     case CheckNodeGroups::Partitioning:
       if (now < partitioned_timeout && result != CheckNodeGroups::Win)
       {
-        signal->theData[1] = c_restartPartionedTimeout == (Uint32) ~0 ? 4 : 5;
-        signal->theData[2] = Uint32((partitioned_timeout - now + 500) / 1000);
-        report_mask.assign(c_definedNodes);
-        report_mask.bitANDC(c_start.m_starting_nodes);
-        retVal = 0;
-        goto start_report;
+        goto missinglog;
       }
       // Fall through...
     case CheckNodeGroups::Win:
@@ -1366,12 +1367,61 @@
         all ? 0x8001 : (result == CheckNodeGroups::Win ? 0x8002 : 0x8003);
       report_mask.assign(c_definedNodes);
       report_mask.bitANDC(c_start.m_starting_nodes);
-      retVal = 1;
-      goto start_report;
+      retVal = 2;
+      goto check_log;
     }
   }
   ndbrequire(false);
 
+check_log:
+  jam();
+  {
+    Uint32 save[4+4*NdbNodeBitmask::Size];
+    memcpy(save, signal->theData, sizeof(save));
+    
+    signal->theData[0] = 0;
+    c_start.m_starting_nodes.copyto(NdbNodeBitmask::Size, signal->theData+1);
+    memcpy(signal->theData+1+NdbNodeBitmask::Size, c_start.m_node_gci,
+	   4*MAX_NDB_NODES);
+    EXECUTE_DIRECT(DBDIH, GSN_DIH_RESTARTREQ, signal, 
+		   1+NdbNodeBitmask::Size+MAX_NDB_NODES);
+    
+    incompleteng = signal->theData[0];
+    memcpy(signal->theData, save, sizeof(save));
+
+    if (incompleteng != MAX_NDB_NODES)
+    {
+      jam();
+      if (retVal == 1)
+      {
+	jam();
+	goto incomplete_log;
+      }
+      else if (retVal == 2)
+      {
+	if (now <= partitioned_timeout)
+	{
+	  jam();
+	  goto missinglog;
+	}
+	else
+	{
+	  goto incomplete_log;
+	}
+      }
+      ndbrequire(false);
+    }
+  }
+  goto start_report;
+
+missinglog:
+  signal->theData[1] = c_restartPartionedTimeout == (Uint32) ~0 ? 4 : 5;
+  signal->theData[2] = Uint32((partitioned_timeout - now + 500) / 1000);
+  report_mask.assign(c_definedNodes);
+  report_mask.bitANDC(c_start.m_starting_nodes);
+  retVal = 0;
+  goto start_report;
+  
 start_report:
   jam();
   {
@@ -1390,17 +1440,32 @@
   
 missing_nodegroup:
   jam();
-  char buf[100], mask1[100], mask2[100];
-  c_start.m_starting_nodes.getText(mask1);
-  tmp.assign(c_start.m_starting_nodes);
-  tmp.bitANDC(c_start.m_starting_nodes_w_log);
-  tmp.getText(mask2);
-  BaseString::snprintf(buf, sizeof(buf),
-		       "Unable to start missing node group! "
-		       " starting: %s (missing fs for: %s)",
-		       mask1, mask2);
-  progError(__LINE__, NDBD_EXIT_SR_RESTARTCONFLICT, buf);
-  return 0;                                     // Deadcode
+  {
+    char buf[100], mask1[100], mask2[100];
+    c_start.m_starting_nodes.getText(mask1);
+    tmp.assign(c_start.m_starting_nodes);
+    tmp.bitANDC(c_start.m_starting_nodes_w_log);
+    tmp.getText(mask2);
+    BaseString::snprintf(buf, sizeof(buf),
+			 "Unable to start missing node group! "
+			 " starting: %s (missing fs for: %s)",
+			 mask1, mask2);
+    progError(__LINE__, NDBD_EXIT_INSUFFICENT_NODES, buf);
+    return 0;                                     // Deadcode
+  }
+
+incomplete_log:
+  jam();
+  {
+    char buf[100], mask1[100];
+    c_start.m_starting_nodes.getText(mask1);
+    BaseString::snprintf(buf, sizeof(buf),
+			 "Incomplete log for node group: %d! "
+			 " starting nodes: %s",
+			 incompleteng, mask1);
+    progError(__LINE__, NDBD_EXIT_INSUFFICENT_NODES, buf);
+    return 0;                                     // Deadcode
+  }
 }
 
 void
@@ -1500,7 +1565,8 @@
   replyNodePtr.p->ndynamicId = dynamicId;
   replyNodePtr.p->blockRef = signal->getSendersBlockRef();
   setNodeInfo(replyNodePtr.i).m_version = version;
-
+  recompute_version_info(NodeInfo::DB, version);
+  
   if(!c_start.m_nodes.done()){
     jam();
     return;
@@ -1599,6 +1665,7 @@
   }
   
   sendCmAckAdd(signal, nodePtr.i, CmAdd::Prepare);
+  sendApiVersionRep(signal, nodePtr);
 
   /* President have prepared us */
   CmNodeInfoConf * conf = (CmNodeInfoConf*)signal->getDataPtrSend();
@@ -1611,6 +1678,29 @@
 }
 
 void
+Qmgr::sendApiVersionRep(Signal* signal, NodeRecPtr nodePtr)
+{
+  if (getNodeInfo(nodePtr.i).m_version >= NDBD_NODE_VERSION_REP)
+  {
+    jam();
+    Uint32 ref = calcQmgrBlockRef(nodePtr.i);
+    for(Uint32 i = 1; i<MAX_NODES; i++)
+    {
+      jam();
+      Uint32 version = getNodeInfo(i).m_version;
+      Uint32 type = getNodeInfo(i).m_type;
+      if (type != NodeInfo::DB && version)
+      {
+	jam();
+	signal->theData[0] = i;
+	signal->theData[1] = version;
+	sendSignal(ref, GSN_NODE_VERSION_REP, signal, 2, JBB);
+      }
+    }
+  }
+}
+
+void
 Qmgr::sendCmAckAdd(Signal * signal, Uint32 nodeId, CmAdd::RequestType type){
   
   CmAckAdd * cmAckAdd = (CmAckAdd*)signal->getDataPtrSend();
@@ -2052,7 +2142,7 @@
    * Timeouts
    */
   const ndb_mgm_configuration_iterator * p = 
-    theConfiguration.getOwnConfigIterator();
+    m_ctx.m_config.getOwnConfigIterator();
   ndbrequire(p != 0);
   
   Uint32 hbDBDB = 1500;
@@ -2101,7 +2191,7 @@
     sd->ticket.clear();
     sd->mask.clear();
     ndb_mgm_configuration_iterator * iter =
-      theConfiguration.getClusterConfigIterator();
+      m_ctx.m_config.getClusterConfigIterator();
     for (ndb_mgm_first(iter); ndb_mgm_valid(iter); ndb_mgm_next(iter)) {
       Uint32 tmp = 0;
       if (ndb_mgm_get_int_parameter(iter, CFG_NODE_ARBIT_RANK, &tmp) == 0 && 
@@ -2385,8 +2475,11 @@
   ndbrequire(failedNodePtr.p->failState == NORMAL);
   
   failedNodePtr.p->failState = WAITING_FOR_FAILCONF1;
+  NodeReceiverGroup rg(QMGR, c_clusterNodes);
+  sendSignal(rg, GSN_API_FAILREQ, signal, 2, JBA);
   sendSignal(DBTC_REF, GSN_API_FAILREQ, signal, 2, JBA);
   sendSignal(DBDICT_REF, GSN_API_FAILREQ, signal, 2, JBA);
+  sendSignal(SUMA_REF, GSN_API_FAILREQ, signal, 2, JBA);
 
   /**-------------------------------------------------------------------------
    * THE OTHER NODE WAS AN API NODE. THE COMMUNICATION LINK IS ALREADY 
@@ -2395,7 +2488,9 @@
    * SECONDS. 
    *-------------------------------------------------------------------------*/
   setNodeInfo(failedNodePtr.i).m_heartbeat_cnt= 0;
-
+  setNodeInfo(failedNodePtr.i).m_version = 0;
+  recompute_version_info(getNodeInfo(failedNodePtr.i).m_type);
+  
   CloseComReqConf * const closeCom = (CloseComReqConf *)&signal->theData[0];
 
   closeCom->xxxBlockRef = reference();
@@ -2407,6 +2502,32 @@
 	     CloseComReqConf::SignalLength, JBA);
 }//Qmgr::sendApiFailReq()
 
+void Qmgr::execAPI_FAILREQ(Signal* signal)
+{
+  jamEntry();
+  NodeRecPtr failedNodePtr;
+  failedNodePtr.i = signal->theData[0];
+  // signal->theData[1] == QMGR_REF
+  ptrCheckGuard(failedNodePtr, MAX_NODES, nodeRec);
+
+  ndbrequire(getNodeInfo(failedNodePtr.i).getType() != NodeInfo::DB);
+
+  // ignore if api not active
+  if (failedNodePtr.p->phase != ZAPI_ACTIVE)
+  {
+    jam();
+    // But send to SUMA anyway...
+    sendSignal(SUMA_REF, GSN_API_FAILREQ, signal, 2, JBA);
+    return;
+  }
+
+  signal->theData[0] = NDB_LE_Disconnected;
+  signal->theData[1] = failedNodePtr.i;
+  sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 2, JBB);
+
+  node_failed(signal, failedNodePtr.i);
+}
+
 void Qmgr::execAPI_FAILCONF(Signal* signal) 
 {
   NodeRecPtr failedNodePtr;
@@ -2657,9 +2778,6 @@
   case NodeInfo::MGM:
     compatability_check = ndbCompatible_ndb_mgmt(NDB_VERSION, version);
     break;
-  case NodeInfo::REP:
-    //    compatability_check = ndbCompatible_ndb_api(NDB_VERSION, version);
-    //    break;
   case NodeInfo::DB:
   case NodeInfo::INVALID:
   default:
@@ -2683,14 +2801,13 @@
   }
 
   setNodeInfo(apiNodePtr.i).m_version = version;
-
   setNodeInfo(apiNodePtr.i).m_heartbeat_cnt= 0;
 
   ApiRegConf * const apiRegConf = (ApiRegConf *)&signal->theData[0];
   apiRegConf->qmgrRef = reference();
   apiRegConf->apiHeartbeatFrequency = (chbApiDelay / 10);
   apiRegConf->version = NDB_VERSION;
-  apiRegConf->nodeState = getNodeState();
+  NodeState state= apiRegConf->nodeState = getNodeState();
   {
     NodeRecPtr nodePtr;
     nodePtr.i = getOwnNodeId();
@@ -2704,13 +2821,17 @@
       apiRegConf->nodeState.dynamicId = -dynamicId;
     }
   }
+  NodeVersionInfo info = getNodeVersionInfo();
+  apiRegConf->minDbVersion = info.m_type[NodeInfo::DB].m_min_version;
   apiRegConf->nodeState.m_connected_nodes.assign(c_connectedNodes);
-
   sendSignal(ref, GSN_API_REGCONF, signal, ApiRegConf::SignalLength, JBB);
 
-  if ((getNodeState().startLevel == NodeState::SL_STARTED ||
-       getNodeState().getSingleUserMode())
-      && apiNodePtr.p->phase == ZAPI_INACTIVE) {
+  if (apiNodePtr.p->phase == ZAPI_INACTIVE &&
+      (state.startLevel == NodeState::SL_STARTED ||
+       state.getSingleUserMode() ||
+       (state.startLevel == NodeState::SL_STARTING && 
+	state.starting.startPhase >= 100)))
+  {       
     jam();
     /**----------------------------------------------------------------------
      * THE API NODE IS REGISTERING. WE WILL ACCEPT IT BY CHANGING STATE AND 
@@ -2720,10 +2841,55 @@
     apiNodePtr.p->blockRef = ref;
     signal->theData[0] = apiNodePtr.i;
     sendSignal(CMVMI_REF, GSN_ENABLE_COMORD, signal, 1, JBA);
+    
+    recompute_version_info(type, version);
+    
+    signal->theData[0] = apiNodePtr.i;
+    signal->theData[1] = version;
+    NodeReceiverGroup rg(QMGR, c_clusterNodes);
+    rg.m_nodes.clear(getOwnNodeId());
+    sendVersionedDb(rg, GSN_NODE_VERSION_REP, signal, 2, JBB, 
+		    NDBD_NODE_VERSION_REP);
+    
+    signal->theData[0] = apiNodePtr.i;
+    EXECUTE_DIRECT(NDBCNTR, GSN_API_START_REP, signal, 1);
   }
   return;
 }//Qmgr::execAPI_REGREQ()
 
+void
+Qmgr::sendVersionedDb(NodeReceiverGroup rg,
+		      GlobalSignalNumber gsn, 
+		      Signal* signal, 
+		      Uint32 length, 
+		      JobBufferLevel jbuf,
+		      Uint32 minversion)
+{
+  jam();
+  NodeVersionInfo info = getNodeVersionInfo();
+  if (info.m_type[NodeInfo::DB].m_min_version >= minversion)
+  {
+    jam();
+    sendSignal(rg, gsn, signal, length, jbuf);
+  }
+  else
+  {
+    jam();
+    Uint32 i = 0, cnt = 0;
+    while((i = rg.m_nodes.find(i + 1)) != NodeBitmask::NotFound)
+    {
+      jam();
+      if (getNodeInfo(i).m_version >= minversion)
+      {
+	jam();
+	cnt++;
+	sendSignal(numberToRef(rg.m_block, i), gsn, signal, length, jbuf);
+      }
+    }
+    ndbassert((cnt == 0 && rg.m_nodes.count() == 0) ||
+	      (cnt < rg.m_nodes.count()));
+  }
+}
 
 void
 Qmgr::execAPI_VERSION_REQ(Signal * signal) {
@@ -2753,6 +2919,76 @@
 	     ApiVersionConf::SignalLength, JBB);
 }
 
+void
+Qmgr::execNODE_VERSION_REP(Signal* signal)
+{
+  jamEntry();
+  Uint32 nodeId = signal->theData[0];
+  Uint32 version = signal->theData[1];
+
+  if (nodeId < MAX_NODES)
+  {
+    jam();
+    Uint32 type = getNodeInfo(nodeId).m_type;
+    setNodeInfo(nodeId).m_version = version;
+    recompute_version_info(type, version);
+  }
+}
+ 
+void
+Qmgr::recompute_version_info(Uint32 type, Uint32 version)
+{
+  NodeVersionInfo& info = setNodeVersionInfo();
+  switch(type){
+  case NodeInfo::DB:
+  case NodeInfo::API:
+  case NodeInfo::MGM:
+    break;
+  default:
+    return;
+  }
+  
+  if (info.m_type[type].m_min_version == 0 ||
+      version < info.m_type[type].m_min_version)
+    info.m_type[type].m_min_version = version;
+  if (version > info.m_type[type].m_max_version)
+    info.m_type[type].m_max_version = version;
+}
+
+void
+Qmgr::recompute_version_info(Uint32 type)
+{
+  switch(type){
+  case NodeInfo::DB:
+  case NodeInfo::API:
+  case NodeInfo::MGM:
+    break;
+  default:
+    return;
+  }
+  
+  Uint32 min = ~0, max = 0;
+  Uint32 cnt = type == NodeInfo::DB ? MAX_NDB_NODES : MAX_NODES;
+  for (Uint32 i = 1; i<cnt; i++)
+  {
+    if (getNodeInfo(i).m_type == type)
+    {
+      Uint32 version = getNodeInfo(i).m_version;
+      
+      if (version)
+      {
+	if (version < min)
+	  min = version;
+	if (version > max)
+	  max = version;
+      }
+    }
+  }
+  
+  NodeVersionInfo& info = setNodeVersionInfo();
+  info.m_type[type].m_min_version = min == ~(Uint32)0 ? 0 : min;
+  info.m_type[type].m_max_version = max;
+}
 
 #if 0
 bool
@@ -3348,8 +3584,10 @@
       nodePtr.p->phase = ZFAIL_CLOSING;
       nodePtr.p->failState = WAITING_FOR_NDB_FAILCONF;
       setNodeInfo(nodePtr.i).m_heartbeat_cnt= 0;
+      setNodeInfo(nodePtr.i).m_version = 0;
       c_clusterNodes.clear(nodePtr.i);
     }//for
+    recompute_version_info(NodeInfo::DB);
     /*----------------------------------------------------------------------*/
     /*       WE INFORM THE API'S WE HAVE CONNECTED ABOUT THE FAILED NODES.  */
     /*----------------------------------------------------------------------*/
@@ -4801,6 +5039,178 @@
 }
 
 void
+Qmgr::execNODE_FAILREP(Signal * signal)
+{
+  jamEntry();
+  // make sure any distributed signals get acknowledged
+  // destructive of the signal
+  c_counterMgr.execNODE_FAILREP(signal);
+}
+
+void
+Qmgr::execALLOC_NODEID_REQ(Signal * signal)
+{
+  jamEntry();
+  const AllocNodeIdReq * req = (AllocNodeIdReq*)signal->getDataPtr();
+  Uint32 senderRef = req->senderRef;
+  Uint32 nodeId = req->nodeId;
+  Uint32 nodeType = req->nodeType;
+  Uint32 error = 0;
+
+  if (refToBlock(senderRef) != QMGR) // request from management server
+  {
+    /* master */
+
+    if (getOwnNodeId() != cpresident)
+      error = AllocNodeIdRef::NotMaster;
+    else if (!opAllocNodeIdReq.m_tracker.done())
+      error = AllocNodeIdRef::Busy;
+    else if (c_connectedNodes.get(nodeId))
+      error = AllocNodeIdRef::NodeConnected;
+
+    if (error)
+    {
+      jam();
+      AllocNodeIdRef * ref = (AllocNodeIdRef*)signal->getDataPtrSend();
+      ref->senderRef = reference();
+      ref->errorCode = error;
+      ref->masterRef = numberToRef(QMGR, cpresident);
+      sendSignal(senderRef, GSN_ALLOC_NODEID_REF, signal,
+                 AllocNodeIdRef::SignalLength, JBB);
+      return;
+    }
+
+    if (ERROR_INSERTED(934) && nodeId != getOwnNodeId())
+    {
+      CRASH_INSERTION(934);
+    }
+    
+    opAllocNodeIdReq.m_req = *req;
+    opAllocNodeIdReq.m_error = 0;
+    opAllocNodeIdReq.m_connectCount = getNodeInfo(refToNode(senderRef)).m_connectCount;
+
+    jam();
+    AllocNodeIdReq * req = (AllocNodeIdReq*)signal->getDataPtrSend();
+    req->senderRef = reference();
+    NodeReceiverGroup rg(QMGR, c_clusterNodes);
+    RequestTracker & p = opAllocNodeIdReq.m_tracker;
+    p.init<AllocNodeIdRef>(c_counterMgr, rg, GSN_ALLOC_NODEID_REF, 0);
+
+    sendSignal(rg, GSN_ALLOC_NODEID_REQ, signal,
+               AllocNodeIdReq::SignalLength, JBB);
+    return;
+  }
+
+  /* participant */
+
+  if (c_connectedNodes.get(nodeId))
+    error = AllocNodeIdRef::NodeConnected;
+  else
+  {
+    NodeRecPtr nodePtr;
+    nodePtr.i = nodeId;
+    ptrAss(nodePtr, nodeRec);
+    if (nodeType != getNodeInfo(nodeId).m_type)
+      error = AllocNodeIdRef::NodeTypeMismatch;
+    else if (nodePtr.p->failState != NORMAL)
+      error = AllocNodeIdRef::NodeFailureHandlingNotCompleted;
+  }
+
+  if (error)
+  {
+    AllocNodeIdRef * ref = (AllocNodeIdRef*)signal->getDataPtrSend();
+    ref->senderRef = reference();
+    ref->errorCode = error;
+    sendSignal(senderRef, GSN_ALLOC_NODEID_REF, signal,
+               AllocNodeIdRef::SignalLength, JBB);
+    return;
+  }
+
+  AllocNodeIdConf * conf = (AllocNodeIdConf*)signal->getDataPtrSend();
+  conf->senderRef = reference();
+  sendSignal(senderRef, GSN_ALLOC_NODEID_CONF, signal,
+             AllocNodeIdConf::SignalLength, JBB);
+}
+
+void
+Qmgr::execALLOC_NODEID_CONF(Signal * signal)
+{
+  /* master */
+
+  jamEntry();
+  const AllocNodeIdConf * conf = (AllocNodeIdConf*)signal->getDataPtr();
+  opAllocNodeIdReq.m_tracker.reportConf(c_counterMgr,
+                                        refToNode(conf->senderRef));
+  completeAllocNodeIdReq(signal);
+}
+
+
+void
+Qmgr::execALLOC_NODEID_REF(Signal * signal)
+{
+  /* master */
+
+  jamEntry();
+  const AllocNodeIdRef * ref = (AllocNodeIdRef*)signal->getDataPtr();
+  if (ref->errorCode == AllocNodeIdRef::NF_FakeErrorREF)
+  {
+    opAllocNodeIdReq.m_tracker.ignoreRef(c_counterMgr,
+                                         refToNode(ref->senderRef));    
+  }
+  else
+  {
+    opAllocNodeIdReq.m_tracker.reportRef(c_counterMgr,
+                                         refToNode(ref->senderRef));
+    if (opAllocNodeIdReq.m_error == 0)
+      opAllocNodeIdReq.m_error = ref->errorCode;
+  }
+  completeAllocNodeIdReq(signal);
+}
+
+void
+Qmgr::completeAllocNodeIdReq(Signal *signal)
+{
+  /* master */
+
+  if (!opAllocNodeIdReq.m_tracker.done())
+  {
+    jam();
+    return;
+  }
+
+  if (opAllocNodeIdReq.m_connectCount !=
+      getNodeInfo(refToNode(opAllocNodeIdReq.m_req.senderRef)).m_connectCount)
+  {
+    // management server not same version as the original requester
+    jam();
+    return;
+  }
+
+  if (opAllocNodeIdReq.m_tracker.hasRef())
+  {
+    jam();
+    AllocNodeIdRef * ref = (AllocNodeIdRef*)signal->getDataPtrSend();
+    ref->senderRef = reference();
+    ref->senderData = opAllocNodeIdReq.m_req.senderData;
+    ref->nodeId = opAllocNodeIdReq.m_req.nodeId;
+    ref->errorCode = opAllocNodeIdReq.m_error;
+    ref->masterRef = numberToRef(QMGR, cpresident);
+    ndbassert(AllocNodeIdRef::SignalLength == 5);
+    sendSignal(opAllocNodeIdReq.m_req.senderRef, GSN_ALLOC_NODEID_REF, signal,
+               AllocNodeIdRef::SignalLength, JBB);
+    return;
+  }
+  jam();
+  AllocNodeIdConf * conf = (AllocNodeIdConf*)signal->getDataPtrSend();
+  conf->senderRef = reference();
+  conf->senderData = opAllocNodeIdReq.m_req.senderData;
+  conf->nodeId = opAllocNodeIdReq.m_req.nodeId;
+  ndbassert(AllocNodeIdConf::SignalLength == 3);
+  sendSignal(opAllocNodeIdReq.m_req.senderRef, GSN_ALLOC_NODEID_CONF, signal,
+             AllocNodeIdConf::SignalLength, JBB);
+}
+	
+void
 Qmgr::execSTOP_REQ(Signal* signal)
 {
   jamEntry();
@@ -4808,6 +5218,7 @@
 
   if (c_stopReq.senderRef)
   {
+    jam();
     ndbrequire(NdbNodeBitmask::get(c_stopReq.nodes, getOwnNodeId()));
     
     StopConf *conf = (StopConf*)signal->getDataPtrSend();

--- 1.2.6.1/ndb/include/mgmapi/ndbd_exit_codes.h	2007-05-15 08:34:36 +02:00
+++ 1.16/storage/ndb/include/mgmapi/ndbd_exit_codes.h	2007-05-15 08:36:16 +02:00
@@ -78,6 +78,7 @@
 #define NDBD_EXIT_SR_RESTARTCONFLICT          2311
 #define NDBD_EXIT_NO_MORE_UNDOLOG             2312 
 #define NDBD_EXIT_SR_UNDOLOG                  2313 
+#define NDBD_EXIT_SR_SCHEMAFILE               2310
 #define NDBD_EXIT_SINGLE_USER_MODE            2314 
 #define NDBD_EXIT_NODE_DECLARED_DEAD          2315 
 #define NDBD_EXIT_MEMALLOC                    2327
@@ -94,6 +95,9 @@
 #define NDBD_EXIT_INVALID_CONFIG              2350
 #define NDBD_EXIT_OUT_OF_LONG_SIGNAL_MEMORY   2351
 
+/* Errorcodes for fatal resource errors */
+#define NDBD_EXIT_RESOURCE_ALLOC_ERROR        2500
+
 #define NDBD_EXIT_OS_SIGNAL_RECEIVED          6000
 
 /* VM 6050-> */
@@ -141,6 +145,9 @@
 #define NDBD_EXIT_AFS_NO_MORE_RESOURCES     2814
 #define NDBD_EXIT_AFS_NO_SUCH_FILE          2815
 #define NDBD_EXIT_AFS_READ_UNDERFLOW        2816
+
+#define NDBD_EXIT_INVALID_LCP_FILE          2352
+#define NDBD_EXIT_INSUFFICENT_NODES         2353
 
 const char *
 ndbd_exit_message(int faultId, ndbd_exit_classification *cl);

--- 1.1.9.1/ndb/src/kernel/error/ndbd_exit_codes.c	2007-05-15 08:34:36 +02:00
+++ 1.18/storage/ndb/src/kernel/error/ndbd_exit_codes.c	2007-05-15 08:35:22 +02:00
@@ -65,6 +65,7 @@
    {NDBD_EXIT_NODE_NOT_DEAD, XRE, "Internal node state conflict, "
     "most probably resolved by restarting node again"},
    {NDBD_EXIT_SR_REDOLOG, XFI, "Error while reading the REDO log"},
+   {NDBD_EXIT_SR_SCHEMAFILE, XFI, "Error while reading the schema file"},
    /* Currently unused? */
    {2311, XIE, "Conflict when selecting restart type"},
    {NDBD_EXIT_NO_MORE_UNDOLOG, XCR,
@@ -88,6 +89,10 @@
    /* this error message is complemented by additional info when generated */
    {NDBD_EXIT_INVALID_CONFIG, XCE,
     "Invalid configuration received from Management Server"},
+
+   {NDBD_EXIT_RESOURCE_ALLOC_ERROR, XCE,
+    "Resource allocation error, please review the configuration"},
+
    /* this error message is complemented by additional info when
       generated, such as signal, and text
    */
@@ -155,7 +160,10 @@
     "System reports no more file system resources"},
    {NDBD_EXIT_AFS_NO_SUCH_FILE          , XFI, "File not found"},
    {NDBD_EXIT_AFS_READ_UNDERFLOW        , XFI, "Read underflow"},
-
+   
+   {NDBD_EXIT_INVALID_LCP_FILE, XFI, "Invalid LCP" },
+   {NDBD_EXIT_INSUFFICENT_NODES, XRE, "Insufficent nodes for system restart" },
+   
    /* Sentinel */
    {0, XUE,
     "No message slogan found (please report a bug if you get this error code)"}
Thread
bk commit into 5.1 tree (tomas:1.2521)tomas15 May