Commit e79e1ab3 authored by unknown's avatar unknown

aligned backup errorcodes with rest of ndb error codes giving it range from 1300

    added new error type "configuration or application error"
    Added check if backup is issued during diskless mode, backup refuse returned
    added possibility to get error code as a result from management client
    addded possibility to set connecstring with CONNECT command
    changed to use strcasecmp instead of strcmp
    added possibility to run one command on cammand client to ndb_mgm and get an errorcode of command fails
    made thread safe veriosn of getErrorText in management server
    aligned backup errorcodes with rest of ndb error codes giving it range from 1300
    print error message from regular ndberror struct
    added new arrer type "cofiguration or application error"
    commented on allocaded ranges for errors


ndb/include/kernel/signaldata/BackupImpl.hpp:
  aligned backup errorcodes with rest of ndb error codes giving it range from 1300
ndb/include/kernel/signaldata/BackupSignalData.hpp:
  aligned backup errorcodes with rest of ndb error codes giving it range from 1300
ndb/include/ndbapi/ndberror.h:
  added new error type "configuration or application error"
ndb/src/kernel/blocks/backup/Backup.cpp:
  Added check if backup is issued during diskless mode, backup refuse returned
ndb/src/kernel/blocks/backup/Backup.hpp:
  member variable in backup block to indicate diskless or not
ndb/src/kernel/blocks/backup/BackupInit.cpp:
  Added check if backup is issued during diskless mode, backup refuse returned
ndb/src/mgmclient/CommandInterpreter.cpp:
  added possibility to get error code as a result from management client
  addded possibility to set connecstring with CONNECT command
  changed to use strcasecmp instead of strcmp
ndb/src/mgmclient/main.cpp:
  added possibility to run one command on cammand client to ndb_mgm and get an errorcode of command fails
ndb/src/mgmclient/ndb_mgmclient.hpp:
  added possibility to get error code as a result from management client
ndb/src/mgmsrv/CommandInterpreter.cpp:
  made thread safe veriosn of getErrorText in management server
ndb/src/mgmsrv/CommandInterpreter.hpp:
  made thread safe veriosn of getErrorText in management server
ndb/src/mgmsrv/MgmtSrvr.cpp:
  aligned backup errorcodes with rest of ndb error codes giving it range from 1300
  print error message from regular ndberror struct
ndb/src/mgmsrv/MgmtSrvr.hpp:
  made thread safe veriosn of getErrorText in management server
ndb/src/mgmsrv/Services.cpp:
  made thread safe veriosn of getErrorText in management server
ndb/src/mgmsrv/Services.hpp:
  made thread safe veriosn of getErrorText in management server
ndb/src/ndbapi/ndberror.c:
  added new arrer type "cofiguration or application error"
  commented on allocaded ranges for errors
  aligned backup errors with rest of errors
