summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <joreland@mysql.com>2005-03-01 13:36:41 +0100
committerunknown <joreland@mysql.com>2005-03-01 13:36:41 +0100
commit46f067bcb9a02548ea2e30ddab234e483df1bce8 (patch)
tree8d7abf60dd99a7e2b3a69861155336fa83ba1d31
parent1a3ee0dec50cb71d314ed6935a012760f0cb72d4 (diff)
parent705fbb7633f31c14eb8ea17ee8040b0245f8421f (diff)
downloadmariadb-git-46f067bcb9a02548ea2e30ddab234e483df1bce8.tar.gz
Merge joreland@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/jonas/src/mysql-4.1
-rw-r--r--ndb/include/ndbapi/NdbConnection.hpp3
-rw-r--r--ndb/src/kernel/blocks/dbtc/DbtcMain.cpp3
-rw-r--r--ndb/test/ndbapi/testNodeRestart.cpp71
-rw-r--r--ndb/test/run-test/daily-devel-tests.txt4
4 files changed, 79 insertions, 2 deletions
diff --git a/ndb/include/ndbapi/NdbConnection.hpp b/ndb/include/ndbapi/NdbConnection.hpp
index 53830dd93c5..3a9f18665e9 100644
--- a/ndb/include/ndbapi/NdbConnection.hpp
+++ b/ndb/include/ndbapi/NdbConnection.hpp
@@ -448,6 +448,8 @@ public:
NdbScanOperation* getNdbScanOperation(const NdbDictionary::Table * table);
NdbIndexScanOperation* getNdbIndexScanOperation(const NdbDictionary::Index * index,
const NdbDictionary::Table * table);
+
+ Uint32 getConnectedNodeId(); // Get Connected node id
private:
/**
@@ -480,7 +482,6 @@ private:
*/
void setConnectedNodeId( Uint32 nodeId, Uint32 sequence);
- Uint32 getConnectedNodeId(); // Get Connected node id
void setMyBlockReference( int ); // Set my block refrerence
void setTC_ConnectPtr( Uint32 ); // Sets TC Connect pointer
int getTC_ConnectPtr(); // Gets TC Connect pointer
diff --git a/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp b/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
index 97931041e2a..d03c908117d 100644
--- a/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
+++ b/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
@@ -5193,7 +5193,8 @@ void Dbtc::execTC_COMMITREQ(Signal* signal)
const Uint32 transId1 = regApiPtr->transid[0];
const Uint32 transId2 = regApiPtr->transid[1];
Uint32 errorCode = 0;
-
+
+ regApiPtr->m_exec_flag = 1;
switch (regApiPtr->apiConnectstate) {
case CS_STARTED:
tcConnectptr.i = regApiPtr->firstTcConnect;
diff --git a/ndb/test/ndbapi/testNodeRestart.cpp b/ndb/test/ndbapi/testNodeRestart.cpp
index e844f227034..a50df91908c 100644
--- a/ndb/test/ndbapi/testNodeRestart.cpp
+++ b/ndb/test/ndbapi/testNodeRestart.cpp
@@ -344,6 +344,71 @@ err:
return NDBT_FAILED;
}
+int runLateCommit(NDBT_Context* ctx, NDBT_Step* step){
+ int result = NDBT_OK;
+ int loops = ctx->getNumLoops();
+ int records = ctx->getNumRecords();
+ NdbRestarter restarter;
+ HugoOperations hugoOps(*ctx->getTab());
+ Ndb* pNdb = GETNDB(step);
+
+ int i = 0;
+ while(i<loops && result != NDBT_FAILED && !ctx->isTestStopped()){
+ g_info << i << ": ";
+
+ if(hugoOps.startTransaction(pNdb) != 0)
+ return NDBT_FAILED;
+
+ if(hugoOps.pkUpdateRecord(pNdb, 1) != 0)
+ return NDBT_FAILED;
+
+ if(hugoOps.execute_NoCommit(pNdb) != 0)
+ return NDBT_FAILED;
+
+ Uint32 transNode= hugoOps.getTransaction()->getConnectedNodeId();
+ int id = i % restarter.getNumDbNodes();
+ int nodeId;
+ while((nodeId = restarter.getDbNodeId(id)) == transNode)
+ id = (id + 1) % restarter.getNumDbNodes();
+
+ ndbout << "Restart node " << nodeId << endl;
+
+ restarter.restartOneDbNode(nodeId,
+ /** initial */ false,
+ /** nostart */ true,
+ /** abort */ true);
+
+ restarter.waitNodesNoStart(&nodeId, 1);
+
+ int res;
+ if(i & 1)
+ res= hugoOps.execute_Commit(pNdb);
+ else
+ res= hugoOps.execute_Rollback(pNdb);
+
+ ndbout_c("res= %d", res);
+
+ hugoOps.closeTransaction(pNdb);
+
+ restarter.startNodes(&nodeId, 1);
+ restarter.waitNodesStarted(&nodeId, 1);
+
+ if(i & 1)
+ {
+ if(res != 286)
+ return NDBT_FAILED;
+ }
+ else
+ {
+ if(res != 0)
+ return NDBT_FAILED;
+ }
+ i++;
+ }
+
+ return NDBT_OK;
+}
+
NDBT_TESTSUITE(testNodeRestart);
TESTCASE("NoLoad",
"Test that one node at a time can be stopped and then restarted "\
@@ -600,6 +665,12 @@ TESTCASE("CommittedRead",
STEP(runDirtyRead);
FINALIZER(runClearTable);
}
+TESTCASE("LateCommit",
+ "Test commit after node failure"){
+ INITIALIZER(runLoadTable);
+ STEP(runLateCommit);
+ FINALIZER(runClearTable);
+}
NDBT_TESTSUITE_END(testNodeRestart);
int main(int argc, const char** argv){
diff --git a/ndb/test/run-test/daily-devel-tests.txt b/ndb/test/run-test/daily-devel-tests.txt
index 2cdd39ffa4c..9812ec2ceaa 100644
--- a/ndb/test/run-test/daily-devel-tests.txt
+++ b/ndb/test/run-test/daily-devel-tests.txt
@@ -71,6 +71,10 @@ args: -n CommittedRead T1
max-time: 2500
cmd: testNodeRestart
+args: -n LateCommit T1
+
+max-time: 2500
+cmd: testNodeRestart
args: -n Terror T6 T13
max-time: 2500