ndb - bug#28276

  Fix DeleteRead in multi-operation
    Dont use setup_read, as it will (correctly) find that tuple is deleted
parent 76bedc6a
......@@ -1491,6 +1491,7 @@ int Dbtup::handleDeleteReq(Signal* signal,
goto error;
}
memcpy(dst, org, regTabPtr->total_rec_size << 2);
req_struct->m_tuple_ptr = (Tuple_header*)dst;
}
else
{
......@@ -1528,8 +1529,9 @@ int Dbtup::handleDeleteReq(Signal* signal,
return 0;
}
if (setup_read(req_struct, regOperPtr, regFragPtr, regTabPtr, disk))
{
if (regTabPtr->need_expand(disk))
prepare_read(req_struct, regTabPtr, disk);
Uint32 RlogSize;
int ret= handleReadReq(signal, regOperPtr, regTabPtr, req_struct);
if (ret == 0 && (RlogSize= req_struct->log_size))
......@@ -1538,7 +1540,6 @@ int Dbtup::handleDeleteReq(Signal* signal,
sendLogAttrinfo(signal, RlogSize, regOperPtr);
}
return ret;
}
error:
tupkeyErrorLab(signal);
......
......@@ -1290,28 +1290,42 @@ runDeleteRead(NDBT_Context* ctx, NDBT_Step* step){
NdbTransaction* pTrans = pNdb->startTransaction();
NdbOperation* pOp = pTrans->getNdbOperation(tab->getName());
pOp->deleteTuple();
tmp.equalForRow(pOp, loops);
// Define attributes to read
for(a = 0; a<tab->getNoOfColumns(); a++)
{
if (tab->getColumn(a)->getPrimaryKey() == true)
{
if(tmp.equalForAttr(pOp, a, 0) != 0)
{
if((row.attributeStore(a) = pOp->getValue(tab->getColumn(a)->getName())) == 0) {
ERR(pTrans->getNdbError());
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++)
{
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());
return NDBT_FAILED;
}
}
if (pTrans->execute(Commit) != 0)
{
ERR(pTrans->getNdbError());
return NDBT_FAILED;
}
pTrans->execute(Commit);
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