Commit ded0bbb1 authored by unknown's avatar unknown

ndb - bug#25794

  Fix read after delete (in same op)
  - lqh, handling of attrinfo
  - tup, setup read for disk/varchar


storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp:
  Dont save ATTRINFO "also" for DELETE, even when getting it in separate signal
storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp:
  Add disk flag to signature
    (for read after delete)
storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp:
  Do setup read before read after delete
storage/ndb/test/ndbapi/testBasic.cpp:
  testcase
storage/ndb/test/run-test/daily-basic-tests.txt:
  testcase
parent c35f33e5
......@@ -3147,6 +3147,8 @@ void Dblqh::lqhAttrinfoLab(Signal* signal, Uint32* dataPtr, Uint32 length)
{
TcConnectionrec * const regTcPtr = tcConnectptr.p;
if (regTcPtr->operation != ZREAD) {
if (regTcPtr->operation != ZDELETE)
{
if (regTcPtr->opExec != 1) {
if (saveTupattrbuf(signal, dataPtr, length) == ZOK) {
;
......@@ -3161,6 +3163,7 @@ void Dblqh::lqhAttrinfoLab(Signal* signal, Uint32* dataPtr, Uint32 length)
}//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())
......@@ -1512,7 +1515,10 @@ int Dbtup::handleDeleteReq(Signal* signal,
return 0;
}
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