summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <joreland@mysql.com>2004-09-17 08:28:22 +0200
committerunknown <joreland@mysql.com>2004-09-17 08:28:22 +0200
commit08ffa2988de9cb8e672cc5e9977755ed791e1ea3 (patch)
tree8a32890b03a3ba43294d197146770ac3226718d7
parent3bfae53babbaeebbcd49c9b699e6fd350b2dc1f7 (diff)
downloadmariadb-git-08ffa2988de9cb8e672cc5e9977755ed791e1ea3.tar.gz
Moved event category match functionality into mgmapi
Removed grep introduced bogus mgm call BitKeeper/deleted/.del-LogLevel.cpp~314a6bada2df40a8: Delete: ndb/src/common/debugger/LogLevel.cpp ndb/include/debugger/EventLogger.hpp: Removed match functionality and put into mgmapi ndb/include/kernel/LogLevel.hpp: Update LogLevel ndb/include/mgmapi/mgmapi_config_parameters.h: fix parameter ndb/src/common/debugger/EventLogger.cpp: Removed match functionality and put into mgmapi ndb/src/common/debugger/Makefile.am: removed LogLevel.cpp ndb/src/cw/cpcd/APIService.cpp: compiler warning ndb/src/cw/cpcd/CPCD.cpp: compiler warning ndb/src/cw/cpcd/CPCD.hpp: compiler warning ndb/src/cw/cpcd/main.cpp: compiler warning ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp: Changed name of config parameter ndb/src/kernel/vm/Configuration.cpp: Changed name of config parameter
-rw-r--r--ndb/include/debugger/EventLogger.hpp33
-rw-r--r--ndb/include/kernel/LogLevel.hpp82
-rw-r--r--ndb/include/mgmapi/mgmapi.h48
-rw-r--r--ndb/include/mgmapi/mgmapi_config_parameters.h25
-rw-r--r--ndb/src/common/debugger/EventLogger.cpp55
-rw-r--r--ndb/src/common/debugger/LogLevel.cpp30
-rw-r--r--ndb/src/common/debugger/Makefile.am2
-rw-r--r--ndb/src/cw/cpcd/APIService.cpp12
-rw-r--r--ndb/src/cw/cpcd/CPCD.cpp2
-rw-r--r--ndb/src/cw/cpcd/CPCD.hpp2
-rw-r--r--ndb/src/cw/cpcd/main.cpp8
-rw-r--r--ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp2
-rw-r--r--ndb/src/kernel/vm/Configuration.cpp2
-rw-r--r--ndb/src/mgmapi/mgmapi.cpp52
-rw-r--r--ndb/src/mgmclient/CommandInterpreter.cpp144
-rw-r--r--ndb/src/mgmsrv/CommandInterpreter.cpp10
-rw-r--r--ndb/src/mgmsrv/MgmtSrvr.cpp2
-rw-r--r--ndb/src/mgmsrv/Services.cpp58
-rwxr-xr-xndb/test/run-test/atrt-mysql-test-run2
19 files changed, 207 insertions, 364 deletions
diff --git a/ndb/include/debugger/EventLogger.hpp b/ndb/include/debugger/EventLogger.hpp
index 36cece6f22a..9a624559d16 100644
--- a/ndb/include/debugger/EventLogger.hpp
+++ b/ndb/include/debugger/EventLogger.hpp
@@ -34,39 +34,6 @@ public:
LogLevel m_logLevel;
/**
- * Find a category matching the string
- *
- * @param str string to match.
- * @param cat the event category.
- * @param exactMatch only do exact matching.
- *
- * @return TRUE if match is found, then cat is modified
- * FALSE if match is not found
- */
- static bool matchEventCategory(const char * str,
- LogLevel::EventCategory * cat,
- bool exactMatch = false);
-
- /**
- * Returns category name or NULL if not found.
- *
- * @param cat the event category.
- * @return category name.
- */
- static const char * getEventCategoryName(LogLevel::EventCategory cat);
-
- /**
- * Specifies allowed event categories/log levels.
- */
- struct EventCategoryName {
- LogLevel::EventCategory category;
- const char * name;
- };
-
- static const EventCategoryName eventCategoryNames[];
- static const Uint32 noOfEventCategoryNames;
-
- /**
* This matrix defines which event should be printed when
*
* threshold - is in range [0-15]
diff --git a/ndb/include/kernel/LogLevel.hpp b/ndb/include/kernel/LogLevel.hpp
index e3a81263dcb..21450917f03 100644
--- a/ndb/include/kernel/LogLevel.hpp
+++ b/ndb/include/kernel/LogLevel.hpp
@@ -45,81 +45,29 @@ public:
* Copy operator
*/
LogLevel & operator= (const LogLevel &);
-
- static const Uint32 MIN_LOGLEVEL_ID = CFG_LOGLEVEL_STARTUP;
-
- enum EventCategory {
- /**
- * Events during all kind of startups
- */
- llStartUp = CFG_LOGLEVEL_STARTUP - MIN_LOGLEVEL_ID,
-
- /**
- * Events during shutdown
- */
- llShutdown = CFG_LOGLEVEL_SHUTDOWN - MIN_LOGLEVEL_ID,
-
- /**
- * Transaction statistics
- * Job level
- * TCP/IP speed
- */
- llStatistic = CFG_LOGLEVEL_STATISTICS - MIN_LOGLEVEL_ID,
-
- /**
- * Checkpoints
- */
- llCheckpoint = CFG_LOGLEVEL_CHECKPOINT - MIN_LOGLEVEL_ID,
-
- /**
- * Events during node restart
- */
- llNodeRestart = CFG_LOGLEVEL_NODERESTART - MIN_LOGLEVEL_ID,
-
- /**
- * Events related to connection / communication
- */
- llConnection = CFG_LOGLEVEL_CONNECTION - MIN_LOGLEVEL_ID,
-
- /**
- * Assorted event w.r.t unexpected happenings
- */
- llError = CFG_LOGLEVEL_ERROR - MIN_LOGLEVEL_ID,
-
- /**
- * Assorted event w.r.t warning
- */
- llWarning = CFG_LOGLEVEL_WARNING - MIN_LOGLEVEL_ID,
-
- /**
- * Assorted event w.r.t information
- */
- llInfo = CFG_LOGLEVEL_INFO - MIN_LOGLEVEL_ID,
-
- /**
- * Events related to global replication
- */
- llGrep = CFG_LOGLEVEL_GREP - MIN_LOGLEVEL_ID
- };
- struct LogLevelCategoryName {
- const char* name;
+ enum EventCategory {
+ llStartUp = CFG_LOGLEVEL_STARTUP - CFG_MIN_LOGLEVEL,
+ llShutdown = CFG_LOGLEVEL_SHUTDOWN - CFG_MIN_LOGLEVEL,
+ llStatistic = CFG_LOGLEVEL_STATISTICS - CFG_MIN_LOGLEVEL,
+ llCheckpoint = CFG_LOGLEVEL_CHECKPOINT - CFG_MIN_LOGLEVEL,
+ llNodeRestart = CFG_LOGLEVEL_NODERESTART - CFG_MIN_LOGLEVEL,
+ llConnection = CFG_LOGLEVEL_CONNECTION - CFG_MIN_LOGLEVEL,
+ llInfo = CFG_LOGLEVEL_INFO - CFG_MIN_LOGLEVEL,
+ llWarning = CFG_LOGLEVEL_WARNING - CFG_MIN_LOGLEVEL,
+ llError = CFG_LOGLEVEL_ERROR - CFG_MIN_LOGLEVEL,
+ llGrep = CFG_LOGLEVEL_GREP - CFG_MIN_LOGLEVEL,
+ llDebug = CFG_LOGLEVEL_DEBUG - CFG_MIN_LOGLEVEL,
};
/**
- * Log/event level category names. Remember to update the names whenever
- * a new category is added.
- */
- static const LogLevelCategoryName LOGLEVEL_CATEGORY_NAME[];
-
- /**
* No of categories
*/
-#define _LOGLEVEL_CATEGORIES 10
+#define _LOGLEVEL_CATEGORIES (CFG_MAX_LOGLEVEL - CFG_MIN_LOGLEVEL + 1);
static const Uint32 LOGLEVEL_CATEGORIES = _LOGLEVEL_CATEGORIES;
-
+
void clear();
-
+
/**
* Note level is valid as 0-15
*/
diff --git a/ndb/include/mgmapi/mgmapi.h b/ndb/include/mgmapi/mgmapi.h
index 9caf1c86c4d..53f2c118156 100644
--- a/ndb/include/mgmapi/mgmapi.h
+++ b/ndb/include/mgmapi/mgmapi.h
@@ -254,19 +254,34 @@ extern "C" {
* Log categories
*/
enum ndb_mgm_event_category {
- NDB_MGM_EVENT_CATEGORY_STARTUP, ///< Events during all kinds
- ///< of startups
- NDB_MGM_EVENT_CATEGORY_SHUTDOWN, ///< Events during shutdown
- NDB_MGM_EVENT_CATEGORY_STATISTIC, ///< Transaction statistics
- ///< (Job level, TCP/IP speed)
- NDB_MGM_EVENT_CATEGORY_CHECKPOINT, ///< Checkpoints
- NDB_MGM_EVENT_CATEGORY_NODE_RESTART, ///< Events during node restart
- NDB_MGM_EVENT_CATEGORY_CONNECTION, ///< Events related to connection
- ///< and communication
- NDB_MGM_EVENT_CATEGORY_ERROR ///< Assorted event w.r.t.
- ///< unexpected happenings
+ NDB_MGM_ILLEGAL_EVENT_CATEGORY = -1, ///< Invalid
+ /**
+ * Events during all kinds of startups
+ */
+ NDB_MGM_EVENT_CATEGORY_STARTUP = CFG_LOGLEVEL_STARTUP,
+
+ /**
+ * Events during shutdown
+ */
+ NDB_MGM_EVENT_CATEGORY_SHUTDOWN = CFG_LOGLEVEL_SHUTDOWN,
+
+ /**
+ * Transaction statistics (Job level, TCP/IP speed)
+ */
+ NDB_MGM_EVENT_CATEGORY_STATISTIC = CFG_LOGLEVEL_STATISTICS,
+ NDB_MGM_EVENT_CATEGORY_CHECKPOINT = CFG_LOGLEVEL_CHECKPOINT,
+ NDB_MGM_EVENT_CATEGORY_NODE_RESTART = CFG_LOGLEVEL_NODERESTART,
+ NDB_MGM_EVENT_CATEGORY_CONNECTION = CFG_LOGLEVEL_CONNECTION,
+ NDB_MGM_EVENT_CATEGORY_DEBUG = CFG_LOGLEVEL_DEBUG,
+ NDB_MGM_EVENT_CATEGORY_INFO = CFG_LOGLEVEL_INFO,
+ NDB_MGM_EVENT_CATEGORY_WARNING = CFG_LOGLEVEL_WARNING,
+ NDB_MGM_EVENT_CATEGORY_ERROR = CFG_LOGLEVEL_ERROR,
+ NDB_MGM_EVENT_CATEGORY_GREP = CFG_LOGLEVEL_GREP,
+
+ NDB_MGM_MIN_EVENT_CATEGORY = CFG_MIN_LOGLEVEL,
+ NDB_MGM_MAX_EVENT_CATEGORY = CFG_MAX_LOGLEVEL
};
-
+
/***************************************************************************/
/**
* @name Functions: Error Handling
@@ -402,6 +417,9 @@ extern "C" {
*/
const char * ndb_mgm_get_node_status_string(enum ndb_mgm_node_status status);
+ ndb_mgm_event_category ndb_mgm_match_event_category(const char *);
+ const char * ndb_mgm_get_event_category_string(enum ndb_mgm_event_category);
+
/** @} *********************************************************************/
/**
* @name Functions: State of cluster
@@ -562,8 +580,7 @@ extern "C" {
*/
int ndb_mgm_set_loglevel_clusterlog(NdbMgmHandle handle,
int nodeId,
- /*enum ndb_mgm_event_category category*/
- char * category,
+ enum ndb_mgm_event_category category,
int level,
struct ndb_mgm_reply* reply);
@@ -579,8 +596,7 @@ extern "C" {
*/
int ndb_mgm_set_loglevel_node(NdbMgmHandle handle,
int nodeId,
- /*enum ndb_mgm_event_category category*/
- char * category,
+ enum ndb_mgm_event_category category,
int level,
struct ndb_mgm_reply* reply);
diff --git a/ndb/include/mgmapi/mgmapi_config_parameters.h b/ndb/include/mgmapi/mgmapi_config_parameters.h
index 6b157720f2b..8bd7d1f69f8 100644
--- a/ndb/include/mgmapi/mgmapi_config_parameters.h
+++ b/ndb/include/mgmapi/mgmapi_config_parameters.h
@@ -1,7 +1,6 @@
#ifndef MGMAPI_CONFIG_PARAMTERS_H
#define MGMAPI_CONFIG_PARAMTERS_H
-
#define CFG_SYS_NAME 3
#define CFG_SYS_PRIMARY_MGM_NODE 1
#define CFG_SYS_CONFIG_GENERATION 2
@@ -64,16 +63,6 @@
#define CFG_DB_BACKUP_LOG_BUFFER_MEM 135
#define CFG_DB_BACKUP_WRITE_SIZE 136
-#define CFG_LOGLEVEL_STARTUP 137
-#define CFG_LOGLEVEL_SHUTDOWN 138
-#define CFG_LOGLEVEL_STATISTICS 139
-#define CFG_LOGLEVEL_CHECKPOINT 140
-#define CFG_LOGLEVEL_NODERESTART 141
-#define CFG_LOGLEVEL_CONNECTION 142
-#define CFG_LOGLEVEL_INFO 143
-#define CFG_LOGLEVEL_WARNING 144
-#define CFG_LOGLEVEL_ERROR 145
-#define CFG_LOGLEVEL_GREP 146
#define CFG_LOG_DESTINATION 147
#define CFG_DB_DISCLESS 148
@@ -95,6 +84,20 @@
#define CFG_NODE_ARBIT_RANK 200
#define CFG_NODE_ARBIT_DELAY 201
+#define CFG_MIN_LOGLEVEL 250
+#define CFG_LOGLEVEL_STARTUP 250
+#define CFG_LOGLEVEL_SHUTDOWN 251
+#define CFG_LOGLEVEL_STATISTICS 252
+#define CFG_LOGLEVEL_CHECKPOINT 253
+#define CFG_LOGLEVEL_NODERESTART 254
+#define CFG_LOGLEVEL_CONNECTION 255
+#define CFG_LOGLEVEL_INFO 256
+#define CFG_LOGLEVEL_WARNING 257
+#define CFG_LOGLEVEL_ERROR 258
+#define CFG_LOGLEVEL_GREP 259
+#define CFG_LOGLEVEL_DEBUG 260
+#define CFG_MAX_LOGLEVEL 260
+
#define CFG_MGM_PORT 300
#define CFG_CONNECTION_NODE_1 400
diff --git a/ndb/src/common/debugger/EventLogger.cpp b/ndb/src/common/debugger/EventLogger.cpp
index 2e818c04e02..bd066e65c94 100644
--- a/ndb/src/common/debugger/EventLogger.cpp
+++ b/ndb/src/common/debugger/EventLogger.cpp
@@ -113,26 +113,6 @@ const EventLoggerBase::EventRepLogLevelMatrix EventLoggerBase::matrix[] = {
const Uint32 EventLoggerBase::matrixSize = sizeof(EventLoggerBase::matrix)/
sizeof(EventRepLogLevelMatrix);
-/**
- * Specifies allowed event categories/log levels that can be set from
- * the Management API/interactive shell.
- */
-const EventLoggerBase::EventCategoryName
-EventLoggerBase::eventCategoryNames[] = {
- { LogLevel::llStartUp, "STARTUP" },
- { LogLevel::llStatistic, "STATISTICS" },
- { LogLevel::llCheckpoint, "CHECKPOINT" },
- { LogLevel::llNodeRestart, "NODERESTART" },
- { LogLevel::llConnection, "CONNECTION" },
- { LogLevel::llInfo, "INFO" },
- { LogLevel::llGrep, "GREP" }
-};
-
-const Uint32
-EventLoggerBase::noOfEventCategoryNames =
- sizeof(EventLoggerBase::eventCategoryNames)/
- sizeof(EventLoggerBase::EventCategoryName);
-
const char*
EventLogger::getText(char * m_text, size_t m_text_len,
int type,
@@ -1287,41 +1267,6 @@ EventLogger::getText(char * m_text, size_t m_text_len,
return m_text;
}
-bool
-EventLoggerBase::matchEventCategory(const char * str,
- LogLevel::EventCategory * cat,
- bool exactMatch){
- unsigned i;
- if(cat == 0 || str == 0)
- return false;
-
- char * tmp = strdup(str);
- for(i = 0; i<strlen(tmp); i++)
- tmp[i] = toupper(tmp[i]);
-
- for(i = 0; i<noOfEventCategoryNames; i++){
- if(strcmp(tmp, eventCategoryNames[i].name) == 0){
- * cat = eventCategoryNames[i].category;
- free(tmp);
- return true;
- }
- }
- free(tmp);
- return false;
-}
-
-const char *
-EventLoggerBase::getEventCategoryName(LogLevel::EventCategory cat){
-
- for(unsigned i = 0; i<noOfEventCategoryNames; i++){
- if(cat == eventCategoryNames[i].category){
- return eventCategoryNames[i].name;
- }
- }
- return 0;
-}
-
-
EventLogger::EventLogger() : m_filterLevel(15)
{
setCategory("EventLogger");
diff --git a/ndb/src/common/debugger/LogLevel.cpp b/ndb/src/common/debugger/LogLevel.cpp
deleted file mode 100644
index f9e2f318432..00000000000
--- a/ndb/src/common/debugger/LogLevel.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-/* 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 <LogLevel.hpp>
-
-const LogLevel::LogLevelCategoryName LogLevel::LOGLEVEL_CATEGORY_NAME[] = {
- { "LogLevelStartup" },
- { "LogLevelShutdown" },
- { "LogLevelStatistic" },
- { "LogLevelCheckpoint" },
- { "LogLevelNodeRestart" },
- { "LogLevelConnection" },
- { "LogLevelError" },
- { "LogLevelWarning" },
- { "LogLevelInfo" },
- { "LogLevelGrep" }
-};
diff --git a/ndb/src/common/debugger/Makefile.am b/ndb/src/common/debugger/Makefile.am
index 0278d0d2ba0..d0fb30717cd 100644
--- a/ndb/src/common/debugger/Makefile.am
+++ b/ndb/src/common/debugger/Makefile.am
@@ -2,7 +2,7 @@ SUBDIRS = signaldata
noinst_LTLIBRARIES = libtrace.la
-libtrace_la_SOURCES = SignalLoggerManager.cpp DebuggerNames.cpp BlockNames.cpp LogLevel.cpp EventLogger.cpp GrepError.cpp
+libtrace_la_SOURCES = SignalLoggerManager.cpp DebuggerNames.cpp BlockNames.cpp EventLogger.cpp GrepError.cpp
include $(top_srcdir)/ndb/config/common.mk.am
include $(top_srcdir)/ndb/config/type_kernel.mk.am
diff --git a/ndb/src/cw/cpcd/APIService.cpp b/ndb/src/cw/cpcd/APIService.cpp
index 46b043c7004..de0e40cebfc 100644
--- a/ndb/src/cw/cpcd/APIService.cpp
+++ b/ndb/src/cw/cpcd/APIService.cpp
@@ -47,7 +47,7 @@
ParserRow<CPCDAPISession>::IgnoreMinMax, \
0, 0, \
fun, \
- desc }
+ desc, 0 }
#define CPCD_ARG(name, type, opt, desc) \
{ name, \
@@ -58,7 +58,7 @@
ParserRow<CPCDAPISession>::IgnoreMinMax, \
0, 0, \
0, \
- desc }
+ desc, 0 }
#define CPCD_ARG2(name, type, opt, min, max, desc) \
{ name, \
@@ -69,7 +69,7 @@
ParserRow<CPCDAPISession>::IgnoreMinMax, \
min, max, \
0, \
- desc }
+ desc, 0 }
#define CPCD_END() \
{ 0, \
@@ -80,7 +80,7 @@
ParserRow<CPCDAPISession>::IgnoreMinMax, \
0, 0, \
0, \
- 0 }
+ 0, 0 }
#define CPCD_CMD_ALIAS(name, realName, fun) \
{ name, \
@@ -91,7 +91,7 @@
ParserRow<CPCDAPISession>::IgnoreMinMax, \
0, 0, \
0, \
- 0 }
+ 0, 0 }
#define CPCD_ARG_ALIAS(name, realName, fun) \
{ name, \
@@ -102,7 +102,7 @@
ParserRow<CPCDAPISession>::IgnoreMinMax, \
0, 0, \
0, \
- 0 }
+ 0, 0 }
const
ParserRow<CPCDAPISession> commands[] =
diff --git a/ndb/src/cw/cpcd/CPCD.cpp b/ndb/src/cw/cpcd/CPCD.cpp
index 44db10422b9..bc9f350755f 100644
--- a/ndb/src/cw/cpcd/CPCD.cpp
+++ b/ndb/src/cw/cpcd/CPCD.cpp
@@ -378,7 +378,7 @@ CPCD::getProcessList() {
}
void
-CPCD::RequestStatus::err(enum RequestStatusCode status, char *msg) {
+CPCD::RequestStatus::err(enum RequestStatusCode status, const char *msg) {
m_status = status;
snprintf(m_errorstring, sizeof(m_errorstring), "%s", msg);
}
diff --git a/ndb/src/cw/cpcd/CPCD.hpp b/ndb/src/cw/cpcd/CPCD.hpp
index 4a7cab23bab..a5c0bef1dac 100644
--- a/ndb/src/cw/cpcd/CPCD.hpp
+++ b/ndb/src/cw/cpcd/CPCD.hpp
@@ -91,7 +91,7 @@ public:
RequestStatus() { m_status = OK; m_errorstring[0] = '\0'; };
/** @brief Sets an errorcode and a printable message */
- void err(enum RequestStatusCode, char *);
+ void err(enum RequestStatusCode, const char *);
/** @brief Returns the error message */
char *getErrMsg() { return m_errorstring; };
diff --git a/ndb/src/cw/cpcd/main.cpp b/ndb/src/cw/cpcd/main.cpp
index 913c31de1f7..207b81bfa89 100644
--- a/ndb/src/cw/cpcd/main.cpp
+++ b/ndb/src/cw/cpcd/main.cpp
@@ -28,12 +28,12 @@
#include "common.hpp"
-static char *work_dir = CPCD_DEFAULT_WORK_DIR;
+static const char *work_dir = CPCD_DEFAULT_WORK_DIR;
static int port = CPCD_DEFAULT_TCP_PORT;
static int use_syslog = 0;
-static char *logfile = NULL;
-static char *config_file = CPCD_DEFAULT_CONFIG_FILE;
-static char *user = 0;
+static const char *logfile = NULL;
+static const char *config_file = CPCD_DEFAULT_CONFIG_FILE;
+static const char *user = 0;
static struct getargs args[] = {
{ "work-dir", 'w', arg_string, &work_dir,
diff --git a/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp b/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp
index fff6c734bd3..4c8d82c9e2e 100644
--- a/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp
+++ b/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp
@@ -97,7 +97,7 @@ Cmvmi::Cmvmi(const Configuration & conf) :
const ndb_mgm_configuration_iterator * db = theConfig.getOwnConfigIterator();
for(unsigned j = 0; j<LogLevel::LOGLEVEL_CATEGORIES; j++){
Uint32 logLevel;
- if(!ndb_mgm_get_int_parameter(db, LogLevel::MIN_LOGLEVEL_ID+j, &logLevel)){
+ if(!ndb_mgm_get_int_parameter(db, CFG_MIN_LOGLEVEL+j, &logLevel)){
clogLevel.setLogLevel((LogLevel::EventCategory)j,
logLevel);
}
diff --git a/ndb/src/kernel/vm/Configuration.cpp b/ndb/src/kernel/vm/Configuration.cpp
index c0015172512..06c6aa1e73c 100644
--- a/ndb/src/kernel/vm/Configuration.cpp
+++ b/ndb/src/kernel/vm/Configuration.cpp
@@ -503,7 +503,7 @@ Configuration::calcSizeAlt(ConfigValues * ownConfig){
for(unsigned j = 0; j<LogLevel::LOGLEVEL_CATEGORIES; j++){
Uint32 tmp;
- if(!ndb_mgm_get_int_parameter(&db, LogLevel::MIN_LOGLEVEL_ID+j, &tmp)){
+ if(!ndb_mgm_get_int_parameter(&db, CFG_MIN_LOGLEVEL+j, &tmp)){
m_logLevel->setLogLevel((LogLevel::EventCategory)j, tmp);
}
}
diff --git a/ndb/src/mgmapi/mgmapi.cpp b/ndb/src/mgmapi/mgmapi.cpp
index 08b83a8d750..c036089526d 100644
--- a/ndb/src/mgmapi/mgmapi.cpp
+++ b/ndb/src/mgmapi/mgmapi.cpp
@@ -954,13 +954,51 @@ struct ndb_mgm_event_categories
{
const char* name;
enum ndb_mgm_event_category category;
+} categories[] = {
+ { "STARTUP", NDB_MGM_EVENT_CATEGORY_STARTUP },
+ { "SHUTDOWN", NDB_MGM_EVENT_CATEGORY_SHUTDOWN },
+ { "STATISTICS", NDB_MGM_EVENT_CATEGORY_STATISTIC },
+ { "NODERESTART", NDB_MGM_EVENT_CATEGORY_NODE_RESTART },
+ { "CONNECTION", NDB_MGM_EVENT_CATEGORY_CONNECTION },
+ { "CHECKPOINT", NDB_MGM_EVENT_CATEGORY_CHECKPOINT },
+ { "DEBUG", NDB_MGM_EVENT_CATEGORY_DEBUG },
+ { "INFO", NDB_MGM_EVENT_CATEGORY_INFO },
+ { "ERROR", NDB_MGM_EVENT_CATEGORY_ERROR },
+ { "GREP", NDB_MGM_EVENT_CATEGORY_GREP },
+ { 0, NDB_MGM_ILLEGAL_EVENT_CATEGORY }
};
extern "C"
+ndb_mgm_event_category
+ndb_mgm_match_event_category(const char * status)
+{
+ if(status == 0)
+ return NDB_MGM_ILLEGAL_EVENT_CATEGORY;
+
+ for(int i = 0; categories[i].name !=0 ; i++)
+ if(strcmp(status, categories[i].name) == 0)
+ return categories[i].category;
+
+ return NDB_MGM_ILLEGAL_EVENT_CATEGORY;
+}
+
+extern "C"
+const char *
+ndb_mgm_get_event_category_string(enum ndb_mgm_event_category status)
+{
+ int i;
+ for(i = 0; categories[i].name != 0; i++)
+ if(categories[i].category == status)
+ return categories[i].name;
+
+ return 0;
+}
+
+extern "C"
int
ndb_mgm_set_loglevel_clusterlog(NdbMgmHandle handle, int nodeId,
- /*enum ndb_mgm_event_category*/
- char * category, int level,
+ enum ndb_mgm_event_category cat,
+ int level,
struct ndb_mgm_reply* /*reply*/)
{
SET_ERROR(handle, NDB_MGM_NO_ERROR,
@@ -975,14 +1013,14 @@ ndb_mgm_set_loglevel_clusterlog(NdbMgmHandle handle, int nodeId,
Properties args;
args.put("node", nodeId);
- args.put("category", category);
+ args.put("category", cat);
args.put("level", level);
-
+
const Properties *reply;
reply = ndb_mgm_call(handle, clusterlog_reply,
"set cluster loglevel", &args);
CHECK_REPLY(reply, -1);
-
+
BaseString result;
reply->get("result", result);
if(strcmp(result.c_str(), "Ok") != 0) {
@@ -997,8 +1035,8 @@ ndb_mgm_set_loglevel_clusterlog(NdbMgmHandle handle, int nodeId,
extern "C"
int
ndb_mgm_set_loglevel_node(NdbMgmHandle handle, int nodeId,
- /*enum ndb_mgm_event_category category*/
- char * category, int level,
+ enum ndb_mgm_event_category category,
+ int level,
struct ndb_mgm_reply* /*reply*/)
{
SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_set_loglevel_node");
diff --git a/ndb/src/mgmclient/CommandInterpreter.cpp b/ndb/src/mgmclient/CommandInterpreter.cpp
index ba8e93edde9..816a84375f1 100644
--- a/ndb/src/mgmclient/CommandInterpreter.cpp
+++ b/ndb/src/mgmclient/CommandInterpreter.cpp
@@ -611,9 +611,9 @@ CommandInterpreter::executeHelp(char* parameters)
<< endl;
ndbout << "<category> = ";
- for(Uint32 i = 0; i<EventLogger::noOfEventCategoryNames; i++){
- ndbout << EventLogger::eventCategoryNames[i].name;
- if (i < EventLogger::noOfEventCategoryNames - 1) {
+ for(int i = 0; i<CFG_MIN_LOGLEVEL; i++){
+ ndbout << ndb_mgm_get_event_category_string((ndb_mgm_event_category)i);
+ if (i < CFG_MIN_LOGLEVEL - 1) {
ndbout << " | ";
}
}
@@ -1247,55 +1247,40 @@ CommandInterpreter::executeLogLevel(int processId, const char* parameters,
{
connect();
(void) all;
- (void) parameters;
- SetLogLevelOrd logLevel; logLevel.clear();
- LogLevel::EventCategory cat;
- int level;
- if (emptyString(parameters) || (strcmp(parameters, "ALL") == 0)) {
- for(Uint32 i = 0; i<EventLogger::noOfEventCategoryNames; i++)
- logLevel.setLogLevel(EventLogger::eventCategoryNames[i].category, 7);
- } else {
-
- char * tmpString = strdup(parameters);
- char * tmpPtr = 0;
- char * item = strtok_r(tmpString, ", ", &tmpPtr);
- while(item != NULL){
- char categoryTxt[255];
- const int m = sscanf(item, "%[^=]=%d", categoryTxt, &level);
- if(m != 2){
- free(tmpString);
- ndbout << "Invalid loglevel specification category=level" << endl;
- return;
- }
+ BaseString tmp(parameters);
+ Vector<BaseString> spec;
+ tmp.split(spec, "=");
+ if(spec.size() != 2){
+ ndbout << "Invalid loglevel specification: " << parameters << endl;
+ return;
+ }
- if(!EventLogger::matchEventCategory(categoryTxt,
- &cat)){
- ndbout << "Invalid loglevel specification, unknown category: "
- << categoryTxt << endl;
- free(tmpString);
- return ;
- }
- if(level < 0 || level > 15){
- ndbout << "Invalid loglevel specification row, level 0-15" << endl;
- free(tmpString);
- return ;
- }
- logLevel.setLogLevel(cat, level);
-
- item = strtok_r(NULL, ", ", &tmpPtr);
+ spec[0].trim().ndb_toupper();
+ int category = ndb_mgm_match_event_category(spec[0].c_str());
+ if(category == NDB_MGM_ILLEGAL_EVENT_CATEGORY){
+ category = atoi(spec[0].c_str());
+ if(category < NDB_MGM_MIN_EVENT_CATEGORY ||
+ category > NDB_MGM_MAX_EVENT_CATEGORY){
+ ndbout << "Unknown category: \"" << spec[0].c_str() << "\"" << endl;
+ return;
}
- free(tmpString);
}
-
+
+ int level = atoi(spec[1].c_str());
+ if(level < 0 || level > 15){
+ ndbout << "Invalid level: " << spec[1].c_str() << endl;
+ return;
+ }
+
struct ndb_mgm_reply reply;
int result;
result = ndb_mgm_set_loglevel_node(m_mgmsrv,
- processId, // fast fix - pekka
- (char*)EventLogger::getEventCategoryName(cat),
+ processId,
+ (ndb_mgm_event_category)category,
level,
&reply);
-
+
if (result < 0) {
ndbout_c("Executing LOGLEVEL on node %d failed.", processId);
printError();
@@ -1303,7 +1288,7 @@ CommandInterpreter::executeLogLevel(int processId, const char* parameters,
ndbout << "Executing LOGLEVEL on node " << processId << " OK!"
<< endl;
}
-
+
}
//*****************************************************************************
@@ -1633,54 +1618,41 @@ CommandInterpreter::executeEventReporting(int processId,
bool all)
{
connect();
- SetLogLevelOrd logLevel; logLevel.clear();
- char categoryTxt[255];
- int level;
- LogLevel::EventCategory cat;
- if (emptyString(parameters) || (strcmp(parameters, "ALL") == 0)) {
- for(Uint32 i = 0; i<EventLogger::noOfEventCategoryNames; i++)
- logLevel.setLogLevel(EventLogger::eventCategoryNames[i].category, 7);
- } else {
- char * tmpString = strdup(parameters);
- char * tmpPtr = 0;
- char * item = strtok_r(tmpString, ", ", &tmpPtr);
- while(item != NULL){
- const int m = sscanf(item, "%[^=]=%d", categoryTxt, &level);
- if(m != 2){
- free(tmpString);
- ndbout << "Invalid loglevel specification category=level" << endl;
- return;
- }
-
- if(!EventLogger::matchEventCategory(categoryTxt,
- &cat)){
- ndbout << "Invalid loglevel specification, unknown category: "
- << categoryTxt << endl;
- free(tmpString);
- return ;
- }
- if(level < 0 || level > 15){
- ndbout << "Invalid loglevel specification row, level 0-15" << endl;
- free(tmpString);
- return ;
- }
- logLevel.setLogLevel(cat, level);
-
- item = strtok_r(NULL, ", ", &tmpPtr);
+ BaseString tmp(parameters);
+ Vector<BaseString> spec;
+ tmp.split(spec, "=");
+ if(spec.size() != 2){
+ ndbout << "Invalid loglevel specification: " << parameters << endl;
+ return;
+ }
+
+ spec[0].trim().ndb_toupper();
+ int category = ndb_mgm_match_event_category(spec[0].c_str());
+ if(category == NDB_MGM_ILLEGAL_EVENT_CATEGORY){
+ category = atoi(spec[0].c_str());
+ if(category < NDB_MGM_MIN_EVENT_CATEGORY ||
+ category > NDB_MGM_MAX_EVENT_CATEGORY){
+ ndbout << "Unknown category: \"" << spec[0].c_str() << "\"" << endl;
+ return;
}
- free(tmpString);
}
+
+ int level = atoi(spec[1].c_str());
+ if(level < 0 || level > 15){
+ ndbout << "Invalid level: " << spec[1].c_str() << endl;
+ return;
+ }
+
+
struct ndb_mgm_reply reply;
int result;
- result =
- ndb_mgm_set_loglevel_clusterlog(m_mgmsrv,
- processId, // fast fix - pekka
- (char*)
- EventLogger::getEventCategoryName(cat),
- level,
- &reply);
+ result = ndb_mgm_set_loglevel_clusterlog(m_mgmsrv,
+ processId, // fast fix - pekka
+ (ndb_mgm_event_category)category,
+ level,
+ &reply);
if (result != 0) {
ndbout_c("Executing CLUSTERLOG on node %d failed", processId);
diff --git a/ndb/src/mgmsrv/CommandInterpreter.cpp b/ndb/src/mgmsrv/CommandInterpreter.cpp
index 8388c012e55..2c2aeda21ed 100644
--- a/ndb/src/mgmsrv/CommandInterpreter.cpp
+++ b/ndb/src/mgmsrv/CommandInterpreter.cpp
@@ -52,7 +52,7 @@ static const char* helpTexts[] = {
"{<id>|ALL} CLUSTERLOG {<category>=<level>}+ Set log level for cluster log",
"QUIT Quit management server",
};
-static const int noOfHelpTexts = sizeof(helpTexts)/sizeof(const char*);
+static const unsigned noOfHelpTexts = sizeof(helpTexts)/sizeof(const char*);
static const char* helpTextShow =
"SHOW prints NDB Cluster information\n\n"
@@ -389,14 +389,14 @@ void CommandInterpreter::executeHelp(char* parameters) {
<< endl;
ndbout << "<category> = ";
- for(i = 0; i<EventLoggerBase::noOfEventCategoryNames; i++){
- ndbout << EventLoggerBase::eventCategoryNames[i].name;
- if (i < EventLoggerBase::noOfEventCategoryNames - 1) {
+ for(i = 0; i<CFG_MIN_LOGLEVEL; i++){
+ ndbout << ndb_mgm_get_event_category_string((ndb_mgm_event_category)i);
+ if (i < CFG_MIN_LOGLEVEL - 1) {
ndbout << " | ";
}
}
ndbout << endl;
-
+
ndbout << "<level> = " << "0 - 15"
<< endl;
diff --git a/ndb/src/mgmsrv/MgmtSrvr.cpp b/ndb/src/mgmsrv/MgmtSrvr.cpp
index 7c2298d4773..232c0c7bb78 100644
--- a/ndb/src/mgmsrv/MgmtSrvr.cpp
+++ b/ndb/src/mgmsrv/MgmtSrvr.cpp
@@ -611,7 +611,7 @@ MgmtSrvr::MgmtSrvr(NodeId nodeId,
{
MgmStatService::StatListener se;
se.m_socket = -1;
- for(size_t t = 0; t<_LOGLEVEL_CATEGORIES; t++)
+ for(size_t t = 0; t<LogLevel::LOGLEVEL_CATEGORIES; t++)
se.m_logLevel.setLogLevel((LogLevel::EventCategory)t, 7);
se.m_logLevel.setLogLevel(LogLevel::llError, 15);
m_statisticsListner.m_clients.push_back(se);
diff --git a/ndb/src/mgmsrv/Services.cpp b/ndb/src/mgmsrv/Services.cpp
index 942e72f3d68..7634a68e3df 100644
--- a/ndb/src/mgmsrv/Services.cpp
+++ b/ndb/src/mgmsrv/Services.cpp
@@ -763,12 +763,12 @@ MgmApiSession::bye(Parser<MgmApiSession>::Context &,
void
MgmApiSession::setClusterLogLevel(Parser<MgmApiSession>::Context &,
Properties const &args) {
- Uint32 node, level;
- BaseString categoryName, errorString;
+ Uint32 node, level, category;
+ BaseString errorString;
SetLogLevelOrd logLevel;
int result;
args.get("node", &node);
- args.get("category", categoryName);
+ args.get("category", &category);
args.get("level", &level);
/* XXX should use constants for this value */
@@ -777,26 +777,18 @@ MgmApiSession::setClusterLogLevel(Parser<MgmApiSession>::Context &,
goto error;
}
- categoryName.ndb_toupper();
-
- LogLevel::EventCategory category;
- if(!EventLogger::matchEventCategory(categoryName.c_str(), &category)) {
- errorString.assign("Unknown category");
- goto error;
- }
-
EventSubscribeReq req;
req.blockRef = 0;
req.noOfEntries = 1;
req.theCategories[0] = category;
req.theLevels[0] = level;
m_mgmsrv.m_log_level_requests.push_back(req);
-
+
m_output->println("set cluster loglevel reply");
m_output->println("result: Ok");
m_output->println("");
return;
- error:
+error:
m_output->println("set cluster loglevel reply");
m_output->println("result: %s", errorString.c_str());
m_output->println("");
@@ -805,13 +797,13 @@ MgmApiSession::setClusterLogLevel(Parser<MgmApiSession>::Context &,
void
MgmApiSession::setLogLevel(Parser<MgmApiSession>::Context &,
Properties const &args) {
- Uint32 node = 0, level = 0;
- BaseString categoryName, errorString;
+ Uint32 node = 0, level = 0, category;
+ BaseString errorString;
SetLogLevelOrd logLevel;
int result;
logLevel.clear();
args.get("node", &node);
- args.get("category", categoryName);
+ args.get("category", &category);
args.get("level", &level);
/* XXX should use constants for this value */
@@ -820,14 +812,6 @@ MgmApiSession::setLogLevel(Parser<MgmApiSession>::Context &,
goto error;
}
- categoryName.ndb_toupper();
-
- LogLevel::EventCategory category;
- if(!EventLogger::matchEventCategory(categoryName.c_str(), &category)) {
- errorString.assign("Unknown category");
- goto error;
- }
-
EventSubscribeReq req;
req.blockRef = node;
req.noOfEntries = 1;
@@ -1259,7 +1243,7 @@ NdbOut&
operator<<(NdbOut& out, const LogLevel & ll)
{
out << "[LogLevel: ";
- for(size_t i = 0; i<_LOGLEVEL_CATEGORIES; i++)
+ for(size_t i = 0; i<LogLevel::LOGLEVEL_CATEGORIES; i++)
out << ll.getLogLevel((LogLevel::EventCategory)i) << " ";
out << "]";
}
@@ -1390,24 +1374,26 @@ MgmApiSession::listen_event(Parser<MgmApiSession>::Context & ctx,
result = -1;
goto done;
}
-
- spec[0].trim();
- spec[0].ndb_toupper();
-
- LogLevel::EventCategory category;
- if(!EventLogger::matchEventCategory(spec[0].c_str(), &category)) {
- msg.appfmt("Unknown category: >%s<", spec[0].c_str());
- result = -1;
- goto done;
- }
+ spec[0].trim().ndb_toupper();
+ int category = ndb_mgm_match_event_category(spec[0].c_str());
+ if(category == NDB_MGM_ILLEGAL_EVENT_CATEGORY){
+ category = atoi(spec[0].c_str());
+ if(category < NDB_MGM_MIN_EVENT_CATEGORY ||
+ category > NDB_MGM_MAX_EVENT_CATEGORY){
+ msg.appfmt("Unknown category: >%s<", spec[0].c_str());
+ result = -1;
+ goto done;
+ }
+ }
+
int level = atoi(spec[1].c_str());
if(level < 0 || level > 15){
msg.appfmt("Invalid level: >%s<", spec[1].c_str());
result = -1;
goto done;
}
- le.m_logLevel.setLogLevel(category, level);
+ le.m_logLevel.setLogLevel((LogLevel::EventCategory)category, level);
}
if(list.size() == 0){
diff --git a/ndb/test/run-test/atrt-mysql-test-run b/ndb/test/run-test/atrt-mysql-test-run
index e36fe1f3882..75482f4b4a7 100755
--- a/ndb/test/run-test/atrt-mysql-test-run
+++ b/ndb/test/run-test/atrt-mysql-test-run
@@ -16,5 +16,3 @@ fi
echo "NDBT_ProgramExit: Failed"
exit 1
-
-