Commit 280bef18 authored by joreland@mysql.com's avatar joreland@mysql.com

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.
parent 12e0d4f5
...@@ -5899,33 +5899,32 @@ Dbacc::check_lock_upgrade(Signal* signal, ...@@ -5899,33 +5899,32 @@ Dbacc::check_lock_upgrade(Signal* signal,
// Find end of parallell que // Find end of parallell que
tmp = lock_owner; tmp = lock_owner;
Uint32 lockMode = next.p->lockMode > lock_owner.p->lockMode ?
next.p->lockMode : lock_owner.p->lockMode;
while(tmp.p->nextParallelQue != RNIL) while(tmp.p->nextParallelQue != RNIL)
{ {
jam(); jam();
tmp.i = tmp.p->nextParallelQue; tmp.i = tmp.p->nextParallelQue;
tmp.p->lockMode = lockMode;
ptrCheckGuard(tmp, coprecsize, operationrec); ptrCheckGuard(tmp, coprecsize, operationrec);
} }
tmp.p->lockMode = lockMode;
next.p->prevParallelQue = tmp.i; next.p->prevParallelQue = tmp.i;
tmp.p->nextParallelQue = next.i; tmp.p->nextParallelQue = next.i;
OperationrecPtr save = operationRecPtr; 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]; Uint32 localdata[2];
localdata[0] = lock_owner.p->localdata[0]; localdata[0] = lock_owner.p->localdata[0];
localdata[1] = lock_owner.p->localdata[1]; localdata[1] = lock_owner.p->localdata[1];
do { do {
next.p->elementIsDisappeared = TelementIsDisappeared;
next.p->hashValue = ThashValue;
next.p->localdata[0] = localdata[0]; next.p->localdata[0] = localdata[0];
next.p->localdata[1] = localdata[1]; next.p->localdata[1] = localdata[1];
next.p->lockMode = lockMode;
operationRecPtr = next; operationRecPtr = next;
next.p->lockMode = lockMode; executeNextOperation(signal);
TelementIsDisappeared = executeNextOperation(signal);
if (next.p->nextParallelQue != RNIL) if (next.p->nextParallelQue != RNIL)
{ {
jam(); jam();
......
...@@ -635,7 +635,14 @@ runLockUpgrade2(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -635,7 +635,14 @@ runLockUpgrade2(NDBT_Context* ctx, NDBT_Step* step){
ndbout_c("wait 3 - done"); ndbout_c("wait 3 - done");
NdbSleep_MilliSleep(200); NdbSleep_MilliSleep(200);
CHECK(hugoOps.execute_Commit(pNdb) == 0); if(ctx->getProperty("LU_COMMIT", (Uint32)0) == 0)
{
CHECK(hugoOps.execute_Commit(pNdb) == 0);
}
else
{
CHECK(hugoOps.execute_Rollback(pNdb) == 0);
}
} while(0); } while(0);
return result; return result;
...@@ -650,7 +657,7 @@ main(int argc, const char** argv){ ...@@ -650,7 +657,7 @@ main(int argc, const char** argv){
NDBT_TestSuite ts("testOperations"); NDBT_TestSuite ts("testOperations");
for(Uint32 i = 0; i <6; i++) for(Uint32 i = 0; i < 12; i++)
{ {
BaseString name("bug_9749"); BaseString name("bug_9749");
name.appfmt("_%d", i); name.appfmt("_%d", i);
...@@ -658,8 +665,9 @@ main(int argc, const char** argv){ ...@@ -658,8 +665,9 @@ main(int argc, const char** argv){
name.c_str(), ""); name.c_str(), "");
pt->setProperty("LOCK_UPGRADE", 1 + (i & 1)); 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, pt->addInitializer(new NDBT_Initializer(pt,
"runClearTable", "runClearTable",
runClearTable)); runClearTable));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment