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,
goto error;
}
memcpy(dst, org, regTabPtr->total_rec_size << 2);
req_struct->m_tuple_ptr = (Tuple_header*)dst;
}
else
{
......@@ -1528,18 +1529,18 @@ 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))
{
Uint32 RlogSize;
int ret= handleReadReq(signal, regOperPtr, regTabPtr, req_struct);
if (ret == 0 && (RlogSize= req_struct->log_size))
{
jam();
sendLogAttrinfo(signal, RlogSize, regOperPtr);
}
return ret;
jam();
sendLogAttrinfo(signal, RlogSize, regOperPtr);
}
return ret;
error:
tupkeyErrorLab(signal);
return -1;
......
......@@ -1290,17 +1290,7 @@ runDeleteRead(NDBT_Context* ctx, NDBT_Step* step){
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;
}
}
}
tmp.equalForRow(pOp, loops);
// Define attributes to read
for(a = 0; a<tab->getNoOfColumns(); a++)
......@@ -1313,6 +1303,30 @@ runDeleteRead(NDBT_Context* ctx, NDBT_Step* step){
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)
{
ERR(pTrans->getNdbError());
return NDBT_FAILED;
}
}
if (pTrans->execute(Commit) != 0)
{
ERR(pTrans->getNdbError());
return NDBT_FAILED;
}
pTrans->close();
}
return NDBT_OK;
......
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