Commit 4a90a658 authored by unknown's avatar unknown

ndb - bug#19245

  A-insert/B-insert/A-rollback/B-rollback leads to node crash, as bits in tuple header gets incorrectly assigned in second insert
  this also likely fixes bug 18589 and explains 18808


storage/ndb/src/kernel/blocks/dbtup/DbtupAbort.cpp:
  remove debug printout
storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp:
  Make sure that alloc bit is set if insert and first_op
storage/ndb/test/ndbapi/testBasic.cpp:
  testcase for bug#19245
storage/ndb/test/run-test/daily-basic-tests.txt:
  testcase for bug#19245
parent 3cb33e44
...@@ -170,7 +170,6 @@ void Dbtup::execTUP_ABORTREQ(Signal* signal) ...@@ -170,7 +170,6 @@ void Dbtup::execTUP_ABORTREQ(Signal* signal)
/** /**
* Aborting last operation that performed ALLOC * Aborting last operation that performed ALLOC
*/ */
ndbout_c("clearing ALLOC");
tuple_ptr->m_header_bits &= ~(Uint32)Tuple_header::ALLOC; tuple_ptr->m_header_bits &= ~(Uint32)Tuple_header::ALLOC;
tuple_ptr->m_header_bits |= Tuple_header::FREED; tuple_ptr->m_header_bits |= Tuple_header::FREED;
} }
......
...@@ -1407,6 +1407,8 @@ int Dbtup::handleInsertReq(Signal* signal, ...@@ -1407,6 +1407,8 @@ int Dbtup::handleInsertReq(Signal* signal,
} }
req_struct->m_use_rowid = false; req_struct->m_use_rowid = false;
base->m_header_bits &= ~(Uint32)Tuple_header::FREE; base->m_header_bits &= ~(Uint32)Tuple_header::FREE;
base->m_header_bits |= Tuple_header::ALLOC &
(regOperPtr.p->is_first_operation() ? ~0 : 1);
} }
else else
{ {
...@@ -1415,6 +1417,8 @@ int Dbtup::handleInsertReq(Signal* signal, ...@@ -1415,6 +1417,8 @@ int Dbtup::handleInsertReq(Signal* signal,
{ {
ndbout_c("no mem insert but rowid (same)"); ndbout_c("no mem insert but rowid (same)");
base->m_header_bits &= ~(Uint32)Tuple_header::FREE; base->m_header_bits &= ~(Uint32)Tuple_header::FREE;
base->m_header_bits |= Tuple_header::ALLOC &
(regOperPtr.p->is_first_operation() ? ~0 : 1);
} }
else else
{ {
......
...@@ -1034,6 +1034,38 @@ runMassiveRollback2(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -1034,6 +1034,38 @@ runMassiveRollback2(NDBT_Context* ctx, NDBT_Step* step){
return result; return result;
} }
int
runMassiveRollback3(NDBT_Context* ctx, NDBT_Step* step){
int result = NDBT_OK;
HugoOperations hugoOps(*ctx->getTab());
Ndb* pNdb = GETNDB(step);
const Uint32 BATCH = 10;
const Uint32 OPS_TOTAL = 20;
const Uint32 LOOPS = 100;
for(Uint32 loop = 0; loop<LOOPS; loop++)
{
CHECK(hugoOps.startTransaction(pNdb) == 0);
bool ok = true;
for (Uint32 i = 0; i<OPS_TOTAL; i+= BATCH)
{
CHECK(hugoOps.pkInsertRecord(pNdb, i, BATCH, 0) == 0);
if (hugoOps.execute_NoCommit(pNdb) != 0)
{
ok = false;
break;
}
}
hugoOps.execute_Rollback(pNdb);
CHECK(hugoOps.closeTransaction(pNdb) == 0);
}
hugoOps.closeTransaction(pNdb);
return result;
}
/** /**
* TUP errors * TUP errors
*/ */
...@@ -1360,6 +1392,13 @@ TESTCASE("MassiveRollback2", ...@@ -1360,6 +1392,13 @@ TESTCASE("MassiveRollback2",
INITIALIZER(runMassiveRollback2); INITIALIZER(runMassiveRollback2);
FINALIZER(runClearTable2); FINALIZER(runClearTable2);
} }
TESTCASE("MassiveRollback3",
"Test rollback of 4096 operations"){
INITIALIZER(runClearTable2);
STEP(runMassiveRollback3);
STEP(runMassiveRollback3);
FINALIZER(runClearTable2);
}
TESTCASE("MassiveTransaction", TESTCASE("MassiveTransaction",
"Test very large insert transaction"){ "Test very large insert transaction"){
INITIALIZER(runLoadTable2); INITIALIZER(runLoadTable2);
......
...@@ -207,6 +207,10 @@ max-time: 500 ...@@ -207,6 +207,10 @@ max-time: 500
cmd: testBasic cmd: testBasic
args: -n MassiveRollback2 T1 T6 T13 D1 D2 args: -n MassiveRollback2 T1 T6 T13 D1 D2
max-time: 500
cmd: testBasic
args: -n MassiveRollback3 T1 D1
max-time: 500 max-time: 500
cmd: testBasic cmd: testBasic
args: -n TupError args: -n TupError
......
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