Commit 56589afd authored by unknown's avatar unknown

ndb -

  fix scan bugs introduced by acc modifications
  add more error testcases


storage/ndb/src/kernel/blocks/dbacc/Dbacc.hpp:
  remove unused state
storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp:
  1) remove unused state
  2) Fix abort of running lock owner
  3) Fix abort of running op in parallell queue (especially scans)
storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp:
  remove some printouts
  add some jams
  fix so that close tupscan, can not acciently start acc scan in queue
    (NOTE limits #tupscans to 12 which is not really necessary...but the fix was easy)
storage/ndb/src/kernel/blocks/dbtup/DbtupScan.cpp:
  Use abort of locks when closing/blocked
    as Dbacc gets annoyed when committing an op with state running
storage/ndb/src/kernel/blocks/dbtux/DbtuxScan.cpp:
  Use abort of locks when closing/blocked
    as Dbacc gets annoyed when committing an op with state running
storage/ndb/test/include/HugoOperations.hpp:
  new method
storage/ndb/test/ndbapi/testBasic.cpp:
  add more test cases
storage/ndb/test/ndbapi/testScan.cpp:
  add more testcases
storage/ndb/test/run-test/daily-basic-tests.txt:
  add more testcases
storage/ndb/test/src/HugoOperations.cpp:
  add more testcases
parent 8bfc2d9c
...@@ -533,7 +533,6 @@ struct Operationrec { ...@@ -533,7 +533,6 @@ struct Operationrec {
,OP_STATE_WAITING = 0x00000 ,OP_STATE_WAITING = 0x00000
,OP_STATE_RUNNING = 0x10000 ,OP_STATE_RUNNING = 0x10000
,OP_STATE_EXECUTED = 0x30000 ,OP_STATE_EXECUTED = 0x30000
,OP_STATE_RUNNING_ABORT = 0x20000
,OP_EXECUTED_DIRTY_READ = 0x3050F ,OP_EXECUTED_DIRTY_READ = 0x3050F
,OP_INITIAL = ~(Uint32)0 ,OP_INITIAL = ~(Uint32)0
......
...@@ -1181,6 +1181,7 @@ void Dbacc::execACCKEYREQ(Signal* signal) ...@@ -1181,6 +1181,7 @@ void Dbacc::execACCKEYREQ(Signal* signal)
void void
Dbacc::execACCKEY_ORD(Signal* signal, Uint32 opPtrI) Dbacc::execACCKEY_ORD(Signal* signal, Uint32 opPtrI)
{ {
jamEntry();
OperationrecPtr lastOp; OperationrecPtr lastOp;
lastOp.i = opPtrI; lastOp.i = opPtrI;
ptrCheckGuard(lastOp, coprecsize, operationrec); ptrCheckGuard(lastOp, coprecsize, operationrec);
...@@ -1200,9 +1201,6 @@ Dbacc::execACCKEY_ORD(Signal* signal, Uint32 opPtrI) ...@@ -1200,9 +1201,6 @@ Dbacc::execACCKEY_ORD(Signal* signal, Uint32 opPtrI)
startNext(signal, lastOp); startNext(signal, lastOp);
return; return;
} }
else if (opstate == Operationrec::OP_STATE_RUNNING_ABORT)
{
}
else else
{ {
} }
...@@ -1240,15 +1238,14 @@ Dbacc::startNext(Signal* signal, OperationrecPtr lastOp) ...@@ -1240,15 +1238,14 @@ Dbacc::startNext(Signal* signal, OperationrecPtr lastOp)
{ {
jam(); jam();
ptrCheckGuard(loPtr, coprecsize, operationrec); ptrCheckGuard(loPtr, coprecsize, operationrec);
nextOp.i = loPtr.p->nextSerialQue;
} }
else else
{ {
jam(); jam();
nextOp.i = loPtr.i;
loPtr = lastOp; loPtr = lastOp;
} }
nextOp.i = loPtr.p->nextSerialQue;
ndbassert(loPtr.p->m_op_bits & Operationrec::OP_LOCK_OWNER); ndbassert(loPtr.p->m_op_bits & Operationrec::OP_LOCK_OWNER);
if (nextOp.i == RNIL) if (nextOp.i == RNIL)
...@@ -1411,6 +1408,9 @@ Dbacc::startNext(Signal* signal, OperationrecPtr lastOp) ...@@ -1411,6 +1408,9 @@ Dbacc::startNext(Signal* signal, OperationrecPtr lastOp)
else else
{ {
jam(); jam();
fragrecptr.i = nextOp.p->fragptr;
ptrCheckGuard(fragrecptr, cfragmentsize, fragmentrec);
sendAcckeyconf(signal); sendAcckeyconf(signal);
sendSignal(nextOp.p->userblockref, GSN_ACCKEYCONF, sendSignal(nextOp.p->userblockref, GSN_ACCKEYCONF,
signal, 6, JBA); signal, 6, JBA);
...@@ -1680,8 +1680,7 @@ Dbacc::validate_lock_queue(OperationrecPtr opPtr) ...@@ -1680,8 +1680,7 @@ Dbacc::validate_lock_queue(OperationrecPtr opPtr)
bool running = false; bool running = false;
{ {
Uint32 opstate = loPtr.p->m_op_bits & Operationrec::OP_STATE_MASK; Uint32 opstate = loPtr.p->m_op_bits & Operationrec::OP_STATE_MASK;
if (opstate == Operationrec::OP_STATE_RUNNING || if (opstate == Operationrec::OP_STATE_RUNNING)
opstate == Operationrec::OP_STATE_RUNNING_ABORT)
running = true; running = true;
else else
{ {
...@@ -1719,8 +1718,7 @@ Dbacc::validate_lock_queue(OperationrecPtr opPtr) ...@@ -1719,8 +1718,7 @@ Dbacc::validate_lock_queue(OperationrecPtr opPtr)
} }
else else
{ {
if (opstate == Operationrec::OP_STATE_RUNNING || if (opstate == Operationrec::OP_STATE_RUNNING)
opstate == Operationrec::OP_STATE_RUNNING_ABORT)
running = true; running = true;
else else
vlqrequire(opstate == Operationrec::OP_STATE_EXECUTED); vlqrequire(opstate == Operationrec::OP_STATE_EXECUTED);
...@@ -1830,8 +1828,6 @@ operator<<(NdbOut & out, Dbacc::OperationrecPtr ptr) ...@@ -1830,8 +1828,6 @@ operator<<(NdbOut & out, Dbacc::OperationrecPtr ptr)
out << " RUNNING "; break; out << " RUNNING "; break;
case Dbacc::Operationrec::OP_STATE_EXECUTED: case Dbacc::Operationrec::OP_STATE_EXECUTED:
out << " EXECUTED "; break; out << " EXECUTED "; break;
case Dbacc::Operationrec::OP_STATE_RUNNING_ABORT:
out << " RUNNIG_ABORT "; break;
case Dbacc::Operationrec::OP_STATE_IDLE: case Dbacc::Operationrec::OP_STATE_IDLE:
out << " IDLE "; break; out << " IDLE "; break;
default: default:
...@@ -1857,7 +1853,6 @@ operator<<(NdbOut & out, Dbacc::OperationrecPtr ptr) ...@@ -1857,7 +1853,6 @@ operator<<(NdbOut & out, Dbacc::OperationrecPtr ptr)
,OP_STATE_WAITING = 0x0000 ,OP_STATE_WAITING = 0x0000
,OP_STATE_RUNNING = 0x1000 ,OP_STATE_RUNNING = 0x1000
,OP_STATE_EXECUTED = 0x3000 ,OP_STATE_EXECUTED = 0x3000
,OP_STATE_RUNNING_ABORT = 0x2000
}; };
*/ */
if (opbits & Dbacc::Operationrec::OP_LOCK_OWNER) if (opbits & Dbacc::Operationrec::OP_LOCK_OWNER)
...@@ -3950,6 +3945,7 @@ void Dbacc::checkoverfreelist(Signal* signal) ...@@ -3950,6 +3945,7 @@ void Dbacc::checkoverfreelist(Signal* signal)
void void
Dbacc::abortParallelQueueOperation(Signal* signal, OperationrecPtr opPtr) Dbacc::abortParallelQueueOperation(Signal* signal, OperationrecPtr opPtr)
{ {
jam();
OperationrecPtr nextP; OperationrecPtr nextP;
OperationrecPtr prevP; OperationrecPtr prevP;
OperationrecPtr loPtr; OperationrecPtr loPtr;
...@@ -3992,13 +3988,21 @@ Dbacc::abortParallelQueueOperation(Signal* signal, OperationrecPtr opPtr) ...@@ -3992,13 +3988,21 @@ Dbacc::abortParallelQueueOperation(Signal* signal, OperationrecPtr opPtr)
else else
{ {
jam(); jam();
/**
* P0 - P1
*
* Abort P1, check start next
*/
ndbassert(prevP.p->m_op_bits & Operationrec::OP_LOCK_OWNER); ndbassert(prevP.p->m_op_bits & Operationrec::OP_LOCK_OWNER);
prevP.p->m_lo_last_parallel_op_ptr_i = RNIL; prevP.p->m_lo_last_parallel_op_ptr_i = RNIL;
startNext(signal, prevP); startNext(signal, prevP);
validate_lock_queue(prevP); validate_lock_queue(prevP);
return; return;
} }
/**
* Abort P1/P2
*/
if (opbits & Operationrec::OP_LOCK_MODE) if (opbits & Operationrec::OP_LOCK_MODE)
{ {
Uint32 nextbits = nextP.p->m_op_bits; Uint32 nextbits = nextP.p->m_op_bits;
...@@ -4024,12 +4028,23 @@ Dbacc::abortParallelQueueOperation(Signal* signal, OperationrecPtr opPtr) ...@@ -4024,12 +4028,23 @@ Dbacc::abortParallelQueueOperation(Signal* signal, OperationrecPtr opPtr)
/** /**
* Abort P1, P2 * Abort P1, P2
*/ */
if (opstate == Operationrec::OP_STATE_RUNNING)
{
jam();
startNext(signal, prevP);
validate_lock_queue(prevP);
return;
}
ndbassert(opstate == Operationrec::OP_STATE_EXECUTED ||
opstate == Operationrec::OP_STATE_WAITING);
/** /**
* Scan to last of run queue * Scan to last of run queue
*/ */
while (nextP.p->nextParallelQue != RNIL) while (nextP.p->nextParallelQue != RNIL)
{ {
jam();
nextP.i = nextP.p->nextParallelQue; nextP.i = nextP.p->nextParallelQue;
ptrCheckGuard(nextP, coprecsize, operationrec); ptrCheckGuard(nextP, coprecsize, operationrec);
} }
...@@ -4049,6 +4064,7 @@ Dbacc::abortParallelQueueOperation(Signal* signal, OperationrecPtr opPtr) ...@@ -4049,6 +4064,7 @@ Dbacc::abortParallelQueueOperation(Signal* signal, OperationrecPtr opPtr)
void void
Dbacc::abortSerieQueueOperation(Signal* signal, OperationrecPtr opPtr) Dbacc::abortSerieQueueOperation(Signal* signal, OperationrecPtr opPtr)
{ {
jam();
OperationrecPtr prevS, nextS; OperationrecPtr prevS, nextS;
OperationrecPtr prevP, nextP; OperationrecPtr prevP, nextP;
OperationrecPtr loPtr; OperationrecPtr loPtr;
...@@ -4620,7 +4636,25 @@ Dbacc::release_lockowner(Signal* signal, OperationrecPtr opPtr, bool commit) ...@@ -4620,7 +4636,25 @@ Dbacc::release_lockowner(Signal* signal, OperationrecPtr opPtr, bool commit)
* Aborting an operation can *always* lead to lock upgrade * Aborting an operation can *always* lead to lock upgrade
*/ */
action = CHECK_LOCK_UPGRADE; action = CHECK_LOCK_UPGRADE;
Uint32 opstate = opbits & Operationrec::OP_STATE_MASK;
if (opstate != Operationrec::OP_STATE_EXECUTED)
{
ndbassert(opstate == Operationrec::OP_STATE_RUNNING);
if (opbits & Operationrec::OP_ELEMENT_DISAPPEARED)
{
jam();
report_dealloc(signal, opPtr.p);
newOwner.p->localdata[0] = ~0;
}
else
{
jam();
newOwner.p->localdata[0] = opPtr.p->localdata[0];
newOwner.p->localdata[1] = opPtr.p->localdata[1];
}
action = START_NEW;
}
/** /**
* Update ACC_LOCK_MODE * Update ACC_LOCK_MODE
*/ */
......
...@@ -2604,11 +2604,6 @@ void Dblqh::execTUPKEYREF(Signal* signal) ...@@ -2604,11 +2604,6 @@ void Dblqh::execTUPKEYREF(Signal* signal)
ndbassert(regTcPtr->transactionState == TcConnectionrec::WAIT_TUP || ndbassert(regTcPtr->transactionState == TcConnectionrec::WAIT_TUP ||
regTcPtr->transactionState ==TcConnectionrec::WAIT_TUP_TO_ABORT); regTcPtr->transactionState ==TcConnectionrec::WAIT_TUP_TO_ABORT);
} }
else if (getNodeState().startLevel == NodeState::SL_STARTED)
{
if (terrorCode == 899)
ndbout << "899: " << regTcPtr->m_row_id << endl;
}
switch (tcConnectptr.p->transactionState) { switch (tcConnectptr.p->transactionState) {
case TcConnectionrec::WAIT_TUP: case TcConnectionrec::WAIT_TUP:
...@@ -9095,6 +9090,7 @@ void Dblqh::scanTupkeyConfLab(Signal* signal) ...@@ -9095,6 +9090,7 @@ void Dblqh::scanTupkeyConfLab(Signal* signal)
if (accOpPtr != (Uint32)-1) if (accOpPtr != (Uint32)-1)
{ {
c_acc->execACCKEY_ORD(signal, accOpPtr); c_acc->execACCKEY_ORD(signal, accOpPtr);
jamEntry();
} }
else else
{ {
...@@ -9419,7 +9415,7 @@ Uint32 Dblqh::initScanrec(const ScanFragReq* scanFragReq) ...@@ -9419,7 +9415,7 @@ Uint32 Dblqh::initScanrec(const ScanFragReq* scanFragReq)
const Uint32 readCommitted = ScanFragReq::getReadCommittedFlag(reqinfo); const Uint32 readCommitted = ScanFragReq::getReadCommittedFlag(reqinfo);
const Uint32 rangeScan = ScanFragReq::getRangeScanFlag(reqinfo); const Uint32 rangeScan = ScanFragReq::getRangeScanFlag(reqinfo);
const Uint32 descending = ScanFragReq::getDescendingFlag(reqinfo); const Uint32 descending = ScanFragReq::getDescendingFlag(reqinfo);
const Uint32 tupScan = ScanFragReq::getTupScanFlag(reqinfo); Uint32 tupScan = ScanFragReq::getTupScanFlag(reqinfo);
const Uint32 attrLen = ScanFragReq::getAttrLen(reqinfo); const Uint32 attrLen = ScanFragReq::getAttrLen(reqinfo);
const Uint32 scanPrio = ScanFragReq::getScanPrio(reqinfo); const Uint32 scanPrio = ScanFragReq::getScanPrio(reqinfo);
...@@ -9458,7 +9454,7 @@ Uint32 Dblqh::initScanrec(const ScanFragReq* scanFragReq) ...@@ -9458,7 +9454,7 @@ Uint32 Dblqh::initScanrec(const ScanFragReq* scanFragReq)
scanptr.p->scanApiOpPtr = scanFragReq->clientOpPtr; scanptr.p->scanApiOpPtr = scanFragReq->clientOpPtr;
scanptr.p->m_last_row = 0; scanptr.p->m_last_row = 0;
scanptr.p->scanStoredProcId = RNIL; scanptr.p->scanStoredProcId = RNIL;
scanptr.p->copyPtr = RNIL;
if (max_rows == 0 || (max_bytes > 0 && max_rows > max_bytes)){ if (max_rows == 0 || (max_bytes > 0 && max_rows > max_bytes)){
jam(); jam();
return ScanFragRef::ZWRONG_BATCH_SIZE; return ScanFragRef::ZWRONG_BATCH_SIZE;
...@@ -9479,8 +9475,10 @@ Uint32 Dblqh::initScanrec(const ScanFragReq* scanFragReq) ...@@ -9479,8 +9475,10 @@ Uint32 Dblqh::initScanrec(const ScanFragReq* scanFragReq)
* !idx uses 1 - (MAX_PARALLEL_SCANS_PER_FRAG - 1) = 1-11 * !idx uses 1 - (MAX_PARALLEL_SCANS_PER_FRAG - 1) = 1-11
* idx uses from MAX_PARALLEL_SCANS_PER_FRAG - MAX = 12-42) * idx uses from MAX_PARALLEL_SCANS_PER_FRAG - MAX = 12-42)
*/ */
Uint32 start = (rangeScan || tupScan ? MAX_PARALLEL_SCANS_PER_FRAG : 1 ); tupScan = 0; // Make sure that close tup scan does not start acc scan incorrectly
Uint32 stop = (rangeScan || tupScan ? MAX_PARALLEL_INDEX_SCANS_PER_FRAG : MAX_PARALLEL_SCANS_PER_FRAG - 1); Uint32 start = (rangeScan || tupScan) ? MAX_PARALLEL_SCANS_PER_FRAG : 1 ;
Uint32 stop = (rangeScan || tupScan) ? MAX_PARALLEL_INDEX_SCANS_PER_FRAG :
MAX_PARALLEL_SCANS_PER_FRAG - 1;
stop += start; stop += start;
Uint32 free = tFragPtr.p->m_scanNumberMask.find(start); Uint32 free = tFragPtr.p->m_scanNumberMask.find(start);
......
...@@ -156,7 +156,7 @@ Dbtup::execNEXT_SCANREQ(Signal* signal) ...@@ -156,7 +156,7 @@ Dbtup::execNEXT_SCANREQ(Signal* signal)
conf->scanPtr = scan.m_userPtr; conf->scanPtr = scan.m_userPtr;
unsigned signalLength = 1; unsigned signalLength = 1;
sendSignal(scanPtr.p->m_userRef, GSN_NEXT_SCANCONF, sendSignal(scanPtr.p->m_userRef, GSN_NEXT_SCANCONF,
signal, signalLength, JBB); signal, signalLength, JBB);
return; return;
} }
break; break;
...@@ -171,7 +171,7 @@ Dbtup::execNEXT_SCANREQ(Signal* signal) ...@@ -171,7 +171,7 @@ Dbtup::execNEXT_SCANREQ(Signal* signal)
lockReq->requestInfo = AccLockReq::AbortWithConf; lockReq->requestInfo = AccLockReq::AbortWithConf;
lockReq->accOpPtr = scan.m_accLockOp; lockReq->accOpPtr = scan.m_accLockOp;
EXECUTE_DIRECT(DBACC, GSN_ACC_LOCKREQ, EXECUTE_DIRECT(DBACC, GSN_ACC_LOCKREQ,
signal, AccLockReq::UndoSignalLength); signal, AccLockReq::UndoSignalLength);
jamEntry(); jamEntry();
ndbrequire(lockReq->returnCode == AccLockReq::Success); ndbrequire(lockReq->returnCode == AccLockReq::Success);
scan.m_state = ScanOp::Aborting; scan.m_state = ScanOp::Aborting;
...@@ -182,10 +182,10 @@ Dbtup::execNEXT_SCANREQ(Signal* signal) ...@@ -182,10 +182,10 @@ Dbtup::execNEXT_SCANREQ(Signal* signal)
ndbrequire(scan.m_accLockOp != RNIL); ndbrequire(scan.m_accLockOp != RNIL);
AccLockReq* const lockReq = (AccLockReq*)signal->getDataPtrSend(); AccLockReq* const lockReq = (AccLockReq*)signal->getDataPtrSend();
lockReq->returnCode = RNIL; lockReq->returnCode = RNIL;
lockReq->requestInfo = AccLockReq::Unlock; lockReq->requestInfo = AccLockReq::Abort;
lockReq->accOpPtr = scan.m_accLockOp; lockReq->accOpPtr = scan.m_accLockOp;
EXECUTE_DIRECT(DBACC, GSN_ACC_LOCKREQ, EXECUTE_DIRECT(DBACC, GSN_ACC_LOCKREQ,
signal, AccLockReq::UndoSignalLength); signal, AccLockReq::UndoSignalLength);
jamEntry(); jamEntry();
ndbrequire(lockReq->returnCode == AccLockReq::Success); ndbrequire(lockReq->returnCode == AccLockReq::Success);
scan.m_accLockOp = RNIL; scan.m_accLockOp = RNIL;
...@@ -433,7 +433,7 @@ Dbtup::execACCKEYCONF(Signal* signal) ...@@ -433,7 +433,7 @@ Dbtup::execACCKEYCONF(Signal* signal)
jam(); jam();
AccLockReq* const lockReq = (AccLockReq*)signal->getDataPtrSend(); AccLockReq* const lockReq = (AccLockReq*)signal->getDataPtrSend();
lockReq->returnCode = RNIL; lockReq->returnCode = RNIL;
lockReq->requestInfo = AccLockReq::Unlock; lockReq->requestInfo = AccLockReq::Abort;
lockReq->accOpPtr = scan.m_accLockOp; lockReq->accOpPtr = scan.m_accLockOp;
EXECUTE_DIRECT(DBACC, GSN_ACC_LOCKREQ, signal, AccLockReq::UndoSignalLength); EXECUTE_DIRECT(DBACC, GSN_ACC_LOCKREQ, signal, AccLockReq::UndoSignalLength);
jamEntry(); jamEntry();
......
...@@ -321,7 +321,7 @@ Dbtux::execNEXT_SCANREQ(Signal* signal) ...@@ -321,7 +321,7 @@ Dbtux::execNEXT_SCANREQ(Signal* signal)
conf->scanPtr = scan.m_userPtr; conf->scanPtr = scan.m_userPtr;
unsigned signalLength = 1; unsigned signalLength = 1;
sendSignal(scanPtr.p->m_userRef, GSN_NEXT_SCANCONF, sendSignal(scanPtr.p->m_userRef, GSN_NEXT_SCANCONF,
signal, signalLength, JBB); signal, signalLength, JBB);
return; return;
} }
break; break;
...@@ -344,7 +344,8 @@ Dbtux::execNEXT_SCANREQ(Signal* signal) ...@@ -344,7 +344,8 @@ Dbtux::execNEXT_SCANREQ(Signal* signal)
lockReq->returnCode = RNIL; lockReq->returnCode = RNIL;
lockReq->requestInfo = AccLockReq::AbortWithConf; lockReq->requestInfo = AccLockReq::AbortWithConf;
lockReq->accOpPtr = scan.m_accLockOp; lockReq->accOpPtr = scan.m_accLockOp;
EXECUTE_DIRECT(DBACC, GSN_ACC_LOCKREQ, signal, AccLockReq::UndoSignalLength); EXECUTE_DIRECT(DBACC, GSN_ACC_LOCKREQ, signal,
AccLockReq::UndoSignalLength);
jamEntry(); jamEntry();
ndbrequire(lockReq->returnCode == AccLockReq::Success); ndbrequire(lockReq->returnCode == AccLockReq::Success);
scan.m_state = ScanOp::Aborting; scan.m_state = ScanOp::Aborting;
...@@ -355,9 +356,10 @@ Dbtux::execNEXT_SCANREQ(Signal* signal) ...@@ -355,9 +356,10 @@ Dbtux::execNEXT_SCANREQ(Signal* signal)
ndbrequire(scan.m_accLockOp != RNIL); ndbrequire(scan.m_accLockOp != RNIL);
AccLockReq* const lockReq = (AccLockReq*)signal->getDataPtrSend(); AccLockReq* const lockReq = (AccLockReq*)signal->getDataPtrSend();
lockReq->returnCode = RNIL; lockReq->returnCode = RNIL;
lockReq->requestInfo = AccLockReq::Unlock; lockReq->requestInfo = AccLockReq::Abort;
lockReq->accOpPtr = scan.m_accLockOp; lockReq->accOpPtr = scan.m_accLockOp;
EXECUTE_DIRECT(DBACC, GSN_ACC_LOCKREQ, signal, AccLockReq::UndoSignalLength); EXECUTE_DIRECT(DBACC, GSN_ACC_LOCKREQ, signal,
AccLockReq::UndoSignalLength);
jamEntry(); jamEntry();
ndbrequire(lockReq->returnCode == AccLockReq::Success); ndbrequire(lockReq->returnCode == AccLockReq::Success);
scan.m_accLockOp = RNIL; scan.m_accLockOp = RNIL;
...@@ -612,7 +614,7 @@ Dbtux::execACCKEYCONF(Signal* signal) ...@@ -612,7 +614,7 @@ Dbtux::execACCKEYCONF(Signal* signal)
jam(); jam();
AccLockReq* const lockReq = (AccLockReq*)signal->getDataPtrSend(); AccLockReq* const lockReq = (AccLockReq*)signal->getDataPtrSend();
lockReq->returnCode = RNIL; lockReq->returnCode = RNIL;
lockReq->requestInfo = AccLockReq::Unlock; lockReq->requestInfo = AccLockReq::Abort;
lockReq->accOpPtr = scan.m_accLockOp; lockReq->accOpPtr = scan.m_accLockOp;
EXECUTE_DIRECT(DBACC, GSN_ACC_LOCKREQ, signal, AccLockReq::UndoSignalLength); EXECUTE_DIRECT(DBACC, GSN_ACC_LOCKREQ, signal, AccLockReq::UndoSignalLength);
jamEntry(); jamEntry();
......
...@@ -108,6 +108,8 @@ public: ...@@ -108,6 +108,8 @@ public:
NDBT_ResultRow& get_row(Uint32 idx) { return *rows[idx];} NDBT_ResultRow& get_row(Uint32 idx) { return *rows[idx];}
int execute_async(Ndb*, NdbTransaction::ExecType, NdbTransaction::AbortOption = NdbTransaction::AbortOnError); int execute_async(Ndb*, NdbTransaction::ExecType, NdbTransaction::AbortOption = NdbTransaction::AbortOnError);
int execute_async_prepare(Ndb*, NdbTransaction::ExecType, NdbTransaction::AbortOption = NdbTransaction::AbortOnError);
int wait_async(Ndb*, int timeout = -1); int wait_async(Ndb*, int timeout = -1);
protected: protected:
......
...@@ -1090,11 +1090,6 @@ runMassiveRollback4(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -1090,11 +1090,6 @@ runMassiveRollback4(NDBT_Context* ctx, NDBT_Step* step){
ok = false; ok = false;
break; break;
} }
if (hugoOps.execute_NoCommit(pNdb) != 0)
{
ok = false;
break;
}
} }
hugoOps.execute_Rollback(pNdb); hugoOps.execute_Rollback(pNdb);
CHECK(hugoOps.closeTransaction(pNdb) == 0); CHECK(hugoOps.closeTransaction(pNdb) == 0);
...@@ -1199,6 +1194,61 @@ runTupErrors(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -1199,6 +1194,61 @@ runTupErrors(NDBT_Context* ctx, NDBT_Step* step){
return NDBT_OK; return NDBT_OK;
} }
int
runInsertError(NDBT_Context* ctx, NDBT_Step* step){
int result = NDBT_OK;
HugoOperations hugoOp1(*ctx->getTab());
HugoOperations hugoOp2(*ctx->getTab());
Ndb* pNdb = GETNDB(step);
NdbRestarter restarter;
restarter.insertErrorInAllNodes(4017);
const Uint32 LOOPS = 10;
for (Uint32 i = 0; i<LOOPS; i++)
{
CHECK(hugoOp1.startTransaction(pNdb) == 0);
CHECK(hugoOp1.pkInsertRecord(pNdb, 1) == 0);
CHECK(hugoOp2.startTransaction(pNdb) == 0);
CHECK(hugoOp2.pkReadRecord(pNdb, 1, 1) == 0);
CHECK(hugoOp1.execute_async_prepare(pNdb, NdbTransaction::Commit) == 0);
CHECK(hugoOp2.execute_async_prepare(pNdb, NdbTransaction::Commit) == 0);
hugoOp1.wait_async(pNdb);
hugoOp2.wait_async(pNdb);
CHECK(hugoOp1.closeTransaction(pNdb) == 0);
CHECK(hugoOp2.closeTransaction(pNdb) == 0);
}
restarter.insertErrorInAllNodes(0);
return result;
}
int
runInsertError2(NDBT_Context* ctx, NDBT_Step* step){
int result = NDBT_OK;
HugoOperations hugoOp1(*ctx->getTab());
Ndb* pNdb = GETNDB(step);
NdbRestarter restarter;
restarter.insertErrorInAllNodes(4017);
const Uint32 LOOPS = 1;
for (Uint32 i = 0; i<LOOPS; i++)
{
CHECK(hugoOp1.startTransaction(pNdb) == 0);
CHECK(hugoOp1.pkInsertRecord(pNdb, 1) == 0);
CHECK(hugoOp1.pkDeleteRecord(pNdb, 1) == 0);
CHECK(hugoOp1.execute_NoCommit(pNdb) == 0);
CHECK(hugoOp1.closeTransaction(pNdb) == 0);
}
restarter.insertErrorInAllNodes(0);
}
NDBT_TESTSUITE(testBasic); NDBT_TESTSUITE(testBasic);
TESTCASE("PkInsert", TESTCASE("PkInsert",
"Verify that we can insert and delete from this table using PK" "Verify that we can insert and delete from this table using PK"
...@@ -1449,16 +1499,16 @@ TESTCASE("MassiveTransaction", ...@@ -1449,16 +1499,16 @@ TESTCASE("MassiveTransaction",
INITIALIZER(runLoadTable2); INITIALIZER(runLoadTable2);
FINALIZER(runClearTable2); FINALIZER(runClearTable2);
} }
TESTCASE("Fill",
"Verify what happens when we fill the db" ){
INITIALIZER(runFillTable);
INITIALIZER(runPkRead);
FINALIZER(runClearTable2);
}
TESTCASE("TupError", TESTCASE("TupError",
"Verify what happens when we fill the db" ){ "Verify what happens when we fill the db" ){
INITIALIZER(runTupErrors); INITIALIZER(runTupErrors);
} }
TESTCASE("InsertError", "" ){
INITIALIZER(runInsertError);
}
TESTCASE("InsertError2", "" ){
INITIALIZER(runInsertError2);
}
NDBT_TESTSUITE_END(testBasic); NDBT_TESTSUITE_END(testBasic);
#if 0 #if 0
...@@ -1469,6 +1519,12 @@ TESTCASE("ReadConsistency", ...@@ -1469,6 +1519,12 @@ TESTCASE("ReadConsistency",
STEP(runReadOne); STEP(runReadOne);
FINALIZER(runClearTable2); FINALIZER(runClearTable2);
} }
TESTCASE("Fill",
"Verify what happens when we fill the db" ){
INITIALIZER(runFillTable);
INITIALIZER(runPkRead);
FINALIZER(runClearTable2);
}
#endif #endif
int main(int argc, const char** argv){ int main(int argc, const char** argv){
......
...@@ -286,15 +286,26 @@ int runRandScanRead(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -286,15 +286,26 @@ int runRandScanRead(NDBT_Context* ctx, NDBT_Step* step){
int records = ctx->getNumRecords(); int records = ctx->getNumRecords();
int parallelism = ctx->getProperty("Parallelism", 240); int parallelism = ctx->getProperty("Parallelism", 240);
int abort = ctx->getProperty("AbortProb", 5); int abort = ctx->getProperty("AbortProb", 5);
int tupscan = ctx->getProperty("TupScan", (Uint32)0);
int i = 0; int i = 0;
HugoTransactions hugoTrans(*ctx->getTab()); HugoTransactions hugoTrans(*ctx->getTab());
while (i<loops && !ctx->isTestStopped()) { while (i<loops && !ctx->isTestStopped()) {
g_info << i << ": "; g_info << i << ": ";
NdbOperation::LockMode lm = (NdbOperation::LockMode)(rand() % 3); NdbOperation::LockMode lm = (NdbOperation::LockMode)(rand() % 3);
int scan_flags = 0;
if (tupscan == 1)
scan_flags |= NdbScanOperation::SF_TupScan;
else if (tupscan == 2 && ((rand() & 0x800)))
{
scan_flags |= NdbScanOperation::SF_TupScan;
}
if (hugoTrans.scanReadRecords(GETNDB(step), if (hugoTrans.scanReadRecords(GETNDB(step),
records, abort, parallelism, records, abort, parallelism,
lm) != 0){ lm,
scan_flags) != 0){
return NDBT_FAILED; return NDBT_FAILED;
} }
i++; i++;
...@@ -1320,6 +1331,16 @@ TESTCASE("ScanRead488", ...@@ -1320,6 +1331,16 @@ TESTCASE("ScanRead488",
STEPS(runRandScanRead, 70); STEPS(runRandScanRead, 70);
FINALIZER(runClearTable); FINALIZER(runClearTable);
} }
TESTCASE("ScanRead488T",
"Verify scan requirement: It's only possible to have 11 concurrent "\
"scans per fragment running in Ndb kernel at the same time. "\
"When this limit is exceeded the scan will be aborted with errorcode "\
"488."){
TC_PROPERTY("TupScan", 1);
INITIALIZER(runLoadTable);
STEPS(runRandScanRead, 70);
FINALIZER(runClearTable);
}
TESTCASE("ScanRead488O", TESTCASE("ScanRead488O",
"Verify scan requirement: It's only possible to have 11 concurrent "\ "Verify scan requirement: It's only possible to have 11 concurrent "\
"scans per fragment running in Ndb kernel at the same time. "\ "scans per fragment running in Ndb kernel at the same time. "\
...@@ -1336,6 +1357,7 @@ TESTCASE("ScanRead488_Mixed", ...@@ -1336,6 +1357,7 @@ TESTCASE("ScanRead488_Mixed",
"scans per fragment running in Ndb kernel at the same time. "\ "scans per fragment running in Ndb kernel at the same time. "\
"When this limit is exceeded the scan will be aborted with errorcode "\ "When this limit is exceeded the scan will be aborted with errorcode "\
"488."){ "488."){
TC_PROPERTY("TupScan", 2);
INITIALIZER(createOrderedPkIndex); INITIALIZER(createOrderedPkIndex);
INITIALIZER(runLoadTable); INITIALIZER(runLoadTable);
STEPS(runRandScanRead, 50); STEPS(runRandScanRead, 50);
......
...@@ -219,6 +219,14 @@ max-time: 500 ...@@ -219,6 +219,14 @@ max-time: 500
cmd: testBasic cmd: testBasic
args: -n TupError args: -n TupError
max-time: 500
cmd: testBasic
args: -n InsertError T1
max-time: 500
cmd: testBasic
args: -n InsertError2 T1
max-time: 500 max-time: 500
cmd: testTimeout cmd: testTimeout
args: T1 args: T1
...@@ -273,6 +281,10 @@ max-time: 500 ...@@ -273,6 +281,10 @@ max-time: 500
cmd: testScan cmd: testScan
args: -n ScanRead488O -l 10 T6 D1 D2 args: -n ScanRead488O -l 10 T6 D1 D2
max-time: 1000
cmd: testScan
args: -n ScanRead488T -l 10 T6 D1 D2
max-time: 1000 max-time: 1000
cmd: testScan cmd: testScan
args: -n ScanRead488_Mixed -l 10 T6 D1 D2 args: -n ScanRead488_Mixed -l 10 T6 D1 D2
......
...@@ -471,16 +471,33 @@ HugoOperations::execute_async(Ndb* pNdb, NdbTransaction::ExecType et, ...@@ -471,16 +471,33 @@ HugoOperations::execute_async(Ndb* pNdb, NdbTransaction::ExecType et,
return NDBT_OK; return NDBT_OK;
} }
int
HugoOperations::execute_async_prepare(Ndb* pNdb, NdbTransaction::ExecType et,
NdbTransaction::AbortOption eao){
m_async_reply= 0;
pTrans->executeAsynchPrepare(et,
HugoOperations_async_callback,
this,
eao);
return NDBT_OK;
}
int int
HugoOperations::wait_async(Ndb* pNdb, int timeout) HugoOperations::wait_async(Ndb* pNdb, int timeout)
{ {
pNdb->pollNdb(1000); volatile int * wait = &m_async_reply;
while (!* wait)
if(m_async_reply)
{ {
if(m_async_return) pNdb->sendPollNdb(1000);
ndbout << "ERROR: " << pNdb->getNdbError(m_async_return) << endl;
return m_async_return; if(* wait)
{
if(m_async_return)
ndbout << "ERROR: " << pNdb->getNdbError(m_async_return) << endl;
return m_async_return;
}
} }
ndbout_c("wait returned nothing..."); ndbout_c("wait returned nothing...");
return -1; return -1;
......
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