Below is the list of changes that have just been committed into a local
5.1 repository of stewart. When stewart does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-03-08 11:19:59+01:00, stewart@stripped +5 -0
[PATCH] Add ndb_mgmd error injection
Add error injection either for this connection or for whole server.
Currently nothing for injecting errors into *another* connection... but that's
perhaps getting tricky-dicky for this point in time. Perhaps needed for events
if we don't do anything fancy.
Index: telco-wl3704/storage/ndb/src/mgmsrv/MgmtSrvr.cpp
===================================================================
storage/ndb/src/mgmsrv/MgmtSrvr.cpp@stripped, 2007-03-08 10:04:20+01:00, stewart@stripped +26 -3
Add ndb_mgmd error injection
storage/ndb/src/mgmsrv/MgmtSrvr.hpp@stripped, 2007-03-08 10:04:20+01:00, stewart@stripped +4 -0
Add ndb_mgmd error injection
storage/ndb/src/mgmsrv/Services.cpp@stripped, 2007-03-08 10:04:20+01:00, stewart@stripped +19 -1
Add ndb_mgmd error injection
storage/ndb/src/mgmsrv/Services.hpp@stripped, 2007-03-08 10:04:20+01:00, stewart@stripped +2 -0
Add ndb_mgmd error injection
storage/ndb/test/ndbapi/testMgm.cpp@stripped, 2007-03-08 10:04:20+01:00, stewart@stripped +52 -0
Add ndb_mgmd error injection
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: stewart
# Host: willster.(none)
# Root: /home/stewart/Documents/MySQL/5.1/telco-wl3704
--- 1.125/storage/ndb/src/mgmsrv/MgmtSrvr.cpp 2007-03-06 18:36:42 +01:00
+++ 1.126/storage/ndb/src/mgmsrv/MgmtSrvr.cpp 2007-03-08 10:04:20 +01:00
@@ -66,6 +66,9 @@
#define DEBUG(x)
#endif
+int g_errorInsert;
+#define ERROR_INSERTED(x) (g_errorInsert == x)
+
#define INIT_SIGNAL_SENDER(ss,nodeId) \
SignalSender ss(theFacade); \
ss.lock(); /* lock will be released on exit */ \
@@ -177,6 +180,7 @@
m_log_level_requests.lock();
}
m_log_level_requests.unlock();
+
NdbSleep_MilliSleep(_logLevelThreadSleep);
}
}
@@ -1746,14 +1750,29 @@
int
MgmtSrvr::insertError(int nodeId, int errorNo)
{
+ int block;
+
if (errorNo < 0) {
return INVALID_ERROR_NUMBER;
}
- INIT_SIGNAL_SENDER(ss,nodeId);
-
+ SignalSender ss(theFacade);
+ ss.lock(); /* lock will be released on exit */
+
+ if(getNodeType(nodeId) == NDB_MGM_NODE_TYPE_NDB)
+ {
+ block= CMVMI;
+ if(!theFacade->theClusterMgr->getNodeInfo(nodeId).connected
+ || !theFacade->get_node_alive(nodeId))
+ return NO_CONTACT_WITH_PROCESS;
+ }
+ else if(getNodeType(nodeId) == NDB_MGM_NODE_TYPE_MGM)
+ block= _blockNumber;
+ else
+ return WRONG_PROCESS_TYPE;
+
SimpleSignal ssig;
- ssig.set(ss,TestOrd::TraceAPI, CMVMI, GSN_TAMPER_ORD,
+ ssig.set(ss,TestOrd::TraceAPI, block, GSN_TAMPER_ORD,
TamperOrd::SignalLength);
TamperOrd* const tamperOrd = CAST_PTR(TamperOrd, ssig.getDataPtrSend());
tamperOrd->errorNo = errorNo;
@@ -1986,6 +2005,10 @@
case GSN_NF_COMPLETEREP:
break;
case GSN_NODE_FAILREP:
+ break;
+
+ case GSN_TAMPER_ORD:
+ ndbout << "TAMPER ORD" << endl;
break;
default:
--- 1.57/storage/ndb/src/mgmsrv/MgmtSrvr.hpp 2007-03-06 18:36:42 +01:00
+++ 1.58/storage/ndb/src/mgmsrv/MgmtSrvr.hpp 2007-03-08 10:04:20 +01:00
@@ -38,6 +38,10 @@
*/
#define MGMSRV 1
+#define MGM_ERROR_MAX_INJECT_SESSION_ONLY 10000
+
+extern int g_errorInsert;
+
class ConfigInfoServer;
class NdbApiSignal;
class Config;
--- 1.88/storage/ndb/src/mgmsrv/Services.cpp 2007-03-06 18:36:42 +01:00
+++ 1.89/storage/ndb/src/mgmsrv/Services.cpp 2007-03-08 10:04:20 +01:00
@@ -288,6 +288,8 @@
NDB_TICKS tick;
};
+#define ERROR_INSERTED(x) (g_errorInsert == x || m_errorInsert == x)
+
MgmApiSession::MgmApiSession(class MgmtSrvr & mgm, NDB_SOCKET_TYPE sock, Uint64 session_id)
: SocketServer::Session(sock), m_mgmsrv(mgm)
{
@@ -300,6 +302,7 @@
m_ctx= NULL;
m_session_id= session_id;
m_mutex= NdbMutex_Create();
+ m_errorInsert= 0;
DBUG_VOID_RETURN;
}
@@ -613,11 +616,22 @@
MgmApiSession::insertError(Parser<MgmApiSession>::Context &,
Properties const &args) {
Uint32 node = 0, error = 0;
+ int result= 0;
args.get("node", &node);
args.get("error", &error);
- int result = m_mgmsrv.insertError(node, error);
+ if(node==m_mgmsrv.getOwnNodeId()
+ && error < MGM_ERROR_MAX_INJECT_SESSION_ONLY)
+ {
+ m_errorInsert= error;
+ if(error==0)
+ g_errorInsert= error;
+ }
+ else
+ {
+ result= m_mgmsrv.insertError(node, error);
+ }
m_output->println("insert error reply");
if(result != 0)
@@ -1608,6 +1622,10 @@
MgmApiSession::check_connection(Parser_t::Context &ctx,
const class Properties &args)
{
+ if(ERROR_INSERTED(1))
+ {
+ NdbSleep_SecSleep(10);
+ }
m_output->println("check connection reply");
m_output->println("result: Ok");
m_output->println("");
--- 1.25/storage/ndb/src/mgmsrv/Services.hpp 2007-02-14 06:35:30 +01:00
+++ 1.26/storage/ndb/src/mgmsrv/Services.hpp 2007-03-08 10:04:20 +01:00
@@ -46,6 +46,8 @@
Parser_t::Context *m_ctx;
Uint64 m_session_id;
+ int m_errorInsert;
+
const char *get_error_text(int err_no)
{ return m_mgmsrv.getErrorText(err_no, m_err_str, sizeof(m_err_str)); }
--- 1.8/storage/ndb/test/ndbapi/testMgm.cpp 2006-12-23 20:20:26 +01:00
+++ 1.9/storage/ndb/test/ndbapi/testMgm.cpp 2007-03-08 10:04:20 +01:00
@@ -207,6 +207,53 @@
}
}
+int runTestApiTimeout1(NDBT_Context* ctx, NDBT_Step* step)
+{
+ char *mgm= ctx->getRemoteMgm();
+ int result= NDBT_FAILED;
+ int cc= 0;
+
+ NdbMgmHandle h;
+ h= ndb_mgm_create_handle();
+ ndb_mgm_set_connectstring(h, mgm);
+ ndb_mgm_connect(h,0,0,0);
+
+ ndbout << "Connected" << endl;
+
+ if(ndb_mgm_check_connection(h) < 0)
+ {
+ result= NDBT_FAILED;
+ goto done;
+ }
+
+ ndbout << "Checked Connection" << endl;
+
+ ndb_mgm_reply reply;
+ reply.return_code= 0;
+
+ if(ndb_mgm_insert_error(h, 3, 1, &reply)< 0)
+ {
+ ndbout << "failed to insert error " << endl;
+ result= NDBT_FAILED;
+ goto done;
+ }
+
+ ndbout << "Inserted session error" << endl;
+
+ cc= ndb_mgm_check_connection(h);
+ if(cc < 0)
+ result= NDBT_OK;
+ else
+ result= NDBT_FAILED;
+
+ ndbout << "Tried check connection with result: " << cc << endl;
+done:
+ ndb_mgm_disconnect(h);
+ ndb_mgm_destroy_handle(&h);
+
+ return result;
+}
+
NDBT_TESTSUITE(testMgm);
TESTCASE("SingleUserMode",
@@ -217,6 +264,11 @@
TESTCASE("ApiSessionFailure",
"Test failures in MGMAPI session"){
INITIALIZER(runTestApiSession);
+
+}
+TESTCASE("ApiTimeout1",
+ "Test timeout for MGMAPI"){
+ INITIALIZER(runTestApiTimeout1);
}
NDBT_TESTSUITE_END(testMgm);
| Thread |
|---|
| • bk commit into 5.1 tree (stewart:1.2462) | Stewart Smith | 8 Mar |