Commit 1e0418cf authored by jonas@eel.(none)'s avatar jonas@eel.(none)

ndb - bug#25794

  Fix read after delete (in same op)
  - lqh, handling of attrinfo
  - tup, setup read for disk/varchar
parent b5fa32f0
......@@ -3147,20 +3147,23 @@ void Dblqh::lqhAttrinfoLab(Signal* signal, Uint32* dataPtr, Uint32 length)
{
TcConnectionrec * const regTcPtr = tcConnectptr.p;
if (regTcPtr->operation != ZREAD) {
if (regTcPtr->opExec != 1) {
if (saveTupattrbuf(signal, dataPtr, length) == ZOK) {
;
} else {
jam();
if (regTcPtr->operation != ZDELETE)
{
if (regTcPtr->opExec != 1) {
if (saveTupattrbuf(signal, dataPtr, length) == ZOK) {
;
} else {
jam();
/* ------------------------------------------------------------------------- */
/* WE MIGHT BE WAITING FOR RESPONSE FROM SOME BLOCK HERE. THUS WE NEED TO */
/* GO THROUGH THE STATE MACHINE FOR THE OPERATION. */
/* ------------------------------------------------------------------------- */
localAbortStateHandlerLab(signal);
return;
localAbortStateHandlerLab(signal);
return;
}//if
}//if
}//if
}//if
}
c_tup->receive_attrinfo(signal, regTcPtr->tupConnectrec, dataPtr, length);
}//Dblqh::lqhAttrinfoLab()
......
......@@ -1736,7 +1736,8 @@ private:
Operationrec* regOperPtr,
Fragrecord* regFragPtr,
Tablerec* regTabPtr,
KeyReqStruct* req_struct);
KeyReqStruct* req_struct,
bool disk);
//------------------------------------------------------------------
//------------------------------------------------------------------
......
......@@ -815,7 +815,9 @@ void Dbtup::execTUPKEYREQ(Signal* signal)
{
jam();
if (handleDeleteReq(signal, regOperPtr,
regFragPtr, regTabPtr, &req_struct) == -1) {
regFragPtr, regTabPtr,
&req_struct,
disk_page != RNIL) == -1) {
return;
}
/*
......@@ -1459,7 +1461,8 @@ int Dbtup::handleDeleteReq(Signal* signal,
Operationrec* regOperPtr,
Fragrecord* regFragPtr,
Tablerec* regTabPtr,
KeyReqStruct *req_struct)
KeyReqStruct *req_struct,
bool disk)
{
// delete must set but not increment tupVersion
if (!regOperPtr->is_first_operation())
......@@ -1511,8 +1514,11 @@ int Dbtup::handleDeleteReq(Signal* signal,
{
return 0;
}
return handleReadReq(signal, regOperPtr, regTabPtr, req_struct);
if (setup_read(req_struct, regOperPtr, regFragPtr, regTabPtr, disk))
{
return handleReadReq(signal, regOperPtr, regTabPtr, req_struct);
}
error:
tupkeyErrorLab(signal);
......
......@@ -1273,6 +1273,52 @@ runBug25090(NDBT_Context* ctx, NDBT_Step* step){
return NDBT_OK;
}
int
runDeleteRead(NDBT_Context* ctx, NDBT_Step* step){
Ndb* pNdb = GETNDB(step);
const NdbDictionary::Table* tab = ctx->getTab();
NDBT_ResultRow row(*ctx->getTab());
HugoTransactions tmp(*ctx->getTab());
int a;
int loops = ctx->getNumLoops();
const int rows = ctx->getNumRecords();
while (loops--)
{
NdbTransaction* pTrans = pNdb->startTransaction();
NdbOperation* pOp = pTrans->getNdbOperation(tab->getName());
pOp->deleteTuple();
for(a = 0; a<tab->getNoOfColumns(); a++)
{
if (tab->getColumn(a)->getPrimaryKey() == true)
{
if(tmp.equalForAttr(pOp, a, 0) != 0)
{
ERR(pTrans->getNdbError());
return NDBT_FAILED;
}
}
}
// Define attributes to read
for(a = 0; a<tab->getNoOfColumns(); a++)
{
if((row.attributeStore(a) = pOp->getValue(tab->getColumn(a)->getName())) == 0) {
ERR(pTrans->getNdbError());
return NDBT_FAILED;
}
}
pTrans->execute(Commit);
pTrans->close();
}
return NDBT_OK;
}
NDBT_TESTSUITE(testBasic);
TESTCASE("PkInsert",
"Verify that we can insert and delete from this table using PK"
......@@ -1543,6 +1589,12 @@ TESTCASE("Bug25090",
"Verify what happens when we fill the db" ){
STEP(runBug25090);
}
TESTCASE("DeleteRead",
"Verify Delete+Read" ){
INITIALIZER(runLoadTable);
INITIALIZER(runDeleteRead);
FINALIZER(runClearTable2);
}
NDBT_TESTSUITE_END(testBasic);
#if 0
......
......@@ -79,6 +79,10 @@ max-time: 660
cmd: testBasic
args: -n UpdateAndRead
max-time: 500
cmd: testBasic
args: -n DeleteRead
max-time: 500
cmd: testBasic
args: -n PkReadAndLocker T6 D1 D2
......@@ -461,7 +465,7 @@ max-time: 500
cmd: testScan
args: -n Bug24447 T1
max-time: 500
max-time: 1000
cmd: testScan
args: -n ScanVariants
......
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