Commit 7652e96f authored by unknown's avatar unknown

[PATCH] WL#3704 mgmapi timeouts: manipulate some things to get infrastructure for event timeouts

Index: ndb-work/storage/ndb/src/mgmsrv/MgmtSrvr.cpp
===================================================================


storage/ndb/src/mgmsrv/ERROR_codes.txt:
  WL#3704 mgmapi timeouts: manipulate some things to get infrastructure for event timeouts
storage/ndb/src/mgmsrv/MgmtSrvr.cpp:
  WL#3704 mgmapi timeouts: manipulate some things to get infrastructure for event timeouts
storage/ndb/src/mgmsrv/Services.cpp:
  WL#3704 mgmapi timeouts: manipulate some things to get infrastructure for event timeouts
storage/ndb/test/ndbapi/testMgm.cpp:
  WL#3704 mgmapi timeouts: manipulate some things to get infrastructure for event timeouts
parent 80220f70
Next Session 10
Next Global 10000
Next Global 10001
#define MGM_ERROR_MAX_INJECT_SESSION_ONLY 10000
......@@ -25,3 +25,5 @@ num where type testing
7 node status sleep after parsable, before status reply
8 node status sleep partway through status reporting
9 node status sleep end of status printing
10000 events PING no ping don't send pings to event listeners
......@@ -181,6 +181,9 @@ MgmtSrvr::logLevelThreadRun()
}
m_log_level_requests.unlock();
if(!ERROR_INSERTED(10000))
m_event_listner.check_listeners();
NdbSleep_MilliSleep(_logLevelThreadSleep);
}
}
......@@ -1750,6 +1753,11 @@ MgmtSrvr::insertError(int nodeId, int errorNo)
|| !theFacade->get_node_alive(nodeId))
return NO_CONTACT_WITH_PROCESS;
}
else if(nodeId == _ownNodeId)
{
g_errorInsert= errorNo;
return 0;
}
else if(getNodeType(nodeId) == NDB_MGM_NODE_TYPE_MGM)
block= _blockNumber;
else
......
......@@ -296,8 +296,8 @@ MgmApiSession::MgmApiSession(class MgmtSrvr & mgm, NDB_SOCKET_TYPE sock, Uint64
: SocketServer::Session(sock), m_mgmsrv(mgm)
{
DBUG_ENTER("MgmApiSession::MgmApiSession");
m_input = new SocketInputStream(sock);
m_output = new SocketOutputStream(sock);
m_input = new SocketInputStream(sock, 30000);
m_output = new SocketOutputStream(sock, 30000);
m_parser = new Parser_t(commands, *m_input, true, true, true);
m_allocated_resources= new MgmtSrvr::Allocated_resources(m_mgmsrv);
m_stopSelf= 0;
......
......@@ -23,6 +23,7 @@
#include <mgmapi.h>
#include <mgmapi_debug.h>
#include <InputStream.hpp>
#include <signaldata/EventReport.hpp>
int runLoadTable(NDBT_Context* ctx, NDBT_Step* step){
......@@ -508,7 +509,7 @@ int runTestMgmApiEventTimeout(NDBT_Context* ctx, NDBT_Step* step)
h= ndb_mgm_create_handle();
ndb_mgm_set_connectstring(h, mgm);
int errs[] = { 0, -1 };
int errs[] = { 10000, 0, -1 };
for(int error_ins_no=0; errs[error_ins_no]!=-1; error_ins_no++)
{
......@@ -553,14 +554,26 @@ int runTestMgmApiEventTimeout(NDBT_Context* ctx, NDBT_Step* step)
result= NDBT_FAILED;
}
Uint32 theData[25];
EventReport *fake_event = (EventReport*)theData;
fake_event->setEventType(NDB_LE_NDBStopForced);
fake_event->setNodeId(42);
theData[2]= 0;
theData[3]= 0;
theData[4]= 0;
theData[5]= 0;
ndb_mgm_report_event(h, theData, 6);
char *tmp= 0;
char buf[512];
SocketInputStream in(fd,20000);
do {
SocketInputStream in(fd,2000);
for(int i=0; i<20; i++)
{
if((tmp = in.gets(buf, sizeof(buf))))
{
const char ping_token[]="<PING>";
if(memcmp(ping_token,tmp,sizeof(ping_token)-1))
// const char ping_token[]="<PING>";
// if(memcmp(ping_token,tmp,sizeof(ping_token)-1))
if(tmp && strlen(tmp))
ndbout << tmp;
}
......@@ -568,28 +581,25 @@ int runTestMgmApiEventTimeout(NDBT_Context* ctx, NDBT_Step* step)
{
if(in.timedout())
{
ndbout << "TIMED OUT READING EVENT" << endl;
ndbout << "TIMED OUT READING EVENT at iteration " << i << endl;
break;
}
}
} while(true);
}
if(error_ins!=0 && ndb_mgm_is_connected(h))
/*
* events go through a *DIFFERENT* socket than the NdbMgmHandle
* so we should still be connected (and be able to check_connection)
*
*/
if(ndb_mgm_check_connection(h) && !ndb_mgm_is_connected(h))
{
ndbout << "FAILED: is still connected after error" << endl;
result= NDBT_FAILED;
}
if(error_ins!=0 && ndb_mgm_get_latest_error(h)!=ETIMEDOUT)
{
ndbout << "FAILED: Incorrect error code (" << ndb_mgm_get_latest_error(h)
<< " != expected " << ETIMEDOUT << ") desc: "
<< ndb_mgm_get_latest_error_desc(h)
<< " line: " << ndb_mgm_get_latest_error_line(h)
<< " msg: " << ndb_mgm_get_latest_error_msg(h)
<< endl;
result= NDBT_FAILED;
}
ndb_mgm_disconnect(h);
}
done:
......
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