List:Internals« Previous MessageNext Message »
From:jonas.oreland Date:April 8 2005 2:15pm
Subject:bk commit into 4.1 tree (joreland:1.2157) BUG#9749
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of jonas. When jonas 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.2157 05/04/08 14:15:37 joreland@stripped +1 -0
  bug#9749 - ndb 
    test case for case 9749, ndb lock upgrade via NDBAPI

  ndb/test/ndbapi/testOperations.cpp
    1.9 05/04/08 14:15:34 joreland@stripped +93 -0
    bug#9749 - test case for case 9749

# 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:	joreland
# Host:	eel.ndb.mysql.com.ndb.mysql.com.ndb.mysql.com.ndb.mysql.com
# Root:	/home/jonas/src/mysql-4.1

--- 1.8/ndb/test/ndbapi/testOperations.cpp	Wed Feb  2 21:03:44 2005
+++ 1.9/ndb/test/ndbapi/testOperations.cpp	Fri Apr  8 14:15:34 2005
@@ -531,6 +531,74 @@
 }
 
 int
+runLockUpgrade1(NDBT_Context* ctx, NDBT_Step* step){
+  // Verify that data in index match 
+  // table data
+  Ndb* pNdb = GETNDB(step);
+  HugoOperations hugoOps(*ctx->getTab());
+  HugoTransactions hugoTrans(*ctx->getTab());
+
+  if(hugoTrans.loadTable(pNdb, 1) != 0){
+    g_err << "Load table failed" << endl;
+    return NDBT_FAILED;
+  }
+
+  int result= NDBT_OK;
+  do
+  {
+    CHECK(hugoOps.startTransaction(pNdb) == 0);  
+    CHECK(hugoOps.pkReadRecord(pNdb, 0, 1, NdbOperation::LM_Read) == 0);
+    CHECK(hugoOps.execute_NoCommit(pNdb) == 0);
+    
+    ctx->setProperty("READ_DONE", 1);
+    ctx->broadcast();
+    ndbout_c("wait 2");
+    ctx->getPropertyWait("READ_DONE", 2);
+    ndbout_c("wait 2 - done");
+    ctx->setProperty("READ_DONE", 3);
+    ctx->broadcast();
+    ndbout_c("before update");
+    CHECK(hugoOps.pkUpdateRecord(pNdb, 0, 1, 2) == 0);
+    ndbout_c("wait update");
+    CHECK(hugoOps.execute_NoCommit(pNdb) == 0);
+    CHECK(hugoOps.closeTransaction(pNdb));
+  } while(0);
+  
+  return result;
+}
+
+int
+runLockUpgrade2(NDBT_Context* ctx, NDBT_Step* step){
+  // Verify that data in index match 
+  // table data
+  Ndb* pNdb = GETNDB(step);
+  HugoOperations hugoOps(*ctx->getTab());
+  HugoTransactions hugoTrans(*ctx->getTab());
+
+  
+  int result= NDBT_OK;
+  do
+  {
+    CHECK(hugoOps.startTransaction(pNdb) == 0);  
+    ndbout_c("wait 1");
+    ctx->getPropertyWait("READ_DONE", 1);
+    ndbout_c("wait 1 - done");
+    CHECK(hugoOps.pkReadRecord(pNdb, 0, 1, NdbOperation::LM_Read) == 0);
+    CHECK(hugoOps.execute_NoCommit(pNdb) == 0);
+    ctx->setProperty("READ_DONE", 2);
+    ctx->broadcast();
+    ndbout_c("wait 3");
+    ctx->getPropertyWait("READ_DONE", 3);
+    ndbout_c("wait 3 - done");
+    
+    NdbSleep_MilliSleep(200);
+    CHECK(hugoOps.execute_Commit(pNdb) == 0);  
+  } while(0);
+
+  return NDBT_FAILED;
+}
+
+int
 main(int argc, const char** argv){
   ndb_init();
 
@@ -538,6 +606,31 @@
   generate(tmp, 5);
 
   NDBT_TestSuite ts("testOperations");
+
+  {
+    BaseString name("bug_9749");
+    NDBT_TestCaseImpl1 *pt = new NDBT_TestCaseImpl1(&ts, 
+						    name.c_str(), "");    
+    
+    pt->addInitializer(new NDBT_Initializer(pt,
+					    "runClearTable", 
+					    runClearTable));
+    
+    pt->addStep(new NDBT_ParallelStep(pt, 
+				      "thread1",
+				      runLockUpgrade1));
+    
+
+    pt->addStep(new NDBT_ParallelStep(pt, 
+				      "thread2",
+				      runLockUpgrade2));
+    
+    pt->addFinalizer(new NDBT_Finalizer(pt, 
+					"runClearTable", 
+					runClearTable));
+    ts.addTest(pt);
+  }
+
   for(size_t i = 0; i<tmp.size(); i++)
   {
     BaseString name;
Thread
bk commit into 4.1 tree (joreland:1.2157) BUG#9749jonas.oreland8 Apr