Commit 987fc113 authored by unknown's avatar unknown

see respective file


ndb/src/mgmsrv/InitConfigFileParser.hpp:
  Rename: ndb/src/common/mgmcommon/InitConfigFileParser.hpp -> ndb/src/mgmsrv/InitConfigFileParser.hpp
ndb/src/mgmsrv/InitConfigFileParser.cpp:
  Rename: ndb/src/common/mgmcommon/InitConfigFileParser.cpp -> ndb/src/mgmsrv/InitConfigFileParser.cpp
ndb/src/mgmsrv/ConfigInfo.hpp:
  Rename: ndb/src/common/mgmcommon/ConfigInfo.hpp -> ndb/src/mgmsrv/ConfigInfo.hpp
ndb/src/common/mgmcommon/Makefile.am:
  moved files to mgmsrv
ndb/src/mgmclient/CommandInterpreter.cpp:
  added shutdown command
ndb/src/mgmclient/CommandInterpreter.hpp:
  added shutdown command
ndb/src/mgmsrv/Config.cpp:
  .
ndb/src/mgmsrv/Config.hpp:
  .
ndb/src/mgmsrv/ConfigInfo.cpp:
  wait with this
ndb/src/mgmsrv/Makefile.am:
  moved files to mgmsrv
ndb/test/include/NdbBackup.hpp:
  backup not necessarily in file system path
ndb/test/ndbapi/testDict.cpp:
  compile error
ndb/test/src/NdbBackup.cpp:
  aligned with new config param
