Commit 9ec0095e authored by unknown's avatar unknown

updated ndb_mgm test

    removed grep event and added congestion event
   more docs
    changed some naming, expecially regarding severities
    added config param for logevel for congestion


mysql-test/ndb/basic.result:
  updated ndb_mgm test
mysql-test/ndb/restart.test:
  updated ndb_mgm test
ndb/include/kernel/LogLevel.hpp:
  removed grep event and added congestion event
ndb/include/mgmapi/mgmapi.h:
  more docs
  changed some naming, expecially regarding severities
ndb/include/mgmapi/mgmapi_config_parameters.h:
  removed grep event and added congestion event
ndb/src/common/debugger/EventLogger.cpp:
  removed grep event and added congestion event
ndb/src/mgmapi/mgmapi.cpp:
  changed some naming, expecially regarding severities
ndb/src/mgmsrv/ConfigInfo.cpp:
  added config param for logevel for congestion
ndb/src/mgmsrv/Services.cpp:
  just som variable name changes
parent 3c7b8815
...@@ -26,17 +26,17 @@ CONNECT [<connectstring>] Connect to management server (reconnect i ...@@ -26,17 +26,17 @@ CONNECT [<connectstring>] Connect to management server (reconnect i
QUIT Quit management client QUIT Quit management client
<severity> = ALERT | CRITICAL | ERROR | WARNING | INFO | DEBUG <severity> = ALERT | CRITICAL | ERROR | WARNING | INFO | DEBUG
<category> = STARTUP | SHUTDOWN | STATISTICS | CHECKPOINT | NODERESTART | CONNECTION | INFO | ERROR | GREP | DEBUG | BACKUP <category> = STARTUP | SHUTDOWN | STATISTICS | CHECKPOINT | NODERESTART | CONNECTION | INFO | ERROR | CONGESTION | DEBUG | BACKUP
<level> = 0 - 15 <level> = 0 - 15
<id> = ALL | Any database node id <id> = ALL | Any database node id
Connected to Management Server at: localhost:1186 Connected to Management Server at: localhost:1186
Node 1: started (Version 4.1.9) Node 1: started (Version 5.0.3)
Node 2: started (Version 4.1.9) Node 2: started (Version 5.0.3)
Node 1: started (Version 4.1.9) Node 1: started (Version 5.0.3)
Node 2: started (Version 4.1.9) Node 2: started (Version 5.0.3)
Executing CLUSTERLOG on node 1 OK! Executing CLUSTERLOG on node 1 OK!
Executing CLUSTERLOG on node 2 OK! Executing CLUSTERLOG on node 2 OK!
......
...@@ -8,5 +8,5 @@ sleep 5 ...@@ -8,5 +8,5 @@ sleep 5
all clusterlog connection=8 all clusterlog connection=8
sleep 1 sleep 1
1 restart 1 restart
sleep 5 sleep 10
clusterlog on all clusterlog on all
...@@ -57,7 +57,7 @@ public: ...@@ -57,7 +57,7 @@ public:
llInfo = CFG_LOGLEVEL_INFO - CFG_MIN_LOGLEVEL, llInfo = CFG_LOGLEVEL_INFO - CFG_MIN_LOGLEVEL,
llWarning = CFG_LOGLEVEL_WARNING - CFG_MIN_LOGLEVEL, llWarning = CFG_LOGLEVEL_WARNING - CFG_MIN_LOGLEVEL,
llError = CFG_LOGLEVEL_ERROR - CFG_MIN_LOGLEVEL, llError = CFG_LOGLEVEL_ERROR - CFG_MIN_LOGLEVEL,
llGrep = CFG_LOGLEVEL_GREP - CFG_MIN_LOGLEVEL, llCongestion = CFG_LOGLEVEL_CONGESTION - CFG_MIN_LOGLEVEL,
llDebug = CFG_LOGLEVEL_DEBUG - CFG_MIN_LOGLEVEL llDebug = CFG_LOGLEVEL_DEBUG - CFG_MIN_LOGLEVEL
,llBackup = CFG_LOGLEVEL_BACKUP - CFG_MIN_LOGLEVEL ,llBackup = CFG_LOGLEVEL_BACKUP - CFG_MIN_LOGLEVEL
}; };
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
* - Control the NDB Cluster log * - Control the NDB Cluster log
* - Perform other administrative tasks * - Perform other administrative tasks
* *
* @section General Concepts * @section secMgmApiGeneral General Concepts
* *
* Each MGM API function needs a management server handle * Each MGM API function needs a management server handle
* of type @ref NdbMgmHandle. * of type @ref NdbMgmHandle.
...@@ -64,6 +64,27 @@ ...@@ -64,6 +64,27 @@
* free((void*)state); * free((void*)state);
* ndb_mgm_destroy_handle(&handle); * ndb_mgm_destroy_handle(&handle);
* @endcode * @endcode
*
* @section secLogEvents Log Events
*
* The database nodes and management server(s) regularly and on specific
* occations report on various log events that occurs in the cluster. These
* log events are written to the cluster log. Optionally a mgmapi client
* may listen to these events by using the method ndb_mgm_listen_event().
* Each log event belongs to a category, @ref ndb_mgm_event_category, and
* has a severity, @ref ndb_mgm_event_severity, associated with it. Each
* log event also has a level (0-15) associated with it.
*
* Which log events that come out is controlled with ndb_mgm_listen_event(),
* ndb_mgm_set_clusterlog_loglevel(), and
* ndb_mgm_set_clusterlog_severity_filter().
*
* Below is an example of how to listen to events related to backup.
*
* @code
* int filter[] = { 15, NDB_MGM_EVENT_CATEGORY_BACKUP, 0 };
* int fd = ndb_mgm_listen_event(handle, filter);
* @endcode
*/ */
/** @addtogroup MGM_C_API /** @addtogroup MGM_C_API
...@@ -325,92 +346,90 @@ extern "C" { ...@@ -325,92 +346,90 @@ extern "C" {
#endif #endif
/** /**
* Log severities (used to filter the cluster log) * Log event severities (used to filter the cluster log,
* ndb_mgm_set_clusterlog_severity_filter(), and filter listening to events
* ndb_mgm_listen_event())
*/ */
enum ndb_mgm_clusterlog_level { enum ndb_mgm_event_severity {
NDB_MGM_ILLEGAL_CLUSTERLOG_LEVEL = -1, NDB_MGM_ILLEGAL_EVENT_SEVERITY = -1,
/* must range from 0 and up, indexes into an array */ /* must range from 0 and up, indexes into an array */
/** Cluster log on*/ /** Cluster log on */
NDB_MGM_CLUSTERLOG_ON = 0, NDB_MGM_EVENT_SEVERITY_ON = 0,
/** Used in NDB Cluster developement */ /** Used in NDB Cluster developement */
NDB_MGM_CLUSTERLOG_DEBUG = 1, NDB_MGM_EVENT_SEVERITY_DEBUG = 1,
/** Informational messages*/ /** Informational messages*/
NDB_MGM_CLUSTERLOG_INFO = 2, NDB_MGM_EVENT_SEVERITY_INFO = 2,
/** Conditions that are not error condition, but might require handling /** Conditions that are not error condition, but might require handling
*/ */
NDB_MGM_CLUSTERLOG_WARNING = 3, NDB_MGM_EVENT_SEVERITY_WARNING = 3,
/** Conditions that should be corrected */ /** Conditions that should be corrected */
NDB_MGM_CLUSTERLOG_ERROR = 4, NDB_MGM_EVENT_SEVERITY_ERROR = 4,
/** Critical conditions, like device errors or out of resources */ /** Critical conditions, like device errors or out of resources */
NDB_MGM_CLUSTERLOG_CRITICAL = 5, NDB_MGM_EVENT_SEVERITY_CRITICAL = 5,
/** A condition that should be corrected immediately, /** A condition that should be corrected immediately,
* such as a corrupted system * such as a corrupted system
*/ */
NDB_MGM_CLUSTERLOG_ALERT = 6, NDB_MGM_EVENT_SEVERITY_ALERT = 6,
/* must be next number, works as bound in loop */ /* must be next number, works as bound in loop */
/** All severities */ /** All severities */
NDB_MGM_CLUSTERLOG_ALL = 7 NDB_MGM_EVENT_SEVERITY_ALL = 7
}; };
/** /**
* Log categories, used to set filter on the clusterlog using * Log event categories, used to set filter level on the log events using
* ndb_mgm_set_loglevel_clusterlog() * ndb_mgm_set_clusterlog_loglevel() and ndb_mgm_listen_event()
*/ */
enum ndb_mgm_event_category { enum ndb_mgm_event_category {
/** /**
* Invalid * Invalid log event category
*/ */
NDB_MGM_ILLEGAL_EVENT_CATEGORY = -1, NDB_MGM_ILLEGAL_EVENT_CATEGORY = -1,
/** /**
* Events during all kinds of startups * Log events during all kinds of startups
*/ */
NDB_MGM_EVENT_CATEGORY_STARTUP = CFG_LOGLEVEL_STARTUP, NDB_MGM_EVENT_CATEGORY_STARTUP = CFG_LOGLEVEL_STARTUP,
/** /**
* Events during shutdown * Log events during shutdown
*/ */
NDB_MGM_EVENT_CATEGORY_SHUTDOWN = CFG_LOGLEVEL_SHUTDOWN, NDB_MGM_EVENT_CATEGORY_SHUTDOWN = CFG_LOGLEVEL_SHUTDOWN,
/** /**
* Transaction statistics (Job level, TCP/IP speed) * Statistics log events
*/ */
NDB_MGM_EVENT_CATEGORY_STATISTIC = CFG_LOGLEVEL_STATISTICS, NDB_MGM_EVENT_CATEGORY_STATISTIC = CFG_LOGLEVEL_STATISTICS,
/** /**
* Events regarding checkpoints * Log events related to checkpoints
*/ */
NDB_MGM_EVENT_CATEGORY_CHECKPOINT = CFG_LOGLEVEL_CHECKPOINT, NDB_MGM_EVENT_CATEGORY_CHECKPOINT = CFG_LOGLEVEL_CHECKPOINT,
/** /**
* Events during node restart * Log events during node restart
*/ */
NDB_MGM_EVENT_CATEGORY_NODE_RESTART = CFG_LOGLEVEL_NODERESTART, NDB_MGM_EVENT_CATEGORY_NODE_RESTART = CFG_LOGLEVEL_NODERESTART,
/** /**
* Events on connection between cluster nodes * Log events related to connections between cluster nodes
*/ */
NDB_MGM_EVENT_CATEGORY_CONNECTION = CFG_LOGLEVEL_CONNECTION, NDB_MGM_EVENT_CATEGORY_CONNECTION = CFG_LOGLEVEL_CONNECTION,
/** /**
* Backup events * Backup related log events
*/ */
NDB_MGM_EVENT_CATEGORY_BACKUP = CFG_LOGLEVEL_BACKUP, NDB_MGM_EVENT_CATEGORY_BACKUP = CFG_LOGLEVEL_BACKUP,
/**
* Congestion related log events
*/
NDB_MGM_EVENT_CATEGORY_CONGESTION = CFG_LOGLEVEL_CONGESTION,
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
/** /**
* Loglevel debug * Loglevel debug
*/ */
NDB_MGM_EVENT_CATEGORY_DEBUG = CFG_LOGLEVEL_DEBUG, NDB_MGM_EVENT_CATEGORY_DEBUG = CFG_LOGLEVEL_DEBUG,
#endif
/** /**
* Loglevel info * Uncategorized log events (severity info)
*/ */
NDB_MGM_EVENT_CATEGORY_INFO = CFG_LOGLEVEL_INFO, NDB_MGM_EVENT_CATEGORY_INFO = CFG_LOGLEVEL_INFO,
/** /**
* Loglevel warning * Uncategorized log events (severity warning or higher)
*/
NDB_MGM_EVENT_CATEGORY_WARNING = CFG_LOGLEVEL_WARNING,
/**
* Loglevel error
*/ */
NDB_MGM_EVENT_CATEGORY_ERROR = CFG_LOGLEVEL_ERROR, NDB_MGM_EVENT_CATEGORY_ERROR = CFG_LOGLEVEL_ERROR,
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
/**
*
*/
NDB_MGM_EVENT_CATEGORY_GREP = CFG_LOGLEVEL_GREP,
#endif
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
NDB_MGM_MIN_EVENT_CATEGORY = CFG_MIN_LOGLEVEL, NDB_MGM_MIN_EVENT_CATEGORY = CFG_MIN_LOGLEVEL,
NDB_MGM_MAX_EVENT_CATEGORY = CFG_MAX_LOGLEVEL NDB_MGM_MAX_EVENT_CATEGORY = CFG_MAX_LOGLEVEL
...@@ -614,7 +633,7 @@ extern "C" { ...@@ -614,7 +633,7 @@ extern "C" {
*/ */
const char * ndb_mgm_get_node_status_string(enum ndb_mgm_node_status status); const char * ndb_mgm_get_node_status_string(enum ndb_mgm_node_status status);
const char * ndb_mgm_get_clusterlog_level_string(enum ndb_mgm_clusterlog_level); const char * ndb_mgm_get_event_severity_string(enum ndb_mgm_event_severity);
ndb_mgm_event_category ndb_mgm_match_event_category(const char *); ndb_mgm_event_category ndb_mgm_match_event_category(const char *);
const char * ndb_mgm_get_event_category_string(enum ndb_mgm_event_category); const char * ndb_mgm_get_event_category_string(enum ndb_mgm_event_category);
#endif #endif
...@@ -740,27 +759,26 @@ extern "C" { ...@@ -740,27 +759,26 @@ extern "C" {
/** @} *********************************************************************/ /** @} *********************************************************************/
/** /**
* @name Functions: Logging * @name Functions: Controlling Clusterlog output
* @{ * @{
*/ */
/** /**
* Filter cluster log * Filter cluster log severities
* *
* @param handle NDB management handle. * @param handle NDB management handle.
* @param level A cluster log level to filter. * @param severity A cluster log severity to filter.
* @param enable set 1=enable 0=disable * @param enable set 1=enable, 0=disable
* @param reply Reply message. * @param reply Reply message.
* *
* @return -1 on error. * @return -1 on error.
*/ */
int ndb_mgm_filter_clusterlog(NdbMgmHandle handle, int ndb_mgm_set_clusterlog_severity_filter(NdbMgmHandle handle,
enum ndb_mgm_clusterlog_level level, enum ndb_mgm_event_severity severity,
int enable, int enable,
struct ndb_mgm_reply* reply); struct ndb_mgm_reply* reply);
/** /**
* Get log filter * Get clusterlog severity filter
* *
* @param handle NDB management handle * @param handle NDB management handle
* *
...@@ -768,14 +786,14 @@ extern "C" { ...@@ -768,14 +786,14 @@ extern "C" {
* where each element contains * where each element contains
* 1 if a severity is enabled and 0 if not. * 1 if a severity is enabled and 0 if not.
* A severity is stored at position * A severity is stored at position
* ndb_mgm_clusterlog_level, * ndb_mgm_event_severity,
* for example the "error" level is stored in position * for example the "error" severity is stored in
* [NDB_MGM_CLUSTERLOG_ERROR-1]. * position [NDB_MGM_EVENT_SEVERITY_ERROR].
* The first element in the vector signals * The first element [NDB_MGM_EVENT_SEVERITY_ON]
* whether the clusterlog * in the vector signals
* is disabled or enabled. * whether the clusterlog is disabled or enabled.
*/ */
unsigned int *ndb_mgm_get_logfilter(NdbMgmHandle handle); const unsigned int *ndb_mgm_get_clusterlog_severity_filter(NdbMgmHandle handle);
/** /**
* Set log category and levels for the cluster log * Set log category and levels for the cluster log
...@@ -787,21 +805,29 @@ extern "C" { ...@@ -787,21 +805,29 @@ extern "C" {
* @param reply Reply message. * @param reply Reply message.
* @return -1 on error. * @return -1 on error.
*/ */
int ndb_mgm_set_loglevel_clusterlog(NdbMgmHandle handle, int ndb_mgm_set_clusterlog_loglevel(NdbMgmHandle handle,
int nodeId, int nodeId,
enum ndb_mgm_event_category category, enum ndb_mgm_event_category category,
int level, int level,
struct ndb_mgm_reply* reply); struct ndb_mgm_reply* reply);
/** @} *********************************************************************/
/** /**
* Listen to log events * @name Functions: Listening to log events
* @{
*/
/**
* Listen to log events. The are read from the return file descriptor
* and the format is textual, and the same as in the cluster log.
* *
* @param handle NDB management handle.
* @param filter pairs of { level, ndb_mgm_event_category } that will be * @param filter pairs of { level, ndb_mgm_event_category } that will be
* pushed to fd, level=0 ends lists * pushed to fd, level=0 ends list.
* *
* @return fd which events will be pushed to * @return fd which events will be pushed to
*/ */
int ndb_mgm_listen_event(NdbMgmHandle handle, int filter[]); int ndb_mgm_listen_event(NdbMgmHandle handle, const int filter[]);
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
/** /**
...@@ -941,6 +967,36 @@ extern "C" { ...@@ -941,6 +967,36 @@ extern "C" {
int ndb_mgm_check_connection(NdbMgmHandle handle); int ndb_mgm_check_connection(NdbMgmHandle handle);
#endif #endif
#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
enum ndb_mgm_clusterlog_level {
NDB_MGM_ILLEGAL_CLUSTERLOG_LEVEL = -1,
NDB_MGM_CLUSTERLOG_ON = 0,
NDB_MGM_CLUSTERLOG_DEBUG = 1,
NDB_MGM_CLUSTERLOG_INFO = 2,
NDB_MGM_CLUSTERLOG_WARNING = 3,
NDB_MGM_CLUSTERLOG_ERROR = 4,
NDB_MGM_CLUSTERLOG_CRITICAL = 5,
NDB_MGM_CLUSTERLOG_ALERT = 6,
NDB_MGM_CLUSTERLOG_ALL = 7
};
inline
int ndb_mgm_filter_clusterlog(NdbMgmHandle h,
enum ndb_mgm_clusterlog_level s,
int e, struct ndb_mgm_reply* r)
{ return ndb_mgm_set_clusterlog_severity_filter(h,(ndb_mgm_event_severity)s,
e,r); }
inline
const unsigned int *ndb_mgm_get_logfilter(NdbMgmHandle h)
{ return ndb_mgm_get_clusterlog_severity_filter(h); }
inline
int ndb_mgm_set_loglevel_clusterlog(NdbMgmHandle h, int n,
enum ndb_mgm_event_category c,
int l, struct ndb_mgm_reply* r)
{ return ndb_mgm_set_clusterlog_loglevel(h,n,c,l,r); }
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
...@@ -94,7 +94,7 @@ ...@@ -94,7 +94,7 @@
#define CFG_LOGLEVEL_INFO 256 #define CFG_LOGLEVEL_INFO 256
#define CFG_LOGLEVEL_WARNING 257 #define CFG_LOGLEVEL_WARNING 257
#define CFG_LOGLEVEL_ERROR 258 #define CFG_LOGLEVEL_ERROR 258
#define CFG_LOGLEVEL_GREP 259 #define CFG_LOGLEVEL_CONGESTION 259
#define CFG_LOGLEVEL_DEBUG 260 #define CFG_LOGLEVEL_DEBUG 260
#define CFG_LOGLEVEL_BACKUP 261 #define CFG_LOGLEVEL_BACKUP 261
#define CFG_MAX_LOGLEVEL 261 #define CFG_MAX_LOGLEVEL 261
......
...@@ -105,10 +105,6 @@ const EventLoggerBase::EventRepLogLevelMatrix EventLoggerBase::matrix[] = { ...@@ -105,10 +105,6 @@ const EventLoggerBase::EventRepLogLevelMatrix EventLoggerBase::matrix[] = {
{ EventReport::CreateLogBytes, LogLevel::llInfo, 11, Logger::LL_INFO }, { EventReport::CreateLogBytes, LogLevel::llInfo, 11, Logger::LL_INFO },
{ EventReport::InfoEvent, LogLevel::llInfo, 2, Logger::LL_INFO }, { EventReport::InfoEvent, LogLevel::llInfo, 2, Logger::LL_INFO },
//Global replication
{ EventReport::GrepSubscriptionInfo, LogLevel::llGrep, 7, Logger::LL_INFO},
{ EventReport::GrepSubscriptionAlert, LogLevel::llGrep, 7, Logger::LL_ALERT},
// Backup // Backup
{ EventReport::BackupStarted, LogLevel::llBackup, 7, Logger::LL_INFO }, { EventReport::BackupStarted, LogLevel::llBackup, 7, Logger::LL_INFO },
{ EventReport::BackupCompleted, LogLevel::llBackup, 7, Logger::LL_INFO }, { EventReport::BackupCompleted, LogLevel::llBackup, 7, Logger::LL_INFO },
......
...@@ -916,67 +916,68 @@ ndb_mgm_restart(NdbMgmHandle handle, int no_of_nodes, const int *node_list) ...@@ -916,67 +916,68 @@ ndb_mgm_restart(NdbMgmHandle handle, int no_of_nodes, const int *node_list)
return ndb_mgm_restart2(handle, no_of_nodes, node_list, 0, 0, 0); return ndb_mgm_restart2(handle, no_of_nodes, node_list, 0, 0, 0);
} }
static const char *clusterlog_level_names[]= static const char *clusterlog_severity_names[]=
{ "enabled", "debug", "info", "warning", "error", "critical", "alert" }; { "enabled", "debug", "info", "warning", "error", "critical", "alert" };
struct ndb_mgm_clusterlog_levels struct ndb_mgm_event_severities
{ {
const char* name; const char* name;
enum ndb_mgm_clusterlog_level level; enum ndb_mgm_event_severity severity;
} clusterlog_levels[] = { } clusterlog_severities[] = {
{ clusterlog_level_names[0], NDB_MGM_CLUSTERLOG_ON }, { clusterlog_severity_names[0], NDB_MGM_EVENT_SEVERITY_ON },
{ clusterlog_level_names[1], NDB_MGM_CLUSTERLOG_DEBUG }, { clusterlog_severity_names[1], NDB_MGM_EVENT_SEVERITY_DEBUG },
{ clusterlog_level_names[2], NDB_MGM_CLUSTERLOG_INFO }, { clusterlog_severity_names[2], NDB_MGM_EVENT_SEVERITY_INFO },
{ clusterlog_level_names[3], NDB_MGM_CLUSTERLOG_WARNING }, { clusterlog_severity_names[3], NDB_MGM_EVENT_SEVERITY_WARNING },
{ clusterlog_level_names[4], NDB_MGM_CLUSTERLOG_ERROR }, { clusterlog_severity_names[4], NDB_MGM_EVENT_SEVERITY_ERROR },
{ clusterlog_level_names[5], NDB_MGM_CLUSTERLOG_CRITICAL }, { clusterlog_severity_names[5], NDB_MGM_EVENT_SEVERITY_CRITICAL },
{ clusterlog_level_names[6], NDB_MGM_CLUSTERLOG_ALERT }, { clusterlog_severity_names[6], NDB_MGM_EVENT_SEVERITY_ALERT },
{ "all", NDB_MGM_CLUSTERLOG_ALL }, { "all", NDB_MGM_EVENT_SEVERITY_ALL },
{ 0, NDB_MGM_ILLEGAL_CLUSTERLOG_LEVEL }, { 0, NDB_MGM_ILLEGAL_EVENT_SEVERITY },
}; };
extern "C" extern "C"
ndb_mgm_clusterlog_level ndb_mgm_event_severity
ndb_mgm_match_clusterlog_level(const char * name) ndb_mgm_match_event_severity(const char * name)
{ {
if(name == 0) if(name == 0)
return NDB_MGM_ILLEGAL_CLUSTERLOG_LEVEL; return NDB_MGM_ILLEGAL_EVENT_SEVERITY;
for(int i = 0; clusterlog_levels[i].name !=0 ; i++) for(int i = 0; clusterlog_severities[i].name !=0 ; i++)
if(strcasecmp(name, clusterlog_levels[i].name) == 0) if(strcasecmp(name, clusterlog_severities[i].name) == 0)
return clusterlog_levels[i].level; return clusterlog_severities[i].severity;
return NDB_MGM_ILLEGAL_CLUSTERLOG_LEVEL; return NDB_MGM_ILLEGAL_EVENT_SEVERITY;
} }
extern "C" extern "C"
const char * const char *
ndb_mgm_get_clusterlog_level_string(enum ndb_mgm_clusterlog_level level) ndb_mgm_get_event_severity_string(enum ndb_mgm_event_severity severity)
{ {
int i= (int)level; int i= (int)severity;
if (i >= 0 && i < (int)NDB_MGM_CLUSTERLOG_ALL) if (i >= 0 && i < (int)NDB_MGM_EVENT_SEVERITY_ALL)
return clusterlog_level_names[i]; return clusterlog_severity_names[i];
for(i = (int)NDB_MGM_CLUSTERLOG_ALL; clusterlog_levels[i].name != 0; i++) for(i = (int)NDB_MGM_EVENT_SEVERITY_ALL; clusterlog_severities[i].name != 0; i++)
if(clusterlog_levels[i].level == level) if(clusterlog_severities[i].severity == severity)
return clusterlog_levels[i].name; return clusterlog_severities[i].name;
return 0; return 0;
} }
extern "C" extern "C"
unsigned int * const unsigned int *
ndb_mgm_get_logfilter(NdbMgmHandle handle) ndb_mgm_get_clusterlog_severity_filter(NdbMgmHandle handle)
{ {
SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_get_logfilter"); SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_get_clusterlog_severity_filter");
static Uint32 enabled[(int)NDB_MGM_CLUSTERLOG_ALL] = {0,0,0,0,0,0,0}; static unsigned int enabled[(int)NDB_MGM_EVENT_SEVERITY_ALL]=
{0,0,0,0,0,0,0};
const ParserRow<ParserDummy> getinfo_reply[] = { const ParserRow<ParserDummy> getinfo_reply[] = {
MGM_CMD("clusterlog", NULL, ""), MGM_CMD("clusterlog", NULL, ""),
MGM_ARG(clusterlog_level_names[0], Int, Mandatory, ""), MGM_ARG(clusterlog_severity_names[0], Int, Mandatory, ""),
MGM_ARG(clusterlog_level_names[1], Int, Mandatory, ""), MGM_ARG(clusterlog_severity_names[1], Int, Mandatory, ""),
MGM_ARG(clusterlog_level_names[2], Int, Mandatory, ""), MGM_ARG(clusterlog_severity_names[2], Int, Mandatory, ""),
MGM_ARG(clusterlog_level_names[3], Int, Mandatory, ""), MGM_ARG(clusterlog_severity_names[3], Int, Mandatory, ""),
MGM_ARG(clusterlog_level_names[4], Int, Mandatory, ""), MGM_ARG(clusterlog_severity_names[4], Int, Mandatory, ""),
MGM_ARG(clusterlog_level_names[5], Int, Mandatory, ""), MGM_ARG(clusterlog_severity_names[5], Int, Mandatory, ""),
MGM_ARG(clusterlog_level_names[6], Int, Mandatory, ""), MGM_ARG(clusterlog_severity_names[6], Int, Mandatory, ""),
}; };
CHECK_HANDLE(handle, NULL); CHECK_HANDLE(handle, NULL);
CHECK_CONNECTED(handle, NULL); CHECK_CONNECTED(handle, NULL);
...@@ -986,20 +987,21 @@ ndb_mgm_get_logfilter(NdbMgmHandle handle) ...@@ -986,20 +987,21 @@ ndb_mgm_get_logfilter(NdbMgmHandle handle)
reply = ndb_mgm_call(handle, getinfo_reply, "get info clusterlog", &args); reply = ndb_mgm_call(handle, getinfo_reply, "get info clusterlog", &args);
CHECK_REPLY(reply, NULL); CHECK_REPLY(reply, NULL);
for(int i=0; i < (int)NDB_MGM_CLUSTERLOG_ALL; i++) { for(int i=0; i < (int)NDB_MGM_EVENT_SEVERITY_ALL; i++) {
reply->get(clusterlog_level_names[i], &enabled[i]); reply->get(clusterlog_severity_names[i], &enabled[i]);
} }
return enabled; return enabled;
} }
extern "C" extern "C"
int int
ndb_mgm_filter_clusterlog(NdbMgmHandle handle, ndb_mgm_set_clusterlog_severity_filter(NdbMgmHandle handle,
enum ndb_mgm_clusterlog_level level, enum ndb_mgm_event_severity severity,
int enable, int enable,
struct ndb_mgm_reply* /*reply*/) struct ndb_mgm_reply* /*reply*/)
{ {
SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_filter_clusterlog"); SET_ERROR(handle, NDB_MGM_NO_ERROR,
"Executing: ndb_mgm_set_clusterlog_severity_filter");
const ParserRow<ParserDummy> filter_reply[] = { const ParserRow<ParserDummy> filter_reply[] = {
MGM_CMD("set logfilter reply", NULL, ""), MGM_CMD("set logfilter reply", NULL, ""),
MGM_ARG("result", String, Mandatory, "Error message"), MGM_ARG("result", String, Mandatory, "Error message"),
...@@ -1010,7 +1012,7 @@ ndb_mgm_filter_clusterlog(NdbMgmHandle handle, ...@@ -1010,7 +1012,7 @@ ndb_mgm_filter_clusterlog(NdbMgmHandle handle,
CHECK_CONNECTED(handle, -1); CHECK_CONNECTED(handle, -1);
Properties args; Properties args;
args.put("level", level); args.put("level", severity);
args.put("enable", enable); args.put("enable", enable);
const Properties *reply; const Properties *reply;
...@@ -1045,10 +1047,9 @@ struct ndb_mgm_event_categories ...@@ -1045,10 +1047,9 @@ struct ndb_mgm_event_categories
{ "CHECKPOINT", NDB_MGM_EVENT_CATEGORY_CHECKPOINT }, { "CHECKPOINT", NDB_MGM_EVENT_CATEGORY_CHECKPOINT },
{ "DEBUG", NDB_MGM_EVENT_CATEGORY_DEBUG }, { "DEBUG", NDB_MGM_EVENT_CATEGORY_DEBUG },
{ "INFO", NDB_MGM_EVENT_CATEGORY_INFO }, { "INFO", NDB_MGM_EVENT_CATEGORY_INFO },
{ "WARNING", NDB_MGM_EVENT_CATEGORY_WARNING },
{ "ERROR", NDB_MGM_EVENT_CATEGORY_ERROR }, { "ERROR", NDB_MGM_EVENT_CATEGORY_ERROR },
{ "GREP", NDB_MGM_EVENT_CATEGORY_GREP },
{ "BACKUP", NDB_MGM_EVENT_CATEGORY_BACKUP }, { "BACKUP", NDB_MGM_EVENT_CATEGORY_BACKUP },
{ "CONGESTION", NDB_MGM_EVENT_CATEGORY_CONGESTION },
{ 0, NDB_MGM_ILLEGAL_EVENT_CATEGORY } { 0, NDB_MGM_ILLEGAL_EVENT_CATEGORY }
}; };
...@@ -1080,13 +1081,13 @@ ndb_mgm_get_event_category_string(enum ndb_mgm_event_category status) ...@@ -1080,13 +1081,13 @@ ndb_mgm_get_event_category_string(enum ndb_mgm_event_category status)
extern "C" extern "C"
int int
ndb_mgm_set_loglevel_clusterlog(NdbMgmHandle handle, int nodeId, ndb_mgm_set_clusterlog_loglevel(NdbMgmHandle handle, int nodeId,
enum ndb_mgm_event_category cat, enum ndb_mgm_event_category cat,
int level, int level,
struct ndb_mgm_reply* /*reply*/) struct ndb_mgm_reply* /*reply*/)
{ {
SET_ERROR(handle, NDB_MGM_NO_ERROR, SET_ERROR(handle, NDB_MGM_NO_ERROR,
"Executing: ndb_mgm_set_loglevel_clusterlog"); "Executing: ndb_mgm_set_clusterlog_loglevel");
const ParserRow<ParserDummy> clusterlog_reply[] = { const ParserRow<ParserDummy> clusterlog_reply[] = {
MGM_CMD("set cluster loglevel reply", NULL, ""), MGM_CMD("set cluster loglevel reply", NULL, ""),
MGM_ARG("result", String, Mandatory, "Error message"), MGM_ARG("result", String, Mandatory, "Error message"),
...@@ -1105,7 +1106,7 @@ ndb_mgm_set_loglevel_clusterlog(NdbMgmHandle handle, int nodeId, ...@@ -1105,7 +1106,7 @@ ndb_mgm_set_loglevel_clusterlog(NdbMgmHandle handle, int nodeId,
"set cluster loglevel", &args); "set cluster loglevel", &args);
CHECK_REPLY(reply, -1); CHECK_REPLY(reply, -1);
DBUG_ENTER("ndb_mgm_set_loglevel_clusterlog"); DBUG_ENTER("ndb_mgm_set_clusterlog_loglevel");
DBUG_PRINT("enter",("node=%d, category=%d, level=%d", nodeId, cat, level)); DBUG_PRINT("enter",("node=%d, category=%d, level=%d", nodeId, cat, level));
BaseString result; BaseString result;
...@@ -1157,7 +1158,7 @@ ndb_mgm_set_loglevel_node(NdbMgmHandle handle, int nodeId, ...@@ -1157,7 +1158,7 @@ ndb_mgm_set_loglevel_node(NdbMgmHandle handle, int nodeId,
extern "C" extern "C"
int int
ndb_mgm_listen_event(NdbMgmHandle handle, int filter[]) ndb_mgm_listen_event(NdbMgmHandle handle, const int filter[])
{ {
SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_listen_event"); SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_listen_event");
const ParserRow<ParserDummy> stat_reply[] = { const ParserRow<ParserDummy> stat_reply[] = {
...@@ -1195,7 +1196,10 @@ ndb_mgm_listen_event(NdbMgmHandle handle, int filter[]) ...@@ -1195,7 +1196,10 @@ ndb_mgm_listen_event(NdbMgmHandle handle, int filter[])
handle->socket = tmp; handle->socket = tmp;
CHECK_REPLY(reply, -1); if(reply == NULL) {
close(sockfd);
CHECK_REPLY(reply, -1);
}
return sockfd; return sockfd;
} }
......
...@@ -1105,6 +1105,18 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ...@@ -1105,6 +1105,18 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
"0", "0",
"15" }, "15" },
{
CFG_LOGLEVEL_CONGESTION,
"LogLevelCongestion",
DB_TOKEN,
"Congestion info printed on stdout",
ConfigInfo::CI_USED,
false,
ConfigInfo::CI_INT,
"0",
"0",
"15" },
{ {
CFG_LOGLEVEL_ERROR, CFG_LOGLEVEL_ERROR,
"LogLevelError", "LogLevelError",
......
...@@ -1184,13 +1184,13 @@ MgmApiSession::startAll(Parser<MgmApiSession>::Context &, ...@@ -1184,13 +1184,13 @@ MgmApiSession::startAll(Parser<MgmApiSession>::Context &,
void void
MgmApiSession::setLogFilter(Parser_t::Context &ctx, MgmApiSession::setLogFilter(Parser_t::Context &ctx,
const class Properties &args) { const class Properties &args) {
Uint32 level; Uint32 severity;
Uint32 enable; Uint32 enable;
args.get("level", &level); args.get("level", &severity);
args.get("enable", &enable); args.get("enable", &enable);
int result = m_mgmsrv.setEventLogFilter(level, enable); int result = m_mgmsrv.setEventLogFilter(severity, enable);
m_output->println("set logfilter reply"); m_output->println("set logfilter reply");
m_output->println("result: %d", result); m_output->println("result: %d", result);
......
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