List:Commits« Previous MessageNext Message »
From:tomas Date:January 27 2006 4:43pm
Subject:bk commit into 5.1 tree (tomas:1.1982)
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
  1.1982 06/01/27 17:43:34 tomas@stripped +9 -0
  bug16772, Starting node joins cluster too early, workaround, do not hand out nodeid from management server

  mysql-test/ndb/ndb_config_4_node.ini
    1.1 06/01/27 17:43:28 tomas@stripped +46 -0
    New BitKeeper file ``mysql-test/ndb/ndb_config_4_node.ini''

  storage/ndb/src/ndbapi/ndberror.c
    1.46 06/01/27 17:43:28 tomas@stripped +10 -0
    bug16772, Starting node joins cluster too early, workaround, do not hand out nodeid from management server

  storage/ndb/src/mgmsrv/MgmtSrvr.hpp
    1.40 06/01/27 17:43:28 tomas@stripped +2 -1
    bug16772, Starting node joins cluster too early, workaround, do not hand out nodeid from management server

  storage/ndb/src/mgmsrv/MgmtSrvr.cpp
    1.86 06/01/27 17:43:28 tomas@stripped +116 -0
    bug16772, Starting node joins cluster too early, workaround, do not hand out nodeid from management server

  storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp
    1.25 06/01/27 17:43:28 tomas@stripped +164 -0
    bug16772, Starting node joins cluster too early, workaround, do not hand out nodeid from management server

  storage/ndb/src/kernel/blocks/qmgr/QmgrInit.cpp
    1.8 06/01/27 17:43:28 tomas@stripped +5 -0
    bug16772, Starting node joins cluster too early, workaround, do not hand out nodeid from management server

  storage/ndb/src/kernel/blocks/qmgr/Qmgr.hpp
    1.10 06/01/27 17:43:28 tomas@stripped +18 -0
    bug16772, Starting node joins cluster too early, workaround, do not hand out nodeid from management server

  storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp
    1.25 06/01/27 17:43:28 tomas@stripped +3 -0
    bug16772, Starting node joins cluster too early, workaround, do not hand out nodeid from management server

  storage/ndb/include/kernel/GlobalSignalNumbers.h
    1.14 06/01/27 17:43:28 tomas@stripped +3 -3
    bug16772, Starting node joins cluster too early, workaround, do not hand out nodeid from management server

  mysql-test/ndb/ndb_config_4_node.ini
    1.0 06/01/27 17:43:28 tomas@stripped +0 -0
    BitKeeper file /home/tomas/wl2325-alcatel/mysql-test/ndb/ndb_config_4_node.ini

# 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:	poseidon.ndb.mysql.com
# Root:	/home/tomas/wl2325-alcatel

--- 1.13/storage/ndb/include/kernel/GlobalSignalNumbers.h	2005-10-07 10:57:56 +02:00
+++ 1.14/storage/ndb/include/kernel/GlobalSignalNumbers.h	2006-01-27 17:43:28 +01:00
@@ -111,9 +111,9 @@
 /* 57 unused */
 /* 58 unused */
 /* 59 unused */
-/* 60 unused */
-/* 61 unused */
-/* 62 unused */
+#define GSN_ALLOC_NODEID_REQ            60
+#define GSN_ALLOC_NODEID_CONF           61
+#define GSN_ALLOC_NODEID_REF            62
 /* 63 unused */
 /* 64 unused */
 /* 65 unused */

--- 1.24/storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp	2006-01-18 16:51:36 +01:00
+++ 1.25/storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp	2006-01-27 17:43:28 +01:00
@@ -1498,6 +1498,9 @@
   sendSignal(SUMA_REF, GSN_NODE_FAILREP, signal,
 	     NodeFailRep::SignalLength, JBB);
 
