List:Internals« Previous MessageNext Message »
From:tomas Date:June 13 2005 7:45pm
Subject:bk commit into 4.1 tree (tulin:1.2291) BUG#11290
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of ndbdev. When ndbdev 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
  1.2291 05/06/13 19:45:15 tulin@stripped +3 -0
  logging_ok:
    Logging to logging@stripped accepted
  DbtcMain.cpp, testTimeout.cpp:
    Bug  #11290 TransactionInactiveTimeout = 0 does not result in infinite timeout

  BitKeeper/etc/logging_ok
    1.399 05/06/13 19:44:57 ndbdev@stripped +1 -0
    Logging to logging@stripped accepted

  ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
    1.56 05/06/13 19:44:15 ndbdev@stripped +10 -6
    Bug  #11290 TransactionInactiveTimeout = 0 does not result in infinite timeout

  ndb/test/ndbapi/testTimeout.cpp
    1.11 05/06/13 19:44:00 ndbdev@stripped +74 -12
    Bug  #11290 TransactionInactiveTimeout = 0 does not result in infinite timeout

# 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:	tulin
# Host:	dl145c.mysql.com
# Root:	/home/ndbdev/tomas/mysql-4.1

--- 1.398/BitKeeper/etc/logging_ok	Tue Jun  7 15:33:37 2005
+++ 1.399/BitKeeper/etc/logging_ok	Mon Jun 13 19:44:57 2005
@@ -176,6 +176,7 @@
 mysqldev@stripped
 mysqldev@stripped
 ndbdev@stripped
+ndbdev@stripped
 ndbdev@stripped
 ndbdev@stripped
 nick@stripped

--- 1.55/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp	Thu May  5 10:34:37 2005
+++ 1.56/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp	Mon Jun 13 19:44:15 2005
@@ -722,11 +722,14 @@
 void
 Dbtc::set_appl_timeout_value(Uint32 timeOut)
 {
-  timeOut /= 10;
-  if (timeOut < ctimeOutValue) {
-    jam();
-    c_appl_timeout_value = ctimeOutValue;
-  }//if
+  if (timeOut)
+  {
+    timeOut /= 10;
+    if (timeOut < ctimeOutValue) {
+      jam();
+      c_appl_timeout_value = ctimeOutValue;
+    }//if
+  }
   c_appl_timeout_value = timeOut;
 }
 
@@ -6133,7 +6136,8 @@
       particular state we will use the application timeout parameter rather
       than the shorter Deadlock detection timeout.
       */
