diff options
author | unknown <tomas@poseidon.mysql.com> | 2007-02-02 21:01:34 +0700 |
---|---|---|
committer | unknown <tomas@poseidon.mysql.com> | 2007-02-02 21:01:34 +0700 |
commit | d08299dee53cfcecd0920c13daff2ea625757327 (patch) | |
tree | 4e35cba594d989fd9f6f2d7f6ff8b10e40614965 /storage | |
parent | f1be406368ccb88f6454555388dcc8bb505db7c4 (diff) | |
parent | 32026612f2adc79a70467adc2eb1409b9e3d8e11 (diff) | |
download | mariadb-git-d08299dee53cfcecd0920c13daff2ea625757327.tar.gz |
Merge tulin@bk-internal.mysql.com:/home/bk/mysql-5.1
into poseidon.mysql.com:/home/tomas/mysql-5.1-new-ndb
Diffstat (limited to 'storage')
24 files changed, 564 insertions, 529 deletions
diff --git a/storage/ndb/include/ndbapi/NdbIndexOperation.hpp b/storage/ndb/include/ndbapi/NdbIndexOperation.hpp index 0f06d8041ee..49e55f54f1a 100644 --- a/storage/ndb/include/ndbapi/NdbIndexOperation.hpp +++ b/storage/ndb/include/ndbapi/NdbIndexOperation.hpp @@ -181,8 +181,6 @@ private: const class NdbTableImpl* aTable, NdbTransaction*); - int prepareSend(Uint32 TC_ConnectPtr, Uint64 TransactionId); - // Private attributes const NdbIndexImpl* m_theIndex; friend struct Ndb_free_list_t<NdbIndexOperation>; diff --git a/storage/ndb/include/ndbapi/NdbOperation.hpp b/storage/ndb/include/ndbapi/NdbOperation.hpp index 556412c4799..90b90c7e481 100644 --- a/storage/ndb/include/ndbapi/NdbOperation.hpp +++ b/storage/ndb/include/ndbapi/NdbOperation.hpp @@ -98,6 +98,19 @@ public: }; /** + * How should transaction be handled if operation fails + * + * For READ, default is AO_IgnoreError + * DML, default is AbortOnError + * CommittedRead does _only_ support AO_IgnoreError + */ + enum AbortOption { + DefaultAbortOption = -1,///< Use default as specified by op-type + AbortOnError = 0, ///< Abort transaction on failed operation + AO_IgnoreError = 2 ///< Transaction continues on failed operation + }; + + /** * Define the NdbOperation to be a standard operation of type insertTuple. * When calling NdbTransaction::execute, this operation * adds a new tuple to the table. @@ -776,8 +789,13 @@ public: */ LockMode getLockMode() const { return theLockMode; } + /** + * Get/set abort option + */ + AbortOption getAbortOption() const; + int setAbortOption(AbortOption); + #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL - void setAbortOption(Int8 ao) { m_abortOption = ao; } /** * Set/get partition key @@ -856,7 +874,8 @@ protected: int doSend(int ProcessorId, Uint32 lastFlag); virtual int prepareSend(Uint32 TC_ConnectPtr, - Uint64 TransactionId); + Uint64 TransactionId, + AbortOption); virtual void setLastFlag(NdbApiSignal* signal, Uint32 lastFlag); int prepareSendInterpreted(); // Help routine to prepare* diff --git a/storage/ndb/include/ndbapi/NdbTransaction.hpp b/storage/ndb/include/ndbapi/NdbTransaction.hpp index 7c5d02c209e..56d0801d507 100644 --- a/storage/ndb/include/ndbapi/NdbTransaction.hpp +++ b/storage/ndb/include/ndbapi/NdbTransaction.hpp @@ -20,6 +20,7 @@ #include "NdbError.hpp" #include "NdbDictionary.hpp" #include "Ndb.hpp" +#include "NdbOperation.hpp" class NdbTransaction; class NdbOperation; @@ -44,11 +45,12 @@ typedef void (* NdbAsynchCallback)(int, NdbTransaction*, void*); #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL enum AbortOption { - CommitIfFailFree= 0, - TryCommit= 0, - AbortOnError= 0, - CommitAsMuchAsPossible= 2, - AO_IgnoreError= 2 + DefaultAbortOption = NdbOperation::DefaultAbortOption, + CommitIfFailFree = NdbOperation::AbortOnError, + TryCommit = NdbOperation::AbortOnError, + AbortOnError= NdbOperation::AbortOnError, + CommitAsMuchAsPossible = NdbOperation::AO_IgnoreError, + AO_IgnoreError= NdbOperation::AO_IgnoreError }; enum ExecType { NoExecTypeDef = -1, @@ -145,20 +147,6 @@ class NdbTransaction public: /** - * Commit type of transaction - */ - enum AbortOption { - AbortOnError= ///< Abort transaction on failed operation -#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL - ::AbortOnError -#endif - ,AO_IgnoreError= ///< Transaction continues on failed operation -#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL - ::AO_IgnoreError -#endif - }; - - /** * Execution type of transaction */ enum ExecType { @@ -316,13 +304,15 @@ public: * @return 0 if successful otherwise -1. */ int execute(ExecType execType, - AbortOption abortOption = AbortOnError, + NdbOperation::AbortOption = NdbOperation::DefaultAbortOption, int force = 0 ); #ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED int execute(::ExecType execType, - ::AbortOption abortOption = ::AbortOnError, - int force = 0 ) - { return execute ((ExecType)execType,(AbortOption)abortOption,force); } + ::AbortOption abortOption = ::DefaultAbortOption, + int force = 0 ) { + return execute ((ExecType)execType, + (NdbOperation::AbortOption)abortOption, + force); } #endif #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL @@ -353,14 +343,14 @@ public: void executeAsynchPrepare(ExecType execType, NdbAsynchCallback callback, void* anyObject, - AbortOption abortOption = AbortOnError); + NdbOperation::AbortOption = NdbOperation::DefaultAbortOption); #ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED void executeAsynchPrepare(::ExecType execType, NdbAsynchCallback callback, void* anyObject, - ::AbortOption abortOption = ::AbortOnError) - { executeAsynchPrepare((ExecType)execType, callback, anyObject, - (AbortOption)abortOption); } + ::AbortOption ao = ::DefaultAbortOption) { + executeAsynchPrepare((ExecType)execType, callback, anyObject, + (NdbOperation::AbortOption)ao); } #endif /** @@ -379,14 +369,14 @@ public: void executeAsynch(ExecType aTypeOfExec, NdbAsynchCallback aCallback, void* anyObject, - AbortOption abortOption = AbortOnError); + NdbOperation::AbortOption = NdbOperation::DefaultAbortOption); #ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED void executeAsynch(::ExecType aTypeOfExec, NdbAsynchCallback aCallback, void* anyObject, - ::AbortOption abortOption= ::AbortOnError) + ::AbortOption abortOption= ::DefaultAbortOption) { executeAsynch((ExecType)aTypeOfExec, aCallback, anyObject, - (AbortOption)abortOption); } + (NdbOperation::AbortOption)abortOption); } #endif #endif /** @@ -588,7 +578,7 @@ private: void init(); // Initialize connection object for new transaction int executeNoBlobs(ExecType execType, - AbortOption abortOption = AbortOnError, + NdbOperation::AbortOption = NdbOperation::DefaultAbortOption, int force = 0 ); /** @@ -642,7 +632,7 @@ private: int sendCOMMIT(); // Send a TC_COMMITREQ signal; void setGCI(int GCI); // Set the global checkpoint identity - int OpCompleteFailure(Uint8 abortoption, bool setFailure = true); + int OpCompleteFailure(NdbOperation*); int OpCompleteSuccess(); void CompletedOperations(); // Move active ops to list of completed @@ -732,7 +722,6 @@ private: Uint32 theNoOfOpSent; // How many operations have been sent Uint32 theNoOfOpCompleted; // How many operations have completed - Uint32 theNoOfOpFetched; // How many operations was actually fetched Uint32 theMyRef; // Our block reference Uint32 theTCConPtr; // Transaction Co-ordinator connection pointer. Uint64 theTransactionId; // theTransactionId of the transaction @@ -756,7 +745,6 @@ private: bool theTransactionIsStarted; bool theInUseState; bool theSimpleState; - Uint8 m_abortOption; // Type of commi enum ListState { NotInList, diff --git a/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp b/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp index e4764698f5b..725219ca006 100644 --- a/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp +++ b/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp @@ -2479,8 +2479,16 @@ Dblqh::execREMOVE_MARKER_ORD(Signal* signal) CommitAckMarkerPtr removedPtr; m_commitAckMarkerHash.remove(removedPtr, key); +#if defined VM_TRACE || defined ERROR_INSERT ndbrequire(removedPtr.i != RNIL); m_commitAckMarkerPool.release(removedPtr); +#else + if (removedPtr.i != RNIL) + { + jam(); + m_commitAckMarkerPool.release(removedPtr); + } +#endif #ifdef MARKER_TRACE ndbout_c("Rem marker[%.8x %.8x]", key.transid1, key.transid2); #endif @@ -3138,20 +3146,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() @@ -3405,7 +3416,7 @@ void Dblqh::execLQHKEYREQ(Signal* signal) markerPtr.p->tcNodeId = tcNodeId; CommitAckMarkerPtr tmp; -#ifdef VM_TRACE +#if defined VM_TRACE || defined ERROR_INSERT #ifdef MARKER_TRACE ndbout_c("Add marker[%.8x %.8x]", markerPtr.p->transid1, markerPtr.p->transid2); #endif @@ -9629,7 +9640,7 @@ Uint32 Dblqh::initScanrec(const ScanFragReq* scanFragReq) active.add(scanptr); if(scanptr.p->scanKeyinfoFlag){ jam(); -#ifdef VM_TRACE +#if defined VM_TRACE || defined ERROR_INSERT ScanRecordPtr tmp; ndbrequire(!c_scanTakeOverHash.find(tmp, * scanptr.p)); #endif @@ -9753,7 +9764,7 @@ void Dblqh::finishScanrec(Signal* signal) scans.add(restart); if(restart.p->scanKeyinfoFlag){ jam(); -#ifdef VM_TRACE +#if defined VM_TRACE || defined ERROR_INSERT ScanRecordPtr tmp; ndbrequire(!c_scanTakeOverHash.find(tmp, * restart.p)); #endif diff --git a/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp b/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp index 44f7954f00d..c7ca8048354 100644 --- a/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp +++ b/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp @@ -2522,7 +2522,7 @@ void Dbtc::execTCKEYREQ(Signal* signal) ApiConnectRecord * const regApiPtr = &localApiConnectRecord[TapiIndex]; apiConnectptr.p = regApiPtr; - Uint32 TstartFlag = tcKeyReq->getStartFlag(Treqinfo); + Uint32 TstartFlag = TcKeyReq::getStartFlag(Treqinfo); Uint32 TexecFlag = TcKeyReq::getExecuteFlag(Treqinfo); Uint8 isIndexOp = regApiPtr->isIndexOp; @@ -2692,14 +2692,14 @@ void Dbtc::execTCKEYREQ(Signal* signal) /* */ /* ---------------------------------------------------------------------- */ - UintR TapiVersionNo = tcKeyReq->getAPIVersion(tcKeyReq->attrLen); + UintR TapiVersionNo = TcKeyReq::getAPIVersion(tcKeyReq->attrLen); UintR Tlqhkeyreqrec = regApiPtr->lqhkeyreqrec; regApiPtr->lqhkeyreqrec = Tlqhkeyreqrec + 1; regCachePtr->apiVersionNo = TapiVersionNo; UintR TapiConnectptrIndex = apiConnectptr.i; UintR TsenderData = tcKeyReq->senderData; - UintR TattrLen = tcKeyReq->getAttrinfoLen(tcKeyReq->attrLen); + UintR TattrLen = TcKeyReq::getAttrinfoLen(tcKeyReq->attrLen); UintR TattrinfoCount = c_counters.cattrinfoCount; regTcPtr->apiConnect = TapiConnectptrIndex; @@ -2725,15 +2725,15 @@ void Dbtc::execTCKEYREQ(Signal* signal) UintR TtabptrIndex = localTabptr.i; UintR TtableSchemaVersion = tcKeyReq->tableSchemaVersion; - Uint8 TOperationType = tcKeyReq->getOperationType(Treqinfo); + Uint8 TOperationType = TcKeyReq::getOperationType(Treqinfo); regCachePtr->tableref = TtabptrIndex; regCachePtr->schemaVersion = TtableSchemaVersion; regTcPtr->operation = TOperationType; - Uint8 TSimpleFlag = tcKeyReq->getSimpleFlag(Treqinfo); - Uint8 TDirtyFlag = tcKeyReq->getDirtyFlag(Treqinfo); - Uint8 TInterpretedFlag = tcKeyReq->getInterpretedFlag(Treqinfo); - Uint8 TDistrKeyFlag = tcKeyReq->getDistributionKeyFlag(Treqinfo); + Uint8 TSimpleFlag = TcKeyReq::getSimpleFlag(Treqinfo); + Uint8 TDirtyFlag = TcKeyReq::getDirtyFlag(Treqinfo); + Uint8 TInterpretedFlag = TcKeyReq::getInterpretedFlag(Treqinfo); + Uint8 TDistrKeyFlag = TcKeyReq::getDistributionKeyFlag(Treqinfo); Uint8 TNoDiskFlag = TcKeyReq::getNoDiskFlag(Treqinfo); Uint8 TexecuteFlag = TexecFlag; @@ -2749,10 +2749,10 @@ void Dbtc::execTCKEYREQ(Signal* signal) Uint32 TkeyIndex; Uint32* TOptionalDataPtr = (Uint32*)&tcKeyReq->scanInfo; { - Uint32 TDistrGHIndex = tcKeyReq->getScanIndFlag(Treqinfo); + Uint32 TDistrGHIndex = TcKeyReq::getScanIndFlag(Treqinfo); Uint32 TDistrKeyIndex = TDistrGHIndex; - Uint32 TscanInfo = tcKeyReq->getTakeOverScanInfo(TOptionalDataPtr[0]); + Uint32 TscanInfo = TcKeyReq::getTakeOverScanInfo(TOptionalDataPtr[0]); regCachePtr->scanTakeOverInd = TDistrGHIndex; regCachePtr->scanInfo = TscanInfo; @@ -2774,7 +2774,7 @@ void Dbtc::execTCKEYREQ(Signal* signal) regCachePtr->keydata[2] = Tdata3; regCachePtr->keydata[3] = Tdata4; - TkeyLength = tcKeyReq->getKeyLength(Treqinfo); + TkeyLength = TcKeyReq::getKeyLength(Treqinfo); Uint32 TAIDataIndex; if (TkeyLength > 8) { TAIDataIndex = TkeyIndex + 8; @@ -2787,7 +2787,7 @@ void Dbtc::execTCKEYREQ(Signal* signal) }//if Uint32* TAIDataPtr = &TOptionalDataPtr[TAIDataIndex]; - titcLenAiInTckeyreq = tcKeyReq->getAIInTcKeyReq(Treqinfo); + titcLenAiInTckeyreq = TcKeyReq::getAIInTcKeyReq(Treqinfo); regCachePtr->keylen = TkeyLength; regCachePtr->lenAiInTckeyreq = titcLenAiInTckeyreq; regCachePtr->currReclenAi = titcLenAiInTckeyreq; @@ -2824,6 +2824,12 @@ void Dbtc::execTCKEYREQ(Signal* signal) tmp.p->apiNodeId = refToNode(regApiPtr->ndbapiBlockref); tmp.p->apiConnectPtr = TapiIndex; tmp.p->noOfLqhs = 0; +#if defined VM_TRACE || defined ERROR_INSERT + { + CommitAckMarkerPtr check; + ndbrequire(!m_commitAckMarkerHash.find(check, *tmp.p)); + } +#endif m_commitAckMarkerHash.add(tmp); } } @@ -2852,14 +2858,14 @@ void Dbtc::execTCKEYREQ(Signal* signal) }//switch }//if - Uint32 TabortOption = tcKeyReq->getAbortOption(Treqinfo); + Uint32 TabortOption = TcKeyReq::getAbortOption(Treqinfo); regTcPtr->m_execAbortOption = TabortOption; /*------------------------------------------------------------------------- * Check error handling per operation * If CommitFlag is set state accordingly and check for early abort *------------------------------------------------------------------------*/ - if (tcKeyReq->getCommitFlag(Treqinfo) == 1) { + if (TcKeyReq::getCommitFlag(Treqinfo) == 1) { ndbrequire(TexecuteFlag); regApiPtr->apiConnectstate = CS_REC_COMMITTING; } else { @@ -8114,6 +8120,13 @@ void Dbtc::initApiConnectFail(Signal* signal) tmp.p->noOfLqhs = 1; tmp.p->lqhNodeId[0] = tnodeid; tmp.p->apiConnectPtr = apiConnectptr.i; + +#if defined VM_TRACE || defined ERROR_INSERT + { + CommitAckMarkerPtr check; + ndbrequire(!m_commitAckMarkerHash.find(check, *tmp.p)); + } +#endif m_commitAckMarkerHash.add(tmp); } }//Dbtc::initApiConnectFail() @@ -8270,6 +8283,12 @@ void Dbtc::updateApiStateFail(Signal* signal) tmp.p->noOfLqhs = 1; tmp.p->lqhNodeId[0] = tnodeid; tmp.p->apiConnectPtr = apiConnectptr.i; +#if defined VM_TRACE || defined ERROR_INSERT + { + CommitAckMarkerPtr check; + ndbrequire(!m_commitAckMarkerHash.find(check, *tmp.p)); + } +#endif m_commitAckMarkerHash.add(tmp); } else { jam(); @@ -11472,7 +11491,7 @@ void Dbtc::execTCINDXREQ(Signal* signal) // If operation is readTupleExclusive or updateTuple then read index // table with exclusive lock Uint32 indexLength = TcKeyReq::getKeyLength(tcIndxRequestInfo); - Uint32 attrLength = tcIndxReq->attrLen; + Uint32 attrLength = TcKeyReq::getAttrinfoLen(tcIndxReq->attrLen); indexOp->expectedKeyInfo = indexLength; Uint32 includedIndexLength = MIN(indexLength, indexBufSize); indexOp->expectedAttrInfo = attrLength; diff --git a/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp b/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp index 357dec6fde7..fb1d580576e 100644 --- a/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp +++ b/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp @@ -1735,7 +1735,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 52981e7fc83..c394812ad1a 100644 --- a/storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp +++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp @@ -814,7 +814,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; } /* @@ -1458,7 +1460,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()) @@ -1510,8 +1513,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/src/kernel/blocks/qmgr/QmgrMain.cpp b/storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp index 3a6f5151fec..4f3c4263fee 100644 --- a/storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp +++ b/storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp @@ -3525,8 +3525,10 @@ void Qmgr::execCOMMIT_FAILREQ(Signal* signal) nodePtr.p->phase = ZFAIL_CLOSING; nodePtr.p->failState = WAITING_FOR_NDB_FAILCONF; setNodeInfo(nodePtr.i).m_heartbeat_cnt= 0; + setNodeInfo(nodePtr.i).m_version = 0; c_clusterNodes.clear(nodePtr.i); }//for + recompute_version_info(NodeInfo::DB); /*----------------------------------------------------------------------*/ /* WE INFORM THE API'S WE HAVE CONNECTED ABOUT THE FAILED NODES. */ /*----------------------------------------------------------------------*/ diff --git a/storage/ndb/src/kernel/blocks/suma/Suma.cpp b/storage/ndb/src/kernel/blocks/suma/Suma.cpp index b201d05726d..7afedfbde71 100644 --- a/storage/ndb/src/kernel/blocks/suma/Suma.cpp +++ b/storage/ndb/src/kernel/blocks/suma/Suma.cpp @@ -4668,9 +4668,7 @@ Suma::out_of_buffer(Signal* signal) m_out_of_buffer_gci = m_last_complete_gci - 1; infoEvent("Out of event buffer: nodefailure will cause event failures"); - signal->theData[0] = SumaContinueB::OUT_OF_BUFFER_RELEASE; - signal->theData[1] = 0; - sendSignal(SUMA_REF, GSN_CONTINUEB, signal, 2, JBB); + out_of_buffer_release(signal, 0); } void @@ -4738,7 +4736,8 @@ loop: Uint32 count; m_tup->allocConsPages(16, count, ref); - ndbrequire(count > 0); + if (count == 0) + return RNIL; ndbout_c("alloc_chunk(%d %d) - ", ref, count); diff --git a/storage/ndb/src/ndbapi/Ndb.cpp b/storage/ndb/src/ndbapi/Ndb.cpp index 0db20f723ea..c7c66ef4d09 100644 --- a/storage/ndb/src/ndbapi/Ndb.cpp +++ b/storage/ndb/src/ndbapi/Ndb.cpp @@ -1077,7 +1077,7 @@ Ndb::opTupleIdOnNdb(const NdbTableImpl* table, tOperation->incValue("NEXTID", opValue); tRecAttrResult = tOperation->getValue("NEXTID"); - if (tConnection->execute( Commit ) == -1 ) + if (tConnection->execute( NdbTransaction::Commit ) == -1 ) goto error_handler; tValue = tRecAttrResult->u_64_value(); @@ -1092,7 +1092,7 @@ Ndb::opTupleIdOnNdb(const NdbTableImpl* table, tOperation->equal("SYSKEY_0", aTableId ); tOperation->setValue("NEXTID", opValue); - if (tConnection->execute( Commit ) == -1 ) + if (tConnection->execute( NdbTransaction::Commit ) == -1 ) goto error_handler; range.reset(); @@ -1109,7 +1109,7 @@ Ndb::opTupleIdOnNdb(const NdbTableImpl* table, tOperation->def_label(0); tOperation->interpret_exit_nok(9999); - if (tConnection->execute( Commit ) == -1) + if (tConnection->execute( NdbTransaction::Commit ) == -1) { if (tConnection->theError.code != 9999) goto error_handler; @@ -1126,7 +1126,7 @@ Ndb::opTupleIdOnNdb(const NdbTableImpl* table, tOperation->readTuple(); tOperation->equal("SYSKEY_0", aTableId ); tRecAttrResult = tOperation->getValue("NEXTID"); - if (tConnection->execute( Commit ) == -1 ) + if (tConnection->execute( NdbTransaction::Commit ) == -1 ) goto error_handler; opValue = tRecAttrResult->u_64_value(); // out break; diff --git a/storage/ndb/src/ndbapi/NdbBlob.cpp b/storage/ndb/src/ndbapi/NdbBlob.cpp index 9ebc5fa9a81..ee3a1cfd66a 100644 --- a/storage/ndb/src/ndbapi/NdbBlob.cpp +++ b/storage/ndb/src/ndbapi/NdbBlob.cpp @@ -1133,7 +1133,7 @@ NdbBlob::readTableParts(char* buf, Uint32 part, Uint32 count) setErrorCode(tOp); DBUG_RETURN(-1); } - tOp->m_abortOption = NdbTransaction::AbortOnError; + tOp->m_abortOption = NdbOperation::AbortOnError; buf += thePartSize; n++; thePendingBlobOps |= (1 << NdbOperation::ReadRequest); @@ -1169,7 +1169,7 @@ NdbBlob::insertParts(const char* buf, Uint32 part, Uint32 count) setErrorCode(tOp); DBUG_RETURN(-1); } - tOp->m_abortOption = NdbTransaction::AbortOnError; + tOp->m_abortOption = NdbOperation::AbortOnError; buf += thePartSize; n++; thePendingBlobOps |= (1 << NdbOperation::InsertRequest); @@ -1193,7 +1193,7 @@ NdbBlob::updateParts(const char* buf, Uint32 part, Uint32 count) setErrorCode(tOp); DBUG_RETURN(-1); } - tOp->m_abortOption = NdbTransaction::AbortOnError; + tOp->m_abortOption = NdbOperation::AbortOnError; buf += thePartSize; n++; thePendingBlobOps |= (1 << NdbOperation::UpdateRequest); @@ -1216,7 +1216,7 @@ NdbBlob::deleteParts(Uint32 part, Uint32 count) setErrorCode(tOp); DBUG_RETURN(-1); } - tOp->m_abortOption = NdbTransaction::AbortOnError; + tOp->m_abortOption = NdbOperation::AbortOnError; n++; thePendingBlobOps |= (1 << NdbOperation::DeleteRequest); theNdbCon->thePendingBlobOps |= (1 << NdbOperation::DeleteRequest); @@ -1252,7 +1252,7 @@ NdbBlob::deletePartsUnknown(Uint32 part) setErrorCode(tOp); DBUG_RETURN(-1); } - tOp->m_abortOption= NdbTransaction::AO_IgnoreError; + tOp->m_abortOption= NdbOperation::AO_IgnoreError; n++; } DBUG_PRINT("info", ("bat=%u", bat)); @@ -1588,7 +1588,7 @@ NdbBlob::preExecute(NdbTransaction::ExecType anExecType, bool& batch) DBUG_RETURN(-1); } if (isWriteOp()) { - tOp->m_abortOption = NdbTransaction::AO_IgnoreError; + tOp->m_abortOption = NdbOperation::AO_IgnoreError; } theHeadInlineReadOp = tOp; // execute immediately @@ -1634,7 +1634,7 @@ NdbBlob::preExecute(NdbTransaction::ExecType anExecType, bool& batch) DBUG_RETURN(-1); } if (isWriteOp()) { - tOp->m_abortOption = NdbTransaction::AO_IgnoreError; + tOp->m_abortOption = NdbOperation::AO_IgnoreError; } theHeadInlineReadOp = tOp; // execute immediately @@ -1807,7 +1807,7 @@ NdbBlob::postExecute(NdbTransaction::ExecType anExecType) setErrorCode(NdbBlobImpl::ErrAbort); DBUG_RETURN(-1); } - tOp->m_abortOption = NdbTransaction::AbortOnError; + tOp->m_abortOption = NdbOperation::AbortOnError; DBUG_PRINT("info", ("added op to update head+inline")); } DBUG_RETURN(0); @@ -1837,7 +1837,7 @@ NdbBlob::preCommit() setErrorCode(NdbBlobImpl::ErrAbort); DBUG_RETURN(-1); } - tOp->m_abortOption = NdbTransaction::AbortOnError; + tOp->m_abortOption = NdbOperation::AbortOnError; DBUG_PRINT("info", ("added op to update head+inline")); } } diff --git a/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp b/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp index 828ba51bc21..7a0ceebe54a 100644 --- a/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp +++ b/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp @@ -1611,17 +1611,24 @@ NdbEventBuffer::insert_event(NdbEventOperationImpl* impl, Uint32 &oid_ref) { NdbEventOperationImpl *dropped_ev_op = m_dropped_ev_op; + DBUG_PRINT("info", ("gci: %u", data.gci)); do { do { - oid_ref = impl->m_oid; - insertDataL(impl, &data, ptr); + if (impl->m_node_bit_mask.get(0u)) + { + oid_ref = impl->m_oid; + insertDataL(impl, &data, ptr); + } NdbEventOperationImpl* blob_op = impl->theBlobOpList; while (blob_op != NULL) { - oid_ref = blob_op->m_oid; - insertDataL(blob_op, &data, ptr); + if (blob_op->m_node_bit_mask.get(0u)) + { + oid_ref = blob_op->m_oid; + insertDataL(blob_op, &data, ptr); + } blob_op = blob_op->m_next; } } while((impl = impl->m_next)); @@ -1806,6 +1813,7 @@ NdbEventBuffer::insertDataL(NdbEventOperationImpl *op, switch (operation) { case NdbDictionary::Event::_TE_NODE_FAILURE: + DBUG_ASSERT(op->m_node_bit_mask.get(0u) != 0); op->m_node_bit_mask.clear(SubTableData::getNdbdNodeId(ri)); DBUG_PRINT("info", ("_TE_NODE_FAILURE: m_ref_count: %u for op: %p id: %u", @@ -1821,29 +1829,23 @@ NdbEventBuffer::insertDataL(NdbEventOperationImpl *op, DBUG_RETURN_EVENT(0); break; case NdbDictionary::Event::_TE_CLUSTER_FAILURE: - if (op->m_node_bit_mask.get(0)) - { - op->m_node_bit_mask.clear(); - DBUG_ASSERT(op->m_ref_count > 0); - // remove kernel reference - // added in execute_nolock - op->m_ref_count--; - DBUG_PRINT("info", ("_TE_CLUSTER_FAILURE: m_ref_count: %u for op: %p", - op->m_ref_count, op)); - if (op->theMainOp) - { - DBUG_ASSERT(op->m_ref_count == 0); - DBUG_ASSERT(op->theMainOp->m_ref_count > 0); - // remove blob reference in main op - // added in execute_no_lock - op->theMainOp->m_ref_count--; - DBUG_PRINT("info", ("m_ref_count: %u for op: %p", - op->theMainOp->m_ref_count, op->theMainOp)); - } - } - else + DBUG_ASSERT(op->m_node_bit_mask.get(0u) != 0); + op->m_node_bit_mask.clear(); + DBUG_ASSERT(op->m_ref_count > 0); + // remove kernel reference + // added in execute_nolock + op->m_ref_count--; + DBUG_PRINT("info", ("_TE_CLUSTER_FAILURE: m_ref_count: %u for op: %p", + op->m_ref_count, op)); + if (op->theMainOp) { - DBUG_ASSERT(op->m_node_bit_mask.isclear() != 0); + DBUG_ASSERT(op->m_ref_count == 0); + DBUG_ASSERT(op->theMainOp->m_ref_count > 0); + // remove blob reference in main op + // added in execute_no_lock + op->theMainOp->m_ref_count--; + DBUG_PRINT("info", ("m_ref_count: %u for op: %p", + op->theMainOp->m_ref_count, op->theMainOp)); } break; case NdbDictionary::Event::_TE_STOP: diff --git a/storage/ndb/src/ndbapi/NdbIndexOperation.cpp b/storage/ndb/src/ndbapi/NdbIndexOperation.cpp index 0965338b325..fc19bd251d4 100644 --- a/storage/ndb/src/ndbapi/NdbIndexOperation.cpp +++ b/storage/ndb/src/ndbapi/NdbIndexOperation.cpp @@ -172,239 +172,6 @@ NdbIndexOperation::getIndex() const return m_theIndex; } -int -NdbIndexOperation::prepareSend(Uint32 aTC_ConnectPtr, Uint64 aTransactionId) -{ - Uint32 tTransId1, tTransId2; - Uint32 tReqInfo; - Uint32 tSignalCount = 0; - Uint32 tInterpretInd = theInterpretIndicator; - - theErrorLine = 0; - - if (tInterpretInd != 1) { - OperationType tOpType = theOperationType; - OperationStatus tStatus = theStatus; - if ((tOpType == UpdateRequest) || - (tOpType == InsertRequest) || - (tOpType == WriteRequest)) { - if (tStatus != SetValue) { - setErrorCodeAbort(4506); - return -1; - }//if - } else if ((tOpType == ReadRequest) || (tOpType == ReadExclusive) || - (tOpType == DeleteRequest)) { - if (tStatus != GetValue) { - setErrorCodeAbort(4506); - return -1; - }//if - } else { - setErrorCodeAbort(4507); - return -1; - }//if - } else { - if (prepareSendInterpreted() == -1) { - return -1; - }//if - }//if - -//------------------------------------------------------------- -// We start by filling in the first 8 unconditional words of the -// TCINDXREQ signal. -//------------------------------------------------------------- - TcKeyReq * tcKeyReq = - CAST_PTR(TcKeyReq, theTCREQ->getDataPtrSend()); - - Uint32 tTotalCurrAI_Len = theTotalCurrAI_Len; - Uint32 tIndexId = m_theIndex->m_id; - Uint32 tSchemaVersion = m_theIndex->m_version; - - tcKeyReq->apiConnectPtr = aTC_ConnectPtr; - tcKeyReq->senderData = ptr2int(); - tcKeyReq->attrLen = tTotalCurrAI_Len; - tcKeyReq->tableId = tIndexId; - tcKeyReq->tableSchemaVersion = tSchemaVersion; - - tTransId1 = (Uint32) aTransactionId; - tTransId2 = (Uint32) (aTransactionId >> 32); - -//------------------------------------------------------------- -// Simple is simple if simple or both start and commit is set. -//------------------------------------------------------------- -// Temporarily disable simple stuff - Uint8 tSimpleIndicator = 0; -// Uint8 tSimpleIndicator = theSimpleIndicator; - Uint8 tCommitIndicator = theCommitIndicator; - Uint8 tStartIndicator = theStartIndicator; -// if ((theNdbCon->theLastOpInList == this) && (theCommitIndicator == 0)) -// abort(); -// Temporarily disable simple stuff - Uint8 tSimpleAlt = 0; -// Uint8 tSimpleAlt = tStartIndicator & tCommitIndicator; - tSimpleIndicator = tSimpleIndicator | tSimpleAlt; - -//------------------------------------------------------------- -// Simple state is set if start and commit is set and it is -// a read request. Otherwise it is set to zero. -//------------------------------------------------------------- - Uint8 tReadInd = (theOperationType == ReadRequest); - Uint8 tSimpleState = tReadInd & tSimpleAlt; - //theNdbCon->theSimpleState = tSimpleState; - - tcKeyReq->transId1 = tTransId1; - tcKeyReq->transId2 = tTransId2; - - tReqInfo = 0; - - if (tTotalCurrAI_Len <= TcKeyReq::MaxAttrInfo) { - tcKeyReq->setAIInTcKeyReq(tReqInfo, tTotalCurrAI_Len); - } else { - tcKeyReq->setAIInTcKeyReq(tReqInfo, TcKeyReq::MaxAttrInfo); - }//if - - tcKeyReq->setSimpleFlag(tReqInfo, tSimpleIndicator); - tcKeyReq->setCommitFlag(tReqInfo, tCommitIndicator); - tcKeyReq->setStartFlag(tReqInfo, tStartIndicator); - const Uint8 tInterpretIndicator = theInterpretIndicator; - tcKeyReq->setInterpretedFlag(tReqInfo, tInterpretIndicator); - - Uint8 tDirtyIndicator = theDirtyIndicator; - OperationType tOperationType = theOperationType; - Uint32 tIndexLen = theTupKeyLen; - Uint8 abortOption = theNdbCon->m_abortOption; - - tcKeyReq->setDirtyFlag(tReqInfo, tDirtyIndicator); - tcKeyReq->setOperationType(tReqInfo, tOperationType); - tcKeyReq->setKeyLength(tReqInfo, tIndexLen); - tcKeyReq->setAbortOption(tReqInfo, abortOption); - - Uint8 tDistrKeyIndicator = theDistrKeyIndicator_; - Uint8 tScanIndicator = theScanInfo & 1; - - tcKeyReq->setDistributionKeyFlag(tReqInfo, tDistrKeyIndicator); - tcKeyReq->setScanIndFlag(tReqInfo, tScanIndicator); - - tcKeyReq->requestInfo = tReqInfo; - -//------------------------------------------------------------- -// The next step is to fill in the upto three conditional words. -//------------------------------------------------------------- - Uint32* tOptionalDataPtr = &tcKeyReq->scanInfo; - Uint32 tDistrGHIndex = tScanIndicator; - Uint32 tDistrKeyIndex = tDistrGHIndex; - - Uint32 tScanInfo = theScanInfo; - Uint32 tDistrKey = theDistributionKey; - - tOptionalDataPtr[0] = tScanInfo; - tOptionalDataPtr[tDistrKeyIndex] = tDistrKey; - -//------------------------------------------------------------- -// The next is step is to compress the key data part of the -// TCKEYREQ signal. -//------------------------------------------------------------- - Uint32 tKeyIndex = tDistrKeyIndex + tDistrKeyIndicator; - Uint32* tKeyDataPtr = &tOptionalDataPtr[tKeyIndex]; - Uint32 Tdata1 = tcKeyReq->keyInfo[0]; - Uint32 Tdata2 = tcKeyReq->keyInfo[1]; - Uint32 Tdata3 = tcKeyReq->keyInfo[2]; - Uint32 Tdata4 = tcKeyReq->keyInfo[3]; - Uint32 Tdata5; - - tKeyDataPtr[0] = Tdata1; - tKeyDataPtr[1] = Tdata2; - tKeyDataPtr[2] = Tdata3; - tKeyDataPtr[3] = Tdata4; - if (tIndexLen > 4) { - Tdata1 = tcKeyReq->keyInfo[4]; - Tdata2 = tcKeyReq->keyInfo[5]; - Tdata3 = tcKeyReq->keyInfo[6]; - Tdata4 = tcKeyReq->keyInfo[7]; - - tKeyDataPtr[4] = Tdata1; - tKeyDataPtr[5] = Tdata2; - tKeyDataPtr[6] = Tdata3; - tKeyDataPtr[7] = Tdata4; - }//if -//------------------------------------------------------------- -// Finally we also compress the INDXATTRINFO part of the signal. -// We optimise by using the if-statement for sending INDXKEYINFO -// signals to calculating the new Attrinfo Index. -//------------------------------------------------------------- - Uint32 tAttrInfoIndex; - - if (tIndexLen > TcKeyReq::MaxKeyInfo) { - /** - * Set transid and TC connect ptr in the INDXKEYINFO signals - */ - NdbApiSignal* tSignal = theTCREQ->next(); - Uint32 remainingKey = tIndexLen - TcKeyReq::MaxKeyInfo; - - do { - Uint32* tSigDataPtr = tSignal->getDataPtrSend(); - NdbApiSignal* tnextSignal = tSignal->next(); - tSignalCount++; - tSigDataPtr[0] = aTC_ConnectPtr; - tSigDataPtr[1] = tTransId1; - tSigDataPtr[2] = tTransId2; - if (remainingKey > IndxKeyInfo::DataLength) { - // The signal is full - tSignal->setLength(IndxKeyInfo::MaxSignalLength); - remainingKey -= IndxKeyInfo::DataLength; - } - else { - // Last signal - tSignal->setLength(IndxKeyInfo::HeaderLength + remainingKey); - remainingKey = 0; - } - tSignal = tnextSignal; - } while (tSignal != NULL); - tAttrInfoIndex = tKeyIndex + TcKeyReq::MaxKeyInfo; - } else { - tAttrInfoIndex = tKeyIndex + tIndexLen; - }//if - -//------------------------------------------------------------- -// Perform the Attrinfo packing in the TCKEYREQ signal started -// above. -//------------------------------------------------------------- - Uint32* tAIDataPtr = &tOptionalDataPtr[tAttrInfoIndex]; - Tdata1 = tcKeyReq->attrInfo[0]; - Tdata2 = tcKeyReq->attrInfo[1]; - Tdata3 = tcKeyReq->attrInfo[2]; - Tdata4 = tcKeyReq->attrInfo[3]; - Tdata5 = tcKeyReq->attrInfo[4]; - - theTCREQ->setLength(tcKeyReq->getAIInTcKeyReq(tReqInfo) + - tAttrInfoIndex + TcKeyReq::StaticLength); - tAIDataPtr[0] = Tdata1; - tAIDataPtr[1] = Tdata2; - tAIDataPtr[2] = Tdata3; - tAIDataPtr[3] = Tdata4; - tAIDataPtr[4] = Tdata5; - -/*************************************************** -* Send the INDXATTRINFO signals. -***************************************************/ - if (tTotalCurrAI_Len > 5) { - // Set the last signal's length. - NdbApiSignal* tSignal = theFirstATTRINFO; - theCurrentATTRINFO->setLength(theAI_LenInCurrAI); - do { - Uint32* tSigDataPtr = tSignal->getDataPtrSend(); - NdbApiSignal* tnextSignal = tSignal->next(); - tSignalCount++; - tSigDataPtr[0] = aTC_ConnectPtr; - tSigDataPtr[1] = tTransId1; - tSigDataPtr[2] = tTransId2; - tSignal = tnextSignal; - } while (tSignal != NULL); - }//if - theStatus = WaitResponse; - theReceiver.prepareSend(); - return 0; -} - /*************************************************************************** int receiveTCINDXREF( NdbApiSignal* aSignal) diff --git a/storage/ndb/src/ndbapi/NdbIndexStat.cpp b/storage/ndb/src/ndbapi/NdbIndexStat.cpp index f95dcfb994c..abb399c77e7 100644 --- a/storage/ndb/src/ndbapi/NdbIndexStat.cpp +++ b/storage/ndb/src/ndbapi/NdbIndexStat.cpp @@ -427,7 +427,7 @@ NdbIndexStat::records_in_range(const NdbDictionary::Index* index, NdbIndexScanOp DBUG_RETURN(-1); } if (trans->execute(NdbTransaction::NoCommit, - NdbTransaction::AbortOnError, forceSend) == -1) { + NdbOperation::AbortOnError, forceSend) == -1) { m_error = trans->getNdbError(); DBUG_PRINT("error", ("trans:%d op:%d", trans->getNdbError().code, op->getNdbError().code)); diff --git a/storage/ndb/src/ndbapi/NdbOperationDefine.cpp b/storage/ndb/src/ndbapi/NdbOperationDefine.cpp index ba26831749d..b39e76b45e1 100644 --- a/storage/ndb/src/ndbapi/NdbOperationDefine.cpp +++ b/storage/ndb/src/ndbapi/NdbOperationDefine.cpp @@ -44,6 +44,7 @@ NdbOperation::insertTuple() tNdbCon->theSimpleState = 0; theErrorLine = tErrorLine++; theLockMode = LM_Exclusive; + m_abortOption = AbortOnError; return 0; } else { setErrorCode(4200); @@ -64,6 +65,7 @@ NdbOperation::updateTuple() theOperationType = UpdateRequest; theErrorLine = tErrorLine++; theLockMode = LM_Exclusive; + m_abortOption = AbortOnError; return 0; } else { setErrorCode(4200); @@ -84,12 +86,35 @@ NdbOperation::writeTuple() theOperationType = WriteRequest; theErrorLine = tErrorLine++; theLockMode = LM_Exclusive; + m_abortOption = AbortOnError; return 0; } else { setErrorCode(4200); return -1; }//if }//NdbOperation::writeTuple() +/***************************************************************************** + * int deleteTuple(); + *****************************************************************************/ +int +NdbOperation::deleteTuple() +{ + NdbTransaction* tNdbCon = theNdbCon; + int tErrorLine = theErrorLine; + if (theStatus == Init) { + theStatus = OperationDefined; + tNdbCon->theSimpleState = 0; + theOperationType = DeleteRequest; + theErrorLine = tErrorLine++; + theLockMode = LM_Exclusive; + m_abortOption = AbortOnError; + return 0; + } else { + setErrorCode(4200); + return -1; + }//if +}//NdbOperation::deleteTuple() + /****************************************************************************** * int readTuple(); *****************************************************************************/ @@ -124,6 +149,7 @@ NdbOperation::readTuple() theOperationType = ReadRequest; theErrorLine = tErrorLine++; theLockMode = LM_Read; + m_abortOption = AO_IgnoreError; return 0; } else { setErrorCode(4200); @@ -131,27 +157,6 @@ NdbOperation::readTuple() }//if }//NdbOperation::readTuple() -/***************************************************************************** - * int deleteTuple(); - *****************************************************************************/ -int -NdbOperation::deleteTuple() -{ - NdbTransaction* tNdbCon = theNdbCon; - int tErrorLine = theErrorLine; - if (theStatus == Init) { - theStatus = OperationDefined; - tNdbCon->theSimpleState = 0; - theOperationType = DeleteRequest; - theErrorLine = tErrorLine++; - theLockMode = LM_Exclusive; - return 0; - } else { - setErrorCode(4200); - return -1; - }//if -}//NdbOperation::deleteTuple() - /****************************************************************************** * int readTupleExclusive(); *****************************************************************************/ @@ -166,6 +171,7 @@ NdbOperation::readTupleExclusive() theOperationType = ReadExclusive; theErrorLine = tErrorLine++; theLockMode = LM_Exclusive; + m_abortOption = AO_IgnoreError; return 0; } else { setErrorCode(4200); @@ -222,6 +228,7 @@ NdbOperation::committedRead() theDirtyIndicator = 1; theErrorLine = tErrorLine++; theLockMode = LM_CommittedRead; + m_abortOption = AO_IgnoreError; return 0; } else { setErrorCode(4200); @@ -245,6 +252,7 @@ NdbOperation::dirtyUpdate() theDirtyIndicator = 1; theErrorLine = tErrorLine++; theLockMode = LM_CommittedRead; + m_abortOption = AbortOnError; return 0; } else { setErrorCode(4200); @@ -268,6 +276,7 @@ NdbOperation::dirtyWrite() theDirtyIndicator = 1; theErrorLine = tErrorLine++; theLockMode = LM_CommittedRead; + m_abortOption = AbortOnError; return 0; } else { setErrorCode(4200); @@ -290,6 +299,7 @@ NdbOperation::interpretedUpdateTuple() theAI_LenInCurrAI = 25; theLockMode = LM_Exclusive; theErrorLine = tErrorLine++; + m_abortOption = AbortOnError; initInterpreter(); return 0; } else { @@ -314,6 +324,7 @@ NdbOperation::interpretedDeleteTuple() theErrorLine = tErrorLine++; theAI_LenInCurrAI = 25; theLockMode = LM_Exclusive; + m_abortOption = AbortOnError; initInterpreter(); return 0; } else { diff --git a/storage/ndb/src/ndbapi/NdbOperationExec.cpp b/storage/ndb/src/ndbapi/NdbOperationExec.cpp index 80f388605b0..ba1905760c3 100644 --- a/storage/ndb/src/ndbapi/NdbOperationExec.cpp +++ b/storage/ndb/src/ndbapi/NdbOperationExec.cpp @@ -99,7 +99,9 @@ Parameters: aTC_ConnectPtr: the Connect pointer to TC. Remark: Puts the the data into TCKEYREQ signal and optional KEYINFO and ATTRINFO signals. ***************************************************************************/ int -NdbOperation::prepareSend(Uint32 aTC_ConnectPtr, Uint64 aTransId) +NdbOperation::prepareSend(Uint32 aTC_ConnectPtr, + Uint64 aTransId, + AbortOption ao) { Uint32 tTransId1, tTransId2; Uint32 tReqInfo; @@ -147,8 +149,8 @@ NdbOperation::prepareSend(Uint32 aTC_ConnectPtr, Uint64 aTransId) //------------------------------------------------------------- TcKeyReq * const tcKeyReq = CAST_PTR(TcKeyReq, theTCREQ->getDataPtrSend()); - Uint32 tTableId = m_currentTable->m_id; - Uint32 tSchemaVersion = m_currentTable->m_version; + Uint32 tTableId = m_accessTable->m_id; + Uint32 tSchemaVersion = m_accessTable->m_version; tcKeyReq->apiConnectPtr = aTC_ConnectPtr; tcKeyReq->apiOperationPtr = ptr2int(); @@ -198,16 +200,16 @@ NdbOperation::prepareSend(Uint32 aTC_ConnectPtr, Uint64 aTransId) OperationType tOperationType = theOperationType; Uint32 tTupKeyLen = theTupKeyLen; - Uint8 abortOption = - m_abortOption != -1 ? m_abortOption : theNdbCon->m_abortOption; + Uint8 abortOption = (ao == DefaultAbortOption) ? m_abortOption : ao; tcKeyReq->setDirtyFlag(tReqInfo, tDirtyIndicator); tcKeyReq->setOperationType(tReqInfo, tOperationType); tcKeyReq->setKeyLength(tReqInfo, tTupKeyLen); // A simple read is always ignore error - abortOption = tSimpleIndicator ? (Uint8) AO_IgnoreError : abortOption; + abortOption = tSimpleState ? AO_IgnoreError : abortOption; tcKeyReq->setAbortOption(tReqInfo, abortOption); + m_abortOption = abortOption; Uint8 tDistrKeyIndicator = theDistrKeyIndicator_; Uint8 tScanIndicator = theScanInfo & 1; @@ -543,21 +545,16 @@ NdbOperation::receiveTCKEYREF( NdbApiSignal* aSignal) return -1; }//if - AbortOption ao = (AbortOption) - (m_abortOption != -1 ? m_abortOption : theNdbCon->m_abortOption); + setErrorCode(aSignal->readData(4)); + theStatus = Finished; theReceiver.m_received_result_length = ~0; - theStatus = Finished; - // blobs want this - if (m_abortOption != AO_IgnoreError) + // not simple read + if(! (theOperationType == ReadRequest && theSimpleIndicator)) { - theNdbCon->theReturnStatus = NdbTransaction::ReturnFailure; + theNdbCon->OpCompleteFailure(this); + return -1; } - theError.code = aSignal->readData(4); - theNdbCon->setOperationErrorCodeAbort(aSignal->readData(4), ao); - - if(theOperationType != ReadRequest || !theSimpleIndicator) // not simple read - return theNdbCon->OpCompleteFailure(ao, m_abortOption != AO_IgnoreError); /** * If TCKEYCONF has arrived @@ -565,23 +562,8 @@ NdbOperation::receiveTCKEYREF( NdbApiSignal* aSignal) */ if(theReceiver.m_expected_result_length) { - return theNdbCon->OpCompleteFailure(AbortOnError); + return theNdbCon->OpCompleteFailure(this); } return -1; } - - -void -NdbOperation::handleFailedAI_ElemLen() -{ - NdbRecAttr* tRecAttr = theReceiver.theFirstRecAttr; - while (tRecAttr != NULL) { - tRecAttr->setNULL(); - tRecAttr = tRecAttr->next(); - }//while -}//NdbOperation::handleFailedAI_ElemLen() - - - - diff --git a/storage/ndb/src/ndbapi/NdbScanOperation.cpp b/storage/ndb/src/ndbapi/NdbScanOperation.cpp index 6e867df47a2..a4a61269a0b 100644 --- a/storage/ndb/src/ndbapi/NdbScanOperation.cpp +++ b/storage/ndb/src/ndbapi/NdbScanOperation.cpp @@ -995,6 +995,7 @@ NdbScanOperation::takeOverScanOp(OperationType opType, NdbTransaction* pTrans) newOp->theTupKeyLen = len; newOp->theOperationType = opType; + newOp->m_abortOption = AbortOnError; switch (opType) { case (ReadRequest): newOp->theLockMode = theLockMode; diff --git a/storage/ndb/src/ndbapi/NdbTransaction.cpp b/storage/ndb/src/ndbapi/NdbTransaction.cpp index 5e3738823d3..9d337c05fd9 100644 --- a/storage/ndb/src/ndbapi/NdbTransaction.cpp +++ b/storage/ndb/src/ndbapi/NdbTransaction.cpp @@ -56,7 +56,6 @@ NdbTransaction::NdbTransaction( Ndb* aNdb ) : theCompletedLastOp(NULL), theNoOfOpSent(0), theNoOfOpCompleted(0), - theNoOfOpFetched(0), theMyRef(0), theTCConPtr(0), theTransactionId(0), @@ -131,7 +130,6 @@ NdbTransaction::init() theNdb->theImpl->m_ndb_cluster_connection.get_latest_trans_gci(); theCommitStatus = Started; theCompletionStatus = NotCompleted; - m_abortOption = AbortOnError; theError.code = 0; theErrorLine = 0; @@ -176,12 +174,9 @@ void NdbTransaction::setOperationErrorCodeAbort(int error, int abortOption) { DBUG_ENTER("NdbTransaction::setOperationErrorCodeAbort"); - if (abortOption == -1) - abortOption = m_abortOption; if (theTransactionIsStarted == false) { theCommitStatus = Aborted; - } else if ((abortOption == AbortOnError) && - (theCommitStatus != Committed) && + } else if ((theCommitStatus != Committed) && (theCommitStatus != Aborted)) { theCommitStatus = NeedAbort; }//if @@ -263,8 +258,8 @@ Remark: Initialise connection object for new transaction. *****************************************************************************/ int NdbTransaction::execute(ExecType aTypeOfExec, - AbortOption abortOption, - int forceSend) + NdbOperation::AbortOption abortOption, + int forceSend) { NdbError savedError= theError; DBUG_ENTER("NdbTransaction::execute"); @@ -354,40 +349,14 @@ NdbTransaction::execute(ExecType aTypeOfExec, theCompletedLastOp = NULL; } - if (executeNoBlobs(tExecType, abortOption, forceSend) == -1) + if (executeNoBlobs(tExecType, + NdbOperation::DefaultAbortOption, + forceSend) == -1) { - ret = -1; if(savedError.code==0) savedError= theError; - /** - * If AO_IgnoreError, error codes arent always set on individual - * operations, making postExecute impossible - */ - if (abortOption == AO_IgnoreError) - { - if (theCompletedFirstOp != NULL) - { - if (tCompletedFirstOp != NULL) - { - tCompletedLastOp->next(theCompletedFirstOp); - theCompletedFirstOp = tCompletedFirstOp; - } - } - else - { - theCompletedFirstOp = tCompletedFirstOp; - theCompletedLastOp = tCompletedLastOp; - } - if (tPrepOp != NULL && tRestOp != NULL) { - if (theFirstOpInList == NULL) - theFirstOpInList = tRestOp; - else - theLastOpInList->next(tRestOp); - theLastOpInList = tLastOp; - } - DBUG_RETURN(-1); - } + DBUG_RETURN(-1); } #ifdef ndb_api_crash_on_complex_blob_abort @@ -447,9 +416,9 @@ NdbTransaction::execute(ExecType aTypeOfExec, } int -NdbTransaction::executeNoBlobs(ExecType aTypeOfExec, - AbortOption abortOption, - int forceSend) +NdbTransaction::executeNoBlobs(NdbTransaction::ExecType aTypeOfExec, + NdbOperation::AbortOption abortOption, + int forceSend) { DBUG_ENTER("NdbTransaction::executeNoBlobs"); DBUG_PRINT("enter", ("aTypeOfExec: %d, abortOption: %d", @@ -527,10 +496,10 @@ Parameters : aTypeOfExec: Type of execute. Remark: Prepare a part of a transaction in an asynchronous manner. *****************************************************************************/ void -NdbTransaction::executeAsynchPrepare( ExecType aTypeOfExec, +NdbTransaction::executeAsynchPrepare(NdbTransaction::ExecType aTypeOfExec, NdbAsynchCallback aCallback, void* anyObject, - AbortOption abortOption) + NdbOperation::AbortOption abortOption) { DBUG_ENTER("NdbTransaction::executeAsynchPrepare"); DBUG_PRINT("enter", ("aTypeOfExec: %d, aCallback: 0x%lx, anyObject: Ox%lx", @@ -570,7 +539,6 @@ NdbTransaction::executeAsynchPrepare( ExecType aTypeOfExec, theReturnStatus = ReturnSuccess; theCallbackFunction = aCallback; theCallbackObject = anyObject; - m_abortOption = abortOption; m_waitForReply = true; tNdb->thePreparedTransactionsArray[tnoOfPreparedTransactions] = this; theTransArrayIndex = tnoOfPreparedTransactions; @@ -665,8 +633,7 @@ NdbTransaction::executeAsynchPrepare( ExecType aTypeOfExec, while (tOp) { int tReturnCode; NdbOperation* tNextOp = tOp->next(); - - tReturnCode = tOp->prepareSend(theTCConPtr, theTransactionId); + tReturnCode = tOp->prepareSend(theTCConPtr, theTransactionId, abortOption); if (tReturnCode == -1) { theSendStatus = sendABORTfail; DBUG_VOID_RETURN; @@ -1799,14 +1766,8 @@ from other transactions. } } else if ((tNoComp >= tNoSent) && (theLastExecOpInList->theCommitIndicator == 1)){ - - - if (m_abortOption == AO_IgnoreError && theError.code != 0){ - /** - * There's always a TCKEYCONF when using IgnoreError - */ - return -1; - } + + /**********************************************************************/ // We sent the transaction with Commit flag set and received a CONF with // no Commit flag set. This is clearly an anomaly. @@ -1980,13 +1941,6 @@ NdbTransaction::receiveTCINDXCONF(const TcIndxConf * indxConf, } else if ((tNoComp >= tNoSent) && (theLastExecOpInList->theCommitIndicator == 1)){ - if (m_abortOption == AO_IgnoreError && theError.code != 0){ - /** - * There's always a TCKEYCONF when using IgnoreError - */ - return -1; - } - /**********************************************************************/ // We sent the transaction with Commit flag set and received a CONF with // no Commit flag set. This is clearly an anomaly. @@ -2010,41 +1964,6 @@ NdbTransaction::receiveTCINDXCONF(const TcIndxConf * indxConf, return -1; }//NdbTransaction::receiveTCINDXCONF() -/***************************************************************************** -int receiveTCINDXREF( NdbApiSignal* aSignal) - -Return Value: Return 0 : send was succesful. - Return -1: In all other case. -Parameters: aSignal: the signal object that contains the - TCINDXREF signal from TC. -Remark: Handles the reception of the TCINDXREF signal. -*****************************************************************************/ -int -NdbTransaction::receiveTCINDXREF( NdbApiSignal* aSignal) -{ - if(checkState_TransId(aSignal->getDataPtr()+1)){ - theError.code = aSignal->readData(4); // Override any previous errors - - /**********************************************************************/ - /* A serious error has occured. This could be due to deadlock or */ - /* lack of resources or simply a programming error in NDB. This */ - /* transaction will be aborted. Actually it has already been */ - /* and we only need to report completion and return with the */ - /* error code to the application. */ - /**********************************************************************/ - theCompletionStatus = NdbTransaction::CompletedFailure; - theCommitStatus = NdbTransaction::Aborted; - theReturnStatus = NdbTransaction::ReturnFailure; - return 0; - } else { -#ifdef NDB_NO_DROPPED_SIGNAL - abort(); -#endif - } - - return -1; -}//NdbTransaction::receiveTCINDXREF() - /******************************************************************************* int OpCompletedFailure(); @@ -2054,36 +1973,15 @@ Parameters: aErrorCode: The error code. Remark: An operation was completed with failure. *******************************************************************************/ int -NdbTransaction::OpCompleteFailure(Uint8 abortOption, bool setFailure) +NdbTransaction::OpCompleteFailure(NdbOperation* op) { Uint32 tNoComp = theNoOfOpCompleted; Uint32 tNoSent = theNoOfOpSent; - if (setFailure) - theCompletionStatus = NdbTransaction::CompletedFailure; + tNoComp++; theNoOfOpCompleted = tNoComp; - if (tNoComp == tNoSent) { - //------------------------------------------------------------------------ - //If the transaction consists of only simple reads we can set - //Commit state Aborted. Otherwise this simple operation cannot - //decide the success of the whole transaction since a simple - //operation is not really part of that transaction. - //------------------------------------------------------------------------ - if (abortOption == AO_IgnoreError){ - /** - * There's always a TCKEYCONF when using IgnoreError - */ - return -1; - } - - return 0; // Last operation received - } else if (tNoComp > tNoSent) { - setOperationErrorCodeAbort(4113); // Too many operations, - // stop waiting for more - return 0; - } else { - return -1; // Continue waiting for more signals - }//if + + return (tNoComp == tNoSent) ? 0 : -1; }//NdbTransaction::OpCompleteFailure() /****************************************************************************** diff --git a/storage/ndb/test/include/HugoOperations.hpp b/storage/ndb/test/include/HugoOperations.hpp index b5014380eec..3147ee57d4d 100644 --- a/storage/ndb/test/include/HugoOperations.hpp +++ b/storage/ndb/test/include/HugoOperations.hpp @@ -106,8 +106,8 @@ public: NDBT_ResultRow& get_row(Uint32 idx) { return *rows[idx];} - int execute_async(Ndb*, NdbTransaction::ExecType, NdbTransaction::AbortOption = NdbTransaction::AbortOnError); - int execute_async_prepare(Ndb*, NdbTransaction::ExecType, NdbTransaction::AbortOption = NdbTransaction::AbortOnError); + int execute_async(Ndb*, NdbTransaction::ExecType, NdbOperation::AbortOption = NdbOperation::AbortOnError); + int execute_async_prepare(Ndb*, NdbTransaction::ExecType, NdbOperation::AbortOption = NdbOperation::AbortOnError); int wait_async(Ndb*, int timeout = -1); diff --git a/storage/ndb/test/ndbapi/testBasic.cpp b/storage/ndb/test/ndbapi/testBasic.cpp index e8e4548a91c..83c2628f8b0 100644 --- a/storage/ndb/test/ndbapi/testBasic.cpp +++ b/storage/ndb/test/ndbapi/testBasic.cpp @@ -1272,6 +1272,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" @@ -1542,6 +1588,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/ndbapi/testBlobs.cpp b/storage/ndb/test/ndbapi/testBlobs.cpp index 81072f6a12a..5d2552220f9 100644 --- a/storage/ndb/test/ndbapi/testBlobs.cpp +++ b/storage/ndb/test/ndbapi/testBlobs.cpp @@ -734,7 +734,7 @@ verifyHeadInline(const Tup& tup) if (! g_opt.m_oneblob) CHK((ra2 = g_opr->getValue("BL2")) != 0); if (tup.m_exists) { - CHK(g_con->execute(Commit) == 0); + CHK(g_con->execute(Commit, AbortOnError) == 0); DBG("verifyHeadInline BL1"); CHK(verifyHeadInline(g_opt.m_blob1, tup.m_blob1, ra1) == 0); if (! g_opt.m_oneblob) { @@ -742,7 +742,8 @@ verifyHeadInline(const Tup& tup) CHK(verifyHeadInline(g_opt.m_blob2, tup.m_blob2, ra2) == 0); } } else { - CHK(g_con->execute(Commit) == -1 && g_con->getNdbError().code == 626); + CHK(g_con->execute(Commit, AbortOnError) == -1 && + g_con->getNdbError().code == 626); } g_ndb->closeTransaction(g_con); g_opr = 0; @@ -1534,7 +1535,7 @@ testperf() g_dic = g_ndb->getDictionary(); NdbDictionary::Table tab(g_opt.m_tnameperf); if (g_dic->getTable(tab.getName()) != 0) - CHK(g_dic->dropTable(tab) == 0); + CHK(g_dic->dropTable(tab.getName()) == 0); // col A - pk { NdbDictionary::Column col("A"); col.setType(NdbDictionary::Column::Unsigned); diff --git a/storage/ndb/test/ndbapi/testNdbApi.cpp b/storage/ndb/test/ndbapi/testNdbApi.cpp index 39a9c7656c0..a7d3c3d0792 100644 --- a/storage/ndb/test/ndbapi/testNdbApi.cpp +++ b/storage/ndb/test/ndbapi/testNdbApi.cpp @@ -1249,6 +1249,274 @@ int runScan_4006(NDBT_Context* ctx, NDBT_Step* step){ return result; } +char pkIdxName[255]; + +int createPkIndex(NDBT_Context* ctx, NDBT_Step* step){ + bool orderedIndex = ctx->getProperty("OrderedIndex", (unsigned)0); + + const NdbDictionary::Table* pTab = ctx->getTab(); + Ndb* pNdb = GETNDB(step); + + bool logged = ctx->getProperty("LoggedIndexes", 1); + + // Create index + BaseString::snprintf(pkIdxName, 255, "IDC_PK_%s", pTab->getName()); + if (orderedIndex) + ndbout << "Creating " << ((logged)?"logged ": "temporary ") << "ordered index " + << pkIdxName << " ("; + else + ndbout << "Creating " << ((logged)?"logged ": "temporary ") << "unique index " + << pkIdxName << " ("; + + NdbDictionary::Index pIdx(pkIdxName); + pIdx.setTable(pTab->getName()); + if (orderedIndex) + pIdx.setType(NdbDictionary::Index::OrderedIndex); + else + pIdx.setType(NdbDictionary::Index::UniqueHashIndex); + for (int c = 0; c< pTab->getNoOfColumns(); c++){ + const NdbDictionary::Column * col = pTab->getColumn(c); + if(col->getPrimaryKey()){ + pIdx.addIndexColumn(col->getName()); + ndbout << col->getName() <<" "; + } + } + + pIdx.setStoredIndex(logged); + ndbout << ") "; + if (pNdb->getDictionary()->createIndex(pIdx) != 0){ + ndbout << "FAILED!" << endl; + const NdbError err = pNdb->getDictionary()->getNdbError(); + ERR(err); + return NDBT_FAILED; + } + + ndbout << "OK!" << endl; + return NDBT_OK; +} + +int createPkIndex_Drop(NDBT_Context* ctx, NDBT_Step* step){ + const NdbDictionary::Table* pTab = ctx->getTab(); + Ndb* pNdb = GETNDB(step); + + // Drop index + ndbout << "Dropping index " << pkIdxName << " "; + if (pNdb->getDictionary()->dropIndex(pkIdxName, + pTab->getName()) != 0){ + ndbout << "FAILED!" << endl; + ERR(pNdb->getDictionary()->getNdbError()); + return NDBT_FAILED; + } else { + ndbout << "OK!" << endl; + } + + return NDBT_OK; +} + +static +int +op_row(NdbTransaction* pTrans, HugoOperations& hugoOps, + const NdbDictionary::Table* pTab, int op, int row) +{ + NdbOperation * pOp = 0; + switch(op){ + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + pOp = pTrans->getNdbOperation(pTab->getName()); + break; + case 9: + return 0; + case 6: + case 7: + case 8: + case 10: + case 11: + pOp = pTrans->getNdbIndexOperation(pkIdxName, pTab->getName()); + default: + break; + } + + switch(op){ + case 0: + case 6: + pOp->readTuple(); + break; + case 1: + case 7: + pOp->committedRead(); + break; + case 2: + case 8: + pOp->readTupleExclusive(); + break; + case 3: + case 9: + pOp->insertTuple(); + break; + case 4: + case 10: + pOp->updateTuple(); + break; + case 5: + case 11: + pOp->deleteTuple(); + break; + default: + abort(); + } + + for(int a = 0; a<pTab->getNoOfColumns(); a++){ + if (pTab->getColumn(a)->getPrimaryKey() == true){ + if(hugoOps.equalForAttr(pOp, a, row) != 0){ + return NDBT_FAILED; + } + } + } + + switch(op){ + case 0: + case 1: + case 2: + case 6: + case 7: + case 8: + for(int a = 0; a<pTab->getNoOfColumns(); a++){ + pOp->getValue(a); + } + break; + case 3: + case 4: + case 10: + for(int a = 0; a<pTab->getNoOfColumns(); a++){ + if (pTab->getColumn(a)->getPrimaryKey() == false){ + if(hugoOps.setValueForAttr(pOp, a, row, 2) != 0){ + return NDBT_FAILED; + } + } + } + break; + case 5: + case 11: + pOp->deleteTuple(); + break; + case 9: + default: + abort(); + } + + return NDBT_OK; +} + +static void print(int op) +{ + const char * str = 0; + switch(op){ + case 0: str = "pk read-sh"; break; + case 1: str = "pk read-nl"; break; + case 2: str = "pk read-ex"; break; + case 3: str = "pk insert "; break; + case 4: str = "pk update "; break; + case 5: str = "pk delete "; break; + case 6: str = "uk read-sh"; break; + case 7: str = "uk read-nl"; break; + case 8: str = "uk read-ex"; break; + case 9: str = "noop "; break; + case 10: str = "uk update "; break; + case 11: str = "uk delete "; break; + default: + abort(); + } + printf("%s ", str); +} + +int +runTestIgnoreError(NDBT_Context* ctx, NDBT_Step* step) +{ + int result = NDBT_OK; + Uint32 loops = ctx->getNumRecords(); + const NdbDictionary::Table* pTab = ctx->getTab(); + + HugoOperations hugoOps(*pTab); + HugoTransactions hugoTrans(*pTab); + + Ndb* pNdb = GETNDB(step); + + struct { + ExecType et; + AbortOption ao; + } tests[] = { + { Commit, AbortOnError }, + { Commit, AO_IgnoreError }, + { NoCommit, AbortOnError }, + { NoCommit, AO_IgnoreError }, + }; + + printf("case: <op1> <op2> c/nc ao/ie\n"); + Uint32 tno = 0; + for (Uint32 op1 = 0; op1 < 12; op1++) + { + for (Uint32 op2 = op1; op2 < 12; op2++) + { + int ret; + NdbTransaction* pTrans = 0; + + for (Uint32 i = 0; i<4; i++, tno++) + { + if (loops != 1000 && loops != tno) + continue; + ExecType et = tests[i].et; + AbortOption ao = tests[i].ao; + + printf("%.3d : ", tno); + print(op1); + print(op2); + switch(et){ + case Commit: printf("c "); break; + case NoCommit: printf("nc "); break; + } + switch(ao){ + case AbortOnError: printf("aoe "); break; + case AO_IgnoreError: printf("ie "); break; + } + printf(": "); + + + hugoTrans.loadTable(pNdb, 1); + pTrans = pNdb->startTransaction(); + op_row(pTrans, hugoOps, pTab, op1, 0); + ret = pTrans->execute(et, ao); + pTrans->close(); + printf("%d ", ret); + hugoTrans.clearTable(pNdb); + + hugoTrans.loadTable(pNdb, 1); + pTrans = pNdb->startTransaction(); + op_row(pTrans, hugoOps, pTab, op1, 1); + ret = pTrans->execute(et, ao); + pTrans->close(); + printf("%d ", ret); + hugoTrans.clearTable(pNdb); + + hugoTrans.loadTable(pNdb, 1); + pTrans = pNdb->startTransaction(); + op_row(pTrans, hugoOps, pTab, op1, 0); + op_row(pTrans, hugoOps, pTab, op2, 1); + ret = pTrans->execute(et, ao); + pTrans->close(); + printf("%d\n", ret); + hugoTrans.clearTable(pNdb); + + hugoTrans.clearTable(pNdb); + } + } + } + return NDBT_OK; +} + template class Vector<NdbScanOperation*>; @@ -1342,6 +1610,12 @@ TESTCASE("Scan_4006", INITIALIZER(runScan_4006); FINALIZER(runClearTable); } +TESTCASE("IgnoreError", ""){ + INITIALIZER(createPkIndex); + STEP(runTestIgnoreError); + FINALIZER(runClearTable); + FINALIZER(createPkIndex_Drop); +} NDBT_TESTSUITE_END(testNdbApi); int main(int argc, const char** argv){ 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 diff --git a/storage/ndb/test/src/HugoOperations.cpp b/storage/ndb/test/src/HugoOperations.cpp index 50234cea351..188e7a9288e 100644 --- a/storage/ndb/test/src/HugoOperations.cpp +++ b/storage/ndb/test/src/HugoOperations.cpp @@ -457,7 +457,7 @@ HugoOperations::callback(int res, NdbTransaction* pCon) int HugoOperations::execute_async(Ndb* pNdb, NdbTransaction::ExecType et, - NdbTransaction::AbortOption eao){ + NdbOperation::AbortOption eao){ m_async_reply= 0; pTrans->executeAsynchPrepare(et, @@ -472,7 +472,7 @@ HugoOperations::execute_async(Ndb* pNdb, NdbTransaction::ExecType et, int HugoOperations::execute_async_prepare(Ndb* pNdb, NdbTransaction::ExecType et, - NdbTransaction::AbortOption eao){ + NdbOperation::AbortOption eao){ m_async_reply= 0; pTrans->executeAsynchPrepare(et, |