+  sendSignal(QMGR_REF, GSN_NODE_FAILREP, signal,
+	     NodeFailRep::SignalLength, JBB);
+
   Uint32 nodeId = 0;
   while(!allFailed.isclear()){
     nodeId = allFailed.find(nodeId + 1);

--- 1.9/storage/ndb/src/kernel/blocks/qmgr/Qmgr.hpp	2005-10-07 01:06:20 +02:00
+++ 1.10/storage/ndb/src/kernel/blocks/qmgr/Qmgr.hpp	2006-01-27 17:43:28 +01:00
@@ -29,6 +29,10 @@
 #include <signaldata/CmRegSignalData.hpp>
 #include <signaldata/ApiRegSignalData.hpp>
 #include <signaldata/FailRep.hpp>
+#include <signaldata/AllocNodeId.hpp>
+
+#include <SafeCounter.hpp>
+#include <RequestTracker.hpp>
 
 #include "timer.hpp"
 
@@ -222,6 +226,12 @@
   void execAPI_VERSION_REQ(Signal* signal);
   void execAPI_BROADCAST_REP(Signal* signal);
 
+  void execNODE_FAILREP(Signal *);
+  void execALLOC_NODEID_REQ(Signal *);
+  void execALLOC_NODEID_CONF(Signal *);
+  void execALLOC_NODEID_REF(Signal *);
+  void completeAllocNodeIdReq(Signal *);
+
   // Arbitration signals
   void execARBIT_CFG(Signal* signal);
   void execARBIT_PREPREQ(Signal* signal);
@@ -388,6 +398,14 @@
   Uint16 cprepFailedNodes[MAX_NDB_NODES];
   Uint16 ccommitFailedNodes[MAX_NDB_NODES];
 
+  struct OpAllocNodeIdReq {
+    RequestTracker m_tracker;
+    AllocNodeIdReq m_req;
+    Uint32 m_connectCount;
+    Uint32 m_error;
+  };
+
+  struct OpAllocNodeIdReq opAllocNodeIdReq;
 };
 
 #endif

--- 1.7/storage/ndb/src/kernel/blocks/qmgr/QmgrInit.cpp	2005-10-07 01:06:20 +02:00
+++ 1.8/storage/ndb/src/kernel/blocks/qmgr/QmgrInit.cpp	2006-01-27 17:43:28 +01:00
@@ -85,6 +85,11 @@
   addRecSignal(GSN_READ_NODESREQ, &Qmgr::execREAD_NODESREQ);
   addRecSignal(GSN_SET_VAR_REQ,  &Qmgr::execSET_VAR_REQ);
   addRecSignal(GSN_API_BROADCAST_REP,  &Qmgr::execAPI_BROADCAST_REP);
+
+  addRecSignal(GSN_NODE_FAILREP, &Qmgr::execNODE_FAILREP);
+  addRecSignal(GSN_ALLOC_NODEID_REQ,  &Qmgr::execALLOC_NODEID_REQ);
+  addRecSignal(GSN_ALLOC_NODEID_CONF,  &Qmgr::execALLOC_NODEID_CONF);
+  addRecSignal(GSN_ALLOC_NODEID_REF,  &Qmgr::execALLOC_NODEID_REF);
   
   // Arbitration signals
   addRecSignal(GSN_ARBIT_PREPREQ, &Qmgr::execARBIT_PREPREQ);

--- 1.24/storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp	2006-01-26 09:48:42 +01:00
+++ 1.25/storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp	2006-01-27 17:43:28 +01:00
@@ -3983,3 +3983,167 @@
   NodeReceiverGroup rg(API_CLUSTERMGR, mask);
   sendSignal(rg, api.gsn, signal, len, JBB); // forward sections
 }
+
+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 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;
+    }
+
+    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 (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);
+}

--- 1.85/storage/ndb/src/mgmsrv/MgmtSrvr.cpp	2006-01-20 16:13:46 +01:00
+++ 1.86/storage/ndb/src/mgmsrv/MgmtSrvr.cpp	2006-01-27 17:43:28 +01:00
@@ -40,6 +40,7 @@
 #include <signaldata/ManagementServer.hpp>
 #include <signaldata/NFCompleteRep.hpp>
 #include <signaldata/NodeFailRep.hpp>