-      if ((ctcTimer - getApiConTimer(apiConnectptr.i)) <= c_appl_timeout_value) {
+      if (c_appl_timeout_value == 0 ||
+          (ctcTimer - getApiConTimer(apiConnectptr.i)) <= c_appl_timeout_value) {
         jam();
         return;
       }//if

--- 1.10/ndb/test/ndbapi/testTimeout.cpp	Wed Oct 13 11:43:52 2004
+++ 1.11/ndb/test/ndbapi/testTimeout.cpp	Mon Jun 13 19:44:00 2005
@@ -22,14 +22,14 @@
 #include <NdbConfig.hpp>
 #include <signaldata/DumpStateOrd.hpp>
 
-#define TIMEOUT 3000
-
+#define TIMEOUT (Uint32)3000
 Uint32 g_org_timeout = 3000;
 
 int
 setTransactionTimeout(NDBT_Context* ctx, NDBT_Step* step){
   NdbRestarter restarter;
-  
+  int timeout = ctx->getProperty("TransactionInactiveTimeout",TIMEOUT);
+
   NdbConfig conf(GETNDB(step)->getNodeId()+1);
   unsigned int nodeId = conf.getMasterNodeId();
   if (!conf.getProperty(nodeId,
@@ -39,7 +39,7 @@
     return NDBT_FAILED;
   }
 
-  int val[] = { DumpStateOrd::TcSetApplTransactionTimeout, TIMEOUT };
+  int val[] = { DumpStateOrd::TcSetApplTransactionTimeout, timeout };
   if(restarter.dumpStateAllNodes(val, 2) != 0){
     return NDBT_FAILED;
   }
@@ -94,9 +94,11 @@
   unsigned int nodeId = conf.getMasterNodeId();
   int stepNo = step->getStepNo();
 
-  int minSleep = (int)(TIMEOUT * 1.5);
-  int maxSleep = TIMEOUT * 2;
-  ndbout << "TransactionInactiveTimeout="<< TIMEOUT
+  int timeout = ctx->getProperty("TransactionInactiveTimeout",TIMEOUT);
+
+  int minSleep = (int)(timeout * 1.5);
+  int maxSleep = timeout * 2;
+  ndbout << "TransactionInactiveTimeout="<< timeout
 	 << ", minSleep="<<minSleep
 	 << ", maxSleep="<<maxSleep<<endl;
 
@@ -134,8 +136,10 @@
   int mul2 = ctx->getProperty("Op2", (Uint32)0);
   int records = ctx->getNumRecords();
 
-  int minSleep = (int)(TIMEOUT * 1.5);
-  int maxSleep = TIMEOUT * 2;
+  int timeout = ctx->getProperty("TransactionInactiveTimeout",TIMEOUT);
+
+  int minSleep = (int)(timeout * 1.5);
+  int maxSleep = timeout * 2;
   
   HugoOperations hugoOps(*ctx->getTab());
   Ndb* pNdb = GETNDB(step);
@@ -148,7 +152,7 @@
     op1 = (op1 % 5);
     op2 = (op2 % 5);
 
-    ndbout << stepNo << ": TransactionInactiveTimeout="<< TIMEOUT
+    ndbout << stepNo << ": TransactionInactiveTimeout="<< timeout
 	   << ", minSleep="<<minSleep
 	   << ", maxSleep="<<maxSleep
 	   << ", op1=" << op1
@@ -250,8 +254,10 @@
   int loops = ctx->getNumLoops();
   int stepNo = step->getStepNo();
 
-  int maxSleep = (int)(TIMEOUT * 0.5);
-  ndbout << "TransactionInactiveTimeout="<< TIMEOUT
+  int timeout = ctx->getProperty("TransactionInactiveTimeout",TIMEOUT);
+
+  int maxSleep = (int)(timeout * 0.5);
+  ndbout << "TransactionInactiveTimeout="<< timeout
 	 << ", maxSleep="<<maxSleep<<endl;
 
 
@@ -281,6 +287,51 @@
   return result;
 }
 
+int runDeadlockTimeoutTrans(NDBT_Context* ctx, NDBT_Step* step){
+  int result = NDBT_OK;
+  int loops = ctx->getNumLoops();
+  int stepNo = step->getStepNo();
+
+  Uint32 deadlock_timeout;
+  NdbConfig conf(GETNDB(step)->getNodeId()+1);
+  unsigned int nodeId = conf.getMasterNodeId();
+  if (!conf.getProperty(nodeId,
+                        NODE_TYPE_DB,
+                        CFG_DB_TRANSACTION_DEADLOCK_TIMEOUT,
+                        &deadlock_timeout)){
+    return NDBT_FAILED;
+  }
+
+
+  int do_sleep = (int)(deadlock_timeout * 0.5);
+
+
+  HugoOperations hugoOps(*ctx->getTab());
+  Ndb* pNdb = GETNDB(step);
+
+  for (int l = 0; l < loops && result == NDBT_OK; l++){
+
+    do{
+      // Commit transaction
+      CHECK(hugoOps.startTransaction(pNdb) == 0);
+      CHECK(hugoOps.pkReadRecord(pNdb, stepNo) == 0);
+      CHECK(hugoOps.execute_NoCommit(pNdb) == 0);
+
+      int sleep = deadlock_timeout * 1.5 + myRandom48(do_sleep);
+      ndbout << "Sleeping for " << sleep << " milliseconds" <<
endl;
+      NdbSleep_MilliSleep(sleep);
+
+      // Expect that transaction has NOT timed-out
+      CHECK(hugoOps.execute_Commit(pNdb) == 0);
+
+    } while(false);
+
+    hugoOps.closeTransaction(pNdb);
+  }
+
+  return result;
+}
+
 int runBuddyTransNoTimeout(NDBT_Context* ctx, NDBT_Step* step){
   int result = NDBT_OK;
   int loops = ctx->getNumLoops();
@@ -331,6 +382,17 @@
   INITIALIZER(runLoadTable);
   INITIALIZER(setTransactionTimeout);
   STEPS(runDontTimeoutTrans, 1); 
+  FINALIZER(resetTransactionTimeout);
+  FINALIZER(runClearTable);
+}
+TESTCASE("Bug11290",
+         "Setting TransactionInactiveTimeout to 0(zero) "\
+         "should result in infinite timeout, and not as "\
+         "was the bug, a timeout that is equal to the deadlock timeout"){
+  TC_PROPERTY("TransactionInactiveTimeout",(Uint32)0);
+  INITIALIZER(runLoadTable);
+  INITIALIZER(setTransactionTimeout);
+  STEPS(runDeadlockTimeoutTrans, 1);
   FINALIZER(resetTransactionTimeout);
   FINALIZER(runClearTable);
 }
Thread
bk commit into 4.1 tree (tulin:1.2291) BUG#11290tomas13 Jun