Bug#27640, backup id not dispalyed in the output of "ndb_mgm start backup wait completed"
correct related sourcecode after merge from 5.0 storage/ndb/src/mgmclient/CommandInterpreter.cpp: correct something to ensure only related sourcecode are merged
This commit is contained in:
parent
6ead7eea29
commit
e470fbe922
@ -15,14 +15,7 @@
|
|||||||
|
|
||||||
#include <ndb_global.h>
|
#include <ndb_global.h>
|
||||||
#include <my_sys.h>
|
#include <my_sys.h>
|
||||||
|
|
||||||
//#define HAVE_GLOBAL_REPLICATION
|
|
||||||
|
|
||||||
#include <Vector.hpp>
|
#include <Vector.hpp>
|
||||||
#ifdef HAVE_GLOBAL_REPLICATION
|
|
||||||
#include "../rep/repapi/repapi.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <mgmapi.h>
|
#include <mgmapi.h>
|
||||||
#include <util/BaseString.hpp>
|
#include <util/BaseString.hpp>
|
||||||
#include <ndbd_exit_codes.h>
|
#include <ndbd_exit_codes.h>
|
||||||
@ -168,11 +161,6 @@ private:
|
|||||||
int m_verbose;
|
int m_verbose;
|
||||||
int try_reconnect;
|
int try_reconnect;
|
||||||
int m_error;
|
int m_error;
|
||||||
#ifdef HAVE_GLOBAL_REPLICATION
|
|
||||||
NdbRepHandle m_repserver;
|
|
||||||
const char *rep_host;
|
|
||||||
bool rep_connected;
|
|
||||||
#endif
|
|
||||||
struct NdbThread* m_event_thread;
|
struct NdbThread* m_event_thread;
|
||||||
NdbMutex *m_print_mutex;
|
NdbMutex *m_print_mutex;
|
||||||
};
|
};
|
||||||
@ -237,10 +225,6 @@ extern "C" {
|
|||||||
#include <NdbMem.h>
|
#include <NdbMem.h>
|
||||||
#include <EventLogger.hpp>
|
#include <EventLogger.hpp>
|
||||||
#include <signaldata/SetLogLevelOrd.hpp>
|
#include <signaldata/SetLogLevelOrd.hpp>
|
||||||
#include <signaldata/GrepImpl.hpp>
|
|
||||||
#ifdef HAVE_GLOBAL_REPLICATION
|
|
||||||
|
|
||||||
#endif // HAVE_GLOBAL_REPLICATION
|
|
||||||
#include "MgmtErrorReporter.hpp"
|
#include "MgmtErrorReporter.hpp"
|
||||||
#include <Parser.hpp>
|
#include <Parser.hpp>
|
||||||
#include <SocketServer.hpp>
|
#include <SocketServer.hpp>
|
||||||
@ -268,9 +252,6 @@ static const char* helpText =
|
|||||||
"---------------------------------------------------------------------------\n"
|
"---------------------------------------------------------------------------\n"
|
||||||
"HELP Print help text\n"
|
"HELP Print help text\n"
|
||||||
"HELP COMMAND Print detailed help for COMMAND(e.g. SHOW)\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
|
#ifdef VM_TRACE // DEBUG ONLY
|
||||||
"HELP DEBUG Help for debug compiled version\n"
|
"HELP DEBUG Help for debug compiled version\n"
|
||||||
#endif
|
#endif
|
||||||
@ -294,9 +275,6 @@ static const char* helpText =
|
|||||||
"EXIT SINGLE USER MODE Exit single user mode\n"
|
"EXIT SINGLE USER MODE Exit single user mode\n"
|
||||||
"<id> STATUS Print status\n"
|
"<id> STATUS Print status\n"
|
||||||
"<id> CLUSTERLOG {<category>=<level>}+ Set log level for cluster log\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"
|
"PURGE STALE SESSIONS Reset reserved nodeid's in the mgmt server\n"
|
||||||
"CONNECT [<connectstring>] Connect to management server (reconnect if already connected)\n"
|
"CONNECT [<connectstring>] Connect to management server (reconnect if already connected)\n"
|
||||||
"QUIT Quit management client\n"
|
"QUIT Quit management client\n"
|
||||||
@ -596,39 +574,6 @@ static const char* helpTextQuit =
|
|||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
#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
|
#ifdef VM_TRACE // DEBUG ONLY
|
||||||
static const char* helpTextDebug =
|
static const char* helpTextDebug =
|
||||||
"---------------------------------------------------------------------------\n"
|
"---------------------------------------------------------------------------\n"
|
||||||
@ -681,10 +626,6 @@ struct st_cmd_help {
|
|||||||
{"PURGE STALE SESSIONS", helpTextPurgeStaleSessions},
|
{"PURGE STALE SESSIONS", helpTextPurgeStaleSessions},
|
||||||
{"CONNECT", helpTextConnect},
|
{"CONNECT", helpTextConnect},
|
||||||
{"QUIT", helpTextQuit},
|
{"QUIT", helpTextQuit},
|
||||||
#ifdef HAVE_GLOBAL_REPLICATION
|
|
||||||
{"REPLICATION", helpTextRep},
|
|
||||||
{"REP", helpTextRep},
|
|
||||||
#endif // HAVE_GLOBAL_REPLICATION
|
|
||||||
#ifdef VM_TRACE // DEBUG ONLY
|
#ifdef VM_TRACE // DEBUG ONLY
|
||||||
{"DEBUG", helpTextDebug},
|
{"DEBUG", helpTextDebug},
|
||||||
#endif //VM_TRACE
|
#endif //VM_TRACE
|
||||||
@ -724,11 +665,6 @@ CommandInterpreter::CommandInterpreter(const char *_host,int verbose)
|
|||||||
m_event_thread= NULL;
|
m_event_thread= NULL;
|
||||||
try_reconnect = 0;
|
try_reconnect = 0;
|
||||||
m_print_mutex= NdbMutex_Create();
|
m_print_mutex= NdbMutex_Create();
|
||||||
#ifdef HAVE_GLOBAL_REPLICATION
|
|
||||||
rep_host = NULL;
|
|
||||||
m_repserver = NULL;
|
|
||||||
rep_connected = false;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1168,15 +1104,9 @@ CommandInterpreter::execute_impl(const char *_line, bool interactive)
|
|||||||
else if (strcasecmp(firstToken, "PURGE") == 0) {
|
else if (strcasecmp(firstToken, "PURGE") == 0) {
|
||||||
m_error = executePurge(allAfterFirstToken);
|
m_error = executePurge(allAfterFirstToken);
|
||||||
DBUG_RETURN(true);
|
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 &&
|
else if(strcasecmp(firstToken, "ENTER") == 0 &&
|
||||||
|
allAfterFirstToken != NULL &&
|
||||||
allAfterFirstToken != NULL &&
|
allAfterFirstToken != NULL &&
|
||||||
strncasecmp(allAfterFirstToken, "SINGLE USER MODE ",
|
strncasecmp(allAfterFirstToken, "SINGLE USER MODE ",
|
||||||
sizeof("SINGLE USER MODE") - 1) == 0){
|
sizeof("SINGLE USER MODE") - 1) == 0){
|
||||||
@ -1651,7 +1581,6 @@ CommandInterpreter::executePurge(char* parameters)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int i;
|
|
||||||
char *str;
|
char *str;
|
||||||
|
|
||||||
if (ndb_mgm_purge_stale_sessions(m_mgmsrv, &str)) {
|
if (ndb_mgm_purge_stale_sessions(m_mgmsrv, &str)) {
|
||||||
@ -1730,8 +1659,8 @@ CommandInterpreter::executeShow(char* parameters)
|
|||||||
case NDB_MGM_NODE_TYPE_UNKNOWN:
|
case NDB_MGM_NODE_TYPE_UNKNOWN:
|
||||||
ndbout << "Error: Unknown Node Type" << endl;
|
ndbout << "Error: Unknown Node Type" << endl;
|
||||||
return -1;
|
return -1;
|
||||||
case NDB_MGM_NODE_TYPE_REP:
|
case NDB_MGM_NODE_TYPE_MAX:
|
||||||
abort();
|
break; /* purify: deadcode */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1769,7 +1698,6 @@ CommandInterpreter::executeConnect(char* parameters, bool interactive)
|
|||||||
{
|
{
|
||||||
BaseString *basestring = NULL;
|
BaseString *basestring = NULL;
|
||||||
|
|
||||||
int retval;
|
|
||||||
disconnect();
|
disconnect();
|
||||||
if (!emptyString(parameters)) {
|
if (!emptyString(parameters)) {
|
||||||
basestring= new BaseString(parameters);
|
basestring= new BaseString(parameters);
|
||||||
@ -1806,7 +1734,15 @@ CommandInterpreter::executeClusterLog(char* parameters)
|
|||||||
char * item = strtok_r(tmpString, " ", &tmpPtr);
|
char * item = strtok_r(tmpString, " ", &tmpPtr);
|
||||||
int enable;
|
int enable;
|
||||||
|
|
||||||
const unsigned int *enabled= ndb_mgm_get_logfilter(m_mgmsrv);
|
ndb_mgm_severity enabled[NDB_MGM_EVENT_SEVERITY_ALL] =
|
||||||
|
{{NDB_MGM_EVENT_SEVERITY_ON,0},
|
||||||
|
{NDB_MGM_EVENT_SEVERITY_DEBUG,0},
|
||||||
|
{NDB_MGM_EVENT_SEVERITY_INFO,0},
|
||||||
|
{NDB_MGM_EVENT_SEVERITY_WARNING,0},
|
||||||
|
{NDB_MGM_EVENT_SEVERITY_ERROR,0},
|
||||||
|
{NDB_MGM_EVENT_SEVERITY_CRITICAL,0},
|
||||||
|
{NDB_MGM_EVENT_SEVERITY_ALERT,0}};
|
||||||
|
ndb_mgm_get_clusterlog_severity_filter(m_mgmsrv, &enabled[0], NDB_MGM_EVENT_SEVERITY_ALL);
|
||||||
if(enabled == NULL) {
|
if(enabled == NULL) {
|
||||||
ndbout << "Couldn't get status" << endl;
|
ndbout << "Couldn't get status" << endl;
|
||||||
printError();
|
printError();
|
||||||
@ -1819,25 +1755,25 @@ CommandInterpreter::executeClusterLog(char* parameters)
|
|||||||
********************/
|
********************/
|
||||||
if (strcasecmp(item, "INFO") == 0) {
|
if (strcasecmp(item, "INFO") == 0) {
|
||||||
DBUG_PRINT("info",("INFO"));
|
DBUG_PRINT("info",("INFO"));
|
||||||
if(enabled[0] == 0)
|
if(enabled[0].value == 0)
|
||||||
{
|
{
|
||||||
ndbout << "Cluster logging is disabled." << endl;
|
ndbout << "Cluster logging is disabled." << endl;
|
||||||
m_error = 0;
|
m_error = 0;
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
#if 0
|
#if 0
|
||||||
for(i = 0; i<7;i++)
|
for(i = 0; i<DB_MGM_EVENT_SEVERITY_ALL;i++)
|
||||||
printf("enabled[%d] = %d\n", i, enabled[i]);
|
printf("enabled[%d] = %d\n", i, enabled[i].value);
|
||||||
#endif
|
#endif
|
||||||
ndbout << "Severities enabled: ";
|
ndbout << "Severities enabled: ";
|
||||||
for(i = 1; i < (int)NDB_MGM_EVENT_SEVERITY_ALL; i++) {
|
for(i = 1; i < (int)NDB_MGM_EVENT_SEVERITY_ALL; i++) {
|
||||||
const char *str= ndb_mgm_get_event_severity_string((ndb_mgm_event_severity)i);
|
const char *str= ndb_mgm_get_event_severity_string(enabled[i].category);
|
||||||
if (str == 0)
|
if (str == 0)
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(false);
|
DBUG_ASSERT(false);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(enabled[i])
|
if(enabled[i].value)
|
||||||
ndbout << BaseString(str).ndb_toupper() << " ";
|
ndbout << BaseString(str).ndb_toupper() << " ";
|
||||||
}
|
}
|
||||||
ndbout << endl;
|
ndbout << endl;
|
||||||
@ -2130,6 +2066,9 @@ CommandInterpreter::executeRestart(Vector<BaseString> &command_list,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!nostart)
|
||||||
|
ndbout_c("Shutting down nodes with \"-n, no start\" option, to subsequently start the nodes.");
|
||||||
|
|
||||||
result= ndb_mgm_restart3(m_mgmsrv, no_of_nodes, node_ids,
|
result= ndb_mgm_restart3(m_mgmsrv, no_of_nodes, node_ids,
|
||||||
initialstart, nostart, abort, &need_disconnect);
|
initialstart, nostart, abort, &need_disconnect);
|
||||||
|
|
||||||
@ -2204,7 +2143,6 @@ CommandInterpreter::executeStatus(int processId,
|
|||||||
|
|
||||||
ndb_mgm_node_status status;
|
ndb_mgm_node_status status;
|
||||||
Uint32 startPhase, version;
|
Uint32 startPhase, version;
|
||||||
bool system;
|
|
||||||
|
|
||||||
struct ndb_mgm_cluster_state *cl;
|
struct ndb_mgm_cluster_state *cl;
|
||||||
cl = ndb_mgm_get_status(m_mgmsrv);
|
cl = ndb_mgm_get_status(m_mgmsrv);
|
||||||
@ -2222,6 +2160,19 @@ CommandInterpreter::executeStatus(int processId,
|
|||||||
ndbout << processId << ": Node not found" << endl;
|
ndbout << processId << ": Node not found" << endl;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
if (cl->node_states[i].node_type != NDB_MGM_NODE_TYPE_NDB){
|
||||||
|
if (cl->node_states[i].version != 0){
|
||||||
|
version = cl->node_states[i].version;
|
||||||
|
ndbout << "Node "<< cl->node_states[i].node_id <<": connected" ;
|
||||||
|
ndbout_c(" (Version %d.%d.%d)",
|
||||||
|
getMajor(version) ,
|
||||||
|
getMinor(version),
|
||||||
|
getBuild(version));
|
||||||
|
|
||||||
|
}else
|
||||||
|
ndbout << "Node "<< cl->node_states[i].node_id <<": not connected" << endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
status = cl->node_states[i].node_status;
|
status = cl->node_states[i].node_status;
|
||||||
startPhase = cl->node_states[i].start_phase;
|
startPhase = cl->node_states[i].start_phase;
|
||||||
version = cl->node_states[i].version;
|
version = cl->node_states[i].version;
|
||||||
@ -2616,6 +2567,7 @@ CommandInterpreter::executeEventReporting(int processId,
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Backup
|
* Backup
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
@ -2731,7 +2683,6 @@ CommandInterpreter::executeStartBackup(char* parameters, bool interactive)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
CommandInterpreter::executeAbortBackup(char* parameters)
|
CommandInterpreter::executeAbortBackup(char* parameters)
|
||||||
{
|
{
|
||||||
@ -2762,233 +2713,4 @@ CommandInterpreter::executeAbortBackup(char* parameters)
|
|||||||
return -1;
|
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*>;
|
template class Vector<char const*>;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user