+#include <signaldata/AllocNodeId.hpp>
 #include <NdbSleep.h>
 #include <EventLogger.hpp>
 #include <DebuggerNames.hpp>
@@ -1702,6 +1703,88 @@
   }
 }
 
+int
+MgmtSrvr::alloc_node_id_req(Uint32 free_node_id)
+{
+  SignalSender ss(theFacade);
+  ss.lock(); // lock will be released on exit
+
+  SimpleSignal ssig;
+  AllocNodeIdReq* req = CAST_PTR(AllocNodeIdReq, ssig.getDataPtrSend());
+  ssig.set(ss, TestOrd::TraceAPI, QMGR, GSN_ALLOC_NODEID_REQ,
+	   AllocNodeIdReq::SignalLength);
+  
+  req->senderRef = ss.getOwnRef();
+  req->senderData = 19;
+  req->nodeId = free_node_id;
+
+  int do_send = 1;
+  NodeId nodeId = 0;
+  while (1)
+  {
+    if (nodeId == 0)
+    {
+      bool next;
+      while((next = getNextNodeId(&nodeId, NDB_MGM_NODE_TYPE_NDB)) == true &&
+            theFacade->get_node_alive(nodeId) == false);
+      if (!next)
+        return NO_CONTACT_WITH_DB_NODES;
+      do_send = 1;
+    }
+    if (do_send)
+    {
+      if (ss.sendSignal(nodeId, &ssig) != SEND_OK) {
+        return SEND_OR_RECEIVE_FAILED;
+      }
+      do_send = 0;
+    }
+    
+    SimpleSignal *signal = ss.waitFor();
+
+    int gsn = signal->readSignalNumber();
+    switch (gsn) {
+    case GSN_ALLOC_NODEID_CONF:
+    {
+      const AllocNodeIdConf * const conf =
+        CAST_CONSTPTR(AllocNodeIdConf, signal->getDataPtr());
+      return 0;
+    }
+    case GSN_ALLOC_NODEID_REF:
+    {
+      const AllocNodeIdRef * const ref =
+        CAST_CONSTPTR(AllocNodeIdRef, signal->getDataPtr());
+      if (ref->errorCode == AllocNodeIdRef::NotMaster ||
+          ref->errorCode == AllocNodeIdRef::Busy)
+      {
+        do_send = 1;
+        nodeId = refToNode(ref->masterRef);
+        continue;
+      }
+      return ref->errorCode;
+    }
+    case GSN_NF_COMPLETEREP:
+    {
+      const NFCompleteRep * const rep =
+        CAST_CONSTPTR(NFCompleteRep, signal->getDataPtr());
+#ifdef VM_TRACE
+      ndbout_c("Node %d fail completed", rep->failedNodeId);
+#endif
+      if (rep->failedNodeId == nodeId)
+        nodeId = 0;
+      continue;
+    }
+    case GSN_NODE_FAILREP:{
+      // ignore NF_COMPLETEREP will come
+      continue;
+    }
+    default:
+      report_unknown_signal(signal);
+      return SEND_OR_RECEIVE_FAILED;
+    }
+  }
+  return 0;
+}
+
 bool
 MgmtSrvr::alloc_node_id(NodeId * nodeId, 
 			enum ndb_mgm_node_type type,
@@ -1825,6 +1908,39 @@
     id_found= tmp; // mgmt server matched, check for more matches
   }
   NdbMutex_Unlock(m_configMutex);
