Skip to content

Commit 7a85bfc

Browse files
author
magnus.blaudd@oracle.com
committed
Merge
2 parents 5f995eb + e1dbdb3 commit 7a85bfc

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

storage/ndb/src/mgmsrv/Services.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -1727,6 +1727,17 @@ MgmApiSession::listen_event(Parser<MgmApiSession>::Context & ctx,
17271727
m_output->println("msg: %s", msg.c_str());
17281728
m_output->println("%s", "");
17291729

1730+
/*
1731+
Flush output from command before adding the new event listener.
1732+
This makes sure that the client receives the reply before the
1733+
loglevel thread starts to check the connection by sending <PING>'s.
1734+
The client is expecting <PING>'s but not until after the reply has been
1735+
received.
1736+
*/
1737+
NdbMutex_Unlock(m_mutex);
1738+
m_output->flush();
1739+
NdbMutex_Lock(m_mutex);
1740+
17301741
if(result==0)
17311742
{
17321743
m_mgmsrv.m_event_listner.add_listener(le);

storage/ndb/test/ndbapi/testMgm.cpp

+31
Original file line numberDiff line numberDiff line change
@@ -3572,6 +3572,34 @@ int runTestNdbApiConfig(NDBT_Context* ctx, NDBT_Step* step)
35723572
return NDBT_OK;
35733573
}
35743574

3575+
3576+
static
3577+
int runTestCreateLogEvent(NDBT_Context* ctx, NDBT_Step* step)
3578+
{
3579+
NdbMgmd mgmd;
3580+
int loops = ctx->getNumLoops();
3581+
3582+
if (!mgmd.connect())
3583+
return NDBT_FAILED;
3584+
3585+
int filter[] = {
3586+
15, NDB_MGM_EVENT_CATEGORY_BACKUP,
3587+
0
3588+
};
3589+
3590+
for(int l=0; l<loops; l++)
3591+
{
3592+
g_info << "Creating log event handle " << l << endl;
3593+
NdbLogEventHandle le_handle =
3594+
ndb_mgm_create_logevent_handle(mgmd.handle(), filter);
3595+
if (!le_handle)
3596+
return NDBT_FAILED;
3597+
3598+
ndb_mgm_destroy_logevent_handle(&le_handle);
3599+
}
3600+
return NDBT_OK;
3601+
}
3602+
35753603
NDBT_TESTSUITE(testMgm);
35763604
DRIVER(DummyDriver); /* turn off use of NdbApi */
35773605
TESTCASE("ApiSessionFailure",
@@ -3726,6 +3754,9 @@ TESTCASE("TestSetPorts",
37263754
"Test 'set ports'"){
37273755
INITIALIZER(runTestSetPorts);
37283756
}
3757+
TESTCASE("TestCreateLogEvent", "Test ndb_mgm_create_log_event_handle"){
3758+
STEPS(runTestCreateLogEvent, 5);
3759+
}
37293760
NDBT_TESTSUITE_END(testMgm);
37303761

37313762
int main(int argc, const char** argv){

0 commit comments

Comments
 (0)