Commit d4b3f437 authored by unknown's avatar unknown

ndb - bug#28276

  Fix DeleteRead in multi-operation
    Dont use setup_read, as it will (correctly) find that tuple is deleted


storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp:
  Fix multi-op DeleteRead
storage/ndb/test/ndbapi/testBasic.cpp:
  Fix multi-op DeleteRead
parent 57ec524b
...@@ -1491,6 +1491,7 @@ int Dbtup::handleDeleteReq(Signal* signal, ...@@ -1491,6 +1491,7 @@ int Dbtup::handleDeleteReq(Signal* signal,
goto error; goto error;
} }
memcpy(dst, org, regTabPtr->total_rec_size << 2); memcpy(dst, org, regTabPtr->total_rec_size << 2);
req_struct->m_tuple_ptr = (Tuple_header*)dst;
} }
else else
{ {
...@@ -1528,8 +1529,9 @@ int Dbtup::handleDeleteReq(Signal* signal, ...@@ -1528,8 +1529,9 @@ int Dbtup::handleDeleteReq(Signal* signal,
return 0; return 0;
} }
if (setup_read(req_struct, regOperPtr, regFragPtr, regTabPtr, disk)) if (regTabPtr->need_expand(disk))
{ prepare_read(req_struct, regTabPtr, disk);
Uint32 RlogSize; Uint32 RlogSize;
int ret= handleReadReq(signal, regOperPtr, regTabPtr, req_struct); int ret= handleReadReq(signal, regOperPtr, regTabPtr, req_struct);
if (ret == 0 && (RlogSize= req_struct->log_size)) if (ret == 0 && (RlogSize= req_struct->log_size))
...@@ -1538,7 +1540,6 @@ int Dbtup::handleDeleteReq(Signal* signal, ...@@ -1538,7 +1540,6 @@ int Dbtup::handleDeleteReq(Signal* signal,
sendLogAttrinfo(signal, RlogSize, regOperPtr); sendLogAttrinfo(signal, RlogSize, regOperPtr);
} }
return ret; return ret;
}
error: error:
tupkeyErrorLab(signal); tupkeyErrorLab(signal);
......
...@@ -1290,28 +1290,42 @@ runDeleteRead(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -1290,28 +1290,42 @@ runDeleteRead(NDBT_Context* ctx, NDBT_Step* step){
NdbTransaction* pTrans = pNdb->startTransaction(); NdbTransaction* pTrans = pNdb->startTransaction();
NdbOperation* pOp = pTrans->getNdbOperation(tab->getName()); NdbOperation* pOp = pTrans->getNdbOperation(tab->getName());
pOp->deleteTuple(); pOp->deleteTuple();
tmp.equalForRow(pOp, loops);
// Define attributes to read
for(a = 0; a<tab->getNoOfColumns(); a++) for(a = 0; a<tab->getNoOfColumns(); a++)
{ {
if (tab->getColumn(a)->getPrimaryKey() == true) if((row.attributeStore(a) = pOp->getValue(tab->getColumn(a)->getName())) == 0) {
{
if(tmp.equalForAttr(pOp, a, 0) != 0)
{
ERR(pTrans->getNdbError()); ERR(pTrans->getNdbError());
return NDBT_FAILED; return NDBT_FAILED;
} }
} }
}
// Define attributes to read pTrans->execute(Commit);
pTrans->close();
pTrans = pNdb->startTransaction();
pOp = pTrans->getNdbOperation(tab->getName());
pOp->insertTuple();
tmp.setValues(pOp, loops, 0);
pOp = pTrans->getNdbOperation(tab->getName());
pOp->deleteTuple();
tmp.equalForRow(pOp, loops);
for(a = 0; a<tab->getNoOfColumns(); a++) for(a = 0; a<tab->getNoOfColumns(); a++)
{ {
if((row.attributeStore(a) = pOp->getValue(tab->getColumn(a)->getName())) == 0) { if((row.attributeStore(a) = pOp->getValue(tab->getColumn(a)->getName())) == 0)
{
ERR(pTrans->getNdbError()); ERR(pTrans->getNdbError());
return NDBT_FAILED; return NDBT_FAILED;
} }
} }
if (pTrans->execute(Commit) != 0)
{
ERR(pTrans->getNdbError());
return NDBT_FAILED;
}
pTrans->execute(Commit);
pTrans->close(); pTrans->close();
} }
......
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