+
+  if (id_found && client_addr != 0)
+  {
+    int res = alloc_node_id_req(id_found);
+    unsigned save_id_found = id_found;
+    switch (res)
+    {
+    case 0:
+      // ok continue
+      break;
+    case NO_CONTACT_WITH_DB_NODES:
+      // ok continue
+      break;
+    default:
+      // something wrong
+      id_found = 0;
+      break;
+
+    }
+    if (id_found == 0)
+    {
+      char buf[128];
+      ndb_error_string(res, buf, sizeof(buf));
+      error_string.appfmt("Cluster refused allocation of id %d. Error: %d (%s).",
+			  save_id_found, res, buf);
+      g_eventLogger.warning("Cluster refused allocation of id %d. "
+                            "Connection from ip %s. "
+                            "Returned error string \"%s\"", save_id_found,
+                            inet_ntoa(((struct sockaddr_in *)(client_addr))->sin_addr),
+                            error_string.c_str());
+      DBUG_RETURN(false);
+    }
+  }
 
   if (id_found)
   {

--- 1.39/storage/ndb/src/mgmsrv/MgmtSrvr.hpp	2006-01-20 16:13:46 +01:00
+++ 1.40/storage/ndb/src/mgmsrv/MgmtSrvr.hpp	2006-01-27 17:43:28 +01:00
@@ -506,7 +506,8 @@
    *   @return  -1 if block not found, otherwise block number
    */
   int getBlockNumber(const BaseString &blockName);
-  
+
+  int alloc_node_id_req(Uint32 free_node_id);
   //**************************************************************************
   
   int _blockNumber;

--- 1.45/storage/ndb/src/ndbapi/ndberror.c	2006-01-18 11:05:56 +01:00
+++ 1.46/storage/ndb/src/ndbapi/ndberror.c	2006-01-27 17:43:28 +01:00
@@ -77,6 +77,7 @@
  * 1200 - LQH
  * 1300 - BACKUP
  * 1400 - SUMA
+ * 1500 - QMGR
  * 4000 - API
  * 4100 - ""
  * 4200 - ""
@@ -404,6 +405,15 @@
   { 1348, DMEC, AE, "Backup failed to allocate file record (check configuration)" },
   { 1349, DMEC, AE, "Backup failed to allocate attribute record (check configuration)" },
   { 1329, DMEC, AE, "Backup during software upgrade not supported" },
+
+  /**
+   * Node id allocation error codes
+   */ 
+
+  { 1600, DMEC, IE, "Undefined error" },
+  { 1601, DMEC, AE, "Node already reserved" },
+  { 1602, DMEC, AE, "Node already connected" },
+  { 1603, DMEC, AE, "Node failure handling not completed" },
   
   /**
    * Still uncategorized
--- New file ---
+++ mysql-test/ndb/ndb_config_4_node.ini	06/01/27 17:43:28
[ndbd default]
NoOfReplicas= 2
MaxNoOfConcurrentTransactions= 64
MaxNoOfConcurrentOperations= CHOOSE_MaxNoOfConcurrentOperations
DataMemory= CHOOSE_DataMemory
IndexMemory= CHOOSE_IndexMemory
Diskless= CHOOSE_Diskless
TimeBetweenWatchDogCheck= 30000
DataDir= CHOOSE_FILESYSTEM
MaxNoOfOrderedIndexes= CHOOSE_MaxNoOfOrderedIndexes
MaxNoOfAttributes= CHOOSE_MaxNoOfAttributes
TimeBetweenGlobalCheckpoints= 500
NoOfFragmentLogFiles= 3

[ndbd]
HostName= CHOOSE_HOSTNAME_1   # hostname is a valid network adress

[ndbd]
HostName= CHOOSE_HOSTNAME_2   # hostname is a valid network adress

[ndbd]
HostName= CHOOSE_HOSTNAME_3   # hostname is a valid network adress

[ndbd]
HostName= CHOOSE_HOSTNAME_4   # hostname is a valid network adress

[ndb_mgmd]
HostName= CHOOSE_HOSTNAME_1   # hostname is a valid network adress
DataDir= CHOOSE_FILESYSTEM    #
PortNumber= CHOOSE_PORT_MGM

[mysqld]

[mysqld]

[mysqld]

[mysqld]

[mysqld]

[mysqld]

[mysqld]

[mysqld]

Thread
bk commit into 5.1 tree (tomas:1.1982)tomas27 Jan