MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Jonas Oreland Date:August 9 2010 10:19am
Subject:bzr commit into mysql-5.1-telco-6.3 branch (jonas:3243) Bug#54724
View as plain text  
#At file:///home/jonas/src/telco-6.3/ based on revid:jonas@stripped

 3243 Jonas Oreland	2010-08-09
      ndb - bug#54724 - refix bug, and add testcase

    modified:
      storage/ndb/src/ndbapi/NdbTransaction.cpp
      storage/ndb/test/ndbapi/testTimeout.cpp
      storage/ndb/test/run-test/daily-basic-tests.txt
=== modified file 'storage/ndb/src/ndbapi/NdbTransaction.cpp'
--- a/storage/ndb/src/ndbapi/NdbTransaction.cpp	2010-07-02 07:55:11 +0000
+++ b/storage/ndb/src/ndbapi/NdbTransaction.cpp	2010-08-09 10:19:19 +0000
@@ -809,9 +809,8 @@ void NdbTransaction::close()
 
 int NdbTransaction::refresh()
 {
-  for(NdbIndexScanOperation* scan_op = m_theFirstScanOperation;
-      scan_op != m_theLastScanOperation;
-      scan_op = (NdbIndexScanOperation *) scan_op->theNext)
+  for(NdbIndexScanOperation* scan_op = m_firstExecutedScanOp;
+      scan_op != 0; scan_op = (NdbIndexScanOperation *) scan_op->theNext)
   {
     NdbTransaction* scan_trans = scan_op->theNdbCon;
     scan_trans->sendTC_HBREP();

=== modified file 'storage/ndb/test/ndbapi/testTimeout.cpp'
--- a/storage/ndb/test/ndbapi/testTimeout.cpp	2010-03-17 12:21:57 +0000
+++ b/storage/ndb/test/ndbapi/testTimeout.cpp	2010-08-09 10:19:19 +0000
@@ -401,8 +401,8 @@ int runBuddyTransNoTimeout(NDBT_Context*
 int runBuddyTransTimeout(NDBT_Context* ctx, NDBT_Step* step){
   int result = NDBT_OK;
   int loops = ctx->getNumLoops();
-  int records = ctx->getNumRecords();
-  int stepNo = step->getStepNo();
+  //int records = ctx->getNumRecords();
+  //int stepNo = step->getStepNo();
   ndbout << "TransactionInactiveTimeout="<< TIMEOUT <<endl;
 
   HugoOperations hugoOps(*ctx->getTab());
@@ -437,6 +437,67 @@ int runBuddyTransTimeout(NDBT_Context* c
   return result;
 }
 
+int runScanRefreshNoTimeout(NDBT_Context* ctx, NDBT_Step* step){
+  int result = NDBT_OK;
+  int loops = ctx->getNumLoops();
+  int records = ctx->getNumRecords();
+  int stepNo = step->getStepNo();
+  int maxSleep = (int)(TIMEOUT * 0.3);
+  ndbout << "TransactionInactiveTimeout="<< TIMEOUT
+	 << ", maxSleep="<<maxSleep<<endl;
+
+  HugoOperations hugoOps(*ctx->getTab());
+  Ndb* pNdb = GETNDB(step);
+
+  for (int l = 1; l < loops && result == NDBT_OK; l++){
+
+    do{
+      // Start an insert trans
+      CHECK(hugoOps.startTransaction(pNdb) == 0);
+      int recordNo = records + (stepNo*loops) + l;
+      CHECK(hugoOps.pkInsertRecord(pNdb, recordNo) == 0);
+      CHECK(hugoOps.execute_NoCommit(pNdb) == 0);
+      
+      for (int i = 0; i < 3; i++)
+      {
+        NdbTransaction* pTrans = hugoOps.getTransaction();
+
+        Vector<NdbScanOperation*> ops;
+        for (int j = 0; j <= i; j++)
+        {
+          // Perform buddy scan reads
+          NdbScanOperation* pOp = pTrans->getNdbScanOperation(ctx->getTab());
+          CHECK(pOp != 0);
+          CHECK(pOp->readTuples(NdbOperation::LM_Read, 0, 0, 1) == 0);
+          ops.push_back(pOp);
+        }
+        CHECK(pTrans->execute(NoCommit) == 0);
+
+        for (unsigned i = 0; i<TIMEOUT; i += 1000)
+        {
+          pTrans->refresh();
+          NdbSleep_MilliSleep(1000);
+        }
+
+        int res;
+        for (size_t j = 0; j < ops.size(); j++)
+        {
+          while((res = ops[j]->nextResult()) == 0);
+          CHECK(res != -1);
+        }
+      }
+
+      // Expect that transaction has NOT timed-out
+      CHECK(hugoOps.execute_Commit(pNdb) == 0); 
+    
+    } while(false);
+
+    hugoOps.closeTransaction(pNdb);
+  }
+
+  return result;
+}
+
 int 
 runError4012(NDBT_Context* ctx, NDBT_Step* step){
   int result = NDBT_OK;
@@ -552,6 +613,15 @@ TESTCASE("BuddyTransTimeout1", 
   FINALIZER(resetTransactionTimeout);
   FINALIZER(runClearTable);
 }
+TESTCASE("ScanRefreshNoTimeout", 
+	 "")
+{
+  INITIALIZER(runLoadTable);
+  INITIALIZER(setTransactionTimeout);
+  STEPS(runScanRefreshNoTimeout, 1);
+  FINALIZER(resetTransactionTimeout);
+  FINALIZER(runClearTable);
+}
 #if 0
 TESTCASE("Error4012", ""){
   TC_PROPERTY("TransactionDeadlockTimeout", 120000);
@@ -570,3 +640,4 @@ int main(int argc, const char** argv){
   return testTimeout.execute(argc, argv);
 }
 
+template class Vector<NdbScanOperation*>;

=== modified file 'storage/ndb/test/run-test/daily-basic-tests.txt'
--- a/storage/ndb/test/run-test/daily-basic-tests.txt	2010-07-04 16:13:03 +0000
+++ b/storage/ndb/test/run-test/daily-basic-tests.txt	2010-08-09 10:19:19 +0000
@@ -231,7 +231,7 @@ max-time: 500
 cmd: testBasic
 args: -n InsertError2 T1
 
-max-time: 500
+max-time: 600
 cmd: testTimeout
 args: T1 
 


Attachment: [text/bzr-bundle] bzr/jonas@mysql.com-20100809101919-1snemm8t74g6hxyu.bundle
Thread
bzr commit into mysql-5.1-telco-6.3 branch (jonas:3243) Bug#54724Jonas Oreland9 Aug