parent 6566af8c
MYSQLDATAdir = $(localstatedir)
MYSQLSHAREdir = $(pkgdatadir)
MYSQLBASEdir= $(prefix)
noinst_LTLIBRARIES = libmgmsrvcommon.la
libmgmsrvcommon_la_SOURCES = \
LocalConfig.cpp \
Config.cpp \
ConfigInfo.cpp \
ConfigRetriever.cpp \
InitConfigFileParser.cpp \
IPCConfig.cpp NdbConfig.c
INCLUDES_LOC = -I$(top_srcdir)/ndb/src/mgmapi
DEFS_LOC = -DDEFAULT_MYSQL_HOME="\"$(MYSQLBASEdir)\"" \
-DDATADIR="\"$(MYSQLDATAdir)\"" \
-DSHAREDIR="\"$(MYSQLSHAREdir)\"" \
-DNDB_BASE_PORT="\"@ndb_port_base@\""
INCLUDES_LOC = -I$(top_srcdir)/ndb/src/mgmapi -I$(top_srcdir)/ndb/src/mgmsrv
include $(top_srcdir)/ndb/config/common.mk.am
include $(top_srcdir)/ndb/config/type_ndbapi.mk.am
......
......@@ -47,10 +47,13 @@ static const char* helpText =
"HELP DEBUG Help for debug compiled version\n"
#endif
"SHOW Print information about cluster\n"
#if 0
"SHOW CONFIG Print configuration\n"
"SHOW PARAMETERS Print configuration parameters\n"
#endif
"START BACKUP Start backup\n"
"ABORT BACKUP <backup id> Abort backup\n"
"SHUTDOWN Shutdown all processed in cluster and quit\n"
"CLUSTERLOG ON Enable Cluster logging\n"
"CLUSTERLOG OFF Disable Cluster logging\n"
"CLUSTERLOG FILTER <severity> Toggle severity filter on/off\n"
......@@ -62,7 +65,9 @@ static const char* helpText =
"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
"QUIT Quit management client\n"
;
......@@ -299,6 +304,10 @@ CommandInterpreter::readAndExecute(int _try_reconnect)
executeShow(allAfterFirstToken);
return true;
}
else if (strcmp(firstToken, "SHUTDOWN") == 0) {
executeShutdown(allAfterFirstToken);
return true;
}
else if (strcmp(firstToken, "CLUSTERLOG") == 0){
executeClusterLog(allAfterFirstToken);
return true;
......@@ -628,6 +637,57 @@ CommandInterpreter::executeHelp(char* parameters)
}
/*****************************************************************************
* SHUTDOWN
*****************************************************************************/
void
CommandInterpreter::executeShutdown(char* parameters)
{
connect();
ndb_mgm_cluster_state *state = ndb_mgm_get_status(m_mgmsrv);
if(state == NULL) {
ndbout_c("Could not get status");
printError();
return;
}
int result = 0;
result = ndb_mgm_stop(m_mgmsrv, 0, 0);
if (result <= 0) {
ndbout << "Shutdown failed." << endl;
printError();
return;
}
ndbout << "NDB Cluster storage node(s) have shutdown." << endl;
int mgm_id= 0;
for(int i=0; i < state->no_of_nodes; i++) {
if(state->node_states[i].node_type == NDB_MGM_NODE_TYPE_MGM &&
state->node_states[i].version != 0){
if (mgm_id == 0)
mgm_id= state->node_states[i].node_id;
else {
ndbout << "Unable to locate management server, shutdown manually with #STOP"
<< endl;
}
}
}
result = 0;
result = ndb_mgm_stop(m_mgmsrv, 1, &mgm_id);
if (result <= 0) {
ndbout << "Shutdown failed." << endl;
printError();
return;
}
ndbout << "NDB Cluster management server shutdown." << endl;
exit(0);
}
/*****************************************************************************
* SHOW
*****************************************************************************/
......
......@@ -127,6 +127,7 @@ private:
*/
void executeHelp(char* parameters);
void executeShow(char* parameters);
void executeShutdown(char* parameters);
void executeRun(char* parameters);
void executeInfo(char* parameters);
void executeClusterLog(char* parameters);
......
......@@ -19,7 +19,6 @@
#include <string.h>
#include "MgmtErrorReporter.hpp"
#include <Properties.hpp>
#include "ConfigInfo.hpp"
//*****************************************************************************
// Ctor / Dtor
......
......@@ -24,7 +24,7 @@
#include <NdbOut.hpp>
#include <ndb_limits.h>
#include <Properties.hpp>
#include "ConfigInfo.hpp"
#include <ConfigInfo.hpp>
class ConfigInfo;
......
......@@ -33,15 +33,15 @@
* Section names
****************************************************************************/
#define DB_TOKEN "NDBD"
#define MGM_TOKEN "NDB_MGMD"
#define API_TOKEN "MYSQLD"
#define DB_TOKEN "DB"
#define MGM_TOKEN "MGM"
#define API_TOKEN "API"
const ConfigInfo::AliasPair
ConfigInfo::m_sectionNameAliases[]={
{API_TOKEN, "API"},
{DB_TOKEN, "DB"},
{MGM_TOKEN, "MGM"},
{API_TOKEN, "MYSQLD"},
{DB_TOKEN, "NDBD"},
{MGM_TOKEN, "NDB_MGMD"},
{0, 0}
};
......@@ -975,7 +975,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
ConfigInfo::USED,
false,
ConfigInfo::STRING,
DATADIR,
MYSQLCLUSTERDIR,
0, 0 },
{
......@@ -1349,7 +1349,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
ConfigInfo::USED,
false,
ConfigInfo::STRING,
DATADIR,
MYSQLCLUSTERDIR,
0, 0 },
{
......
MYSQLDATAdir = $(localstatedir)
MYSQLSHAREdir = $(pkgdatadir)
MYSQLBASEdir= $(prefix)
MYSQLCLUSTERdir= $(prefix)/mysql-cluster
ndbbin_PROGRAMS = ndb_mgmd
......@@ -11,6 +15,9 @@ ndb_mgmd_SOURCES = \
NodeLogLevelList.cpp \
SignalQueue.cpp \
MgmtSrvrConfig.cpp \
ConfigInfo.cpp \
InitConfigFileParser.cpp \
Config.cpp \
CommandInterpreter.cpp
INCLUDES_LOC = -I$(top_srcdir)/ndb/src/ndbapi \
......@@ -24,6 +31,12 @@ LDADD_LOC = $(top_builddir)/ndb/src/libndbclient.la \
$(top_builddir)/strings/libmystrings.a
@TERMCAP_LIB@
DEFS_LOC = -DDEFAULT_MYSQL_HOME="\"$(MYSQLBASEdir)\"" \
-DDATADIR="\"$(MYSQLDATAdir)\"" \
-DSHAREDIR="\"$(MYSQLSHAREdir)\"" \
-DMYSQLCLUSTERDIR="\"$(MYSQLCLUSTERdir)\"" \
-DNDB_BASE_PORT="\"@ndb_port_base@\""
include $(top_srcdir)/ndb/config/common.mk.am
include $(top_srcdir)/ndb/config/type_ndbapi.mk.am
......
......@@ -47,7 +47,7 @@ private:
int _node_id,
unsigned _backup_id);
const char * getFileSystemPathForNode(int _node_id);
const char * getBackupDataDirForNode(int _node_id);
};
......
......@@ -1305,7 +1305,7 @@ runTableRenameNF(NDBT_Context* ctx, NDBT_Step* step){
const int numNodes = restarter.getNumDbNodes();
for(int i = 0; i<numNodes; i++){
int nodeId = restarter.getDbNodeId(i);
int error = NF_codes[i];
int error = NF_codes[i].error_id;
g_info << "NF1: node = " << nodeId << " error code = " << error << endl;
......
......@@ -64,7 +64,7 @@ NdbBackup::start(unsigned int & _backup_id){
const char *
NdbBackup::getFileSystemPathForNode(int _node_id){
NdbBackup::getBackupDataDirForNode(int _node_id){
/**
* Fetch configuration from management server
......@@ -106,8 +106,8 @@ NdbBackup::getFileSystemPathForNode(int _node_id){
}
const char * path;
if (iter.get(CFG_DB_FILESYSTEM_PATH, &path)){
ndbout << "FileSystemPath not found" << endl;
if (iter.get(CFG_DB_BACKUP_DATADIR, &path)){
ndbout << "BackupDataDir not found" << endl;
return NULL;
}
......@@ -123,9 +123,9 @@ NdbBackup::execRestore(bool _restore_data,
const int buf_len = 1000;
char buf[buf_len];
ndbout << "getFileSystemPathForNode "<< _node_id <<endl;
ndbout << "getBackupDataDir "<< _node_id <<endl;
const char* path = getFileSystemPathForNode(_node_id);
const char* path = getBackupDataDirForNode(_node_id);
if (path == NULL)
return -1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment