Commit a33d5e17 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 764e010e
...@@ -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,18 +1529,18 @@ int Dbtup::handleDeleteReq(Signal* signal, ...@@ -1528,18 +1529,18 @@ 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;
int ret= handleReadReq(signal, regOperPtr, regTabPtr, req_struct);
if (ret == 0 && (RlogSize= req_struct->log_size))
{ {
Uint32 RlogSize; jam();
int ret= handleReadReq(signal, regOperPtr, regTabPtr, req_struct); sendLogAttrinfo(signal, RlogSize, regOperPtr);
if (ret == 0 && (RlogSize= req_struct->log_size))
{
jam();
sendLogAttrinfo(signal, RlogSize, regOperPtr);
}
return ret;
} }
return ret;
error: error:
tupkeyErrorLab(signal); tupkeyErrorLab(signal);
return -1; return -1;
......
...@@ -1290,17 +1290,7 @@ runDeleteRead(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -1290,17 +1290,7 @@ 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();
for(a = 0; a<tab->getNoOfColumns(); a++) tmp.equalForRow(pOp, loops);
{
if (tab->getColumn(a)->getPrimaryKey() == true)
{
if(tmp.equalForAttr(pOp, a, 0) != 0)
{
ERR(pTrans->getNdbError());
return NDBT_FAILED;
}
}
}
// Define attributes to read // Define attributes to read
for(a = 0; a<tab->getNoOfColumns(); a++) for(a = 0; a<tab->getNoOfColumns(); a++)
...@@ -1313,6 +1303,30 @@ runDeleteRead(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -1313,6 +1303,30 @@ runDeleteRead(NDBT_Context* ctx, NDBT_Step* step){
pTrans->execute(Commit); pTrans->execute(Commit);
pTrans->close(); 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; 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