diff options
-rw-r--r-- | ndb/include/ndbapi/NdbConnection.hpp | 2 | ||||
-rw-r--r-- | ndb/test/include/HugoOperations.hpp | 2 | ||||
-rw-r--r-- | ndb/test/ndbapi/testOperations.cpp | 240 | ||||
-rw-r--r-- | ndb/test/src/HugoOperations.cpp | 7 | ||||
-rw-r--r-- | ndb/test/src/HugoTransactions.cpp | 122 |
5 files changed, 234 insertions, 139 deletions
diff --git a/ndb/include/ndbapi/NdbConnection.hpp b/ndb/include/ndbapi/NdbConnection.hpp index f173cd8ac6e..53830dd93c5 100644 --- a/ndb/include/ndbapi/NdbConnection.hpp +++ b/ndb/include/ndbapi/NdbConnection.hpp @@ -688,7 +688,7 @@ private: void remove_list(NdbOperation*& head, NdbOperation*); void define_scan_op(NdbIndexScanOperation*); - friend int runOperations(class NDBT_Context*, class NDBT_Step*); + friend class HugoOperations; }; inline diff --git a/ndb/test/include/HugoOperations.hpp b/ndb/test/include/HugoOperations.hpp index fe22e4b5649..9ca2772e768 100644 --- a/ndb/test/include/HugoOperations.hpp +++ b/ndb/test/include/HugoOperations.hpp @@ -30,6 +30,8 @@ public: int closeTransaction(Ndb*); NdbConnection* getTransaction(); void refresh(); + + void setTransactionId(Uint64); int pkInsertRecord(Ndb*, int recordNo, diff --git a/ndb/test/ndbapi/testOperations.cpp b/ndb/test/ndbapi/testOperations.cpp index 92cc3e81b1a..e254aff58dc 100644 --- a/ndb/test/ndbapi/testOperations.cpp +++ b/ndb/test/ndbapi/testOperations.cpp @@ -103,6 +103,10 @@ OperationTestCase matrix[] = { << " failed on line " << __LINE__ << endl; \ abort(); return NDBT_FAILED; } +#define C3(b) if (!(b)) { \ + g_err << "ERR: failed on line " << __LINE__ << endl; \ + return NDBT_FAILED; } + int runOp(HugoOperations & hugoOps, Ndb * pNdb, @@ -326,18 +330,122 @@ generate(Vector<int>& out, size_t len) } } +static const Uint32 DUMMY = 0; +static const Uint32 ROW = 1; + +int +verify_other(NDBT_Context* ctx, + Ndb* pNdb, int seq, OPS latest, bool initial_row, bool commit) +{ + Uint32 no_wait = NdbOperation::LM_CommittedRead* + ctx->getProperty("NoWait", (Uint32)1); + + for(size_t j = no_wait; j<3; j++) + { + HugoOperations other(*ctx->getTab()); + C3(other.startTransaction(pNdb) == 0); + C3(other.pkReadRecord(pNdb, ROW, 1, (NdbOperation::LockMode)j) == 0); + int tmp= other.execute_Commit(pNdb); + if(seq == 0){ + if(j == NdbOperation::LM_CommittedRead) + { + C3(initial_row? tmp==0 && other.verifyUpdatesValue(0) == 0 : tmp==626); + } + else + { + C3(tmp == 266); + } + } + else if(commit) + { + switch(latest){ + case o_INS: + case o_UPD: + C3(tmp == 0 && other.verifyUpdatesValue(seq) == 0); + break; + case o_DEL: + C3(tmp == 626); + break; + case o_DONE: + abort(); + } + } + else + { + // rollback + C3(initial_row? tmp==0 && other.verifyUpdatesValue(0) == 0 : tmp==626); + } + } + + return NDBT_OK; +} + +int +verify_savepoint(NDBT_Context* ctx, + Ndb* pNdb, int seq, OPS latest, + Uint64 transactionId) +{ + bool initial_row= (seq == 0) && latest == o_INS; + + for(size_t j = 0; j<3; j++) + { + const NdbOperation::LockMode lm= (NdbOperation::LockMode)j; + + HugoOperations same(*ctx->getTab()); + C3(same.startTransaction(pNdb) == 0); + same.setTransactionId(transactionId); // Cheat + + /** + * Increase savepoint to <em>k</em> + */ + for(size_t l = 1; l<=seq; l++) + { + C3(same.pkReadRecord(pNdb, DUMMY, 1, lm) == 0); // Read dummy row + C3(same.execute_NoCommit(pNdb) == 0); + g_info << "savepoint: " << l << endl; + } + + g_info << "op(" << seq << "): " + << " lock mode " << lm << endl; + + C3(same.pkReadRecord(pNdb, ROW, 1, lm) == 0); // Read real row + int tmp= same.execute_Commit(pNdb); + if(seq == 0) + { + if(initial_row) + { + C3(tmp == 0 && same.verifyUpdatesValue(0) == 0); + } else + { + C3(tmp == 626); + } + } + else + { + switch(latest){ + case o_INS: + case o_UPD: + C3(tmp == 0 && same.verifyUpdatesValue(seq) == 0); + break; + case o_DEL: + C3(tmp == 626); + break; + case o_DONE: + abort(); + } + } + } + return NDBT_OK; +} + int runOperations(NDBT_Context* ctx, NDBT_Step* step) { - const Uint32 DUMMY = 0; - const Uint32 ROW = 1; - int tmp; Ndb* pNdb = GETNDB(step); Uint32 seqNo = ctx->getProperty("Sequence", (Uint32)0); - Uint32 no_wait = NdbOperation::LM_CommittedRead* - ctx->getProperty("NoWait", (Uint32)1); + Uint32 commit= ctx->getProperty("Commit", (Uint32)1); if(seqNo == 0) { @@ -355,8 +463,8 @@ runOperations(NDBT_Context* ctx, NDBT_Step* step) C3(hugoOps.execute_Commit(pNdb) == 0); } - const bool inital_row= (seq[0] != o_INS); - if(inital_row) + const bool initial_row= (seq[0] != o_INS); + if(initial_row) { HugoOperations hugoOps(*ctx->getTab()); C3(hugoOps.startTransaction(pNdb) == 0); @@ -389,80 +497,36 @@ runOperations(NDBT_Context* ctx, NDBT_Step* step) /** * Verify other transaction */ - for(size_t j = no_wait; j<3; j++) - { - HugoOperations other(*ctx->getTab()); - C3(other.startTransaction(pNdb) == 0); - C3(other.pkReadRecord(pNdb, ROW, 1, (NdbOperation::LockMode)j) == 0); - tmp= other.execute_Commit(pNdb); - if(j == NdbOperation::LM_CommittedRead) - { - C3(inital_row? tmp==0 && other.verifyUpdatesValue(0) == 0 : tmp==626); - } - else - { - C3(tmp == 266); - } - } - + if(verify_other(ctx, pNdb, 0, seq[0], initial_row, commit) != NDBT_OK) + return NDBT_FAILED; + /** * Verify savepoint read */ Uint64 transactionId= trans1.getTransaction()->getTransactionId(); + for(size_t k=0; k<=i+1; k++) { - for(size_t j = 0; j<3; j++) - { - const NdbOperation::LockMode lm= (NdbOperation::LockMode)j; - - HugoOperations same(*ctx->getTab()); - C3(same.startTransaction(pNdb) == 0); - same.getTransaction()->setTransactionId(transactionId); // Cheat - - /** - * Increase savepoint to <em>k</em> - */ - for(size_t l = 1; l<=k; l++) - { - C3(same.pkReadRecord(pNdb, DUMMY, 1, lm) == 0); // Read dummy row - C3(same.execute_NoCommit(pNdb) == 0); - g_info << "savepoint: " << l << endl; - } - - g_info << "op(" << k << ", " << i << "): " - << " lock mode " << lm << endl; - - C3(same.pkReadRecord(pNdb, ROW, 1, lm) == 0); // Read real row - tmp= same.execute_Commit(pNdb); - if(k == 0) - { - if(inital_row) - { - C3(tmp == 0 && same.verifyUpdatesValue(0) == 0); - } else - { - C3(tmp == 626); - } - } - else - { - switch(seq[k-1]){ - case o_INS: - case o_UPD: - C3(tmp == 0 && same.verifyUpdatesValue(k) == 0); - break; - case o_DEL: - C3(tmp == 626); - break; - case o_DONE: - abort(); - } - } - } - } + if(verify_savepoint(ctx, pNdb, k, + k>0 ? seq[k-1] : initial_row ? o_INS : o_DONE, + transactionId) != NDBT_OK) + return NDBT_FAILED; + } + } + + if(commit) + { + C3(trans1.execute_Commit(pNdb) == 0); + } + else + { + C3(trans1.execute_Rollback(pNdb) == 0); } - C3(trans1.execute_Commit(pNdb) == 0); + if(verify_other(ctx, pNdb, seq.size(), seq.back(), + initial_row, commit) != NDBT_OK) + return NDBT_FAILED; + return NDBT_OK; } @@ -495,16 +559,20 @@ main(int argc, const char** argv){ } } + BaseString n1; + n1.append(name); + n1.append("_COMMIT"); + NDBT_TestCaseImpl1 *pt = new NDBT_TestCaseImpl1(&ts, - name.c_str()+1, ""); - + n1.c_str()+1, ""); + pt->setProperty("Sequence", tmp[i]); pt->addInitializer(new NDBT_Initializer(pt, "runClearTable", runClearTable)); pt->addStep(new NDBT_ParallelStep(pt, - name.c_str()+1, + "run", runOperations)); pt->addFinalizer(new NDBT_Finalizer(pt, @@ -512,8 +580,26 @@ main(int argc, const char** argv){ runClearTable)); ts.addTest(pt); - } + name.append("_ABORT"); + pt = new NDBT_TestCaseImpl1(&ts, name.c_str()+1, ""); + pt->setProperty("Sequence", tmp[i]); + pt->setProperty("Commit", (Uint32)0); + pt->addInitializer(new NDBT_Initializer(pt, + "runClearTable", + runClearTable)); + + pt->addStep(new NDBT_ParallelStep(pt, + "run", + runOperations)); + + pt->addFinalizer(new NDBT_Finalizer(pt, + "runClearTable", + runClearTable)); + + ts.addTest(pt); + } + for(Uint32 i = 0; i<sizeof(matrix)/sizeof(matrix[0]); i++){ NDBT_TestCaseImpl1 *pt = new NDBT_TestCaseImpl1(&ts, matrix[i].name, ""); diff --git a/ndb/test/src/HugoOperations.cpp b/ndb/test/src/HugoOperations.cpp index caaa3a3a0ee..8e6603ec6ff 100644 --- a/ndb/test/src/HugoOperations.cpp +++ b/ndb/test/src/HugoOperations.cpp @@ -32,6 +32,13 @@ int HugoOperations::startTransaction(Ndb* pNdb){ return NDBT_OK; } +void +HugoOperations::setTransactionId(Uint64 id){ + if (pTrans != NULL){ + pTrans->setTransactionId(id); + } +} + int HugoOperations::closeTransaction(Ndb* pNdb){ if (pTrans != NULL){ diff --git a/ndb/test/src/HugoTransactions.cpp b/ndb/test/src/HugoTransactions.cpp index 096f5406bbf..a2ed9c77db7 100644 --- a/ndb/test/src/HugoTransactions.cpp +++ b/ndb/test/src/HugoTransactions.cpp @@ -92,7 +92,7 @@ HugoTransactions::scanReadRecords(Ndb* pNdb, if((row.attributeStore(a) = pOp->getValue(tab.getColumn(a)->getName())) == 0) { ERR(pTrans->getNdbError()); - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); return NDBT_FAILED; } } @@ -102,13 +102,13 @@ HugoTransactions::scanReadRecords(Ndb* pNdb, const NdbError err = pTrans->getNdbError(); if (err.status == NdbError::TemporaryError){ ERR(err); - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); NdbSleep_MilliSleep(50); retryAttempt++; continue; } ERR(err); - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); return NDBT_FAILED; } @@ -127,7 +127,7 @@ HugoTransactions::scanReadRecords(Ndb* pNdb, while((eof = rs->nextResult(true)) == 0){ rows++; if (calc.verifyRowValues(&row) != 0){ - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); return NDBT_FAILED; } @@ -137,11 +137,11 @@ HugoTransactions::scanReadRecords(Ndb* pNdb, rs->close(); if( check == -1 ) { ERR(pTrans->getNdbError()); - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); return NDBT_FAILED; } - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); return NDBT_OK; } } @@ -150,7 +150,7 @@ HugoTransactions::scanReadRecords(Ndb* pNdb, if (err.status == NdbError::TemporaryError){ ERR_INFO(err); - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); NdbSleep_MilliSleep(50); switch (err.code){ case 488: @@ -164,17 +164,17 @@ HugoTransactions::scanReadRecords(Ndb* pNdb, continue; } ERR(err); - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); return NDBT_FAILED; } - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); g_info << rows << " rows have been read" << endl; if (records != 0 && rows != records){ g_err << "Check expected number of records failed" << endl - << " expected=" << records <<", " << endl - << " read=" << rows << endl; + << " expected=" << records <<", " << endl + << " read=" << rows << endl; return NDBT_FAILED; } @@ -248,7 +248,7 @@ HugoTransactions::scanReadRecords(Ndb* pNdb, if((row.attributeStore(a) = pOp->getValue(tab.getColumn(a)->getName())) == 0) { ERR(pTrans->getNdbError()); - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); return NDBT_FAILED; } } @@ -258,13 +258,13 @@ HugoTransactions::scanReadRecords(Ndb* pNdb, const NdbError err = pTrans->getNdbError(); if (err.status == NdbError::TemporaryError){ ERR(err); - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); NdbSleep_MilliSleep(50); retryAttempt++; continue; } ERR(err); - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); return NDBT_FAILED; } @@ -283,7 +283,7 @@ HugoTransactions::scanReadRecords(Ndb* pNdb, while((eof = rs->nextResult(true)) == 0){ rows++; if (calc.verifyRowValues(&row) != 0){ - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); return NDBT_FAILED; } @@ -293,11 +293,11 @@ HugoTransactions::scanReadRecords(Ndb* pNdb, rs->close(); if( check == -1 ) { ERR(pTrans->getNdbError()); - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); return NDBT_FAILED; } - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); return NDBT_OK; } } @@ -306,7 +306,7 @@ HugoTransactions::scanReadRecords(Ndb* pNdb, if (err.status == NdbError::TemporaryError){ ERR_INFO(err); - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); NdbSleep_MilliSleep(50); switch (err.code){ case 488: @@ -320,17 +320,17 @@ HugoTransactions::scanReadRecords(Ndb* pNdb, continue; } ERR(err); - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); return NDBT_FAILED; } - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); g_info << rows << " rows have been read" << endl; if (records != 0 && rows != records){ g_err << "Check expected number of records failed" << endl - << " expected=" << records <<", " << endl - << " read=" << rows << endl; + << " expected=" << records <<", " << endl + << " read=" << rows << endl; return NDBT_FAILED; } @@ -344,9 +344,9 @@ HugoTransactions::scanReadRecords(Ndb* pNdb, int HugoTransactions::scanUpdateRecords(Ndb* pNdb, - int records, - int abortPercent, - int parallelism){ + int records, + int abortPercent, + int parallelism){ if(m_defaultScanUpdateMethod == 1){ return scanUpdateRecords1(pNdb, records, abortPercent, parallelism); } else if(m_defaultScanUpdateMethod == 2){ @@ -707,7 +707,7 @@ HugoTransactions::scanUpdateRecords3(Ndb* pNdb, while (true){ - restart: +restart: if (retryAttempt++ >= retryMax){ g_info << "ERROR: has retried this operation " << retryAttempt << " times, failing!" << endl; @@ -743,7 +743,7 @@ HugoTransactions::scanUpdateRecords3(Ndb* pNdb, for(a=0; a<tab.getNoOfColumns(); a++){ if((row.attributeStore(a) = pOp->getValue(tab.getColumn(a)->getName())) == NULL){ ERR(pTrans->getNdbError()); - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); return NDBT_FAILED; } } @@ -752,7 +752,7 @@ HugoTransactions::scanUpdateRecords3(Ndb* pNdb, if( check == -1 ) { const NdbError err = pTrans->getNdbError(); ERR(err); - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); if (err.status == NdbError::TemporaryError){ NdbSleep_MilliSleep(50); continue; @@ -777,7 +777,7 @@ HugoTransactions::scanUpdateRecords3(Ndb* pNdb, NdbOperation* pUp = rs->updateTuple(); if(pUp == 0){ ERR(pTrans->getNdbError()); - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); return NDBT_FAILED; } const int updates = calc.getUpdatesValue(&row) + 1; @@ -786,7 +786,7 @@ HugoTransactions::scanUpdateRecords3(Ndb* pNdb, if (tab.getColumn(a)->getPrimaryKey() == false){ if(setValueForAttr(pUp, a, r, updates ) != 0){ ERR(pTrans->getNdbError()); - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); return NDBT_FAILED; } } @@ -795,7 +795,7 @@ HugoTransactions::scanUpdateRecords3(Ndb* pNdb, if (rows == abortCount && abortTrans == true){ g_info << "Scan is aborted" << endl; // This scan should be aborted - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); return NDBT_OK; } } while((check = rs->nextResult(false)) == 0); @@ -807,7 +807,7 @@ HugoTransactions::scanUpdateRecords3(Ndb* pNdb, const NdbError err = pTrans->getNdbError(); if( check == -1 ) { - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); ERR(err); if (err.status == NdbError::TemporaryError){ NdbSleep_MilliSleep(50); @@ -819,7 +819,7 @@ HugoTransactions::scanUpdateRecords3(Ndb* pNdb, const NdbError err = pTrans->getNdbError(); if( check == -1 ) { - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); ERR(err); if (err.status == NdbError::TemporaryError){ NdbSleep_MilliSleep(50); @@ -828,7 +828,7 @@ HugoTransactions::scanUpdateRecords3(Ndb* pNdb, return NDBT_FAILED; } - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); g_info << rows << " rows have been updated" << endl; return NDBT_OK; @@ -1772,7 +1772,7 @@ HugoTransactions::pkInterpretedUpdateRecords(Ndb* pNdb, pUpdOp = pTrans->getNdbOperation(tab.getName()); if (pUpdOp == NULL) { ERR(pTrans->getNdbError()); - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); return NDBT_FAILED; } @@ -1788,7 +1788,7 @@ HugoTransactions::pkInterpretedUpdateRecords(Ndb* pNdb, if (tab.getColumn(a)->getPrimaryKey() == true){ if(equalForAttr(pUpdOp, a, r) != 0){ ERR(pTrans->getNdbError()); - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); return NDBT_FAILED; } } @@ -1805,7 +1805,7 @@ HugoTransactions::pkInterpretedUpdateRecords(Ndb* pNdb, check = pUpdOp->incValue(attr->getName(), valToIncWith); if( check == -1 ) { ERR(pTrans->getNdbError()); - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); return NDBT_FAILED; } } @@ -1817,7 +1817,7 @@ HugoTransactions::pkInterpretedUpdateRecords(Ndb* pNdb, (calc.isUpdateCol(a) == false)){ if(setValueForAttr(pUpdOp, a, r, updates ) != 0){ ERR(pTrans->getNdbError()); - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); return NDBT_FAILED; } } @@ -1846,7 +1846,7 @@ HugoTransactions::pkInterpretedUpdateRecords(Ndb* pNdb, } - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); r++; // Read next record @@ -1900,7 +1900,7 @@ HugoTransactions::pkDelRecords(Ndb* pNdb, pOp = pTrans->getNdbOperation(tab.getName()); if (pOp == NULL) { ERR(pTrans->getNdbError()); - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); return NDBT_FAILED; } @@ -1928,7 +1928,7 @@ HugoTransactions::pkDelRecords(Ndb* pNdb, switch(err.status){ case NdbError::TemporaryError: ERR(err); - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); NdbSleep_MilliSleep(50); retryAttempt++; continue; @@ -2066,18 +2066,18 @@ HugoTransactions::lockRecords(Ndb* pNdb, if (err.status == NdbError::TemporaryError){ ERR(err); - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); NdbSleep_MilliSleep(50); retryAttempt++; continue; } ERR(err); - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); return NDBT_FAILED; } for (int b=0; (b<lockBatch) && (r+b<records); b++){ if (calc.verifyRowValues(rows[b]) != 0){ - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); return NDBT_FAILED; } } @@ -2178,7 +2178,7 @@ HugoTransactions::indexReadRecords(Ndb* pNdb, pOp = pTrans->getNdbIndexOperation(idxName, tab.getName()); if (pOp == NULL) { ERR(pTrans->getNdbError()); - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); return NDBT_FAILED; } check = pOp->readTuple(); @@ -2186,7 +2186,7 @@ HugoTransactions::indexReadRecords(Ndb* pNdb, pOp = sOp = pTrans->getNdbIndexScanOperation(idxName, tab.getName()); if (sOp == NULL) { ERR(pTrans->getNdbError()); - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); return NDBT_FAILED; } @@ -2196,7 +2196,7 @@ HugoTransactions::indexReadRecords(Ndb* pNdb, if( check == -1 ) { ERR(pTrans->getNdbError()); - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); return NDBT_FAILED; } @@ -2205,7 +2205,7 @@ HugoTransactions::indexReadRecords(Ndb* pNdb, if (tab.getColumn(a)->getPrimaryKey() == true){ if(equalForAttr(pOp, a, r+b) != 0){ ERR(pTrans->getNdbError()); - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); return NDBT_FAILED; } } @@ -2216,7 +2216,7 @@ HugoTransactions::indexReadRecords(Ndb* pNdb, if((rows[b]->attributeStore(a) = pOp->getValue(tab.getColumn(a)->getName())) == 0) { ERR(pTrans->getNdbError()); - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); return NDBT_FAILED; } } @@ -2257,11 +2257,11 @@ HugoTransactions::indexReadRecords(Ndb* pNdb, if(ordered && rs->nextResult(true) == 0){ ndbout << "Error when comparing records " << " - index op next_result to many" << endl; - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); return NDBT_FAILED; } } - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); } deallocRows(); g_info << reads << " records read" << endl; @@ -2322,21 +2322,21 @@ HugoTransactions::indexUpdateRecords(Ndb* pNdb, pOp = pTrans->getNdbIndexOperation(idxName, tab.getName()); if (pOp == NULL) { ERR(pTrans->getNdbError()); - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); return NDBT_FAILED; } check = pOp->readTupleExclusive(); if( check == -1 ) { ERR(pTrans->getNdbError()); - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); return NDBT_FAILED; } } else { pOp = sOp = pTrans->getNdbIndexScanOperation(idxName, tab.getName()); if (pOp == NULL) { ERR(pTrans->getNdbError()); - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); return NDBT_FAILED; } @@ -2349,7 +2349,7 @@ HugoTransactions::indexUpdateRecords(Ndb* pNdb, if (tab.getColumn(a)->getPrimaryKey() == true){ if(equalForAttr(pOp, a, r+b) != 0){ ERR(pTrans->getNdbError()); - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); return NDBT_FAILED; } } @@ -2371,7 +2371,7 @@ HugoTransactions::indexUpdateRecords(Ndb* pNdb, if( check == -1 ) { const NdbError err = pTrans->getNdbError(); ERR(err); - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); if (err.status == NdbError::TemporaryError){ NdbSleep_MilliSleep(50); @@ -2405,13 +2405,13 @@ HugoTransactions::indexUpdateRecords(Ndb* pNdb, if (pUpdOp == NULL) { ERR(pTrans->getNdbError()); - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); return NDBT_FAILED; } if( check == -1 ) { ERR(pTrans->getNdbError()); - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); return NDBT_FAILED; } @@ -2420,7 +2420,7 @@ HugoTransactions::indexUpdateRecords(Ndb* pNdb, if (tab.getColumn(a)->getPrimaryKey() == true){ if(equalForAttr(pUpdOp, a, r+b) != 0){ ERR(pTrans->getNdbError()); - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); return NDBT_FAILED; } } @@ -2431,7 +2431,7 @@ HugoTransactions::indexUpdateRecords(Ndb* pNdb, if (tab.getColumn(a)->getPrimaryKey() == false){ if(setValueForAttr(pUpdOp, a, r+b, updates ) != 0){ ERR(pTrans->getNdbError()); - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); return NDBT_FAILED; } } @@ -2455,7 +2455,7 @@ HugoTransactions::indexUpdateRecords(Ndb* pNdb, updated += batchsize; } - pNdb->closeTransaction(pTrans); + closeTransaction(pNdb); r+= batchsize; // Read next record } |