List:Commits« Previous MessageNext Message »
From:gni Date:September 22 2006 11:32am
Subject:bk commit into 5.1 tree (gni:1.2295)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of root. When root 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-09-22 19:30:37+08:00, gni@dev3-127.(none) +3 -0
  Merge dev3-127.(none):/mnt/mysql/home/ngb/mysql-5.0/bug20575
  into  dev3-127.(none):/mnt/mysql/home/ngb/mysql-5.1/mysql-5.1-bug20575
  MERGE: 1.1810.1697.131

  storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp@stripped, 2006-09-22 19:30:34+08:00, gni@dev3-127.(none) +0 -0
    Auto merged
    MERGE: 1.14.15.2

  storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp@stripped, 2006-09-22 19:30:34+08:00, gni@dev3-127.(none) +0 -0
    Merge rename: ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp -> storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp

  storage/ndb/src/mgmclient/CommandInterpreter.cpp@stripped, 2006-09-22 19:30:34+08:00, gni@dev3-127.(none) +0 -0
    Auto merged
    MERGE: 1.49.25.2

  storage/ndb/src/mgmclient/CommandInterpreter.cpp@stripped, 2006-09-22 19:30:34+08:00, gni@dev3-127.(none) +0 -0
    Merge rename: ndb/src/mgmclient/CommandInterpreter.cpp -> storage/ndb/src/mgmclient/CommandInterpreter.cpp

  storage/ndb/src/mgmsrv/MgmtSrvr.cpp@stripped, 2006-09-22 19:30:34+08:00, gni@dev3-127.(none) +0 -0
    Auto merged
    MERGE: 1.73.38.2

  storage/ndb/src/mgmsrv/MgmtSrvr.cpp@stripped, 2006-09-22 19:30:34+08:00, gni@dev3-127.(none) +0 -0
    Merge rename: ndb/src/mgmsrv/MgmtSrvr.cpp -> storage/ndb/src/mgmsrv/MgmtSrvr.cpp

# 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:	gni
# Host:	dev3-127.(none)
# Root:	/mnt/mysql/home/ngb/mysql-5.1/mysql-5.1-bug20575/RESYNC

--- 1.14.15.1/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp	2006-09-22 19:31:41 +08:00
+++ 1.40/storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp	2006-09-22 19:31:41 +08:00
@@ -68,13 +68,13 @@
 };
 
 static BlockInfo ALL_BLOCKS[] = { 
+  { NDBFS_REF,   0 ,  2000,  2999 },
   { DBTC_REF,    1 ,  8000,  8035 },
   { DBDIH_REF,   1 ,  7000,  7173 },
   { DBLQH_REF,   1 ,  5000,  5030 },
   { DBACC_REF,   1 ,  3000,  3999 },
   { DBTUP_REF,   1 ,  4000,  4007 },
   { DBDICT_REF,  1 ,  6000,  6003 },
-  { NDBFS_REF,   0 ,  2000,  2999 },
   { NDBCNTR_REF, 0 ,  1000,  1999 },
   { QMGR_REF,    1 ,     1,   999 },
   { CMVMI_REF,   1 ,  9000,  9999 },
@@ -83,11 +83,16 @@
   { DBUTIL_REF,  1 , 11000, 11999 },
   { SUMA_REF,    1 , 13000, 13999 },
   { DBTUX_REF,   1 , 12000, 12999 }
+  ,{ TSMAN_REF,  1 ,     0,     0 }
+  ,{ LGMAN_REF,  1 ,     0,     0 }
+  ,{ PGMAN_REF,  1 ,     0,     0 }
+  ,{ RESTORE_REF,1 ,     0,     0 }
 };
 
 static const Uint32 ALL_BLOCKS_SZ = sizeof(ALL_BLOCKS)/sizeof(BlockInfo);
 
 static BlockReference readConfigOrder[ALL_BLOCKS_SZ] = {
+  CMVMI_REF,
   DBTUP_REF,
   DBACC_REF,
   DBTC_REF,
@@ -98,11 +103,14 @@
   NDBFS_REF,
   NDBCNTR_REF,
   QMGR_REF,
-  CMVMI_REF,
   TRIX_REF,
   BACKUP_REF,
   DBUTIL_REF,
-  SUMA_REF
+  SUMA_REF,
+  TSMAN_REF,
+  LGMAN_REF,
+  PGMAN_REF,
+  RESTORE_REF
 };
 
 /*******************************/
