CommandInterpreter.cpp
上传用户:romrleung
上传日期:2022-05-23
资源大小:18897k
文件大小:65k
源码类别:
MySQL数据库
开发平台:
Visual C++
- /* Copyright (C) 2003 MySQL AB
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
- #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>
- class MgmtSrvr;
- /**
- * @class CommandInterpreter
- * @brief Reads command line in management client
- *
- * This class has one public method which reads a command line
- * from a stream. It then interpret that commmand line and calls a suitable
- * method in the MgmtSrvr class which executes the command.
- *
- * For command syntax, see the HELP command.
- */
- class CommandInterpreter {
- public:
- /**
- * Constructor
- * @param mgmtSrvr: Management server to use when executing commands
- */
- CommandInterpreter(const char *, int verbose);
- ~CommandInterpreter();
- /**
- * Reads one line from the stream, parse the line to find
- * a command and then calls a suitable method which executes
- * the command.
- *
- * @return true until quit/bye/exit has been typed
- */
- int execute(const char *_line, int _try_reconnect=-1, int *error= 0);
- private:
- void printError();
- int execute_impl(const char *_line);
- /**
- * Analyse the command line, after the first token.
- *
- * @param processId: DB process id to send command to or -1 if
- * command will be sent to all DB processes.
- * @param allAfterFirstToken: What the client gave after the
- * first token on the command line
- */
- void analyseAfterFirstToken(int processId, char* allAfterFirstTokenCstr);
- /**
- * Parse the block specification part of the LOG* commands,
- * things after LOG*: [BLOCK = {ALL|<blockName>+}]
- *
- * @param allAfterLog: What the client gave after the second token
- * (LOG*) on the command line
- * @param blocks, OUT: ALL or name of all the blocks
- * @return: true if correct syntax, otherwise false
- */
- bool parseBlockSpecification(const char* allAfterLog,
- Vector<const char*>& blocks);
- /**
- * A bunch of execute functions: Executes one of the commands
- *
- * @param processId: DB process id to send command to
- * @param parameters: What the client gave after the command name
- * on the command line.
- * For example if complete input from user is: "1 LOGLEVEL 22" then the
- * parameters argument is the string with everything after LOGLEVEL, in
- * this case "22". Each function is responsible to check the parameters
- * argument.
- */
- void executeHelp(char* parameters);
- void executeShow(char* parameters);
- void executeConnect(char* parameters);
- void executePurge(char* parameters);
- int executeShutdown(char* parameters);
- void executeRun(char* parameters);
- void executeInfo(char* parameters);
- void executeClusterLog(char* parameters);
- public:
- void executeStop(int processId, const char* parameters, bool all);
- void executeEnterSingleUser(char* parameters);
- void executeExitSingleUser(char* parameters);
- void executeStart(int processId, const char* parameters, bool all);
- void executeRestart(int processId, const char* parameters, bool all);
- void executeLogLevel(int processId, const char* parameters, bool all);
- void executeError(int processId, const char* parameters, bool all);
- void executeLog(int processId, const char* parameters, bool all);
- void executeLogIn(int processId, const char* parameters, bool all);
- void executeLogOut(int processId, const char* parameters, bool all);
- void executeLogOff(int processId, const char* parameters, bool all);
- void executeTestOn(int processId, const char* parameters, bool all);
- void executeTestOff(int processId, const char* parameters, bool all);
- void executeSet(int processId, const char* parameters, bool all);
- void executeGetStat(int processId, const char* parameters, bool all);
- void executeStatus(int processId, const char* parameters, bool all);
- void executeEventReporting(int processId, const char* parameters, bool all);
- void executeDumpState(int processId, const char* parameters, bool all);
- int executeStartBackup(char * parameters);
- void executeAbortBackup(char * parameters);
- void executeRep(char* parameters);
- void executeCpc(char * parameters);
- public:
- bool connect();
- bool disconnect();
- /**
- * A execute function definition
- */
- public:
- typedef void (CommandInterpreter::* ExecuteFunction)(int processId,
- const char * param,
- bool all);
- struct CommandFunctionPair {
- const char * command;
- ExecuteFunction executeFunction;
- };
- private:
- /**
- *
- */
- void executeForAll(const char * cmd,
- ExecuteFunction fun,
- const char * param);
- NdbMgmHandle m_mgmsrv;
- NdbMgmHandle m_mgmsrv2;
- bool m_connected;
- 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;
- };
- /*
- * Facade object for CommandInterpreter
- */
- #include "ndb_mgmclient.hpp"
- #include "ndb_mgmclient.h"
- Ndb_mgmclient::Ndb_mgmclient(const char *host,int verbose)
- {
- m_cmd= new CommandInterpreter(host,verbose);
- }
- Ndb_mgmclient::~Ndb_mgmclient()
- {
- delete m_cmd;
- }
- int Ndb_mgmclient::execute(const char *_line, int _try_reconnect, int *error)
- {
- return m_cmd->execute(_line,_try_reconnect,error);
- }
- int
- Ndb_mgmclient::disconnect()
- {
- return m_cmd->disconnect();
- }
- extern "C" {
- Ndb_mgmclient_handle ndb_mgmclient_handle_create(const char *connect_string)
- {
- return (Ndb_mgmclient_handle) new Ndb_mgmclient(connect_string);
- }
- int ndb_mgmclient_execute(Ndb_mgmclient_handle h, int argc, char** argv)
- {
- return ((Ndb_mgmclient*)h)->execute(argc, argv, 1);
- }
- int ndb_mgmclient_handle_destroy(Ndb_mgmclient_handle h)
- {
- delete (Ndb_mgmclient*)h;
- return 0;
- }
- }
- /*
- * The CommandInterpreter
- */
- #include <mgmapi.h>
- #include <mgmapi_debug.h>
- #include <version.h>
- #include <NdbAutoPtr.hpp>
- #include <NdbOut.hpp>
- #include <NdbSleep.h>
- #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>
- #include <util/InputStream.hpp>
- #include <util/OutputStream.hpp>
- int Ndb_mgmclient::execute(int argc, char** argv, int _try_reconnect, int *error)
- {
- if (argc <= 0)
- return 0;
- BaseString _line(argv[0]);
- for (int i= 1; i < argc; i++)
- {
- _line.appfmt(" %s", argv[i]);
- }
- return m_cmd->execute(_line.c_str(),_try_reconnect, error);
- }
- /*****************************************************************************
- * HELP
- *****************************************************************************/
- static const char* helpText =
- "---------------------------------------------------------------------------n"
- " NDB Cluster -- Management Client -- Helpn"
- "---------------------------------------------------------------------------n"
- "HELP Print help textn"
- "HELP SHOW Help for SHOW commandn"
- #ifdef HAVE_GLOBAL_REPLICATION
- "HELP REPLICATION Help for global replicationn"
- #endif // HAVE_GLOBAL_REPLICATION
- #ifdef VM_TRACE // DEBUG ONLY
- "HELP DEBUG Help for debug compiled versionn"
- #endif
- "SHOW Print information about clustern"
- #if 0
- "SHOW CONFIG Print configurationn"
- "SHOW PARAMETERS Print configuration parametersn"
- #endif
- "START BACKUP [NOWAIT | WAIT STARTED | WAIT COMPLETED]n"
- " Start backup (default WAIT COMPLETED)n"
- "ABORT BACKUP <backup id> Abort backupn"
- "SHUTDOWN Shutdown all processes in clustern"
- "CLUSTERLOG ON [<severity>] ... Enable Cluster loggingn"
- "CLUSTERLOG OFF [<severity>] ... Disable Cluster loggingn"
- "CLUSTERLOG TOGGLE [<severity>] ... Toggle severity filter on/offn"
- "CLUSTERLOG INFO Print cluster log informationn"
- "<id> START Start DB node (started with -n)n"
- "<id> RESTART [-n] [-i] Restart DB noden"
- "<id> STOP Stop DB noden"
- "ENTER SINGLE USER MODE <api-node> Enter single user moden"
- "EXIT SINGLE USER MODE Exit single user moden"
- "<id> STATUS Print statusn"
- "<id> CLUSTERLOG {<category>=<level>}+ Set log level for cluster logn"
- #ifdef HAVE_GLOBAL_REPLICATION
- "REP CONNECT <host:port> Connect to REP server on host:portn"
- #endif
- "PURGE STALE SESSIONS Reset reserved nodeid's in the mgmt servern"
- "CONNECT [<connectstring>] Connect to management server (reconnect if already connected)n"
- "QUIT Quit management clientn"
- ;
- static const char* helpTextShow =
- "---------------------------------------------------------------------------n"
- " NDB Cluster -- Management Client -- Help for SHOW commandn"
- "---------------------------------------------------------------------------n"
- "SHOW prints NDB Cluster informationnn"
- "SHOW Print information about clustern"
- #if 0
- "SHOW CONFIG Print configuration (in initial config file format)n"
- "SHOW PARAMETERS Print information about configuration parametersnn"
- #endif
- ;
- #ifdef HAVE_GLOBAL_REPLICATION
- static const char* helpTextRep =
- "---------------------------------------------------------------------------n"
- " NDB Cluster -- Management Client -- Help for Global Replicationn"
- "---------------------------------------------------------------------------n"
- "Commands should be executed on the standby NDB Clustern"
- "These features are in an experimental release state.n"
- "n"
- "Simple Commands:n"
- "REP START Start Global Replicationn"
- "REP START REQUESTOR Start Global Replication Requestorn"
- "REP STATUS Show Global Replication statusn"
- "REP STOP Stop Global Replicationn"
- "REP STOP REQUESTOR Stop Global Replication Requestorn"
- "n"
- "Advanced Commands:n"
- "REP START <protocol> Starts protocoln"
- "REP STOP <protocol> Stops protocoln"
- "<protocol> = TRANSFER | APPLY | DELETEn"
- "n"
- #ifdef VM_TRACE // DEBUG ONLY
- "Debugging commands:n"
- "REP DELETE Removes epochs stored in primary and standy systemsn"
- "REP DROP <tableid> Drop a table in SS identified by table idn"
- "REP SLOWSTOP Stop Replication (Tries to synchonize with primary)n"
- "REP FASTSTOP Stop Replication (Stops in consistent state)n"
- "<component> = SUBSCRIPTIONn"
- " METALOG | METASCAN | DATALOG | DATASCANn"
- " REQUESTOR | TRANSFER | APPLY | DELETEn"
- #endif
- ;
- #endif // HAVE_GLOBAL_REPLICATION
- #ifdef VM_TRACE // DEBUG ONLY
- static const char* helpTextDebug =
- "---------------------------------------------------------------------------n"
- " NDB Cluster -- Management Client -- Help for Debugging (Internal use only)n"
- "---------------------------------------------------------------------------n"
- "SHOW PROPERTIES Print config properties objectn"
- "<id> LOGLEVEL {<category>=<level>}+ Set log leveln"
- #ifdef ERROR_INSERT
- "<id> ERROR <errorNo> Inject error into NDB noden"
- #endif
- "<id> LOG [BLOCK = {ALL|<block>+}] Set logging on in & out signalsn"
- "<id> LOGIN [BLOCK = {ALL|<block>+}] Set logging on in signalsn"
- "<id> LOGOUT [BLOCK = {ALL|<block>+}] Set logging on out signalsn"
- "<id> LOGOFF [BLOCK = {ALL|<block>+}] Unset signal loggingn"
- "<id> TESTON Start signal loggingn"
- "<id> TESTOFF Stop signal loggingn"
- "<id> SET <configParamName> <value> Update configuration variablen"
- "<id> DUMP <arg> Dump system state to cluster.logn"
- "<id> GETSTAT Print statisticsn"
- "n"
- "<id> = ALL | Any database node idn"
- ;
- #endif
- static bool
- convert(const char* s, int& val) {
- if (s == NULL)
- return false;
- if (strlen(s) == 0)
- return false;
- errno = 0;
- char* p;
- long v = strtol(s, &p, 10);
- if (errno != 0)
- return false;
- if (p != &s[strlen(s)])
- return false;
- val = v;
- return true;
- }
- /*
- * Constructor
- */
- CommandInterpreter::CommandInterpreter(const char *_host,int verbose)
- : m_verbose(verbose)
- {
- m_mgmsrv = ndb_mgm_create_handle();
- if(m_mgmsrv == NULL) {
- ndbout_c("Cannot create handle to management server.");
- exit(-1);
- }
- m_mgmsrv2 = ndb_mgm_create_handle();
- if(m_mgmsrv2 == NULL) {
- ndbout_c("Cannot create handle to management server.");
- exit(-1);
- }
- if (ndb_mgm_set_connectstring(m_mgmsrv, _host))
- {
- printError();
- exit(-1);
- }
- m_connected= false;
- m_event_thread= 0;
- try_reconnect = 0;
- #ifdef HAVE_GLOBAL_REPLICATION
- rep_host = NULL;
- m_repserver = NULL;
- rep_connected = false;
- #endif
- }
- /*
- * Destructor
- */
- CommandInterpreter::~CommandInterpreter()
- {
- disconnect();
- ndb_mgm_destroy_handle(&m_mgmsrv);
- ndb_mgm_destroy_handle(&m_mgmsrv2);
- }
- static bool
- emptyString(const char* s)
- {
- if (s == NULL) {
- return true;
- }
- for (unsigned int i = 0; i < strlen(s); ++i) {
- if (! isspace(s[i])) {
- return false;
- }
- }
- return true;
- }
- void
- CommandInterpreter::printError()
- {
- if (ndb_mgm_check_connection(m_mgmsrv))
- {
- m_connected= false;
- disconnect();
- }
- ndbout_c("* %5d: %s",
- ndb_mgm_get_latest_error(m_mgmsrv),
- ndb_mgm_get_latest_error_msg(m_mgmsrv));
- ndbout_c("* %s", ndb_mgm_get_latest_error_desc(m_mgmsrv));
- }
- //*****************************************************************************
- //*****************************************************************************
- static int do_event_thread;
- static void*
- event_thread_run(void* m)
- {
- DBUG_ENTER("event_thread_run");
- NdbMgmHandle handle= *(NdbMgmHandle*)m;
- int filter[] = { 15, NDB_MGM_EVENT_CATEGORY_BACKUP, 0 };
- int fd = ndb_mgm_listen_event(handle, filter);
- if (fd != NDB_INVALID_SOCKET)
- {
- do_event_thread= 1;
- char *tmp= 0;
- char buf[1024];
- SocketInputStream in(fd,10);
- do {
- if (tmp == 0) NdbSleep_MilliSleep(10);
- if((tmp = in.gets(buf, 1024)))
- {
- const char ping_token[]= "<PING>";
- if (memcmp(ping_token,tmp,sizeof(ping_token)-1))
- ndbout << tmp;
- }
- } while(do_event_thread);
- NDB_CLOSE_SOCKET(fd);
- }
- else
- {
- do_event_thread= -1;
- }
- DBUG_RETURN(NULL);
- }
- bool
- CommandInterpreter::connect()
- {
- DBUG_ENTER("CommandInterpreter::connect");
- if(!m_connected)
- {
- if(!ndb_mgm_connect(m_mgmsrv, try_reconnect-1, 5, 1))
- {
- const char *host= ndb_mgm_get_connected_host(m_mgmsrv);
- unsigned port= ndb_mgm_get_connected_port(m_mgmsrv);
- if(!ndb_mgm_set_connectstring(m_mgmsrv2,
- BaseString(host).appfmt(":%d",port).c_str())
- &&
- !ndb_mgm_connect(m_mgmsrv2, try_reconnect-1, 5, 1))
- {
- assert(m_event_thread == 0);
- assert(do_event_thread == 0);
- do_event_thread= 0;
- m_event_thread = NdbThread_Create(event_thread_run,
- (void**)&m_mgmsrv2,
- 32768,
- "CommandInterpreted_event_thread",
- NDB_THREAD_PRIO_LOW);
- if (m_event_thread != 0)
- {
- int iter= 1000; // try for 30 seconds
- while(do_event_thread == 0 &&
- iter-- > 0)
- NdbSleep_MilliSleep(30);
- }
- if (m_event_thread == 0 ||
- do_event_thread == 0 ||
- do_event_thread == -1)
- {
- DBUG_PRINT("info",("Warning, event thread startup failed, "
- "degraded printouts as result, errno=%d",
- errno));
- printf("Warning, event thread startup failed, "
- "degraded printouts as result, errno=%dn", errno);
- do_event_thread= 0;
- if (m_event_thread)
- {
- void *res;
- NdbThread_WaitFor(m_event_thread, &res);
- NdbThread_Destroy(&m_event_thread);
- }
- ndb_mgm_disconnect(m_mgmsrv2);
- }
- }
- else
- {
- printf("Warning, event connect failed, degraded printouts as resultn");
- }
- m_connected= true;
- DBUG_PRINT("info",("Connected to Management Server at: %s:%d",
- host,port));
- if (m_verbose)
- {
- printf("Connected to Management Server at: %s:%dn",
- host, port);
- }
- }
- }
- DBUG_RETURN(m_connected);
- }
- bool
- CommandInterpreter::disconnect()
- {
- DBUG_ENTER("CommandInterpreter::disconnect");
- if (m_event_thread) {
- void *res;
- do_event_thread= 0;
- NdbThread_WaitFor(m_event_thread, &res);
- NdbThread_Destroy(&m_event_thread);
- m_event_thread= 0;
- ndb_mgm_disconnect(m_mgmsrv2);
- }
- if (m_connected)
- {
- if (ndb_mgm_disconnect(m_mgmsrv) == -1) {
- ndbout_c("Could not disconnect from management server");
- printError();
- }
- m_connected= false;
- }
- DBUG_RETURN(true);
- }
- //*****************************************************************************
- //*****************************************************************************
- int
- CommandInterpreter::execute(const char *_line, int _try_reconnect,
- int *error)
- {
- if (_try_reconnect >= 0)
- try_reconnect=_try_reconnect;
- int result= execute_impl(_line);
- if (error)
- *error= m_error;
- return result;
- }
- static void
- invalid_command(const char *cmd)
- {
- ndbout << "Invalid command: " << cmd << endl;
- ndbout << "Type HELP for help." << endl << endl;
- }
- int
- CommandInterpreter::execute_impl(const char *_line)
- {
- DBUG_ENTER("CommandInterpreter::execute_impl");
- DBUG_PRINT("enter",("line="%s"",_line));
- m_error= 0;
- char * line;
- if(_line == NULL) {
- DBUG_RETURN(false);
- }
- line = my_strdup(_line,MYF(MY_WME));
- My_auto_ptr<char> ptr(line);
- int do_continue;
- do {
- do_continue= 0;
- BaseString::trim(line," t");
- if (line[0] == 0 ||
- line[0] == '#')
- {
- DBUG_RETURN(true);
- }
- // for mysql client compatability remove trailing ';'
- {
- unsigned last= strlen(line)-1;
- if (line[last] == ';')
- {
- line[last]= 0;
- do_continue= 1;
- }
- }
- } while (do_continue);
- // if there is anything in the line proceed
- char* firstToken = strtok(line, " ");
- char* allAfterFirstToken = strtok(NULL, "");
- if (strcasecmp(firstToken, "HELP") == 0 ||
- strcasecmp(firstToken, "?") == 0) {
- executeHelp(allAfterFirstToken);
- DBUG_RETURN(true);
- }
- else if (strcasecmp(firstToken, "CONNECT") == 0) {
- executeConnect(allAfterFirstToken);
- DBUG_RETURN(true);
- }
- else if (strcasecmp(firstToken, "SLEEP") == 0) {
- if (allAfterFirstToken)
- sleep(atoi(allAfterFirstToken));
- DBUG_RETURN(true);
- }
- else if((strcasecmp(firstToken, "QUIT") == 0 ||
- strcasecmp(firstToken, "EXIT") == 0 ||
- strcasecmp(firstToken, "BYE") == 0) &&
- allAfterFirstToken == NULL){
- DBUG_RETURN(false);
- }
- if (!connect())
- DBUG_RETURN(true);
- if (strcasecmp(firstToken, "SHOW") == 0) {
- executeShow(allAfterFirstToken);
- DBUG_RETURN(true);
- }
- else if (strcasecmp(firstToken, "SHUTDOWN") == 0) {
- m_error= executeShutdown(allAfterFirstToken);
- DBUG_RETURN(true);
- }
- else if (strcasecmp(firstToken, "CLUSTERLOG") == 0){
- executeClusterLog(allAfterFirstToken);
- DBUG_RETURN(true);
- }
- else if(strcasecmp(firstToken, "START") == 0 &&
- allAfterFirstToken != NULL &&
- strncasecmp(allAfterFirstToken, "BACKUP", sizeof("BACKUP") - 1) == 0){
- m_error= executeStartBackup(allAfterFirstToken);
- DBUG_RETURN(true);
- }
- else if(strcasecmp(firstToken, "ABORT") == 0 &&
- allAfterFirstToken != NULL &&
- strncasecmp(allAfterFirstToken, "BACKUP", sizeof("BACKUP") - 1) == 0){
- executeAbortBackup(allAfterFirstToken);
- DBUG_RETURN(true);
- }
- else if (strcasecmp(firstToken, "PURGE") == 0) {
- 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 ",
- sizeof("SINGLE USER MODE") - 1) == 0){
- executeEnterSingleUser(allAfterFirstToken);
- DBUG_RETURN(true);
- }
- else if(strcasecmp(firstToken, "EXIT") == 0 &&
- allAfterFirstToken != NULL &&
- strncasecmp(allAfterFirstToken, "SINGLE USER MODE ",
- sizeof("SINGLE USER MODE") - 1) == 0){
- executeExitSingleUser(allAfterFirstToken);
- DBUG_RETURN(true);
- }
- else if (strcasecmp(firstToken, "ALL") == 0) {
- analyseAfterFirstToken(-1, allAfterFirstToken);
- } else {
- /**
- * First token should be a digit, node ID
- */
- int nodeId;
- if (! convert(firstToken, nodeId)) {
- invalid_command(_line);
- DBUG_RETURN(true);
- }
- if (nodeId <= 0) {
- ndbout << "Invalid node ID: " << firstToken << "." << endl;
- DBUG_RETURN(true);
- }
- analyseAfterFirstToken(nodeId, allAfterFirstToken);
- }
- DBUG_RETURN(true);
- }
- /**
- * List of commands used as second command argument
- */
- static const CommandInterpreter::CommandFunctionPair commands[] = {
- { "START", &CommandInterpreter::executeStart }
- ,{ "RESTART", &CommandInterpreter::executeRestart }
- ,{ "STOP", &CommandInterpreter::executeStop }
- ,{ "STATUS", &CommandInterpreter::executeStatus }
- ,{ "LOGLEVEL", &CommandInterpreter::executeLogLevel }
- ,{ "CLUSTERLOG", &CommandInterpreter::executeEventReporting }
- #ifdef ERROR_INSERT
- ,{ "ERROR", &CommandInterpreter::executeError }
- #endif
- ,{ "LOG", &CommandInterpreter::executeLog }
- ,{ "LOGIN", &CommandInterpreter::executeLogIn }
- ,{ "LOGOUT", &CommandInterpreter::executeLogOut }
- ,{ "LOGOFF", &CommandInterpreter::executeLogOff }
- ,{ "TESTON", &CommandInterpreter::executeTestOn }
- ,{ "TESTOFF", &CommandInterpreter::executeTestOff }
- ,{ "SET", &CommandInterpreter::executeSet }
- ,{ "GETSTAT", &CommandInterpreter::executeGetStat }
- ,{ "DUMP", &CommandInterpreter::executeDumpState }
- };
- //*****************************************************************************
- //*****************************************************************************
- void
- CommandInterpreter::analyseAfterFirstToken(int processId,
- char* allAfterFirstToken) {
- if (emptyString(allAfterFirstToken)) {
- ndbout << "Expected a command after "
- << ((processId == -1) ? "ALL." : "node ID.") << endl;
- return;
- }
- char* secondToken = strtok(allAfterFirstToken, " ");
- char* allAfterSecondToken = strtok(NULL, "