parent 85be5fc3
...@@ -78,15 +78,15 @@ public: ...@@ -78,15 +78,15 @@ public:
STATIC_CONST( SignalLength = 3 ); STATIC_CONST( SignalLength = 3 );
enum ErrorCode { enum ErrorCode {
Undefined = 200, Undefined = 1340,
FailedToAllocateBuffers = 202, FailedToAllocateBuffers = 1342,
FailedToSetupFsBuffers = 203, FailedToSetupFsBuffers = 1343,
FailedToAllocateTables = 204, FailedToAllocateTables = 1344,
FailedInsertFileHeader = 205, FailedInsertFileHeader = 1345,
FailedInsertTableList = 206, FailedInsertTableList = 1346,
FailedAllocateTableMem = 207, FailedAllocateTableMem = 1347,
FailedToAllocateFileRecord = 208, FailedToAllocateFileRecord = 1348,
FailedToAllocateAttributeRecord = 209 FailedToAllocateAttributeRecord = 1349
}; };
private: private:
Uint32 backupId; Uint32 backupId;
......
...@@ -119,12 +119,13 @@ public: ...@@ -119,12 +119,13 @@ public:
private: private:
enum ErrorCodes { enum ErrorCodes {
Undefined = 100, Undefined = 1300,
IAmNotMaster = 101, IAmNotMaster = 1301,
OutOfBackupRecord = 102, OutOfBackupRecord = 1302,
OutOfResources = 103, OutOfResources = 1303,
SequenceFailure = 104, SequenceFailure = 1304,
BackupDefinitionNotImplemented = 105 BackupDefinitionNotImplemented = 1305,
CannotBackupDiskless = 1306
}; };
Uint32 senderData; Uint32 senderData;
Uint32 errorCode; Uint32 errorCode;
...@@ -232,13 +233,13 @@ public: ...@@ -232,13 +233,13 @@ public:
STATIC_CONST( SignalLength = 3 ); STATIC_CONST( SignalLength = 3 );
enum RequestType { enum RequestType {
ClientAbort = 1, ClientAbort = 1321,
BackupComplete = 2, BackupComplete = 1322,
BackupFailure = 3, // General backup failure coordinator -> slave BackupFailure = 1323, // General backup failure coordinator -> slave
LogBufferFull = 4, // slave -> coordinator LogBufferFull = 1324, // slave -> coordinator
FileOrScanError = 5, // slave -> coordinator FileOrScanError = 1325, // slave -> coordinator
BackupFailureDueToNodeFail = 6, // slave -> slave BackupFailureDueToNodeFail = 1326, // slave -> slave
OkToClean = 7 // master -> slave OkToClean = 1327 // master -> slave
}; };
private: private:
Uint32 requestType; Uint32 requestType;
......
...@@ -46,7 +46,8 @@ typedef enum ...@@ -46,7 +46,8 @@ typedef enum
ndberror_cl_internal_error = 12, ndberror_cl_internal_error = 12,
ndberror_cl_function_not_implemented = 13, ndberror_cl_function_not_implemented = 13,
ndberror_cl_unknown_error_code = 14, ndberror_cl_unknown_error_code = 14,
ndberror_cl_node_shutdown = 15 ndberror_cl_node_shutdown = 15,
ndberror_cl_configuration = 16
} ndberror_classification_enum; } ndberror_classification_enum;
......
...@@ -863,6 +863,13 @@ Backup::execBACKUP_REQ(Signal* signal) ...@@ -863,6 +863,13 @@ Backup::execBACKUP_REQ(Signal* signal)
sendBackupRef(senderRef, signal, senderData, BackupRef::IAmNotMaster); sendBackupRef(senderRef, signal, senderData, BackupRef::IAmNotMaster);
return; return;
}//if }//if
if (m_diskless)
{
sendBackupRef(senderRef, signal, senderData,
BackupRef::CannotBackupDiskless);
return;
}
if(dataLen32 != 0) { if(dataLen32 != 0) {
jam(); jam();
......
...@@ -526,6 +526,7 @@ public: ...@@ -526,6 +526,7 @@ public:
NdbNodeBitmask c_aliveNodes; NdbNodeBitmask c_aliveNodes;
DLList<BackupRecord> c_backups; DLList<BackupRecord> c_backups;
Config c_defaults; Config c_defaults;
Uint32 m_diskless;
STATIC_CONST(NO_OF_PAGES_META_FILE = 2); STATIC_CONST(NO_OF_PAGES_META_FILE = 2);
......
...@@ -42,6 +42,7 @@ Backup::Backup(const Configuration & conf) : ...@@ -42,6 +42,7 @@ Backup::Backup(const Configuration & conf) :
ndbrequire(p != 0); ndbrequire(p != 0);
Uint32 noBackups = 0, noTables = 0, noAttribs = 0; Uint32 noBackups = 0, noTables = 0, noAttribs = 0;
ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_DB_DISCLESS, &m_diskless));
ndb_mgm_get_int_parameter(p, CFG_DB_PARALLEL_BACKUPS, &noBackups); ndb_mgm_get_int_parameter(p, CFG_DB_PARALLEL_BACKUPS, &noBackups);
ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_DB_NO_TABLES, &noTables)); ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_DB_NO_TABLES, &noTables));
ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_DB_NO_ATTRIBUTES, &noAttribs)); ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_DB_NO_ATTRIBUTES, &noAttribs));
......
This diff is collapsed.
...@@ -60,10 +60,15 @@ static const char default_prompt[]= "ndb_mgm> "; ...@@ -60,10 +60,15 @@ static const char default_prompt[]= "ndb_mgm> ";
static unsigned _try_reconnect; static unsigned _try_reconnect;
static char *opt_connect_str= 0; static char *opt_connect_str= 0;
static const char *prompt= default_prompt; static const char *prompt= default_prompt;
static char *opt_execute_str= 0;
static struct my_option my_long_options[] = static struct my_option my_long_options[] =
{ {
NDB_STD_OPTS("ndb_mgm"), NDB_STD_OPTS("ndb_mgm"),
{ "execute", 'e',
"execute command and exit",
(gptr*) &opt_execute_str, (gptr*) &opt_execute_str, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "try-reconnect", 't', { "try-reconnect", 't',
"Specify number of tries for connecting to ndb_mgmd (0 = infinite)", "Specify number of tries for connecting to ndb_mgmd (0 = infinite)",
(gptr*) &_try_reconnect, (gptr*) &_try_reconnect, 0, (gptr*) &_try_reconnect, (gptr*) &_try_reconnect, 0,
...@@ -156,19 +161,25 @@ int main(int argc, char** argv){ ...@@ -156,19 +161,25 @@ int main(int argc, char** argv){
opt_connect_str= buf; opt_connect_str= buf;
} }
if (!isatty(0)) if (!isatty(0) || opt_execute_str)
{ {
prompt= 0; prompt= 0;
} }
ndbout << "-- NDB Cluster -- Management Client --" << endl;
signal(SIGPIPE, handler); signal(SIGPIPE, handler);
com = new Ndb_mgmclient(opt_connect_str,1); com = new Ndb_mgmclient(opt_connect_str,1);
while(read_and_execute(_try_reconnect)); int ret= 0;
if (!opt_execute_str)
{
ndbout << "-- NDB Cluster -- Management Client --" << endl;
while(read_and_execute(_try_reconnect));
}
else
{
com->execute(opt_execute_str,_try_reconnect, &ret);
}
delete com; delete com;
return 0; return ret;
} }
...@@ -23,8 +23,8 @@ class Ndb_mgmclient ...@@ -23,8 +23,8 @@ class Ndb_mgmclient
public: public:
Ndb_mgmclient(const char*,int verbose=0); Ndb_mgmclient(const char*,int verbose=0);
~Ndb_mgmclient(); ~Ndb_mgmclient();
int execute(const char *_line, int _try_reconnect=-1); int execute(const char *_line, int _try_reconnect=-1, int *error= 0);
int execute(int argc, char** argv, int _try_reconnect=-1); int execute(int argc, char** argv, int _try_reconnect=-1, int *error= 0);
int disconnect(); int disconnect();
private: private:
CommandInterpreter *m_cmd; CommandInterpreter *m_cmd;
......
...@@ -113,6 +113,11 @@ class AutoPtr { ...@@ -113,6 +113,11 @@ class AutoPtr {
void * m_ptr; void * m_ptr;
}; };
const char *CommandInterpreter::get_error_text(int err_no)
{
return _mgmtSrvr.getErrorText(err_no, m_err_str, sizeof(m_err_str));
}
//***************************************************************************** //*****************************************************************************
//***************************************************************************** //*****************************************************************************
int CommandInterpreter::readAndExecute() { int CommandInterpreter::readAndExecute() {
...@@ -600,8 +605,9 @@ stopCallback(int nodeId, void * anyData, int errCode){ ...@@ -600,8 +605,9 @@ stopCallback(int nodeId, void * anyData, int errCode){
ndbout << "\nNode " << nodeId << " has shutdown" << endl; ndbout << "\nNode " << nodeId << " has shutdown" << endl;
} else { } else {
MgmtSrvr * mgm = (MgmtSrvr *)anyData; MgmtSrvr * mgm = (MgmtSrvr *)anyData;
char err_str[1024];
ndbout << "Node " << nodeId << " has not shutdown: " ndbout << "Node " << nodeId << " has not shutdown: "
<< mgm->getErrorText(errCode) << endl; << mgm->getErrorText(errCode,err_str,sizeof(err_str)) << endl;
} }
} }
...@@ -653,7 +659,8 @@ versionCallback(int nodeId, int version, void * anyData, int errCode){ ...@@ -653,7 +659,8 @@ versionCallback(int nodeId, int version, void * anyData, int errCode){
} else { } else {
MgmtSrvr * mgm = (MgmtSrvr *)anyData; MgmtSrvr * mgm = (MgmtSrvr *)anyData;
ndbout << mgm->getErrorText(errCode) << endl; char err_str[1024];
ndbout << mgm->getErrorText(errCode,err_str,sizeof(err_str)) << endl;
} }
} }
...@@ -671,7 +678,7 @@ void CommandInterpreter::executeStop(int processId, ...@@ -671,7 +678,7 @@ void CommandInterpreter::executeStop(int processId,
result = _mgmtSrvr.stopNode(processId, false, stopCallback, this); result = _mgmtSrvr.stopNode(processId, false, stopCallback, this);
if(result != 0) if(result != 0)
ndbout << _mgmtSrvr.getErrorText(result) << endl; ndbout << get_error_text(result) << endl;
} }
...@@ -686,7 +693,7 @@ void CommandInterpreter::executeStart(int processId, const char* parameters, ...@@ -686,7 +693,7 @@ void CommandInterpreter::executeStart(int processId, const char* parameters,
int result = _mgmtSrvr.start(processId); int result = _mgmtSrvr.start(processId);
if (result != 0) { if (result != 0) {
ndbout << _mgmtSrvr.getErrorText(result) << endl; ndbout << get_error_text(result) << endl;
} }
} }
...@@ -719,7 +726,7 @@ CommandInterpreter::executeRestart(int processId, const char* parameters, ...@@ -719,7 +726,7 @@ CommandInterpreter::executeRestart(int processId, const char* parameters,
stopCallback, stopCallback,
this); this);
if (result != 0) { if (result != 0) {
ndbout << _mgmtSrvr.getErrorText(result) << endl; ndbout << get_error_text(result) << endl;
} }
} }
...@@ -760,7 +767,7 @@ CommandInterpreter::executeDumpState(int processId, const char* parameters, ...@@ -760,7 +767,7 @@ CommandInterpreter::executeDumpState(int processId, const char* parameters,
free(tmpString); free(tmpString);
int result = _mgmtSrvr.dumpState(processId, pars, no); int result = _mgmtSrvr.dumpState(processId, pars, no);
if (result != 0) { if (result != 0) {
ndbout << _mgmtSrvr.getErrorText(result) << endl; ndbout << get_error_text(result) << endl;
} }
} }
...@@ -781,7 +788,7 @@ void CommandInterpreter::executeStatus(int processId, ...@@ -781,7 +788,7 @@ void CommandInterpreter::executeStatus(int processId,
&status, &version, &startPhase, &system, &status, &version, &startPhase, &system,
&dynamicId, &nodeGroup, &connectCount); &dynamicId, &nodeGroup, &connectCount);
if(result != 0){ if(result != 0){
ndbout << _mgmtSrvr.getErrorText(result) << endl; ndbout << get_error_text(result) << endl;
return; return;
} }
...@@ -875,7 +882,7 @@ void CommandInterpreter::executeLogLevel(int processId, ...@@ -875,7 +882,7 @@ void CommandInterpreter::executeLogLevel(int processId,
int result = _mgmtSrvr.setNodeLogLevel(processId, logLevel); int result = _mgmtSrvr.setNodeLogLevel(processId, logLevel);
if (result != 0) { if (result != 0) {
ndbout << _mgmtSrvr.getErrorText(result) << endl; ndbout << get_error_text(result) << endl;
} }
#endif #endif
} }
...@@ -913,7 +920,7 @@ void CommandInterpreter::executeError(int processId, ...@@ -913,7 +920,7 @@ void CommandInterpreter::executeError(int processId,
int result = _mgmtSrvr.insertError(processId, errorNo); int result = _mgmtSrvr.insertError(processId, errorNo);
if (result != 0) { if (result != 0) {
ndbout << _mgmtSrvr.getErrorText(result) << endl; ndbout << get_error_text(result) << endl;
} }
free(newpar); free(newpar);
} }
...@@ -953,7 +960,7 @@ void CommandInterpreter::executeTrace(int processId, ...@@ -953,7 +960,7 @@ void CommandInterpreter::executeTrace(int processId,
int result = _mgmtSrvr.setTraceNo(processId, traceNo); int result = _mgmtSrvr.setTraceNo(processId, traceNo);
if (result != 0) { if (result != 0) {
ndbout << _mgmtSrvr.getErrorText(result) << endl; ndbout << get_error_text(result) << endl;
} }
free(newpar); free(newpar);
} }
...@@ -974,7 +981,7 @@ void CommandInterpreter::executeLog(int processId, ...@@ -974,7 +981,7 @@ void CommandInterpreter::executeLog(int processId,
int result = _mgmtSrvr.setSignalLoggingMode(processId, MgmtSrvr::InOut, blocks); int result = _mgmtSrvr.setSignalLoggingMode(processId, MgmtSrvr::InOut, blocks);
if (result != 0) { if (result != 0) {
ndbout << _mgmtSrvr.getErrorText(result) << endl; ndbout << get_error_text(result) << endl;
} }
} }
...@@ -995,7 +1002,7 @@ void CommandInterpreter::executeLogIn(int processId, ...@@ -995,7 +1002,7 @@ void CommandInterpreter::executeLogIn(int processId,
int result = _mgmtSrvr.setSignalLoggingMode(processId, MgmtSrvr::In, blocks); int result = _mgmtSrvr.setSignalLoggingMode(processId, MgmtSrvr::In, blocks);
if (result != 0) { if (result != 0) {
ndbout << _mgmtSrvr.getErrorText(result) << endl; ndbout << get_error_text(result) << endl;
} }
} }
...@@ -1014,7 +1021,7 @@ void CommandInterpreter::executeLogOut(int processId, ...@@ -1014,7 +1021,7 @@ void CommandInterpreter::executeLogOut(int processId,
int result = _mgmtSrvr.setSignalLoggingMode(processId, MgmtSrvr::Out, blocks); int result = _mgmtSrvr.setSignalLoggingMode(processId, MgmtSrvr::Out, blocks);
if (result != 0) { if (result != 0) {
ndbout << _mgmtSrvr.getErrorText(result) << endl; ndbout << get_error_text(result) << endl;
} }
} }
...@@ -1035,7 +1042,7 @@ void CommandInterpreter::executeLogOff(int processId, ...@@ -1035,7 +1042,7 @@ void CommandInterpreter::executeLogOff(int processId,
int result = _mgmtSrvr.setSignalLoggingMode(processId, MgmtSrvr::Off, blocks); int result = _mgmtSrvr.setSignalLoggingMode(processId, MgmtSrvr::Off, blocks);
if (result != 0) { if (result != 0) {
ndbout << _mgmtSrvr.getErrorText(result) << endl; ndbout << get_error_text(result) << endl;
} }
} }
...@@ -1054,7 +1061,7 @@ void CommandInterpreter::executeTestOn(int processId, ...@@ -1054,7 +1061,7 @@ void CommandInterpreter::executeTestOn(int processId,
int result = _mgmtSrvr.startSignalTracing(processId); int result = _mgmtSrvr.startSignalTracing(processId);
if (result != 0) { if (result != 0) {
ndbout << _mgmtSrvr.getErrorText(result) << endl; ndbout << get_error_text(result) << endl;
} }
} }
...@@ -1073,7 +1080,7 @@ void CommandInterpreter::executeTestOff(int processId, ...@@ -1073,7 +1080,7 @@ void CommandInterpreter::executeTestOff(int processId,
int result = _mgmtSrvr.stopSignalTracing(processId); int result = _mgmtSrvr.stopSignalTracing(processId);
if (result != 0) { if (result != 0) {
ndbout << _mgmtSrvr.getErrorText(result) << endl; ndbout << get_error_text(result) << endl;
} }
} }
...@@ -1126,7 +1133,7 @@ void CommandInterpreter::executeEventReporting(int processId, ...@@ -1126,7 +1133,7 @@ void CommandInterpreter::executeEventReporting(int processId,
ndbout_c("processId %d", processId); ndbout_c("processId %d", processId);
int result = _mgmtSrvr.setEventReportingLevel(processId, logLevel); int result = _mgmtSrvr.setEventReportingLevel(processId, logLevel);
if (result != 0) { if (result != 0) {
ndbout << _mgmtSrvr.getErrorText(result) << endl; ndbout << get_error_text(result) << endl;
} }
#endif #endif
} }
...@@ -1136,7 +1143,7 @@ CommandInterpreter::executeStartBackup(char* parameters) { ...@@ -1136,7 +1143,7 @@ CommandInterpreter::executeStartBackup(char* parameters) {
Uint32 backupId; Uint32 backupId;
int result = _mgmtSrvr.startBackup(backupId); int result = _mgmtSrvr.startBackup(backupId);
if (result != 0) { if (result != 0) {
ndbout << _mgmtSrvr.getErrorText(result) << endl; ndbout << get_error_text(result) << endl;
} else { } else {
// ndbout << "Start of backup ordered" << endl; // ndbout << "Start of backup ordered" << endl;
} }
...@@ -1153,7 +1160,7 @@ CommandInterpreter::executeAbortBackup(char* parameters) { ...@@ -1153,7 +1160,7 @@ CommandInterpreter::executeAbortBackup(char* parameters) {
} }
int result = _mgmtSrvr.abortBackup(bid); int result = _mgmtSrvr.abortBackup(bid);
if (result != 0) { if (result != 0) {
ndbout << _mgmtSrvr.getErrorText(result) << endl; ndbout << get_error_text(result) << endl;
} else { } else {
ndbout << "Abort of backup " << bid << " ordered" << endl; ndbout << "Abort of backup " << bid << " ordered" << endl;
} }
...@@ -1174,7 +1181,7 @@ CommandInterpreter::executeEnterSingleUser(char* parameters) { ...@@ -1174,7 +1181,7 @@ CommandInterpreter::executeEnterSingleUser(char* parameters) {
} }
int result = _mgmtSrvr.enterSingleUser(0, nodeId,0,0); int result = _mgmtSrvr.enterSingleUser(0, nodeId,0,0);
if (result != 0) { if (result != 0) {
ndbout << _mgmtSrvr.getErrorText(result) << endl; ndbout << get_error_text(result) << endl;
} else { } else {
ndbout << "Entering single user mode, granting access for node " ndbout << "Entering single user mode, granting access for node "
<< nodeId << " OK." << endl; << nodeId << " OK." << endl;
......
...@@ -55,6 +55,9 @@ public: ...@@ -55,6 +55,9 @@ public:
int readAndExecute(); int readAndExecute();
private: private:
char m_err_str[1024];
const char *get_error_text(int err_no);
/** /**
* Read a string, and return a pointer to it. * Read a string, and return a pointer to it.
* *
......
...@@ -49,6 +49,8 @@ ...@@ -49,6 +49,8 @@
#include <NdbAutoPtr.hpp> #include <NdbAutoPtr.hpp>
#include <ndberror.h>
#include <mgmapi.h> #include <mgmapi.h>
#include <mgmapi_configuration.hpp> #include <mgmapi_configuration.hpp>
#include <mgmapi_config_parameters.h> #include <mgmapi_config_parameters.h>
...@@ -264,16 +266,6 @@ MgmtSrvr::isEventLogFilterEnabled(int severity) ...@@ -264,16 +266,6 @@ MgmtSrvr::isEventLogFilterEnabled(int severity)
static ErrorItem errorTable[] = static ErrorItem errorTable[] =
{ {
{200, "Backup undefined error"},
{202, "Backup failed to allocate buffers (check configuration)"},
{203, "Backup failed to setup fs buffers (check configuration)"},
{204, "Backup failed to allocate tables (check configuration)"},
{205, "Backup failed to insert file header (check configuration)"},
{206, "Backup failed to insert table list (check configuration)"},
{207, "Backup failed to allocate table memory (check configuration)"},
{208, "Backup failed to allocate file record (check configuration)"},
{209, "Backup failed to allocate attribute record (check configuration)"},
{MgmtSrvr::NO_CONTACT_WITH_PROCESS, "No contact with the process (dead ?)."}, {MgmtSrvr::NO_CONTACT_WITH_PROCESS, "No contact with the process (dead ?)."},
{MgmtSrvr::PROCESS_NOT_CONFIGURED, "The process is not configured."}, {MgmtSrvr::PROCESS_NOT_CONFIGURED, "The process is not configured."},
{MgmtSrvr::WRONG_PROCESS_TYPE, {MgmtSrvr::WRONG_PROCESS_TYPE,
...@@ -1856,18 +1848,21 @@ MgmtSrvr::dumpState(int processId, const Uint32 args[], Uint32 no) ...@@ -1856,18 +1848,21 @@ MgmtSrvr::dumpState(int processId, const Uint32 args[], Uint32 no)
//**************************************************************************** //****************************************************************************
//**************************************************************************** //****************************************************************************
const char* MgmtSrvr::getErrorText(int errorCode) const char* MgmtSrvr::getErrorText(int errorCode, char *buf, int buf_sz)
{ {
static char text[255];
for (int i = 0; i < noOfErrorCodes; ++i) { for (int i = 0; i < noOfErrorCodes; ++i) {
if (errorCode == errorTable[i]._errorCode) { if (errorCode == errorTable[i]._errorCode) {
return errorTable[i]._errorText; BaseString::snprintf(buf, buf_sz, errorTable[i]._errorText);
buf[buf_sz-1]= 0;
return buf;
} }
} }
BaseString::snprintf(text, 255, "Unknown management server error code %d", errorCode); ndb_error_string(errorCode, buf, buf_sz);
return text; buf[buf_sz-1]= 0;
return buf;
} }
void void
......
...@@ -466,7 +466,7 @@ public: ...@@ -466,7 +466,7 @@ public:
* @param errorCode: Error code to get a match error text for. * @param errorCode: Error code to get a match error text for.
* @return The error text. * @return The error text.
*/ */
const char* getErrorText(int errorCode); const char* getErrorText(int errorCode, char *buf, int buf_sz);
/** /**
* Get configuration * Get configuration
......
...@@ -579,7 +579,7 @@ MgmApiSession::insertError(Parser<MgmApiSession>::Context &, ...@@ -579,7 +579,7 @@ MgmApiSession::insertError(Parser<MgmApiSession>::Context &,
m_output->println("insert error reply"); m_output->println("insert error reply");
if(result != 0) if(result != 0)
m_output->println("result: %s", m_mgmsrv.getErrorText(result)); m_output->println("result: %s", get_error_text(result));
else else
m_output->println("result: Ok"); m_output->println("result: Ok");
m_output->println(""); m_output->println("");
...@@ -597,7 +597,7 @@ MgmApiSession::setTrace(Parser<MgmApiSession>::Context &, ...@@ -597,7 +597,7 @@ MgmApiSession::setTrace(Parser<MgmApiSession>::Context &,
m_output->println("set trace reply"); m_output->println("set trace reply");
if(result != 0) if(result != 0)
m_output->println("result: %s", m_mgmsrv.getErrorText(result)); m_output->println("result: %s", get_error_text(result));
else else
m_output->println("result: Ok"); m_output->println("result: Ok");
m_output->println(""); m_output->println("");
...@@ -665,7 +665,7 @@ MgmApiSession::startBackup(Parser<MgmApiSession>::Context &, ...@@ -665,7 +665,7 @@ MgmApiSession::startBackup(Parser<MgmApiSession>::Context &,
m_output->println("start backup reply"); m_output->println("start backup reply");
if(result != 0) if(result != 0)
m_output->println("result: %s(%d)", m_mgmsrv.getErrorText(result), result); m_output->println("result: %s(%d)", get_error_text(result), result);
else{ else{
m_output->println("result: Ok"); m_output->println("result: Ok");
m_output->println("id: %d", backupId); m_output->println("id: %d", backupId);
...@@ -685,7 +685,7 @@ MgmApiSession::startBackup(Parser<MgmApiSession>::Context &, ...@@ -685,7 +685,7 @@ MgmApiSession::startBackup(Parser<MgmApiSession>::Context &,
m_output->println("start backup reply"); m_output->println("start backup reply");
if(result != 0) if(result != 0)
m_output->println("result: %s", m_mgmsrv.getErrorText(result)); m_output->println("result: %s", get_error_text(result));
else{ else{
m_output->println("result: Ok"); m_output->println("result: Ok");
m_output->println("id: %d", backupId); m_output->println("id: %d", backupId);
...@@ -705,7 +705,7 @@ MgmApiSession::abortBackup(Parser<MgmApiSession>::Context &, ...@@ -705,7 +705,7 @@ MgmApiSession::abortBackup(Parser<MgmApiSession>::Context &,
m_output->println("abort backup reply"); m_output->println("abort backup reply");
if(result != 0) if(result != 0)
m_output->println("result: %s", m_mgmsrv.getErrorText(result)); m_output->println("result: %s", get_error_text(result));
else else
m_output->println("result: Ok"); m_output->println("result: Ok");
m_output->println(""); m_output->println("");
...@@ -727,7 +727,7 @@ MgmApiSession::repCommand(Parser<MgmApiSession>::Context &, ...@@ -727,7 +727,7 @@ MgmApiSession::repCommand(Parser<MgmApiSession>::Context &,
m_output->println("global replication reply"); m_output->println("global replication reply");
if(result != 0) if(result != 0)
m_output->println("result: %s", m_mgmsrv.getErrorText(result)); m_output->println("result: %s", get_error_text(result));
else{ else{
m_output->println("result: Ok"); m_output->println("result: Ok");
m_output->println("id: %d", repReqId); m_output->println("id: %d", repReqId);
...@@ -749,7 +749,7 @@ MgmApiSession::dumpState(Parser<MgmApiSession>::Context &, ...@@ -749,7 +749,7 @@ MgmApiSession::dumpState(Parser<MgmApiSession>::Context &,
int result = m_mgmsrv.dumpState(node, args_str.c_str()); int result = m_mgmsrv.dumpState(node, args_str.c_str());
m_output->println("dump state reply"); m_output->println("dump state reply");
if(result != 0) if(result != 0)
m_output->println("result: %s", m_mgmsrv.getErrorText(result)); m_output->println("result: %s", get_error_text(result));
else else
m_output->println("result: Ok"); m_output->println("result: Ok");
m_output->println(""); m_output->println("");
...@@ -834,7 +834,7 @@ MgmApiSession::stopSignalLog(Parser<MgmApiSession>::Context &, ...@@ -834,7 +834,7 @@ MgmApiSession::stopSignalLog(Parser<MgmApiSession>::Context &,
m_output->println("stop signallog"); m_output->println("stop signallog");
if(result != 0) if(result != 0)
m_output->println("result: %s", m_mgmsrv.getErrorText(result)); m_output->println("result: %s", get_error_text(result));
else else
m_output->println("result: Ok"); m_output->println("result: Ok");
m_output->println(""); m_output->println("");
...@@ -874,7 +874,7 @@ MgmApiSession::restart(Parser<MgmApiSession>::Context &, ...@@ -874,7 +874,7 @@ MgmApiSession::restart(Parser<MgmApiSession>::Context &,
m_output->println("restart reply"); m_output->println("restart reply");
if(result != 0){ if(result != 0){
m_output->println("result: %d-%s", result, m_mgmsrv.getErrorText(result)); m_output->println("result: %d-%s", result, get_error_text(result));
} else } else
m_output->println("result: Ok"); m_output->println("result: Ok");
m_output->println("restarted: %d", restarted); m_output->println("restarted: %d", restarted);
...@@ -898,7 +898,7 @@ MgmApiSession::restartAll(Parser<MgmApiSession>::Context &, ...@@ -898,7 +898,7 @@ MgmApiSession::restartAll(Parser<MgmApiSession>::Context &,
m_output->println("restart reply"); m_output->println("restart reply");
if(result != 0) if(result != 0)
m_output->println("result: %s", m_mgmsrv.getErrorText(result)); m_output->println("result: %s", get_error_text(result));
else else
m_output->println("result: Ok"); m_output->println("result: Ok");
m_output->println("restarted: %d", count); m_output->println("restarted: %d", count);
...@@ -1029,7 +1029,7 @@ MgmApiSession::stop(Parser<MgmApiSession>::Context &, ...@@ -1029,7 +1029,7 @@ MgmApiSession::stop(Parser<MgmApiSession>::Context &,
m_output->println("stop reply"); m_output->println("stop reply");
if(result != 0) if(result != 0)
m_output->println("result: %s", m_mgmsrv.getErrorText(result)); m_output->println("result: %s", get_error_text(result));
else else
m_output->println("result: Ok"); m_output->println("result: Ok");
m_output->println("stopped: %d", stopped); m_output->println("stopped: %d", stopped);
...@@ -1051,7 +1051,7 @@ MgmApiSession::stopAll(Parser<MgmApiSession>::Context &, ...@@ -1051,7 +1051,7 @@ MgmApiSession::stopAll(Parser<MgmApiSession>::Context &,
m_output->println("stop reply"); m_output->println("stop reply");
if(result != 0) if(result != 0)
m_output->println("result: %s", m_mgmsrv.getErrorText(result)); m_output->println("result: %s", get_error_text(result));
else else
m_output->println("result: Ok"); m_output->println("result: Ok");
m_output->println("stopped: %d", stopped); m_output->println("stopped: %d", stopped);
...@@ -1067,7 +1067,7 @@ MgmApiSession::enterSingleUser(Parser<MgmApiSession>::Context &, ...@@ -1067,7 +1067,7 @@ MgmApiSession::enterSingleUser(Parser<MgmApiSession>::Context &,
int result = m_mgmsrv.enterSingleUser(&stopped, nodeId); int result = m_mgmsrv.enterSingleUser(&stopped, nodeId);
m_output->println("enter single user reply"); m_output->println("enter single user reply");
if(result != 0) { if(result != 0) {
m_output->println("result: %s", m_mgmsrv.getErrorText(result)); m_output->println("result: %s", get_error_text(result));
} }
else { else {
m_output->println("result: Ok"); m_output->println("result: Ok");
...@@ -1082,7 +1082,7 @@ MgmApiSession::exitSingleUser(Parser<MgmApiSession>::Context &, ...@@ -1082,7 +1082,7 @@ MgmApiSession::exitSingleUser(Parser<MgmApiSession>::Context &,
int result = m_mgmsrv.exitSingleUser(&stopped, false); int result = m_mgmsrv.exitSingleUser(&stopped, false);
m_output->println("exit single user reply"); m_output->println("exit single user reply");
if(result != 0) if(result != 0)
m_output->println("result: %s", m_mgmsrv.getErrorText(result)); m_output->println("result: %s", get_error_text(result));
else else
m_output->println("result: Ok"); m_output->println("result: Ok");
m_output->println(""); m_output->println("");
...@@ -1100,7 +1100,7 @@ MgmApiSession::startSignalLog(Parser<MgmApiSession>::Context &, ...@@ -1100,7 +1100,7 @@ MgmApiSession::startSignalLog(Parser<MgmApiSession>::Context &,
m_output->println("start signallog reply"); m_output->println("start signallog reply");
if(result != 0) if(result != 0)
m_output->println("result: %s", m_mgmsrv.getErrorText(result)); m_output->println("result: %s", get_error_text(result));
else else
m_output->println("result: Ok"); m_output->println("result: Ok");
m_output->println(""); m_output->println("");
...@@ -1145,7 +1145,7 @@ MgmApiSession::logSignals(Parser<MgmApiSession>::Context &, ...@@ -1145,7 +1145,7 @@ MgmApiSession::logSignals(Parser<MgmApiSession>::Context &,
m_output->println("log signals reply"); m_output->println("log signals reply");
if(result != 0) if(result != 0)
m_output->println("result: %s", m_mgmsrv.getErrorText(result)); m_output->println("result: %s", get_error_text(result));
else else
m_output->println("result: Ok"); m_output->println("result: Ok");
m_output->println(""); m_output->println("");
...@@ -1162,7 +1162,7 @@ MgmApiSession::start(Parser<MgmApiSession>::Context &, ...@@ -1162,7 +1162,7 @@ MgmApiSession::start(Parser<MgmApiSession>::Context &,
m_output->println("start reply"); m_output->println("start reply");
if(result != 0) if(result != 0)
m_output->println("result: %s", m_mgmsrv.getErrorText(result)); m_output->println("result: %s", get_error_text(result));
else else
m_output->println("result: Ok"); m_output->println("result: Ok");
m_output->println(""); m_output->println("");
......
...@@ -39,10 +39,13 @@ private: ...@@ -39,10 +39,13 @@ private:
OutputStream *m_output; OutputStream *m_output;
Parser_t *m_parser; Parser_t *m_parser;
MgmtSrvr::Allocated_resources *m_allocated_resources; MgmtSrvr::Allocated_resources *m_allocated_resources;
char m_err_str[1024];
void getConfig_common(Parser_t::Context &ctx, void getConfig_common(Parser_t::Context &ctx,
const class Properties &args, const class Properties &args,
bool compat = false); bool compat = false);
const char *get_error_text(int err_no)
{ return m_mgmsrv.getErrorText(err_no, m_err_str, sizeof(m_err_str)); }
public: public:
MgmApiSession(class MgmtSrvr & mgm, NDB_SOCKET_TYPE sock); MgmApiSession(class MgmtSrvr & mgm, NDB_SOCKET_TYPE sock);
......
...@@ -35,6 +35,7 @@ typedef struct ErrorBundle { ...@@ -35,6 +35,7 @@ typedef struct ErrorBundle {
#define NE ndberror_cl_none #define NE ndberror_cl_none
#define AE ndberror_cl_application #define AE ndberror_cl_application
#define CE ndberror_cl_configuration
#define ND ndberror_cl_no_data_found #define ND ndberror_cl_no_data_found
#define CV ndberror_cl_constraint_violation #define CV ndberror_cl_constraint_violation
#define SE ndberror_cl_schema_error #define SE ndberror_cl_schema_error
...@@ -58,6 +59,27 @@ static const char REDO_BUFFER_MSG[]= ...@@ -58,6 +59,27 @@ static const char REDO_BUFFER_MSG[]=
static const char* empty_string = ""; static const char* empty_string = "";
/*
* Error code ranges are reserved for respective block
*
* 200 - TC
* 300 - DIH
* 400 - LQH
* 600 - ACC
* 700 - DICT
* 800 - TUP
* 1200 - LQH
* 1300 - BACKUP
* 4000 - API
* 4100 - ""
* 4200 - ""
* 4300 - ""
* 4400 - ""
* 4500 - ""
* 4600 - ""
* 5000 - Management server
*/
static static
const const
ErrorBundle ErrorCodes[] = { ErrorBundle ErrorCodes[] = {
...@@ -303,6 +325,36 @@ ErrorBundle ErrorCodes[] = { ...@@ -303,6 +325,36 @@ ErrorBundle ErrorCodes[] = {
*/ */
{ 4003, NI, "Function not implemented yet" }, { 4003, NI, "Function not implemented yet" },
/**
* Backup error codes
*/
{ 1300, IE, "Undefined error" },
{ 1301, IE, "Backup issued to not master (reissue command to master)" },
{ 1302, IE, "Out of backup record" },
{ 1303, IS, "Out of resources" },
{ 1304, IE, "Sequence failure" },
{ 1305, IE, "Backup definition not implemented" },
{ 1306, AE, "Backup not supported in diskless mode (change Diskless)" },
{ 1321, IE, "Backup aborted by application" },
{ 1322, IE, "Backup already completed" },
{ 1323, IE, "1323" },
{ 1324, IE, "Backup log buffer full" },
{ 1325, IE, "File or scan error" },
{ 1326, IE, "Backup abortet due to node failure" },
{ 1327, IE, "1327" },
{ 1340, IE, "Backup undefined error" },
{ 1342, AE, "Backup failed to allocate buffers (check configuration)" },
{ 1343, AE, "Backup failed to setup fs buffers (check configuration)" },
{ 1344, AE, "Backup failed to allocate tables (check configuration)" },
{ 1345, AE, "Backup failed to insert file header (check configuration)" },
{ 1346, AE, "Backup failed to insert table list (check configuration)" },
{ 1347, AE, "Backup failed to allocate table memory (check configuration)" },
{ 1348, AE, "Backup failed to allocate file record (check configuration)" },
{ 1349, AE, "Backup failed to allocate attribute record (check configuration)" },
/** /**
* Still uncategorized * Still uncategorized
*/ */
...@@ -467,6 +519,7 @@ const ...@@ -467,6 +519,7 @@ const
ErrorStatusClassification StatusClassificationMapping[] = { ErrorStatusClassification StatusClassificationMapping[] = {
{ ST_S, NE, "No error"}, { ST_S, NE, "No error"},
{ ST_P, AE, "Application error"}, { ST_P, AE, "Application error"},
{ ST_P, CE, "Configuration or application error"},
{ ST_P, ND, "No data found"}, { ST_P, ND, "No data found"},
{ ST_P, CV, "Constraint violation"}, { ST_P, CV, "Constraint violation"},
{ ST_P, SE, "Schema error"}, { ST_P, SE, "Schema error"},
......
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