@@ -131,7 +139,7 @@
       jam();
       Uint32 to_3= 0;
       const ndb_mgm_configuration_iterator * p = 
-	theConfiguration.getOwnConfigIterator();
+	m_ctx.m_config.getOwnConfigIterator();
       ndb_mgm_get_int_parameter(p, CFG_DB_START_FAILURE_TIMEOUT, &to_3);
       BaseString tmp;
       tmp.append("Shutting down node as total restart time exceeds "
@@ -160,6 +168,16 @@
   }//switch
 }//Ndbcntr::execCONTINUEB()
 
+void
+Ndbcntr::execAPI_START_REP(Signal* signal)
+{
+  if(refToBlock(signal->getSendersBlockRef()) == QMGR)
+  {
+    for(Uint32 i = 0; i<ALL_BLOCKS_SZ; i++){
+      sendSignal(ALL_BLOCKS[i].Ref, GSN_API_START_REP, signal, 1, JBB);
+    }
+  }
+}
 /*******************************/
 /*  SYSTEM_ERROR               */
 /*******************************/
@@ -186,6 +204,27 @@
 			 killingNode, data1);
     break;
 
+  case SystemError::StartFragRefError:
+    BaseString::snprintf(buf, sizeof(buf), 
+			 "Node %d killed this node because "
+			 "it replied StartFragRef error code: %u.",
+			 killingNode, data1);
+    break;
+    
+  case SystemError::CopySubscriptionRef:
+    BaseString::snprintf(buf, sizeof(buf), 
+	     "Node %d killed this node because "
+	     "it could not copy a subscription during node restart. "
+	     "Copy subscription error code: %u.",
+	     killingNode, data1);
+    break;
+  case SystemError::CopySubscriberRef:
+    BaseString::snprintf(buf, sizeof(buf), 
+	     "Node %d killed this node because "
+	     "it could not start a subscriber during node restart. "
+	     "Copy subscription error code: %u.",
+	     killingNode, data1);
+    break;
   default:
     BaseString::snprintf(buf, sizeof(buf), "System error %d, "
 	     " this node was killed by node %d", 
@@ -208,7 +247,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();
@@ -223,16 +262,12 @@
   jamEntry();
   cstartPhase = signal->theData[1];
 
-  NodeState newState(NodeState::SL_STARTING, cstartPhase, 
-		     (NodeState::StartType)ctypeOfStart);
-  updateNodeState(signal, newState);
-  
   cndbBlocksCount = 0;
   cinternalStartphase = cstartPhase - 1;
 
   switch (cstartPhase) {
   case 0:
-    if(theConfiguration.getInitialStart()){
+    if(m_ctx.m_config.getInitialStart()){
       jam();
       c_fsRemoveCount = 0;
       clearFilesystem(signal);
@@ -475,7 +510,7 @@
   Uint32 to_3 = 0;
 
   const ndb_mgm_configuration_iterator * p = 
-    theConfiguration.getOwnConfigIterator();
+    m_ctx.m_config.getOwnConfigIterator();
   
   ndbrequire(p != 0);
   ndb_mgm_get_int_parameter(p, CFG_DB_START_PARTIAL_TIMEOUT, &to_1);
@@ -1467,6 +1502,12 @@
   sendSignal(BACKUP_REF, GSN_NODE_FAILREP, signal,
 	     NodeFailRep::SignalLength, JBB);
 
+  sendSignal(SUMA_REF, GSN_NODE_FAILREP, signal,
+	     NodeFailRep::SignalLength, JBB);
+
+  sendSignal(QMGR_REF, GSN_NODE_FAILREP, signal,
+	     NodeFailRep::SignalLength, JBB);
+
   if (c_stopRec.stopReq.senderRef)
   {
     jam();
@@ -1634,7 +1675,6 @@
   //w.add(DictTabInfo::MinLoadFactor, 70);
   //w.add(DictTabInfo::MaxLoadFactor, 80);
   w.add(DictTabInfo::FragmentTypeVal, (Uint32)table.fragmentType);
-  //w.add(DictTabInfo::TableStorageVal, (Uint32)DictTabInfo::MainMemory);
   //w.add(DictTabInfo::NoOfKeyAttr, 1);
   w.add(DictTabInfo::NoOfAttributes, (Uint32)table.columnCount);
   //w.add(DictTabInfo::NoOfNullable, (Uint32)0);
@@ -1646,9 +1686,12 @@
     const SysColumn& column = table.columnList[i];
     ndbassert(column.pos == i);
     w.add(DictTabInfo::AttributeName, column.name);
-    w.add(DictTabInfo::AttributeId, (Uint32)column.pos);
+    w.add(DictTabInfo::AttributeId, (Uint32)i);
     w.add(DictTabInfo::AttributeKeyFlag, (Uint32)column.keyFlag);
-    //w.add(DictTabInfo::AttributeStorage, (Uint32)DictTabInfo::MainMemory);
+    w.add(DictTabInfo::AttributeStorageType, 
+	  (Uint32)NDB_STORAGETYPE_MEMORY);
+    w.add(DictTabInfo::AttributeArrayType, 
+	  (Uint32)NDB_ARRAYTYPE_FIXED);
     w.add(DictTabInfo::AttributeNullableFlag, (Uint32)column.nullable);
     w.add(DictTabInfo::AttributeExtType, (Uint32)column.type);
     w.add(DictTabInfo::AttributeExtLength, (Uint32)column.length);
@@ -1769,9 +1812,9 @@
 
     tKeyDataPtr[0]               = tkey;
 
-    AttributeHeader::init(&tAIDataPtr[0], 0, 1);
+    AttributeHeader::init(&tAIDataPtr[0], 0, 1 << 2);
     tAIDataPtr[1]                = tkey;
-    AttributeHeader::init(&tAIDataPtr[2], 1, 2);
+    AttributeHeader::init(&tAIDataPtr[2], 1, 2 << 2);
     tAIDataPtr[3]                = (tkey << 16);
     tAIDataPtr[4]                = 1;    
     sendSignal(DBTC_REF, GSN_TCKEYREQ, signal, 
@@ -1985,8 +2028,8 @@
   }
 
   if (arg == DumpStateOrd::NdbcntrTestStopOnError){
-    if (theConfiguration.stopOnError() == true)
-      ((Configuration&)theConfiguration).stopOnError(false);
+    if (m_ctx.m_config.stopOnError() == true)
+      ((Configuration&)m_ctx.m_config).stopOnError(false);
     
     const BlockReference tblockref = calcNdbCntrBlockRef(getOwnNodeId());
       
@@ -2194,7 +2237,7 @@
       jam();
       if(StopReq::getPerformRestart(c_stopRec.stopReq.requestInfo))
       {
-	((Configuration&)theConfiguration).stopOnError(false);
+	((Configuration&)m_ctx.m_config).stopOnError(false);
       }
     }
     if(!c_stopRec.checkNodeFail(signal))
@@ -2862,6 +2905,10 @@
     
     currentBlockIndex = 0;
 
+    NodeState newState(NodeState::SL_STARTING, currentStartPhase, 
+		       (NodeState::StartType)cntr.ctypeOfStart);
+    cntr.updateNodeState(signal, newState);
+    
     if(start != 0){
       /**
        * At least one wanted this start phase,  report it

--- 1.49.25.1/ndb/src/mgmclient/CommandInterpreter.cpp	2006-09-22 19:31:41 +08:00
+++ 1.75/storage/ndb/src/mgmclient/CommandInterpreter.cpp	2006-09-22 19:31:41 +08:00
@@ -16,14 +16,7 @@
 
 #include <ndb_global.h>
 #include <my_sys.h>
-
-//#define HAVE_GLOBAL_REPLICATION
-
 #include <Vector.hpp>
-#ifdef  HAVE_GLOBAL_REPLICATION
-#include "../rep/repapi/repapi.h"
-#endif
-
 #include <mgmapi.h>
 #include <util/BaseString.hpp>
 
@@ -168,11 +161,6 @@
   int m_verbose;
   int try_reconnect;
   int m_error;
-#ifdef HAVE_GLOBAL_REPLICATION  
-  NdbRepHandle m_repserver;
-  const char *rep_host;
-  bool rep_connected;
-#endif
   struct NdbThread* m_event_thread;
   NdbMutex *m_print_mutex;
 };
@@ -237,10 +225,6 @@
 #include <NdbMem.h>
 #include <EventLogger.hpp>
 #include <signaldata/SetLogLevelOrd.hpp>
-#include <signaldata/GrepImpl.hpp>
-#ifdef HAVE_GLOBAL_REPLICATION
-
-#endif // HAVE_GLOBAL_REPLICATION
 #include "MgmtErrorReporter.hpp"
 #include <Parser.hpp>
 #include <SocketServer.hpp>
@@ -268,9 +252,6 @@
 "---------------------------------------------------------------------------\n"
 "HELP                                   Print help text\n"
 "HELP COMMAND                           Print detailed help for COMMAND(e.g. SHOW)\n"
-#ifdef HAVE_GLOBAL_REPLICATION
-"HELP REPLICATION                       Help for global replication\n"
-#endif // HAVE_GLOBAL_REPLICATION
 #ifdef VM_TRACE // DEBUG ONLY
 "HELP DEBUG                             Help for debug compiled version\n"
 #endif
@@ -294,9 +275,6 @@
 "EXIT SINGLE USER MODE                  Exit single user mode\n"
 "<id> STATUS                            Print status\n"
 "<id> CLUSTERLOG {<category>=<level>}+  Set log level for cluster log\n"
-#ifdef HAVE_GLOBAL_REPLICATION
-"REP CONNECT <host:port>                Connect to REP server on host:port\n"
-#endif
 "PURGE STALE SESSIONS                   Reset reserved nodeid's in the mgmt server\n"
 "CONNECT [<connectstring>]              Connect to management server (reconnect if already connected)\n"
 "QUIT                                   Quit management client\n"
@@ -596,39 +574,6 @@
 ;
 
 
-#ifdef HAVE_GLOBAL_REPLICATION
-static const char* helpTextRep =
-"---------------------------------------------------------------------------\n"
-" NDB Cluster -- Management Client -- Help for Global Replication\n"
-"---------------------------------------------------------------------------\n"
-"Commands should be executed on the standby NDB Cluster\n"
-"These features are in an experimental release state.\n"
-"\n"
-"Simple Commands:\n"
-"REP START              Start Global Replication\n" 
-"REP START REQUESTOR    Start Global Replication Requestor\n" 
-"REP STATUS             Show Global Replication status\n" 
-"REP STOP               Stop Global Replication\n"
-"REP STOP REQUESTOR     Stop Global Replication Requestor\n"
-"\n" 
-"Advanced Commands:\n"
-"REP START <protocol>   Starts protocol\n"
-"REP STOP <protocol>    Stops protocol\n"
-"<protocol> = TRANSFER | APPLY | DELETE\n"
-"\n"
-#ifdef VM_TRACE // DEBUG ONLY
-"Debugging commands:\n"
-"REP DELETE             Removes epochs stored in primary and standy systems\n"
-"REP DROP <tableid>     Drop a table in SS identified by table id\n"
-"REP SLOWSTOP           Stop Replication (Tries to synchonize with primary)\n" 
-"REP FASTSTOP           Stop Replication (Stops in consistent state)\n" 
-"<component> = SUBSCRIPTION\n"
-"              METALOG | METASCAN | DATALOG | DATASCAN\n"
-"              REQUESTOR | TRANSFER | APPLY | DELETE\n"
-#endif
-;
-#endif // HAVE_GLOBAL_REPLICATION
-
 #ifdef VM_TRACE // DEBUG ONLY
 static const char* helpTextDebug =
 "---------------------------------------------------------------------------\n"
@@ -681,10 +626,6 @@
   {"PURGE STALE SESSIONS", helpTextPurgeStaleSessions},
   {"CONNECT", helpTextConnect},
   {"QUIT", helpTextQuit},
-#ifdef HAVE_GLOBAL_REPLICATION
-  {"REPLICATION", helpTextRep},
-  {"REP", helpTextRep},
-#endif // HAVE_GLOBAL_REPLICATION
 #ifdef VM_TRACE // DEBUG ONLY
   {"DEBUG", helpTextDebug},
 #endif //VM_TRACE
@@ -724,11 +665,6 @@
   m_event_thread= NULL;
   try_reconnect = 0;
   m_print_mutex= NdbMutex_Create();
-#ifdef HAVE_GLOBAL_REPLICATION
-  rep_host = NULL;
-  m_repserver = NULL;
-  rep_connected = false;
-#endif
 }
 
 /*
@@ -1067,14 +1003,7 @@
   else if (strcasecmp(firstToken, "PURGE") == 0) {
     m_error = executePurge(allAfterFirstToken);
     DBUG_RETURN(true);
-  } 
-#ifdef HAVE_GLOBAL_REPLICATION
-  else if(strcasecmp(firstToken, "REPLICATION") == 0 ||
-	  strcasecmp(firstToken, "REP") == 0) {
-    m_error = executeRep(allAfterFirstToken);
-    DBUG_RETURN(true);
-  }
-#endif // HAVE_GLOBAL_REPLICATION
+  }                
   else if(strcasecmp(firstToken, "ENTER") == 0 &&
 	  allAfterFirstToken != NULL &&
 	  strncasecmp(allAfterFirstToken, "SINGLE USER MODE ", 
@@ -1629,8 +1558,6 @@
       case NDB_MGM_NODE_TYPE_UNKNOWN:
         ndbout << "Error: Unknown Node Type" << endl;
         return -1;
-      case NDB_MGM_NODE_TYPE_REP:
-	abort();
       }
     }
 
@@ -2642,234 +2569,5 @@
   ndbout << "Invalid arguments: expected <BackupId>" << endl;
   return -1;
 }
-
-#ifdef HAVE_GLOBAL_REPLICATION
-/*****************************************************************************
- * Global Replication
- *
- * For information about the different commands, see
- * GrepReq::Request in file signaldata/grepImpl.cpp.
- *
- * Below are commands as of 2003-07-05 (may change!):
- * START = 0,            ///< Start Global Replication (all phases)
- * START_METALOG = 1,    ///< Start Global Replication (all phases)
- * START_METASCAN = 2,   ///< Start Global Replication (all phases)
- * START_DATALOG = 3,    ///< Start Global Replication (all phases)
- * START_DATASCAN = 4,   ///< Start Global Replication (all phases)
- * START_REQUESTOR = 5,  ///< Start Global Replication (all phases)
- * ABORT = 6,            ///< Immediate stop (removes subscription)
- * SLOW_STOP = 7,        ///< Stop after finishing applying current GCI epoch
- * FAST_STOP = 8,        ///< Stop after finishing applying all PS GCI epochs
- * START_TRANSFER = 9,   ///< Start SS-PS transfer
- * STOP_TRANSFER = 10,   ///< Stop SS-PS transfer
- * START_APPLY = 11,     ///< Start applying GCI epochs in SS
- * STOP_APPLY = 12,      ///< Stop applying GCI epochs in SS
- * STATUS = 13,           ///< Status
- * START_SUBSCR = 14,
- * REMOVE_BUFFERS = 15,
- * DROP_TABLE = 16
-
- *****************************************************************************/
-
-int
-CommandInterpreter::executeRep(char* parameters) 
-{
-  if (emptyString(parameters)) {
-    ndbout << helpTextRep;
-    return 0;
-  }
-
-  char * line = my_strdup(parameters,MYF(MY_WME));
-  My_auto_ptr<char> ap1((char*)line);
-  char * firstToken = strtok(line, " ");
-  
-  struct ndb_rep_reply  reply;
-  unsigned int          repId;
-
-
-  if (!strcasecmp(firstToken, "CONNECT")) {
-    char * host = strtok(NULL, "\0");
-    for (unsigned int i = 0; i < strlen(host); ++i) {
-      host[i] = tolower(host[i]);
-    }
-    
-    if(host == NULL)
-    {
-      ndbout_c("host:port must be specified.");
-      return -1;
-    }
-    
-    if(rep_connected) {
-      if(m_repserver != NULL) {
-	ndb_rep_disconnect(m_repserver);
-	rep_connected = false;
-      }       
-    }
-          
-    if(m_repserver == NULL)
-      m_repserver = ndb_rep_create_handle();
-    if(ndb_rep_connect(m_repserver, host) < 0){
-      ndbout_c("Failed to connect to %s", host);
-      return -1;
-    } 
-    else
-      rep_connected=true;
-    return 0;
-    
-    if(!rep_connected) {
-      ndbout_c("Not connected to REP server");
-      return -1;
-    }
-  }
-    
-  /********
-   * START 
-   ********/
-  if (!strcasecmp(firstToken, "START")) {
-    
-    unsigned int          req;
-    char *startType = strtok(NULL, "\0");
-    
-    if (startType == NULL) {                
-      req = GrepReq::START;
-    } else if (!strcasecmp(startType, "SUBSCRIPTION")) {  
-      req = GrepReq::START_SUBSCR;
-    } else if (!strcasecmp(startType, "METALOG")) { 
-      req = GrepReq::START_METALOG;
-    } else if (!strcasecmp(startType, "METASCAN")) {
-      req = GrepReq::START_METASCAN;
-    } else if (!strcasecmp(startType, "DATALOG")) {
-      req = GrepReq::START_DATALOG;
-    } else if (!strcasecmp(startType, "DATASCAN")) {
-      req = GrepReq::START_DATASCAN;
-    } else if (!strcasecmp(startType, "REQUESTOR")) {
-      req = GrepReq::START_REQUESTOR;
-    } else if (!strcasecmp(startType, "TRANSFER")) {
-      req = GrepReq::START_TRANSFER;
-    } else if (!strcasecmp(startType, "APPLY")) {
-      req = GrepReq::START_APPLY;
-    } else if (!strcasecmp(startType, "DELETE")) {
-      req = GrepReq::START_DELETE;
-    } else {
-      ndbout_c("Illegal argument to command 'REPLICATION START'");
-      return -1;
-    }
-
-    int result = ndb_rep_command(m_repserver, req, &repId, &reply);
-    
-    if (result != 0) {
-      ndbout << "Start of Global Replication failed" << endl;
-      return -1;
-    } else {
-      ndbout << "Start of Global Replication ordered" << endl;
-    }
-    return 0;
-  }
-
-  /********
-   * STOP
-   ********/
-  if (!strcasecmp(firstToken, "STOP")) {    
-    unsigned int          req;
-    char *startType = strtok(NULL, " ");
-    unsigned int epoch = 0;
-    
-    if (startType == NULL) {                 
-      /**
-       * Stop immediately
-       */
-      req = GrepReq::STOP;
-    } else if (!strcasecmp(startType, "EPOCH")) {  
-      char *strEpoch = strtok(NULL, "\0");
-      if(strEpoch == NULL) {
-	ndbout_c("Epoch expected!");
-	return -1;
-      }
-      req = GrepReq::STOP;
-      epoch=atoi(strEpoch);      
-    } else if (!strcasecmp(startType, "SUBSCRIPTION")) {  
-      req = GrepReq::STOP_SUBSCR;
-    } else if (!strcasecmp(startType, "METALOG")) { 
-      req = GrepReq::STOP_METALOG;
-    } else if (!strcasecmp(startType, "METASCAN")) {
-      req = GrepReq::STOP_METASCAN;
-    } else if (!strcasecmp(startType, "DATALOG")) {
-      req = GrepReq::STOP_DATALOG;
-    } else if (!strcasecmp(startType, "DATASCAN")) {
-      req = GrepReq::STOP_DATASCAN;
-    } else if (!strcasecmp(startType, "REQUESTOR")) {
-      req = GrepReq::STOP_REQUESTOR;
-    } else if (!strcasecmp(startType, "TRANSFER")) {
-      req = GrepReq::STOP_TRANSFER;
-    } else if (!strcasecmp(startType, "APPLY")) {
-      req = GrepReq::STOP_APPLY;
-    } else if (!strcasecmp(startType, "DELETE")) {
-      req = GrepReq::STOP_DELETE;
-    } else {
-      ndbout_c("Illegal argument to command 'REPLICATION STOP'");
-      return -1;
-    }
-    int result = ndb_rep_command(m_repserver, req, &repId, &reply, epoch);
-    
-    if (result != 0) {
-      ndbout << "Stop command failed" << endl;
-      return -1;
-    } else {
-      ndbout << "Stop ordered" << endl;
-    }
-    return 0;
-  }
-
-  /*********
-   * STATUS
-   *********/
-  if (!strcasecmp(firstToken, "STATUS")) {
-    struct rep_state repstate;
-    int result = 
-      ndb_rep_get_status(m_repserver, &repId, &reply, &repstate);
-    
-    if (result != 0) {
-      ndbout << "Status request of Global Replication failed" << endl;
-      return -1;
-    } else {
-      ndbout << "Status request of Global Replication ordered" << endl;
-      ndbout << "See printout at one of the DB nodes" << endl;
-      ndbout << "(Better status report is under development.)" << endl;
-      ndbout << " SubscriptionId " << repstate.subid 
-	     << " SubscriptionKey " << repstate.subkey << endl;
-    }
-    return 0;
-  }
-
-  /*********
-   * QUERY (see repapi.h for querable counters)
-   *********/
-  if (!strcasecmp(firstToken, "QUERY")) {
-    char *query = strtok(NULL, "\0");
-    int queryCounter=-1;
-    if(query != NULL) {
-      queryCounter = atoi(query);
-    }
-    struct rep_state repstate;
-    unsigned repId = 0;
-    int result = ndb_rep_query(m_repserver, (QueryCounter)queryCounter,
-			       &repId, &reply, &repstate);
-    
-    if (result != 0) {
-      ndbout << "Query repserver failed" << endl;
-      return -1;
-    } else {
-      ndbout << "Query repserver sucessful" << endl;
-      ndbout_c("repstate : QueryCounter %d, f=%d l=%d"
-	       " nodegroups %d" , 
-	       repstate.queryCounter,
-	       repstate.first[0], repstate.last[0],
-	       repstate.no_of_nodegroups );
-    }
-    return 0;
-  }
-  return 0;
-}
-#endif // HAVE_GLOBAL_REPLICATION
 
 template class Vector<char const*>;

--- 1.73.38.1/ndb/src/mgmsrv/MgmtSrvr.cpp	2006-09-22 19:32:40 +08:00
+++ 1.109/storage/ndb/src/mgmsrv/MgmtSrvr.cpp	2006-09-22 19:32:40 +08:00
@@ -37,10 +37,10 @@
 #include <signaldata/EventReport.hpp>
 #include <signaldata/DumpStateOrd.hpp>
 #include <signaldata/BackupSignalData.hpp>
-#include <signaldata/GrepImpl.hpp>
 #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>
@@ -493,10 +493,6 @@
       case NODE_TYPE_MGM:
 	nodeTypes[id] = NDB_MGM_NODE_TYPE_MGM;
 	break;
-      case NODE_TYPE_REP:
-	nodeTypes[id] = NDB_MGM_NODE_TYPE_REP;
-	break;
-      case NODE_TYPE_EXT_REP:
       default:
 	break;
       }
@@ -579,8 +575,7 @@
       DBUG_RETURN(false);
     }
   }
-  theFacade= TransporterFacade::theFacadeInstance
-    = new TransporterFacade();
+  theFacade= new TransporterFacade();
   
   if(theFacade == 0) {
     DEBUG("MgmtSrvr.cpp: theFacade is NULL.");
@@ -1876,9 +1871,6 @@
     break;
   case GSN_EVENT_REP:
   {
-    EventReport *rep = (EventReport*) signal->getDataPtr();
-    if (rep->getNodeId() == 0)
-      rep->setNodeId(refToNode(signal->theSendersBlockRef));
     eventReport(signal->getDataPtr());
     break;
   }
@@ -1919,7 +1911,6 @@
       DBUG_VOID_RETURN;
     }
   }
-  
   rep->setNodeId(_ownNodeId);
   eventReport(theData);
   DBUG_VOID_RETURN;
@@ -1992,6 +1983,89 @@
   }
 }
 
+int
+MgmtSrvr::alloc_node_id_req(NodeId free_node_id, enum ndb_mgm_node_type type)
+{
+  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;
+  req->nodeType = type;
+
+  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,
@@ -2122,6 +2196,39 @@
   }
   NdbMutex_Unlock(m_configMutex);
 
+  if (id_found && client_addr != 0)
+  {
+    int res = alloc_node_id_req(id_found, type);
+    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)
   {
     *nodeId= id_found;
@@ -2495,17 +2602,6 @@
   return ss.sendSignal(nodeId, &ssig) == SEND_OK ? 0 : SEND_OR_RECEIVE_FAILED;
 }
 
-
-/*****************************************************************************
- * Global Replication
- *****************************************************************************/
-
-int
-MgmtSrvr::repCommand(Uint32* repReqId, Uint32 request, bool waitCompleted)
-{
-  require(false);
-  return 0;
-}
 
 MgmtSrvr::Allocated_resources::Allocated_resources(MgmtSrvr &m)
   : m_mgmsrv(m)
Thread
bk commit into 5.1 tree (gni:1.2295)gni22 Sep