summaryrefslogtreecommitdiff
path: root/ndb/test
diff options
context:
space:
mode:
Diffstat (limited to 'ndb/test')
-rw-r--r--ndb/test/include/NdbRestarter.hpp2
-rw-r--r--ndb/test/ndbapi/testNodeRestart.cpp42
-rw-r--r--ndb/test/run-test/daily-basic-tests.txt4
-rw-r--r--ndb/test/src/NdbRestarter.cpp62
4 files changed, 110 insertions, 0 deletions
diff --git a/ndb/test/include/NdbRestarter.hpp b/ndb/test/include/NdbRestarter.hpp
index 3ec92ae786e..a2e6a4b3248 100644
--- a/ndb/test/include/NdbRestarter.hpp
+++ b/ndb/test/include/NdbRestarter.hpp
@@ -62,6 +62,8 @@ public:
int dumpStateAllNodes(int * _args, int _num_args);
int getMasterNodeId();
+ int getNextMasterNodeId(int nodeId);
+ int getNodeGroup(int nodeId);
int getRandomNodeSameNodeGroup(int nodeId, int randomNumber);
int getRandomNodeOtherNodeGroup(int nodeId, int randomNumber);
int getRandomNotMasterNodeId(int randomNumber);
diff --git a/ndb/test/ndbapi/testNodeRestart.cpp b/ndb/test/ndbapi/testNodeRestart.cpp
index 43fb77342b5..e729e8179b5 100644
--- a/ndb/test/ndbapi/testNodeRestart.cpp
+++ b/ndb/test/ndbapi/testNodeRestart.cpp
@@ -1045,6 +1045,45 @@ int runBug25554(NDBT_Context* ctx, NDBT_Step* step){
return NDBT_OK;
}
+int
+runBug26457(NDBT_Context* ctx, NDBT_Step* step)
+{
+ NdbRestarter res;
+ if (res.getNumDbNodes() < 4)
+ return NDBT_OK;
+
+ int loops = ctx->getNumLoops();
+ while (loops --)
+ {
+retry:
+ int master = res.getMasterNodeId();
+ int next = res.getNextMasterNodeId(master);
+
+ ndbout_c("master: %d next: %d", master, next);
+
+ if (res.getNodeGroup(master) == res.getNodeGroup(next))
+ {
+ res.restartOneDbNode(next, false, false, true);
+ if (res.waitClusterStarted())
+ return NDBT_FAILED;
+ goto retry;
+ }
+
+ int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 2 };
+
+ if (res.dumpStateOneNode(next, val2, 2))
+ return NDBT_FAILED;
+
+ if (res.insertErrorInNode(next, 7180))
+ return NDBT_FAILED;
+
+ res.restartOneDbNode(master, false, false, true);
+ if (res.waitClusterStarted())
+ return NDBT_FAILED;
+ }
+
+ return NDBT_OK;
+}
NDBT_TESTSUITE(testNodeRestart);
TESTCASE("NoLoad",
@@ -1367,6 +1406,9 @@ TESTCASE("Bug25364", ""){
TESTCASE("Bug25554", ""){
INITIALIZER(runBug25554);
}
+TESTCASE("Bug26457", ""){
+ INITIALIZER(runBug26457);
+}
NDBT_TESTSUITE_END(testNodeRestart);
int main(int argc, const char** argv){
diff --git a/ndb/test/run-test/daily-basic-tests.txt b/ndb/test/run-test/daily-basic-tests.txt
index 00fa14eea2c..9074ff145d8 100644
--- a/ndb/test/run-test/daily-basic-tests.txt
+++ b/ndb/test/run-test/daily-basic-tests.txt
@@ -477,6 +477,10 @@ max-time: 1000
cmd: testNodeRestart
args: -n Bug25554 T1
+max-time: 1000
+cmd: testNodeRestart
+args: -n Bug26457 T1
+
# OLD FLEX
max-time: 500
cmd: flexBench
diff --git a/ndb/test/src/NdbRestarter.cpp b/ndb/test/src/NdbRestarter.cpp
index 2c16a05240d..4c7f52a8622 100644
--- a/ndb/test/src/NdbRestarter.cpp
+++ b/ndb/test/src/NdbRestarter.cpp
@@ -129,6 +129,68 @@ NdbRestarter::getMasterNodeId(){
}
int
+NdbRestarter::getNodeGroup(int nodeId){
+ if (!isConnected())
+ return -1;
+
+ if (getStatus() != 0)
+ return -1;
+
+ for(size_t i = 0; i < ndbNodes.size(); i++)
+ {
+ if(ndbNodes[i].node_id == nodeId)
+ {
+ return ndbNodes[i].node_group;
+ }
+ }
+
+ return -1;
+}
+
+int
+NdbRestarter::getNextMasterNodeId(int nodeId){
+ if (!isConnected())
+ return -1;
+
+ if (getStatus() != 0)
+ return -1;
+
+ size_t i;
+ for(i = 0; i < ndbNodes.size(); i++)
+ {
+ if(ndbNodes[i].node_id == nodeId)
+ {
+ break;
+ }
+ }
+ assert(i < ndbNodes.size());
+ if (i == ndbNodes.size())
+ return -1;
+
+ int dynid = ndbNodes[i].dynamic_id;
+ int minid = dynid;
+ for (i = 0; i<ndbNodes.size(); i++)
+ if (ndbNodes[i].dynamic_id > minid)
+ minid = ndbNodes[i].dynamic_id;
+
+ for (i = 0; i<ndbNodes.size(); i++)
+ if (ndbNodes[i].dynamic_id > dynid &&
+ ndbNodes[i].dynamic_id < minid)
+ {
+ minid = ndbNodes[i].dynamic_id;
+ }
+
+ if (minid != ~0)
+ {
+ for (i = 0; i<ndbNodes.size(); i++)
+ if (ndbNodes[i].dynamic_id == minid)
+ return ndbNodes[i].node_id;
+ }
+
+ return getMasterNodeId();
+}
+
+int
NdbRestarter::getRandomNotMasterNodeId(int rand){
int master = getMasterNodeId();
if(master == -1)