diff options
author | unknown <jonas@eel.(none)> | 2007-01-23 19:27:55 +0100 |
---|---|---|
committer | unknown <jonas@eel.(none)> | 2007-01-23 19:27:55 +0100 |
commit | 8dca186c353db7fcb76388bc0cb61f605785e8dd (patch) | |
tree | 4554ef5648f62da54b8a1af0ac2013323a1fdc2b /storage | |
parent | 997f63503eea784c5298cb477c560193d0753b18 (diff) | |
download | mariadb-git-8dca186c353db7fcb76388bc0cb61f605785e8dd.tar.gz |
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
Diffstat (limited to 'storage')
-rw-r--r-- | storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp | 19 | ||||
-rw-r--r-- | storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp | 3 | ||||
-rw-r--r-- | storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp | 14 | ||||
-rw-r--r-- | storage/ndb/test/ndbapi/testBasic.cpp | 52 | ||||
-rw-r--r-- | storage/ndb/test/run-test/daily-basic-tests.txt | 6 |
5 files changed, 80 insertions, 14 deletions
diff --git a/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp b/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp index 20fb910e78a..f59e858dd4d 100644 --- a/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp +++ b/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp @@ -3147,20 +3147,23 @@ void Dblqh::lqhAttrinfoLab(Signal* signal, Uint32* dataPtr, Uint32 length) { TcConnectionrec * const regTcPtr = tcConnectptr.p; if (regTcPtr->operation != ZREAD) { - if (regTcPtr->opExec != 1) { - if (saveTupattrbuf(signal, dataPtr, length) == ZOK) { - ; - } else { - jam(); + if (regTcPtr->operation != ZDELETE) + { + if (regTcPtr->opExec != 1) { + if (saveTupattrbuf(signal, dataPtr, length) == ZOK) { + ; + } else { + jam(); /* ------------------------------------------------------------------------- */ /* WE MIGHT BE WAITING FOR RESPONSE FROM SOME BLOCK HERE. THUS WE NEED TO */ /* GO THROUGH THE STATE MACHINE FOR THE OPERATION. */ /* ------------------------------------------------------------------------- */ - localAbortStateHandlerLab(signal); - return; + localAbortStateHandlerLab(signal); + return; + }//if }//if }//if - }//if + } c_tup->receive_attrinfo(signal, regTcPtr->tupConnectrec, dataPtr, length); }//Dblqh::lqhAttrinfoLab() diff --git a/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp b/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp index 02fa4e71d08..824338e4d03 100644 --- a/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp +++ b/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp @@ -1736,7 +1736,8 @@ private: Operationrec* regOperPtr, Fragrecord* regFragPtr, Tablerec* regTabPtr, - KeyReqStruct* req_struct); + KeyReqStruct* req_struct, + bool disk); //------------------------------------------------------------------ //------------------------------------------------------------------ diff --git a/storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp b/storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp index 47f61132699..22338899aa8 100644 --- a/storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp +++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp @@ -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()) @@ -1511,8 +1514,11 @@ int Dbtup::handleDeleteReq(Signal* signal, { return 0; } - - return handleReadReq(signal, regOperPtr, regTabPtr, req_struct); + + if (setup_read(req_struct, regOperPtr, regFragPtr, regTabPtr, disk)) + { + return handleReadReq(signal, regOperPtr, regTabPtr, req_struct); + } error: tupkeyErrorLab(signal); diff --git a/storage/ndb/test/ndbapi/testBasic.cpp b/storage/ndb/test/ndbapi/testBasic.cpp index 3c6ce7b7583..9c327118ceb 100644 --- a/storage/ndb/test/ndbapi/testBasic.cpp +++ b/storage/ndb/test/ndbapi/testBasic.cpp @@ -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 diff --git a/storage/ndb/test/run-test/daily-basic-tests.txt b/storage/ndb/test/run-test/daily-basic-tests.txt index 8b69353d42d..8d2bf6704d7 100644 --- a/storage/ndb/test/run-test/daily-basic-tests.txt +++ b/storage/ndb/test/run-test/daily-basic-tests.txt @@ -81,6 +81,10 @@ args: -n UpdateAndRead max-time: 500 cmd: testBasic +args: -n DeleteRead + +max-time: 500 +cmd: testBasic args: -n PkReadAndLocker T6 D1 D2 max-time: 500 @@ -461,7 +465,7 @@ max-time: 500 cmd: testScan args: -n Bug24447 T1 -max-time: 500 +max-time: 1000 cmd: testScan args: -n ScanVariants |