mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
wl 1801
Testcases for NF ndb/src/kernel/blocks/ERROR_codes.txt: Error insert for testing NF handling of committed read ndb/src/kernel/blocks/dblqh/DblqhMain.cpp: Error insert for testing NF handling of committed read ndb/src/kernel/blocks/dbtc/DbtcMain.cpp: Error insert for testing NF handling of committed read ndb/test/include/NDBT_Test.hpp: Move sync methods into NDBT_Context ndb/test/ndbapi/testIndex.cpp: Move sync methods into NDBT_Context ndb/test/ndbapi/testNodeRestart.cpp: Add test case that verifies committed read during NF ndb/test/src/NDBT_Test.cpp: Move sync methods into NDBT_Context
This commit is contained in:
@@ -3,7 +3,7 @@ Next NDBCNTR 1000
|
|||||||
Next NDBFS 2000
|
Next NDBFS 2000
|
||||||
Next DBACC 3001
|
Next DBACC 3001
|
||||||
Next DBTUP 4007
|
Next DBTUP 4007
|
||||||
Next DBLQH 5040
|
Next DBLQH 5042
|
||||||
Next DBDICT 6006
|
Next DBDICT 6006
|
||||||
Next DBDIH 7174
|
Next DBDIH 7174
|
||||||
Next DBTC 8035
|
Next DBTC 8035
|
||||||
@@ -193,6 +193,8 @@ Delay execution of ABORTREQ signal 2 seconds to generate time-out.
|
|||||||
5038: Drop LQHKEYREQ + set 5039
|
5038: Drop LQHKEYREQ + set 5039
|
||||||
5039: Drop ABORT + set 5003
|
5039: Drop ABORT + set 5003
|
||||||
|
|
||||||
|
8048: Make TC not choose own node for simple/dirty read
|
||||||
|
5041: Crash is receiving simple read from other TC on different node
|
||||||
|
|
||||||
ERROR CODES FOR TESTING TIME-OUT HANDLING IN DBTC
|
ERROR CODES FOR TESTING TIME-OUT HANDLING IN DBTC
|
||||||
-------------------------------------------------
|
-------------------------------------------------
|
||||||
|
@@ -3305,6 +3305,9 @@ void Dblqh::execLQHKEYREQ(Signal* signal)
|
|||||||
UintR TreclenAiLqhkey = LqhKeyReq::getAIInLqhKeyReq(Treqinfo);
|
UintR TreclenAiLqhkey = LqhKeyReq::getAIInLqhKeyReq(Treqinfo);
|
||||||
regTcPtr->apiVersionNo = 0;
|
regTcPtr->apiVersionNo = 0;
|
||||||
|
|
||||||
|
CRASH_INSERTION2(5041, regTcPtr->simpleRead &&
|
||||||
|
refToNode(signal->senderBlockRef()) != cownNodeid);
|
||||||
|
|
||||||
regTcPtr->reclenAiLqhkey = TreclenAiLqhkey;
|
regTcPtr->reclenAiLqhkey = TreclenAiLqhkey;
|
||||||
regTcPtr->currReclenAi = TreclenAiLqhkey;
|
regTcPtr->currReclenAi = TreclenAiLqhkey;
|
||||||
UintR TitcKeyLen = LqhKeyReq::getKeyLen(Treqinfo);
|
UintR TitcKeyLen = LqhKeyReq::getKeyLen(Treqinfo);
|
||||||
|
@@ -2963,15 +2963,27 @@ void Dbtc::tckeyreq050Lab(Signal* signal)
|
|||||||
/*-------------------------------------------------------------*/
|
/*-------------------------------------------------------------*/
|
||||||
arrGuard(tnoOfBackup, 4);
|
arrGuard(tnoOfBackup, 4);
|
||||||
UintR Tindex;
|
UintR Tindex;
|
||||||
|
UintR TownNode = cownNodeid;
|
||||||
for (Tindex = 1; Tindex <= tnoOfBackup; Tindex++) {
|
for (Tindex = 1; Tindex <= tnoOfBackup; Tindex++) {
|
||||||
UintR Tnode = regTcPtr->tcNodedata[Tindex];
|
UintR Tnode = regTcPtr->tcNodedata[Tindex];
|
||||||
UintR TownNode = cownNodeid;
|
|
||||||
jam();
|
jam();
|
||||||
if (Tnode == TownNode) {
|
if (Tnode == TownNode) {
|
||||||
jam();
|
jam();
|
||||||
regTcPtr->tcNodedata[0] = Tnode;
|
regTcPtr->tcNodedata[0] = Tnode;
|
||||||
}//if
|
}//if
|
||||||
}//for
|
}//for
|
||||||
|
if(ERROR_INSERTED(8048))
|
||||||
|
{
|
||||||
|
for (Tindex = 0; Tindex <= tnoOfBackup; Tindex++)
|
||||||
|
{
|
||||||
|
UintR Tnode = regTcPtr->tcNodedata[Tindex];
|
||||||
|
jam();
|
||||||
|
if (Tnode != TownNode) {
|
||||||
|
jam();
|
||||||
|
regTcPtr->tcNodedata[0] = Tnode;
|
||||||
|
}//if
|
||||||
|
}//for
|
||||||
|
}
|
||||||
}//if
|
}//if
|
||||||
jam();
|
jam();
|
||||||
regTcPtr->lastReplicaNo = 0;
|
regTcPtr->lastReplicaNo = 0;
|
||||||
|
@@ -82,6 +82,12 @@ public:
|
|||||||
*/
|
*/
|
||||||
int getNoOfRunningSteps() const ;
|
int getNoOfRunningSteps() const ;
|
||||||
int getNoOfCompletedSteps() const ;
|
int getNoOfCompletedSteps() const ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Thread sync
|
||||||
|
*/
|
||||||
|
void sync_down(const char * key);
|
||||||
|
void sync_up_and_wait(const char * key, Uint32 count = 0);
|
||||||
private:
|
private:
|
||||||
friend class NDBT_Step;
|
friend class NDBT_Step;
|
||||||
friend class NDBT_TestSuite;
|
friend class NDBT_TestSuite;
|
||||||
|
@@ -380,27 +380,6 @@ runVerifyIndex(NDBT_Context* ctx, NDBT_Step* step){
|
|||||||
return NDBT_OK;
|
return NDBT_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
sync_down(NDBT_Context* ctx){
|
|
||||||
Uint32 threads = ctx->getProperty("PauseThreads", (unsigned)0);
|
|
||||||
if(threads){
|
|
||||||
ctx->decProperty("PauseThreads");
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
sync_up_and_wait(NDBT_Context* ctx){
|
|
||||||
Uint32 threads = ctx->getProperty("Threads", (unsigned)0);
|
|
||||||
ndbout_c("Setting PauseThreads to %d", threads);
|
|
||||||
ctx->setProperty("PauseThreads", threads);
|
|
||||||
ctx->getPropertyWait("PauseThreads", (unsigned)0);
|
|
||||||
if(threads){
|
|
||||||
ndbout_c("wait completed");
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
runTransactions1(NDBT_Context* ctx, NDBT_Step* step){
|
runTransactions1(NDBT_Context* ctx, NDBT_Step* step){
|
||||||
// Verify that data in index match
|
// Verify that data in index match
|
||||||
@@ -416,7 +395,7 @@ runTransactions1(NDBT_Context* ctx, NDBT_Step* step){
|
|||||||
return NDBT_FAILED;
|
return NDBT_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
sync_down(ctx);
|
ctx->sync_down("PauseThreads");
|
||||||
if(ctx->isTestStopped())
|
if(ctx->isTestStopped())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -425,7 +404,7 @@ runTransactions1(NDBT_Context* ctx, NDBT_Step* step){
|
|||||||
return NDBT_FAILED;
|
return NDBT_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
sync_down(ctx);
|
ctx->sync_down("PauseThreads");
|
||||||
}
|
}
|
||||||
return NDBT_OK;
|
return NDBT_OK;
|
||||||
}
|
}
|
||||||
@@ -446,7 +425,7 @@ runTransactions2(NDBT_Context* ctx, NDBT_Step* step){
|
|||||||
return NDBT_FAILED;
|
return NDBT_FAILED;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
sync_down(ctx);
|
ctx->sync_down("PauseThreads");
|
||||||
if(ctx->isTestStopped())
|
if(ctx->isTestStopped())
|
||||||
break;
|
break;
|
||||||
#if 1
|
#if 1
|
||||||
@@ -455,7 +434,7 @@ runTransactions2(NDBT_Context* ctx, NDBT_Step* step){
|
|||||||
return NDBT_FAILED;
|
return NDBT_FAILED;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
sync_down(ctx);
|
ctx->sync_down("PauseThreads");
|
||||||
}
|
}
|
||||||
return NDBT_OK;
|
return NDBT_OK;
|
||||||
}
|
}
|
||||||
@@ -476,7 +455,7 @@ runTransactions3(NDBT_Context* ctx, NDBT_Step* step){
|
|||||||
g_err << "Load table failed" << endl;
|
g_err << "Load table failed" << endl;
|
||||||
return NDBT_FAILED;
|
return NDBT_FAILED;
|
||||||
}
|
}
|
||||||
sync_down(ctx);
|
ctx->sync_down("PauseThreads");
|
||||||
if(ctx->isTestStopped())
|
if(ctx->isTestStopped())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -485,7 +464,7 @@ runTransactions3(NDBT_Context* ctx, NDBT_Step* step){
|
|||||||
return NDBT_FAILED;
|
return NDBT_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
sync_down(ctx);
|
ctx->sync_down("PauseThreads");
|
||||||
if(ctx->isTestStopped())
|
if(ctx->isTestStopped())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -494,7 +473,7 @@ runTransactions3(NDBT_Context* ctx, NDBT_Step* step){
|
|||||||
return NDBT_FAILED;
|
return NDBT_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
sync_down(ctx);
|
ctx->sync_down("PauseThreads");
|
||||||
if(ctx->isTestStopped())
|
if(ctx->isTestStopped())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -503,7 +482,7 @@ runTransactions3(NDBT_Context* ctx, NDBT_Step* step){
|
|||||||
return NDBT_FAILED;
|
return NDBT_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
sync_down(ctx);
|
ctx->sync_down("PauseThreads");
|
||||||
if(ctx->isTestStopped())
|
if(ctx->isTestStopped())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -512,7 +491,7 @@ runTransactions3(NDBT_Context* ctx, NDBT_Step* step){
|
|||||||
return NDBT_FAILED;
|
return NDBT_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
sync_down(ctx);
|
ctx->sync_down("PauseThreads");
|
||||||
if(ctx->isTestStopped())
|
if(ctx->isTestStopped())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -521,14 +500,14 @@ runTransactions3(NDBT_Context* ctx, NDBT_Step* step){
|
|||||||
return NDBT_FAILED;
|
return NDBT_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
sync_down(ctx);
|
ctx->sync_down("PauseThreads");
|
||||||
if(ctx->isTestStopped())
|
if(ctx->isTestStopped())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
int count = -1;
|
int count = -1;
|
||||||
if(utilTrans.selectCount(pNdb, 64, &count) != 0 || count != 0)
|
if(utilTrans.selectCount(pNdb, 64, &count) != 0 || count != 0)
|
||||||
return NDBT_FAILED;
|
return NDBT_FAILED;
|
||||||
sync_down(ctx);
|
ctx->sync_down("PauseThreads");
|
||||||
}
|
}
|
||||||
return NDBT_OK;
|
return NDBT_OK;
|
||||||
}
|
}
|
||||||
@@ -540,6 +519,7 @@ int runRestarts(NDBT_Context* ctx, NDBT_Step* step){
|
|||||||
NdbRestarts restarts;
|
NdbRestarts restarts;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int timeout = 240;
|
int timeout = 240;
|
||||||
|
int sync_threads = ctx->getProperty("Threads", (unsigned)0);
|
||||||
|
|
||||||
while(i<loops && result != NDBT_FAILED && !ctx->isTestStopped()){
|
while(i<loops && result != NDBT_FAILED && !ctx->isTestStopped()){
|
||||||
if(restarts.executeRestart("RestartRandomNodeAbort", timeout) != 0){
|
if(restarts.executeRestart("RestartRandomNodeAbort", timeout) != 0){
|
||||||
@@ -547,7 +527,7 @@ int runRestarts(NDBT_Context* ctx, NDBT_Step* step){
|
|||||||
result = NDBT_FAILED;
|
result = NDBT_FAILED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
sync_up_and_wait(ctx);
|
ctx->sync_up_and_wait("PauseThreads", sync_threads);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
ctx->stopTest();
|
ctx->stopTest();
|
||||||
|
@@ -219,6 +219,7 @@ int runScanReadVerify(NDBT_Context* ctx, NDBT_Step* step){
|
|||||||
int runRestarter(NDBT_Context* ctx, NDBT_Step* step){
|
int runRestarter(NDBT_Context* ctx, NDBT_Step* step){
|
||||||
int result = NDBT_OK;
|
int result = NDBT_OK;
|
||||||
int loops = ctx->getNumLoops();
|
int loops = ctx->getNumLoops();
|
||||||
|
int sync_threads = ctx->getProperty("SyncThreads", (unsigned)0);
|
||||||
NdbRestarter restarter;
|
NdbRestarter restarter;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int lastId = 0;
|
int lastId = 0;
|
||||||
@@ -251,7 +252,7 @@ int runRestarter(NDBT_Context* ctx, NDBT_Step* step){
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
NdbSleep_SecSleep(1);
|
ctx->sync_up_and_wait("PauseThreads", sync_threads);
|
||||||
|
|
||||||
lastId++;
|
lastId++;
|
||||||
i++;
|
i++;
|
||||||
@@ -295,6 +296,32 @@ int runRestarts(NDBT_Context* ctx, NDBT_Step* step){
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int runDirtyRead(NDBT_Context* ctx, NDBT_Step* step){
|
||||||
|
int result = NDBT_OK;
|
||||||
|
int loops = ctx->getNumLoops();
|
||||||
|
NdbRestarter restarter;
|
||||||
|
HugoTransactions hugoTrans(*ctx->getTab());
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
while(i<loops && result != NDBT_FAILED && !ctx->isTestStopped()){
|
||||||
|
g_info << i << ": ";
|
||||||
|
|
||||||
|
int id = i % restarter.getNumDbNodes();
|
||||||
|
int nodeId = restarter.getDbNodeId(id);
|
||||||
|
ndbout << "Restart node " << nodeId << endl;
|
||||||
|
restarter.insertErrorInNode(nodeId, 5041);
|
||||||
|
restarter.insertErrorInAllNodes(8048);
|
||||||
|
|
||||||
|
if (hugoTrans.pkReadRecords(GETNDB(step), 1, 1,
|
||||||
|
NdbOperation::LM_CommittedRead) != 0)
|
||||||
|
{
|
||||||
|
return NDBT_FAILED;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
NDBT_TESTSUITE(testNodeRestart);
|
NDBT_TESTSUITE(testNodeRestart);
|
||||||
TESTCASE("NoLoad",
|
TESTCASE("NoLoad",
|
||||||
"Test that one node at a time can be stopped and then restarted "\
|
"Test that one node at a time can be stopped and then restarted "\
|
||||||
@@ -545,6 +572,12 @@ TESTCASE("StopOnError",
|
|||||||
FINALIZER(runScanReadVerify);
|
FINALIZER(runScanReadVerify);
|
||||||
FINALIZER(runClearTable);
|
FINALIZER(runClearTable);
|
||||||
}
|
}
|
||||||
|
TESTCASE("CommittedRead",
|
||||||
|
"Test committed read"){
|
||||||
|
INITIALIZER(runLoadTable);
|
||||||
|
STEP(runDirtyRead);
|
||||||
|
FINALIZER(runClearTable);
|
||||||
|
}
|
||||||
NDBT_TESTSUITE_END(testNodeRestart);
|
NDBT_TESTSUITE_END(testNodeRestart);
|
||||||
|
|
||||||
int main(int argc, const char** argv){
|
int main(int argc, const char** argv){
|
||||||
|
@@ -1150,6 +1150,20 @@ void NDBT_Step::print(){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
NDBT_Context::sync_down(const char * key){
|
||||||
|
Uint32 threads = getProperty(key, (unsigned)0);
|
||||||
|
if(threads){
|
||||||
|
decProperty(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
NDBT_Context::sync_up_and_wait(const char * key, Uint32 value){
|
||||||
|
setProperty(key, value);
|
||||||
|
getPropertyWait(key, (unsigned)0);
|
||||||
|
}
|
||||||
|
|
||||||
template class Vector<NDBT_TestCase*>;
|
template class Vector<NDBT_TestCase*>;
|
||||||
template class Vector<NDBT_TestCaseResult*>;
|
template class Vector<NDBT_TestCaseResult*>;
|
||||||
template class Vector<NDBT_Step*>;
|
template class Vector<NDBT_Step*>;
|
||||||
|
Reference in New Issue
Block a user