Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
af1dfd74
Commit
af1dfd74
authored
Jan 09, 2005
by
tomas@poseidon.ndb.mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge
parents
65e96e52
a12244c5
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
214 additions
and
142 deletions
+214
-142
mysql-test/ndb/basic.result
mysql-test/ndb/basic.result
+5
-5
mysql-test/ndb/restart.test
mysql-test/ndb/restart.test
+1
-1
ndb/include/kernel/LogLevel.hpp
ndb/include/kernel/LogLevel.hpp
+1
-1
ndb/include/mgmapi/mgmapi.h
ndb/include/mgmapi/mgmapi.h
+114
-57
ndb/include/mgmapi/mgmapi_config_parameters.h
ndb/include/mgmapi/mgmapi_config_parameters.h
+1
-1
ndb/src/common/debugger/EventLogger.cpp
ndb/src/common/debugger/EventLogger.cpp
+0
-4
ndb/src/mgmapi/mgmapi.cpp
ndb/src/mgmapi/mgmapi.cpp
+57
-53
ndb/src/mgmclient/CommandInterpreter.cpp
ndb/src/mgmclient/CommandInterpreter.cpp
+20
-17
ndb/src/mgmsrv/ConfigInfo.cpp
ndb/src/mgmsrv/ConfigInfo.cpp
+12
-0
ndb/src/mgmsrv/Services.cpp
ndb/src/mgmsrv/Services.cpp
+3
-3
No files found.
mysql-test/ndb/basic.result
View file @
af1dfd74
...
...
@@ -26,17 +26,17 @@ CONNECT [<connectstring>] Connect to management server (reconnect i
QUIT Quit management client
<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
<id> = ALL | Any database node id
Connected to Management Server at: localhost:1186
Node 1: started (Version
4.1.9
)
Node 2: started (Version
4.1.9
)
Node 1: started (Version
5.0.3
)
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 2 OK!
...
...
mysql-test/ndb/restart.test
View file @
af1dfd74
...
...
@@ -8,5 +8,5 @@ sleep 5
all
clusterlog
connection
=
8
sleep
1
1
restart
sleep
5
sleep
10
clusterlog
on
all
ndb/include/kernel/LogLevel.hpp
View file @
af1dfd74
...
...
@@ -57,7 +57,7 @@ public:
llInfo
=
CFG_LOGLEVEL_INFO
-
CFG_MIN_LOGLEVEL
,
llWarning
=
CFG_LOGLEVEL_WARNING
-
CFG_MIN_LOGLEVEL
,
llError
=
CFG_LOGLEVEL_ERROR
-
CFG_MIN_LOGLEVEL
,
ll
Grep
=
CFG_LOGLEVEL_GREP
-
CFG_MIN_LOGLEVEL
,
ll
Congestion
=
CFG_LOGLEVEL_CONGESTION
-
CFG_MIN_LOGLEVEL
,
llDebug
=
CFG_LOGLEVEL_DEBUG
-
CFG_MIN_LOGLEVEL
,
llBackup
=
CFG_LOGLEVEL_BACKUP
-
CFG_MIN_LOGLEVEL
};
...
...
ndb/include/mgmapi/mgmapi.h
View file @
af1dfd74
...
...
@@ -27,7 +27,7 @@
* - Controlling the NDB Cluster log
* - Performing other administrative tasks
*
* @section General Concepts
* @section
secMgmApiGeneral
General Concepts
*
* Each MGM API function needs a management server handle
* of type @ref NdbMgmHandle.
...
...
@@ -64,6 +64,27 @@
* free((void*)state);
* ndb_mgm_destroy_handle(&handle);
* @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
...
...
@@ -325,92 +346,90 @@ extern "C" {
#endif
/**
* Log severity of errors. (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
{
NDB_MGM_ILLEGAL_
CLUSTERLOG_LEVEL
=
-
1
,
enum
ndb_mgm_
event_severity
{
NDB_MGM_ILLEGAL_
EVENT_SEVERITY
=
-
1
,
/* Must be a nonnegative integer (used for array indexing) */
/** Cluster log on*/
NDB_MGM_
CLUSTERLOG
_ON
=
0
,
/** Cluster log on
*/
NDB_MGM_
EVENT_SEVERITY
_ON
=
0
,
/** Used in NDB Cluster developement */
NDB_MGM_
CLUSTERLOG
_DEBUG
=
1
,
NDB_MGM_
EVENT_SEVERITY
_DEBUG
=
1
,
/** Informational messages*/
NDB_MGM_
CLUSTERLOG
_INFO
=
2
,
/** Conditions that are not error condition, but might require
special
handling.
NDB_MGM_
EVENT_SEVERITY
_INFO
=
2
,
/** Conditions that are not error condition, but might require handling.
*/
NDB_MGM_
CLUSTERLOG
_WARNING
=
3
,
NDB_MGM_
EVENT_SEVERITY
_WARNING
=
3
,
/** Conditions that, while not fatal, should be corrected. */
NDB_MGM_
CLUSTERLOG
_ERROR
=
4
,
NDB_MGM_
EVENT_SEVERITY
_ERROR
=
4
,
/** 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,
* 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 */
/** All severities */
NDB_MGM_
CLUSTERLOG
_ALL
=
7
NDB_MGM_
EVENT_SEVERITY
_ALL
=
7
};
/**
* Log
categories, used in setting filters on the clusterlog
using
* ndb_mgm_set_
loglevel_clusterlog
()
* Log
event categories, used to set filter level on the log events
using
* ndb_mgm_set_
clusterlog_loglevel() and ndb_mgm_listen_event
()
*/
enum
ndb_mgm_event_category
{
/**
* Invalid
* Invalid
log event category
*/
NDB_MGM_ILLEGAL_EVENT_CATEGORY
=
-
1
,
/**
*
Startup event
s
*
Log events during all kinds of startup
s
*/
NDB_MGM_EVENT_CATEGORY_STARTUP
=
CFG_LOGLEVEL_STARTUP
,
/**
*
Shutdown events
*
Log events during 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
,
/**
*
Checkpoint eve
nts
*
Log events related to checkpoi
nts
*/
NDB_MGM_EVENT_CATEGORY_CHECKPOINT
=
CFG_LOGLEVEL_CHECKPOINT
,
/**
*
Node restart events
*
Log events during node restart
*/
NDB_MGM_EVENT_CATEGORY_NODE_RESTART
=
CFG_LOGLEVEL_NODERESTART
,
/**
*
Cluster node connection event
s
*
Log events related to connections between cluster node
s
*/
NDB_MGM_EVENT_CATEGORY_CONNECTION
=
CFG_LOGLEVEL_CONNECTION
,
/**
* Backup events
* Backup
related log
events
*/
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
*/
NDB_MGM_EVENT_CATEGORY_DEBUG
=
CFG_LOGLEVEL_DEBUG
,
#endif
/**
*
Loglevel info
*
Uncategorized log events (severity info)
*/
NDB_MGM_EVENT_CATEGORY_INFO
=
CFG_LOGLEVEL_INFO
,
/**
* Loglevel warning
*/
NDB_MGM_EVENT_CATEGORY_WARNING
=
CFG_LOGLEVEL_WARNING
,
/**
* Loglevel error
* Uncategorized log events (severity warning or higher)
*/
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
NDB_MGM_MIN_EVENT_CATEGORY
=
CFG_MIN_LOGLEVEL
,
NDB_MGM_MAX_EVENT_CATEGORY
=
CFG_MAX_LOGLEVEL
...
...
@@ -501,7 +520,7 @@ extern "C" {
* <connectstring> := [<nodeid-specification>,]<host-specification>[,<host-specification>]
* <nodeid-specification> := nodeid=<id>
* <host-specification> := <host>[:<port>]
* <id> is an integer greater than
1
identifying a node in config.ini
* <id> is an integer greater than
0
identifying a node in config.ini
* <port> is an integer referring to a regular unix port
* <host> is a string containing a valid network host address
* @endcode
...
...
@@ -615,7 +634,7 @@ extern "C" {
*/
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
*
);
const
char
*
ndb_mgm_get_event_category_string
(
enum
ndb_mgm_event_category
);
#endif
...
...
@@ -741,27 +760,26 @@ extern "C" {
/** @} *********************************************************************/
/**
* @name Functions:
Logging
* @name Functions:
Controlling Clusterlog output
* @{
*/
/**
* Filter cluster log
* Filter cluster log
severities
*
* @param handle NDB management handle.
* @param
level A cluster log level
to filter.
* @param enable
Set 1=enable or
0=disable
* @param
severity A cluster log severity
to filter.
* @param enable
set 1=enable o
0=disable
* @param reply Reply message.
*
* @return -1 on error.
*/
int
ndb_mgm_filter_clusterlog
(
NdbMgmHandle
handle
,
enum
ndb_mgm_clusterlog_level
level
,
int
enable
,
struct
ndb_mgm_reply
*
reply
);
int
ndb_mgm_set_clusterlog_severity_filter
(
NdbMgmHandle
handle
,
enum
ndb_mgm_event_severity
severity
,
int
enable
,
struct
ndb_mgm_reply
*
reply
);
/**
* Get
log
filter
* Get
clusterlog severity
filter
*
* @param handle NDB management handle
*
...
...
@@ -771,12 +789,13 @@ extern "C" {
* A severity level is stored at position
* ndb_mgm_clusterlog_level;
* for example the "error" level is stored in position
* [NDB_MGM_CLUSTERLOG_ERROR-1].
* The first element in the vector signals
* [NDB_MGM_EVENT_SEVERITY_ERROR].
* The first element [NDB_MGM_EVENT_SEVERITY_ON] in
* the vector signals
* whether the cluster log
* is disabled or enabled.
*/
unsigned
int
*
ndb_mgm_get_log
filter
(
NdbMgmHandle
handle
);
const
unsigned
int
*
ndb_mgm_get_clusterlog_severity_
filter
(
NdbMgmHandle
handle
);
/**
* Set log category and levels for the cluster log
...
...
@@ -788,21 +807,29 @@ extern "C" {
* @param reply Reply message.
* @return -1 on error.
*/
int
ndb_mgm_set_
loglevel_clusterlog
(
NdbMgmHandle
handle
,
int
ndb_mgm_set_
clusterlog_loglevel
(
NdbMgmHandle
handle
,
int
nodeId
,
enum
ndb_mgm_event_category
category
,
int
level
,
struct
ndb_mgm_reply
*
reply
);
/** @} *********************************************************************/
/**
* Listen to log events
* @name Functions: Listening to log events
* @{
*/
/**
* Listen to log events. They are read from the return file descriptor
* and the format is textual, and the same as in the cluster log.
*
* @param filter pairs of { level, ndb_mgm_event_category } that will be
* pushed to fd, level=0 ends lists
* @param handle NDB management handle.
* @param filter pairs of { level, ndb_mgm_event_category } that will be
* pushed to fd, level=0 ends list.
*
* @return
fd which events will be pushed to the log
* @return
fd filedescriptor to read events from
*/
int
ndb_mgm_listen_event
(
NdbMgmHandle
handle
,
int
filter
[]);
int
ndb_mgm_listen_event
(
NdbMgmHandle
handle
,
const
int
filter
[]);
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
/**
...
...
@@ -942,6 +969,36 @@ extern "C" {
int
ndb_mgm_check_connection
(
NdbMgmHandle
handle
);
#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
}
#endif
...
...
ndb/include/mgmapi/mgmapi_config_parameters.h
View file @
af1dfd74
...
...
@@ -94,7 +94,7 @@
#define CFG_LOGLEVEL_INFO 256
#define CFG_LOGLEVEL_WARNING 257
#define CFG_LOGLEVEL_ERROR 258
#define CFG_LOGLEVEL_
GREP
259
#define CFG_LOGLEVEL_
CONGESTION
259
#define CFG_LOGLEVEL_DEBUG 260
#define CFG_LOGLEVEL_BACKUP 261
#define CFG_MAX_LOGLEVEL 261
...
...
ndb/src/common/debugger/EventLogger.cpp
View file @
af1dfd74
...
...
@@ -105,10 +105,6 @@ const EventLoggerBase::EventRepLogLevelMatrix EventLoggerBase::matrix[] = {
{
EventReport
::
CreateLogBytes
,
LogLevel
::
llInfo
,
11
,
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
{
EventReport
::
BackupStarted
,
LogLevel
::
llBackup
,
7
,
Logger
::
LL_INFO
},
{
EventReport
::
BackupCompleted
,
LogLevel
::
llBackup
,
7
,
Logger
::
LL_INFO
},
...
...
ndb/src/mgmapi/mgmapi.cpp
View file @
af1dfd74
...
...
@@ -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
);
}
static
const
char
*
clusterlog_
level
_names
[]
=
static
const
char
*
clusterlog_
severity
_names
[]
=
{
"enabled"
,
"debug"
,
"info"
,
"warning"
,
"error"
,
"critical"
,
"alert"
};
struct
ndb_mgm_
clusterlog_level
s
struct
ndb_mgm_
event_severitie
s
{
const
char
*
name
;
enum
ndb_mgm_
clusterlog_level
level
;
}
clusterlog_
level
s
[]
=
{
{
clusterlog_
level_names
[
0
],
NDB_MGM_CLUSTERLOG
_ON
},
{
clusterlog_
level_names
[
1
],
NDB_MGM_CLUSTERLOG
_DEBUG
},
{
clusterlog_
level_names
[
2
],
NDB_MGM_CLUSTERLOG
_INFO
},
{
clusterlog_
level_names
[
3
],
NDB_MGM_CLUSTERLOG
_WARNING
},
{
clusterlog_
level_names
[
4
],
NDB_MGM_CLUSTERLOG
_ERROR
},
{
clusterlog_
level_names
[
5
],
NDB_MGM_CLUSTERLOG
_CRITICAL
},
{
clusterlog_
level_names
[
6
],
NDB_MGM_CLUSTERLOG
_ALERT
},
{
"all"
,
NDB_MGM_CLUSTERLOG
_ALL
},
{
0
,
NDB_MGM_ILLEGAL_CLUSTERLOG_LEVEL
},
enum
ndb_mgm_
event_severity
severity
;
}
clusterlog_
severitie
s
[]
=
{
{
clusterlog_
severity_names
[
0
],
NDB_MGM_EVENT_SEVERITY
_ON
},
{
clusterlog_
severity_names
[
1
],
NDB_MGM_EVENT_SEVERITY
_DEBUG
},
{
clusterlog_
severity_names
[
2
],
NDB_MGM_EVENT_SEVERITY
_INFO
},
{
clusterlog_
severity_names
[
3
],
NDB_MGM_EVENT_SEVERITY
_WARNING
},
{
clusterlog_
severity_names
[
4
],
NDB_MGM_EVENT_SEVERITY
_ERROR
},
{
clusterlog_
severity_names
[
5
],
NDB_MGM_EVENT_SEVERITY
_CRITICAL
},
{
clusterlog_
severity_names
[
6
],
NDB_MGM_EVENT_SEVERITY
_ALERT
},
{
"all"
,
NDB_MGM_EVENT_SEVERITY
_ALL
},
{
0
,
NDB_MGM_ILLEGAL_EVENT_SEVERITY
},
};
extern
"C"
ndb_mgm_
clusterlog_level
ndb_mgm_match_
clusterlog_level
(
const
char
*
name
)
ndb_mgm_
event_severity
ndb_mgm_match_
event_severity
(
const
char
*
name
)
{
if
(
name
==
0
)
return
NDB_MGM_ILLEGAL_
CLUSTERLOG_LEVEL
;
return
NDB_MGM_ILLEGAL_
EVENT_SEVERITY
;
for
(
int
i
=
0
;
clusterlog_
level
s
[
i
].
name
!=
0
;
i
++
)
if
(
strcasecmp
(
name
,
clusterlog_
level
s
[
i
].
name
)
==
0
)
return
clusterlog_
levels
[
i
].
level
;
for
(
int
i
=
0
;
clusterlog_
severitie
s
[
i
].
name
!=
0
;
i
++
)
if
(
strcasecmp
(
name
,
clusterlog_
severitie
s
[
i
].
name
)
==
0
)
return
clusterlog_
severities
[
i
].
severity
;
return
NDB_MGM_ILLEGAL_
CLUSTERLOG_LEVEL
;
return
NDB_MGM_ILLEGAL_
EVENT_SEVERITY
;
}
extern
"C"
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
;
if
(
i
>=
0
&&
i
<
(
int
)
NDB_MGM_
CLUSTERLOG
_ALL
)
return
clusterlog_
level
_names
[
i
];
for
(
i
=
(
int
)
NDB_MGM_
CLUSTERLOG_ALL
;
clusterlog_level
s
[
i
].
name
!=
0
;
i
++
)
if
(
clusterlog_
levels
[
i
].
level
==
level
)
return
clusterlog_
level
s
[
i
].
name
;
int
i
=
(
int
)
severity
;
if
(
i
>=
0
&&
i
<
(
int
)
NDB_MGM_
EVENT_SEVERITY
_ALL
)
return
clusterlog_
severity
_names
[
i
];
for
(
i
=
(
int
)
NDB_MGM_
EVENT_SEVERITY_ALL
;
clusterlog_severitie
s
[
i
].
name
!=
0
;
i
++
)
if
(
clusterlog_
severities
[
i
].
severity
==
severity
)
return
clusterlog_
severitie
s
[
i
].
name
;
return
0
;
}
extern
"C"
unsigned
int
*
ndb_mgm_get_
log
filter
(
NdbMgmHandle
handle
)
const
unsigned
int
*
ndb_mgm_get_
clusterlog_severity_
filter
(
NdbMgmHandle
handle
)
{
SET_ERROR
(
handle
,
NDB_MGM_NO_ERROR
,
"Executing: ndb_mgm_get_logfilter"
);
static
Uint32
enabled
[(
int
)
NDB_MGM_CLUSTERLOG_ALL
]
=
{
0
,
0
,
0
,
0
,
0
,
0
,
0
};
SET_ERROR
(
handle
,
NDB_MGM_NO_ERROR
,
"Executing: ndb_mgm_get_clusterlog_severity_filter"
);
static
unsigned
int
enabled
[(
int
)
NDB_MGM_EVENT_SEVERITY_ALL
]
=
{
0
,
0
,
0
,
0
,
0
,
0
,
0
};
const
ParserRow
<
ParserDummy
>
getinfo_reply
[]
=
{
MGM_CMD
(
"clusterlog"
,
NULL
,
""
),
MGM_ARG
(
clusterlog_
level
_names
[
0
],
Int
,
Mandatory
,
""
),
MGM_ARG
(
clusterlog_
level
_names
[
1
],
Int
,
Mandatory
,
""
),
MGM_ARG
(
clusterlog_
level
_names
[
2
],
Int
,
Mandatory
,
""
),
MGM_ARG
(
clusterlog_
level
_names
[
3
],
Int
,
Mandatory
,
""
),
MGM_ARG
(
clusterlog_
level
_names
[
4
],
Int
,
Mandatory
,
""
),
MGM_ARG
(
clusterlog_
level
_names
[
5
],
Int
,
Mandatory
,
""
),
MGM_ARG
(
clusterlog_
level
_names
[
6
],
Int
,
Mandatory
,
""
),
MGM_ARG
(
clusterlog_
severity
_names
[
0
],
Int
,
Mandatory
,
""
),
MGM_ARG
(
clusterlog_
severity
_names
[
1
],
Int
,
Mandatory
,
""
),
MGM_ARG
(
clusterlog_
severity
_names
[
2
],
Int
,
Mandatory
,
""
),
MGM_ARG
(
clusterlog_
severity
_names
[
3
],
Int
,
Mandatory
,
""
),
MGM_ARG
(
clusterlog_
severity
_names
[
4
],
Int
,
Mandatory
,
""
),
MGM_ARG
(
clusterlog_
severity
_names
[
5
],
Int
,
Mandatory
,
""
),
MGM_ARG
(
clusterlog_
severity
_names
[
6
],
Int
,
Mandatory
,
""
),
};
CHECK_HANDLE
(
handle
,
NULL
);
CHECK_CONNECTED
(
handle
,
NULL
);
...
...
@@ -986,20 +987,21 @@ ndb_mgm_get_logfilter(NdbMgmHandle handle)
reply
=
ndb_mgm_call
(
handle
,
getinfo_reply
,
"get info clusterlog"
,
&
args
);
CHECK_REPLY
(
reply
,
NULL
);
for
(
int
i
=
0
;
i
<
(
int
)
NDB_MGM_
CLUSTERLOG
_ALL
;
i
++
)
{
reply
->
get
(
clusterlog_
level
_names
[
i
],
&
enabled
[
i
]);
for
(
int
i
=
0
;
i
<
(
int
)
NDB_MGM_
EVENT_SEVERITY
_ALL
;
i
++
)
{
reply
->
get
(
clusterlog_
severity
_names
[
i
],
&
enabled
[
i
]);
}
return
enabled
;
}
extern
"C"
int
ndb_mgm_
filter_clusterlog
(
NdbMgmHandle
handle
,
enum
ndb_mgm_clusterlog_level
level
,
int
enable
,
struct
ndb_mgm_reply
*
/*reply*/
)
ndb_mgm_
set_clusterlog_severity_filter
(
NdbMgmHandle
handle
,
enum
ndb_mgm_event_severity
severity
,
int
enable
,
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
[]
=
{
MGM_CMD
(
"set logfilter reply"
,
NULL
,
""
),
MGM_ARG
(
"result"
,
String
,
Mandatory
,
"Error message"
),
...
...
@@ -1010,7 +1012,7 @@ ndb_mgm_filter_clusterlog(NdbMgmHandle handle,
CHECK_CONNECTED
(
handle
,
-
1
);
Properties
args
;
args
.
put
(
"level"
,
level
);
args
.
put
(
"level"
,
severity
);
args
.
put
(
"enable"
,
enable
);
const
Properties
*
reply
;
...
...
@@ -1045,10 +1047,9 @@ struct ndb_mgm_event_categories
{
"CHECKPOINT"
,
NDB_MGM_EVENT_CATEGORY_CHECKPOINT
},
{
"DEBUG"
,
NDB_MGM_EVENT_CATEGORY_DEBUG
},
{
"INFO"
,
NDB_MGM_EVENT_CATEGORY_INFO
},
{
"WARNING"
,
NDB_MGM_EVENT_CATEGORY_WARNING
},
{
"ERROR"
,
NDB_MGM_EVENT_CATEGORY_ERROR
},
{
"GREP"
,
NDB_MGM_EVENT_CATEGORY_GREP
},
{
"BACKUP"
,
NDB_MGM_EVENT_CATEGORY_BACKUP
},
{
"CONGESTION"
,
NDB_MGM_EVENT_CATEGORY_CONGESTION
},
{
0
,
NDB_MGM_ILLEGAL_EVENT_CATEGORY
}
};
...
...
@@ -1080,13 +1081,13 @@ ndb_mgm_get_event_category_string(enum ndb_mgm_event_category status)
extern
"C"
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
,
int
level
,
struct
ndb_mgm_reply
*
/*reply*/
)
{
SET_ERROR
(
handle
,
NDB_MGM_NO_ERROR
,
"Executing: ndb_mgm_set_
loglevel_clusterlog
"
);
"Executing: ndb_mgm_set_
clusterlog_loglevel
"
);
const
ParserRow
<
ParserDummy
>
clusterlog_reply
[]
=
{
MGM_CMD
(
"set cluster loglevel reply"
,
NULL
,
""
),
MGM_ARG
(
"result"
,
String
,
Mandatory
,
"Error message"
),
...
...
@@ -1105,7 +1106,7 @@ ndb_mgm_set_loglevel_clusterlog(NdbMgmHandle handle, int nodeId,
"set cluster loglevel"
,
&
args
);
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
));
BaseString
result
;
...
...
@@ -1157,7 +1158,7 @@ ndb_mgm_set_loglevel_node(NdbMgmHandle handle, int nodeId,
extern
"C"
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"
);
const
ParserRow
<
ParserDummy
>
stat_reply
[]
=
{
...
...
@@ -1195,7 +1196,10 @@ ndb_mgm_listen_event(NdbMgmHandle handle, int filter[])
handle
->
socket
=
tmp
;
CHECK_REPLY
(
reply
,
-
1
);
if
(
reply
==
NULL
)
{
close
(
sockfd
);
CHECK_REPLY
(
reply
,
-
1
);
}
return
sockfd
;
}
...
...
ndb/src/mgmclient/CommandInterpreter.cpp
View file @
af1dfd74
...
...
@@ -1246,7 +1246,7 @@ CommandInterpreter::executeClusterLog(char* parameters)
DBUG_VOID_RETURN
;
}
enum
ndb_mgm_
clusterlog_level
severity
=
NDB_MGM_CLUSTERLOG
_ALL
;
enum
ndb_mgm_
event_severity
severity
=
NDB_MGM_EVENT_SEVERITY
_ALL
;
char
*
tmpString
=
my_strdup
(
parameters
,
MYF
(
MY_WME
));
My_auto_ptr
<
char
>
ap1
(
tmpString
);
...
...
@@ -1254,7 +1254,7 @@ CommandInterpreter::executeClusterLog(char* parameters)
char
*
item
=
strtok_r
(
tmpString
,
" "
,
&
tmpPtr
);
int
enable
;
Uint32
*
enabled
=
ndb_mgm_get_logfilter
(
m_mgmsrv
);
const
unsigned
int
*
enabled
=
ndb_mgm_get_logfilter
(
m_mgmsrv
);
if
(
enabled
==
NULL
)
{
ndbout
<<
"Couldn't get status"
<<
endl
;
printError
();
...
...
@@ -1276,8 +1276,8 @@ CommandInterpreter::executeClusterLog(char* parameters)
printf("enabled[%d] = %d\n", i, enabled[i]);
#endif
ndbout
<<
"Severities enabled: "
;
for
(
i
=
1
;
i
<
(
int
)
NDB_MGM_
CLUSTERLOG
_ALL
;
i
++
)
{
const
char
*
str
=
ndb_mgm_get_
clusterlog_level_string
((
ndb_mgm_clusterlog_level
)
i
);
for
(
i
=
1
;
i
<
(
int
)
NDB_MGM_
EVENT_SEVERITY
_ALL
;
i
++
)
{
const
char
*
str
=
ndb_mgm_get_
event_severity_string
((
ndb_mgm_event_severity
)
i
);
if
(
str
==
0
)
{
DBUG_ASSERT
(
false
);
...
...
@@ -1311,8 +1311,10 @@ CommandInterpreter::executeClusterLog(char* parameters)
int
res_enable
;
item
=
strtok_r
(
NULL
,
" "
,
&
tmpPtr
);
if
(
item
==
NULL
)
{
res_enable
=
ndb_mgm_filter_clusterlog
(
m_mgmsrv
,
NDB_MGM_CLUSTERLOG_ON
,
enable
,
NULL
);
res_enable
=
ndb_mgm_set_clusterlog_severity_filter
(
m_mgmsrv
,
NDB_MGM_EVENT_SEVERITY_ON
,
enable
,
NULL
);
if
(
res_enable
<
0
)
{
ndbout
<<
"Couldn't set filter"
<<
endl
;
...
...
@@ -1324,32 +1326,33 @@ CommandInterpreter::executeClusterLog(char* parameters)
}
do
{
severity
=
NDB_MGM_ILLEGAL_
CLUSTERLOG_LEVEL
;
severity
=
NDB_MGM_ILLEGAL_
EVENT_SEVERITY
;
if
(
strcasecmp
(
item
,
"ALL"
)
==
0
)
{
severity
=
NDB_MGM_
CLUSTERLOG
_ALL
;
severity
=
NDB_MGM_
EVENT_SEVERITY
_ALL
;
}
else
if
(
strcasecmp
(
item
,
"ALERT"
)
==
0
)
{
severity
=
NDB_MGM_
CLUSTERLOG
_ALERT
;
severity
=
NDB_MGM_
EVENT_SEVERITY
_ALERT
;
}
else
if
(
strcasecmp
(
item
,
"CRITICAL"
)
==
0
)
{
severity
=
NDB_MGM_
CLUSTERLOG
_CRITICAL
;
severity
=
NDB_MGM_
EVENT_SEVERITY
_CRITICAL
;
}
else
if
(
strcasecmp
(
item
,
"ERROR"
)
==
0
)
{
severity
=
NDB_MGM_
CLUSTERLOG
_ERROR
;
severity
=
NDB_MGM_
EVENT_SEVERITY
_ERROR
;
}
else
if
(
strcasecmp
(
item
,
"WARNING"
)
==
0
)
{
severity
=
NDB_MGM_
CLUSTERLOG
_WARNING
;
severity
=
NDB_MGM_
EVENT_SEVERITY
_WARNING
;
}
else
if
(
strcasecmp
(
item
,
"INFO"
)
==
0
)
{
severity
=
NDB_MGM_
CLUSTERLOG
_INFO
;
severity
=
NDB_MGM_
EVENT_SEVERITY
_INFO
;
}
else
if
(
strcasecmp
(
item
,
"DEBUG"
)
==
0
)
{
severity
=
NDB_MGM_
CLUSTERLOG
_DEBUG
;
severity
=
NDB_MGM_
EVENT_SEVERITY
_DEBUG
;
}
else
if
(
strcasecmp
(
item
,
"OFF"
)
==
0
||
strcasecmp
(
item
,
"ON"
)
==
0
)
{
if
(
enable
<
0
)
// only makes sense with toggle
severity
=
NDB_MGM_
CLUSTERLOG
_ON
;
severity
=
NDB_MGM_
EVENT_SEVERITY
_ON
;
}
if
(
severity
==
NDB_MGM_ILLEGAL_
CLUSTERLOG_LEVEL
)
{
if
(
severity
==
NDB_MGM_ILLEGAL_
EVENT_SEVERITY
)
{
ndbout
<<
"Invalid severity level: "
<<
item
<<
endl
;
DBUG_VOID_RETURN
;
}
res_enable
=
ndb_mgm_filter_clusterlog
(
m_mgmsrv
,
severity
,
enable
,
NULL
);
res_enable
=
ndb_mgm_set_clusterlog_severity_filter
(
m_mgmsrv
,
severity
,
enable
,
NULL
);
if
(
res_enable
<
0
)
{
ndbout
<<
"Couldn't set filter"
<<
endl
;
...
...
ndb/src/mgmsrv/ConfigInfo.cpp
View file @
af1dfd74
...
...
@@ -1105,6 +1105,18 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
"0"
,
"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
,
"LogLevelError"
,
...
...
ndb/src/mgmsrv/Services.cpp
View file @
af1dfd74
...
...
@@ -1184,13 +1184,13 @@ MgmApiSession::startAll(Parser<MgmApiSession>::Context &,
void
MgmApiSession
::
setLogFilter
(
Parser_t
::
Context
&
ctx
,
const
class
Properties
&
args
)
{
Uint32
level
;
Uint32
severity
;
Uint32
enable
;
args
.
get
(
"level"
,
&
level
);
args
.
get
(
"level"
,
&
severity
);
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
(
"result: %d"
,
result
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment