move all error codes to ndberror.c

- step 1 mgmtsrvr error codes
parent afdee6e0
......@@ -18,6 +18,7 @@
#include "MgmtSrvr.hpp"
#include "MgmtErrorReporter.hpp"
#include "ndb_mgmd_error.h"
#include <ConfigRetriever.hpp>
#include <NdbOut.hpp>
......@@ -239,13 +240,6 @@ MgmtSrvr::stopEventLog()
// Nothing yet
}
class ErrorItem
{
public:
int _errorCode;
const char * _errorText;
};
bool
MgmtSrvr::setEventLogFilter(int severity, int enable)
{
......@@ -268,62 +262,6 @@ MgmtSrvr::isEventLogFilterEnabled(int severity)
return g_eventLogger.isEnable((Logger::LoggerLevel)severity);
}
static ErrorItem errorTable[] =
{
{MgmtSrvr::NO_CONTACT_WITH_PROCESS, "No contact with the process (dead ?)."},
{MgmtSrvr::PROCESS_NOT_CONFIGURED, "The process is not configured."},
{MgmtSrvr::WRONG_PROCESS_TYPE,
"The process has wrong type. Expected a DB process."},
{MgmtSrvr::COULD_NOT_ALLOCATE_MEMORY, "Could not allocate memory."},
{MgmtSrvr::SEND_OR_RECEIVE_FAILED, "Send to process or receive failed."},
{MgmtSrvr::INVALID_LEVEL, "Invalid level. Should be between 1 and 30."},
{MgmtSrvr::INVALID_ERROR_NUMBER, "Invalid error number. Should be >= 0."},
{MgmtSrvr::INVALID_TRACE_NUMBER, "Invalid trace number."},
{MgmtSrvr::NOT_IMPLEMENTED, "Not implemented."},
{MgmtSrvr::INVALID_BLOCK_NAME, "Invalid block name"},
{MgmtSrvr::CONFIG_PARAM_NOT_EXIST,
"The configuration parameter does not exist for the process type."},
{MgmtSrvr::CONFIG_PARAM_NOT_UPDATEABLE,
"The configuration parameter is not possible to update."},
{MgmtSrvr::VALUE_WRONG_FORMAT_INT_EXPECTED,
"Incorrect value. Expected integer."},
{MgmtSrvr::VALUE_TOO_LOW, "Value is too low."},
{MgmtSrvr::VALUE_TOO_HIGH, "Value is too high."},
{MgmtSrvr::VALUE_WRONG_FORMAT_BOOL_EXPECTED,
"Incorrect value. Expected TRUE or FALSE."},
{MgmtSrvr::CONFIG_FILE_OPEN_WRITE_ERROR,
"Could not open configuration file for writing."},
{MgmtSrvr::CONFIG_FILE_OPEN_READ_ERROR,
"Could not open configuration file for reading."},
{MgmtSrvr::CONFIG_FILE_WRITE_ERROR,
"Write error when writing configuration file."},
{MgmtSrvr::CONFIG_FILE_READ_ERROR,
"Read error when reading configuration file."},
{MgmtSrvr::CONFIG_FILE_CLOSE_ERROR, "Could not close configuration file."},
{MgmtSrvr::CONFIG_CHANGE_REFUSED_BY_RECEIVER,
"The change was refused by the receiving process."},
{MgmtSrvr::COULD_NOT_SYNC_CONFIG_CHANGE_AGAINST_PHYSICAL_MEDIUM,
"The change could not be synced against physical medium."},
{MgmtSrvr::CONFIG_FILE_CHECKSUM_ERROR,
"The config file is corrupt. Checksum error."},
{MgmtSrvr::NOT_POSSIBLE_TO_SEND_CONFIG_UPDATE_TO_PROCESS_TYPE,
"It is not possible to send an update of a configuration variable "
"to this kind of process."},
{MgmtSrvr::NODE_SHUTDOWN_IN_PROGESS, "Node shutdown in progress" },
{MgmtSrvr::SYSTEM_SHUTDOWN_IN_PROGRESS, "System shutdown in progress" },
{MgmtSrvr::NODE_SHUTDOWN_WOULD_CAUSE_SYSTEM_CRASH,
"Node shutdown would cause system crash" },
{MgmtSrvr::UNSUPPORTED_NODE_SHUTDOWN,
"Unsupported multi node shutdown. Abort option required." },
{MgmtSrvr::NODE_NOT_API_NODE, "The specified node is not an API node." },
{MgmtSrvr::OPERATION_NOT_ALLOWED_START_STOP,
"Operation not allowed while nodes are starting or stopping."},
{MgmtSrvr::NO_CONTACT_WITH_DB_NODES, "No contact with database nodes" }
};
int MgmtSrvr::translateStopRef(Uint32 errCode)
{
switch(errCode){
......@@ -343,8 +281,6 @@ int MgmtSrvr::translateStopRef(Uint32 errCode)
return 4999;
}
static int noOfErrorCodes = sizeof(errorTable) / sizeof(ErrorItem);
int
MgmtSrvr::getNodeCount(enum ndb_mgm_node_type type) const
{
......@@ -1969,18 +1905,8 @@ MgmtSrvr::dumpState(int nodeId, const Uint32 args[], Uint32 no)
const char* MgmtSrvr::getErrorText(int errorCode, char *buf, int buf_sz)
{
for (int i = 0; i < noOfErrorCodes; ++i) {
if (errorCode == errorTable[i]._errorCode) {
BaseString::snprintf(buf, buf_sz, errorTable[i]._errorText);
buf[buf_sz-1]= 0;
return buf;
}
}
ndb_error_string(errorCode, buf, buf_sz);
buf[buf_sz-1]= 0;
return buf;
}
......
......@@ -148,45 +148,6 @@ public:
*/
bool isEventLogFilterEnabled(int severity);
STATIC_CONST( NO_CONTACT_WITH_PROCESS = 5000 );
STATIC_CONST( PROCESS_NOT_CONFIGURED = 5001 );
STATIC_CONST( WRONG_PROCESS_TYPE = 5002 );
STATIC_CONST( COULD_NOT_ALLOCATE_MEMORY = 5003 );
STATIC_CONST( SEND_OR_RECEIVE_FAILED = 5005 );
STATIC_CONST( INVALID_LEVEL = 5006 );
STATIC_CONST( INVALID_ERROR_NUMBER = 5007 );
STATIC_CONST( INVALID_TRACE_NUMBER = 5008 );
STATIC_CONST( NOT_IMPLEMENTED = 5009 );
STATIC_CONST( INVALID_BLOCK_NAME = 5010 );
STATIC_CONST( CONFIG_PARAM_NOT_EXIST = 5011 );
STATIC_CONST( CONFIG_PARAM_NOT_UPDATEABLE = 5012 );
STATIC_CONST( VALUE_WRONG_FORMAT_INT_EXPECTED = 5013 );
STATIC_CONST( VALUE_TOO_LOW = 5014 );
STATIC_CONST( VALUE_TOO_HIGH = 5015 );
STATIC_CONST( VALUE_WRONG_FORMAT_BOOL_EXPECTED = 5016 );
STATIC_CONST( CONFIG_FILE_OPEN_WRITE_ERROR = 5017 );
STATIC_CONST( CONFIG_FILE_OPEN_READ_ERROR = 5018 );
STATIC_CONST( CONFIG_FILE_WRITE_ERROR = 5019 );
STATIC_CONST( CONFIG_FILE_READ_ERROR = 5020 );
STATIC_CONST( CONFIG_FILE_CLOSE_ERROR = 5021 );
STATIC_CONST( CONFIG_CHANGE_REFUSED_BY_RECEIVER = 5022 );
STATIC_CONST( COULD_NOT_SYNC_CONFIG_CHANGE_AGAINST_PHYSICAL_MEDIUM = 5023 );
STATIC_CONST( CONFIG_FILE_CHECKSUM_ERROR = 5024 );
STATIC_CONST( NOT_POSSIBLE_TO_SEND_CONFIG_UPDATE_TO_PROCESS_TYPE = 5025 );
STATIC_CONST( NODE_SHUTDOWN_IN_PROGESS = 5026 );
STATIC_CONST( SYSTEM_SHUTDOWN_IN_PROGRESS = 5027 );
STATIC_CONST( NODE_SHUTDOWN_WOULD_CAUSE_SYSTEM_CRASH = 5028 );
STATIC_CONST( NO_CONTACT_WITH_DB_NODES = 5030 );
STATIC_CONST( UNSUPPORTED_NODE_SHUTDOWN = 5031 );
STATIC_CONST( NODE_NOT_API_NODE = 5062 );
STATIC_CONST( OPERATION_NOT_ALLOWED_START_STOP = 5063 );
/**
* This enum specifies the different signal loggig modes possible to set
* with the setSignalLoggingMode method.
......
/* Copyright (C) 2007 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; version 2 of the License.
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 */
#ifndef NDB_MGMD_ERROR_H
#define NDB_MGMD_ERROR_H
#define NO_CONTACT_WITH_PROCESS 5000
#define WRONG_PROCESS_TYPE 5002
#define SEND_OR_RECEIVE_FAILED 5005
#define INVALID_ERROR_NUMBER 5007
#define INVALID_TRACE_NUMBER 5008
#define INVALID_BLOCK_NAME 5010
#define NODE_SHUTDOWN_IN_PROGESS 5026
#define SYSTEM_SHUTDOWN_IN_PROGRESS 5027
#define NODE_SHUTDOWN_WOULD_CAUSE_SYSTEM_CRASH 5028
#define NO_CONTACT_WITH_DB_NODES 5030
#define UNSUPPORTED_NODE_SHUTDOWN 5031
#define NODE_NOT_API_NODE 5062
#define OPERATION_NOT_ALLOWED_START_STOP 5063
#endif
......@@ -19,6 +19,9 @@
#include <ndberror.h>
#include <m_string.h>
#include "../mgmsrv/ndb_mgmd_error.h"
typedef struct ErrorBundle {
int code;
int mysql_code;
......@@ -619,6 +622,33 @@ ErrorBundle ErrorCodes[] = {
{ 4273, DMEC, IE, "No blob table in dict cache" },
{ 4274, DMEC, IE, "Corrupted main table PK in blob operation" },
{ 4275, DMEC, AE, "The blob method is incompatible with operation type or lock mode" },
{ NO_CONTACT_WITH_PROCESS, DMEC, AE,
"No contact with the process (dead ?)."},
{ WRONG_PROCESS_TYPE, DMEC, AE,
"The process has wrong type. Expected a DB process."},
{ SEND_OR_RECEIVE_FAILED, DMEC, AE,
"Send to process or receive failed."},
{ INVALID_ERROR_NUMBER, DMEC, AE,
"Invalid error number. Should be >= 0."},
{ INVALID_TRACE_NUMBER, DMEC, AE,
"Invalid trace number."},
{ INVALID_BLOCK_NAME, DMEC, AE,
"Invalid block name"},
{ NODE_SHUTDOWN_IN_PROGESS, DMEC, AE,
"Node shutdown in progress" },
{ SYSTEM_SHUTDOWN_IN_PROGRESS, DMEC, AE,
"System shutdown in progress" },
{ NODE_SHUTDOWN_WOULD_CAUSE_SYSTEM_CRASH, DMEC, AE,
"Node shutdown would cause system crash" },
{ UNSUPPORTED_NODE_SHUTDOWN, DMEC, AE,
"Unsupported multi node shutdown. Abort option required." },
{ NODE_NOT_API_NODE, DMEC, AE,
"The specified node is not an API node." },
{ OPERATION_NOT_ALLOWED_START_STOP, DMEC, AE,
"Operation not allowed while nodes are starting or stopping."},
{ NO_CONTACT_WITH_DB_NODES, DMEC, AE,
"No contact with database nodes" }
};
static
......
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