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-08-16 11:09:41+08:00, gni@dev3-127.(none) +2 -0
Merge dev3-127.(none):/mnt/mysql/home/ngb/bug19620
into dev3-127.(none):/mnt/mysql/home/ngb/mysql-5.1-bug19620
MERGE: 1.1810.1972.24
storage/ndb/src/mgmclient/CommandInterpreter.cpp@stripped, 2006-08-16 11:09:38+08:00,
gni@dev3-127.(none) +0 -0
Auto merged
MERGE: 1.49.16.3
storage/ndb/src/mgmclient/CommandInterpreter.cpp@stripped, 2006-08-16 11:09:38+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-08-16 11:09:38+08:00,
gni@dev3-127.(none) +0 -0
Auto merged
MERGE: 1.73.36.2
storage/ndb/src/mgmsrv/MgmtSrvr.cpp@stripped, 2006-08-16 11:09:38+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-bug19620/RESYNC
--- 1.49.16.2/ndb/src/mgmclient/CommandInterpreter.cpp 2006-08-16 11:10:44 +08:00
+++ 1.68/storage/ndb/src/mgmclient/CommandInterpreter.cpp 2006-08-16 11:10:44 +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>
@@ -167,11 +160,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;
};
@@ -236,10 +224,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>
@@ -267,9 +251,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
@@ -293,9 +274,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"
@@ -595,39 +573,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"
@@ -680,10 +625,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
@@ -723,11 +664,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
}
/*
@@ -1057,13 +993,6 @@
executePurge(allAfterFirstToken);
DBUG_RETURN(true);
}
-#ifdef HAVE_GLOBAL_REPLICATION
- else if(strcasecmp(firstToken, "REPLICATION") == 0 ||
- strcasecmp(firstToken, "REP") == 0) {
- executeRep(allAfterFirstToken);
- DBUG_RETURN(true);
- }
-#endif // HAVE_GLOBAL_REPLICATION
else if(strcasecmp(firstToken, "ENTER") == 0 &&
allAfterFirstToken != NULL &&
strncasecmp(allAfterFirstToken, "SINGLE USER MODE ",
@@ -1604,8 +1533,6 @@
case NDB_MGM_NODE_TYPE_UNKNOWN:
ndbout << "Error: Unknown Node Type" << endl;
return;
- case NDB_MGM_NODE_TYPE_REP:
- abort();
}
}
@@ -2552,226 +2479,5 @@
ndbout << "Invalid arguments: expected <BackupId>" << endl;
return;
}
-
-#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
-
- *****************************************************************************/
-
-void
-CommandInterpreter::executeRep(char* parameters)
-{
- if (emptyString(parameters)) {
- ndbout << helpTextRep;
- return;
- }
-
- 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;
- }
-
- 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);
- else
- rep_connected=true;
- return;
-
- if(!rep_connected) {
- ndbout_c("Not connected to REP server");
- }
- }
-
- /********
- * 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;
- }
-
- int result = ndb_rep_command(m_repserver, req, &repId, &reply);
-
- if (result != 0) {
- ndbout << "Start of Global Replication failed" << endl;
- } else {
- ndbout << "Start of Global Replication ordered" << endl;
- }
- return;
- }
-
- /********
- * 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;
- }
- 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;
- }
- int result = ndb_rep_command(m_repserver, req, &repId, &reply, epoch);
-
- if (result != 0) {
- ndbout << "Stop command failed" << endl;
- } else {
- ndbout << "Stop ordered" << endl;
- }
- return;
- }
-
- /*********
- * 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;
- } 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;
- }
-
- /*********
- * 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;
- } 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;
- }
-}
-#endif // HAVE_GLOBAL_REPLICATION
template class Vector<char const*>;
--- 1.73.36.1/ndb/src/mgmsrv/MgmtSrvr.cpp 2006-08-16 11:10:45 +08:00
+++ 1.107/storage/ndb/src/mgmsrv/MgmtSrvr.cpp 2006-08-16 11:10:45 +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.");
@@ -1871,9 +1866,6 @@
break;
case GSN_EVENT_REP:
{
- EventReport *rep = (EventReport*) signal->getDataPtr();
- if (rep->getNodeId() == 0)
- rep->setNodeId(refToNode(signal->theSendersBlockRef));
eventReport(signal->getDataPtr());
break;
}
@@ -1914,7 +1906,6 @@
DBUG_VOID_RETURN;
}
}
-
rep->setNodeId(_ownNodeId);
eventReport(theData);
DBUG_VOID_RETURN;
@@ -1987,6 +1978,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,
@@ -2117,6 +2191,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;
@@ -2490,17 +2597,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.2279) | gni | 16 Aug |