Commit 2c066230 authored by unknown's avatar unknown
Browse files

bug#9749 - ndb lock upgrade

  post review fix.
  don't init hash value on restart operations
  make sure that lock mode is correct in entire que.


ndb/test/ndbapi/testOperations.cpp:
  Test case also for abort case.
    (abort if not lock owner still fails!)
parent 7f005d17
Loading
Loading
Loading
Loading
+6 −7
Original line number Diff line number Diff line
@@ -5899,33 +5899,32 @@ Dbacc::check_lock_upgrade(Signal* signal,
  
  // Find end of parallell que
  tmp = lock_owner;
  Uint32 lockMode = next.p->lockMode > lock_owner.p->lockMode ?
    next.p->lockMode : lock_owner.p->lockMode;
  while(tmp.p->nextParallelQue != RNIL)
  {
    jam();
    tmp.i = tmp.p->nextParallelQue;
    tmp.p->lockMode = lockMode;
    ptrCheckGuard(tmp, coprecsize, operationrec);
  }
  tmp.p->lockMode = lockMode;
  
  next.p->prevParallelQue = tmp.i;
  tmp.p->nextParallelQue = next.i;
  
  OperationrecPtr save = operationRecPtr;
  Uint32 lockMode = lock_owner.p->lockMode;
  Uint32 TelementIsDisappeared = 0; // lock upgrade = all reads
  Uint32 ThashValue = lock_owner.p->hashValue;
  Uint32 localdata[2];
  localdata[0] = lock_owner.p->localdata[0];
  localdata[1] = lock_owner.p->localdata[1];
  do {
    next.p->elementIsDisappeared = TelementIsDisappeared;
    next.p->hashValue = ThashValue;
    next.p->localdata[0] = localdata[0];
    next.p->localdata[1] = localdata[1];
    next.p->lockMode = lockMode;
    
    operationRecPtr = next;
    next.p->lockMode = lockMode;
    TelementIsDisappeared = executeNextOperation(signal);
    executeNextOperation(signal);
    if (next.p->nextParallelQue != RNIL) 
    {
      jam();
+12 −4
Original line number Diff line number Diff line
@@ -635,7 +635,14 @@ runLockUpgrade2(NDBT_Context* ctx, NDBT_Step* step){
    ndbout_c("wait 3 - done");
    
    NdbSleep_MilliSleep(200);
    if(ctx->getProperty("LU_COMMIT", (Uint32)0) == 0)
    {
      CHECK(hugoOps.execute_Commit(pNdb) == 0);
    }
    else
    {
      CHECK(hugoOps.execute_Rollback(pNdb) == 0);
    }
  } while(0);

  return result;
@@ -650,7 +657,7 @@ main(int argc, const char** argv){

  NDBT_TestSuite ts("testOperations");

  for(Uint32 i = 0; i <6; i++)
  for(Uint32 i = 0; i < 12; i++)
  {
    BaseString name("bug_9749");
    name.appfmt("_%d", i);
@@ -658,7 +665,8 @@ main(int argc, const char** argv){
						    name.c_str(), "");    
    
    pt->setProperty("LOCK_UPGRADE", 1 + (i & 1));
    pt->setProperty("LU_OP", 1 + (i >> 1));
    pt->setProperty("LU_OP", 1 + ((i >> 1) % 3));
    pt->setProperty("LU_COMMIT", i / 6);

    pt->addInitializer(new NDBT_Initializer(pt,
					    "runClearTable",