Commit 32e8f2ac authored by unknown's avatar unknown

New mgmapi call - ndb_mtm_listen_event

parent cc499e6e
...@@ -668,6 +668,15 @@ extern "C" { ...@@ -668,6 +668,15 @@ extern "C" {
int ndb_mgm_exit_single_user(NdbMgmHandle handle, int ndb_mgm_exit_single_user(NdbMgmHandle handle,
struct ndb_mgm_reply* reply); 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 * Get configuration
* @param handle NDB management handle. * @param handle NDB management handle.
......
...@@ -1069,6 +1069,48 @@ ndb_mgm_set_loglevel_node(NdbMgmHandle handle, int nodeId, ...@@ -1069,6 +1069,48 @@ ndb_mgm_set_loglevel_node(NdbMgmHandle handle, int nodeId,
return 0; 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" extern "C"
int int
ndb_mgm_get_stat_port(NdbMgmHandle handle, struct ndb_mgm_reply* /*reply*/) ndb_mgm_get_stat_port(NdbMgmHandle handle, struct ndb_mgm_reply* /*reply*/)
......
...@@ -2419,6 +2419,8 @@ MgmtSrvr::abortBackup(Uint32 backupId) ...@@ -2419,6 +2419,8 @@ MgmtSrvr::abortBackup(Uint32 backupId)
void void
MgmtSrvr::backupCallback(BackupEvent & event) MgmtSrvr::backupCallback(BackupEvent & event)
{ {
m_lastBackupEvent = event;
theWaitState = NO_WAIT;
} }
......
...@@ -1391,6 +1391,7 @@ MgmApiSession::listen_event(Parser<MgmApiSession>::Context & ctx, ...@@ -1391,6 +1391,7 @@ MgmApiSession::listen_event(Parser<MgmApiSession>::Context & ctx,
result = -1; result = -1;
goto done; goto done;
} }
category -= CFG_MIN_LOGLEVEL;
le.m_logLevel.setLogLevel((LogLevel::EventCategory)category, level); le.m_logLevel.setLogLevel((LogLevel::EventCategory)category, level);
} }
......
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