mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 18:20:07 +01:00
New mgmapi call - ndb_mtm_listen_event
This commit is contained in:
parent
cc499e6eac
commit
32e8f2ac95
4 changed files with 54 additions and 0 deletions
|
@ -668,6 +668,15 @@ extern "C" {
|
|||
int ndb_mgm_exit_single_user(NdbMgmHandle handle,
|
||||
struct ndb_mgm_reply* reply);
|
||||
|
||||
/**
|
||||
* Listen event
|
||||
*
|
||||
* @param filter pairs of { level, category } that will be
|
||||
* pushed to fd, level=0 ends lists
|
||||
* @return fd which events will be pushed to
|
||||
*/
|
||||
int ndb_mgm_listen_event(NdbMgmHandle handle, int filter[]);
|
||||
|
||||
/**
|
||||
* Get configuration
|
||||
* @param handle NDB management handle.
|
||||
|
|
|
@ -1069,6 +1069,48 @@ ndb_mgm_set_loglevel_node(NdbMgmHandle handle, int nodeId,
|
|||
return 0;
|
||||
}
|
||||
|
||||
extern "C"
|
||||
int
|
||||
ndb_mgm_listen_event(NdbMgmHandle handle, int filter[])
|
||||
{
|
||||
SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_listen_event");
|
||||
const ParserRow<ParserDummy> stat_reply[] = {
|
||||
MGM_CMD("listen event", NULL, ""),
|
||||
MGM_ARG("result", Int, Mandatory, "Error message"),
|
||||
MGM_ARG("msg", String, Optional, "Error message"),
|
||||
MGM_END()
|
||||
};
|
||||
CHECK_HANDLE(handle, -1);
|
||||
|
||||
SocketClient s(handle->hostname, handle->port);
|
||||
const NDB_SOCKET_TYPE sockfd = s.connect();
|
||||
if (sockfd < 0) {
|
||||
setError(handle, NDB_MGM_COULD_NOT_CONNECT_TO_SOCKET, __LINE__,
|
||||
"Unable to connect to");
|
||||
return -1;
|
||||
}
|
||||
|
||||
Properties args;
|
||||
{
|
||||
BaseString tmp;
|
||||
for(int i = 0; filter[i] != 0; i += 2){
|
||||
tmp.appfmt("%d=%d ", filter[i+1], filter[i]);
|
||||
}
|
||||
args.put("filter", tmp.c_str());
|
||||
}
|
||||
|
||||
int tmp = handle->socket;
|
||||
handle->socket = sockfd;
|
||||
|
||||
const Properties *reply;
|
||||
reply = ndb_mgm_call(handle, stat_reply, "listen event", &args);
|
||||
|
||||
handle->socket = tmp;
|
||||
|
||||
CHECK_REPLY(reply, -1);
|
||||
return sockfd;
|
||||
}
|
||||
|
||||
extern "C"
|
||||
int
|
||||
ndb_mgm_get_stat_port(NdbMgmHandle handle, struct ndb_mgm_reply* /*reply*/)
|
||||
|
|
|
@ -2419,6 +2419,8 @@ MgmtSrvr::abortBackup(Uint32 backupId)
|
|||
void
|
||||
MgmtSrvr::backupCallback(BackupEvent & event)
|
||||
{
|
||||
m_lastBackupEvent = event;
|
||||
theWaitState = NO_WAIT;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1391,6 +1391,7 @@ MgmApiSession::listen_event(Parser<MgmApiSession>::Context & ctx,
|
|||
result = -1;
|
||||
goto done;
|
||||
}
|
||||
category -= CFG_MIN_LOGLEVEL;
|
||||
le.m_logLevel.setLogLevel((LogLevel::EventCategory)category, level);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue