List:Commits« Previous MessageNext Message »
From:Jonas Oreland Date:August 7 2009 11:54am
Subject:bzr commit into mysql-5.1-telco-6.2 branch (jonas:2961) Bug#46069
View as plain text  
#At file:///home/jonas/src/telco-6.2/ based on revid:frazer@stripped

 2961 Jonas Oreland	2009-08-07
      ndb - bug#46069
        Fix crash in ACC caused by assertion fire-ing due to TUX LOCK_REQ
          did not set OP_COMMIT_DELETE_CHECK during setup

    modified:
      storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp
      storage/ndb/test/ndbapi/testIndex.cpp
      storage/ndb/test/run-test/daily-basic-tests.txt
=== modified file 'storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp	2009-05-26 18:53:34 +0000
+++ b/storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp	2009-08-07 11:54:37 +0000
@@ -970,7 +970,22 @@ void Dbacc::initOpRec(Signal* signal) 
   opbits |= ((Treqinfo >> 4) & 0x3) ? (Uint32) Operationrec::OP_LOCK_MODE : 0;
   opbits |= ((Treqinfo >> 4) & 0x3) ? (Uint32) Operationrec::OP_ACC_LOCK_MODE : 0;
   opbits |= (dirtyReadFlag) ? (Uint32) Operationrec::OP_DIRTY_READ : 0;
-  opbits |= ((Treqinfo >> 31) & 0x1) ? (Uint32) Operationrec::OP_LOCK_REQ : 0;
+  if ((Treqinfo >> 31) & 0x1)
+  {
+    opbits |= Operationrec::OP_LOCK_REQ;            // TUX LOCK_REQ
+
+    /**
+     * A lock req has SCAN_OP, it can't delete a row,
+     *   so OP_COMMIT_DELETE_CHECK is set like for SCAN
+     *   see initScanOpRec
+     */
+    opbits |= Operationrec::OP_COMMIT_DELETE_CHECK;
+
+    /**
+     * TODO: Looking at it now, I think it would be more natural
+     *       to treat it as a ZREAD...
+     */
+  }
   
   //operationRecPtr.p->nodeType = (Treqinfo >> 7) & 0x3;
   operationRecPtr.p->fid = fragrecptr.p->myfid;

=== modified file 'storage/ndb/test/ndbapi/testIndex.cpp'
--- a/storage/ndb/test/ndbapi/testIndex.cpp	2009-05-26 18:53:34 +0000
+++ b/storage/ndb/test/ndbapi/testIndex.cpp	2009-08-07 11:54:37 +0000
@@ -1424,6 +1424,94 @@ runBug28804_ATTRINFO(NDBT_Context* ctx, 
   return tcSaveINDX_test(ctx, step, 8051);
 }
 
+int
+runBug46069(NDBT_Context* ctx, NDBT_Step* step)
+{
+  HugoTransactions hugoTrans(*ctx->getTab());
+  Ndb* pNdb = GETNDB(step);
+  const int rows = ctx->getNumRecords();
+  Uint32 threads = ctx->getProperty("THREADS", 12);
+  int loops = ctx->getNumLoops();
+
+  ctx->getPropertyWait("STARTED", threads);
+
+  for (int i = 0; i<loops; i++)
+  {
+    ndbout << "Loop: " << i << endl;
+    if (hugoTrans.loadTable(pNdb, rows) != 0)
+      return NDBT_FAILED;
+
+    ctx->setProperty("STARTED", Uint32(0));
+    ctx->getPropertyWait("STARTED", threads);
+  }
+
+  ctx->stopTest();
+  return NDBT_OK;
+}
+
+int
+runBug46069_pkdel(NDBT_Context* ctx, NDBT_Step* step)
+{
+  HugoOperations hugoOps(*ctx->getTab());
+  Ndb* pNdb = GETNDB(step);
+  const int rows = ctx->getNumRecords();
+
+  while(!ctx->isTestStopped())
+  {
+    ctx->incProperty("STARTED");
+    ctx->getPropertyWait("STARTED", Uint32(0));
+    if (ctx->isTestStopped())
+      break;
+
+    for (int i = 0; i<rows && !ctx->isTestStopped(); )
+    {
+      int cnt = (rows - i);
+      if (cnt > 100)
+        cnt = 100;
+      cnt = 1 + (rand() % cnt);
+      if (hugoOps.startTransaction(pNdb) != 0)
+      {
+        break;
+      }
+      hugoOps.pkDeleteRecord(pNdb, i, cnt);
+      int res = hugoOps.execute_Commit(pNdb, AO_IgnoreError);
+      if (res != -1)
+      {
+        i += cnt;
+      }
+      hugoOps.closeTransaction(pNdb);
+    }
+  }
+
+  return NDBT_OK;
+}
+
+int
+runBug46069_scandel(NDBT_Context* ctx, NDBT_Step* step)
+{
+  Ndb* pNdb = GETNDB(step);
+  NdbDictionary::Dictionary * dict = pNdb->getDictionary();
+  const NdbDictionary::Index * idx = dict->getIndex(pkIdxName,
+						    ctx->getTab()->getName());
+  if (idx == 0)
+  {
+    return NDBT_FAILED;
+  }
+  UtilTransactions hugoTrans(*ctx->getTab(), idx);
+
+  while(!ctx->isTestStopped())
+  {
+    ctx->incProperty("STARTED");
+    ctx->getPropertyWait("STARTED", Uint32(0));
+    if (ctx->isTestStopped())
+      break;
+
+    hugoTrans.clearTable(pNdb);
+  }
+
+  return NDBT_OK;
+}
+
 NDBT_TESTSUITE(testIndex);
 TESTCASE("CreateAll", 
 	 "Test that we can create all various indexes on each table\n"
@@ -1777,6 +1865,16 @@ TESTCASE("Bug28804_ATTRINFO",
   FINALIZER(createPkIndex_Drop);
   FINALIZER(runClearTable);
 }
+TESTCASE("Bug46069", ""){
+  TC_PROPERTY("OrderedIndex", 1);
+  TC_PROPERTY("THREADS", 12);
+  TC_PROPERTY("LoggedIndexes", Uint32(0));
+  INITIALIZER(createPkIndex);
+  STEP(runBug46069);
+  STEPS(runBug46069_pkdel, 10);
+  STEPS(runBug46069_scandel, 2);
+  FINALIZER(createPkIndex_Drop);
+}
 NDBT_TESTSUITE_END(testIndex);
 
 int main(int argc, const char** argv){

=== modified file 'storage/ndb/test/run-test/daily-basic-tests.txt'
--- a/storage/ndb/test/run-test/daily-basic-tests.txt	2009-05-28 12:53:33 +0000
+++ b/storage/ndb/test/run-test/daily-basic-tests.txt	2009-08-07 11:54:37 +0000
@@ -274,6 +274,10 @@ max-time: 2500
 cmd: testIndex
 args: -n BuildDuring T6 
 
+max-time: 600
+cmd: testIndex
+args: -n Bug46069 T1
+
 #
 # SCAN TESTS
 #


Attachment: [text/bzr-bundle] bzr/jonas@mysql.com-20090807115437-q2t9wdp1x2npwl94.bundle
Thread
bzr commit into mysql-5.1-telco-6.2 branch (jonas:2961) Bug#46069Jonas Oreland7 Aug