From 89b446969ae7942861da716f84ed8e15d1231a66 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 9 Aug 2004 09:44:05 +0200 Subject: [PATCH] testTransaction -n FRead* testTransaction -n *Scan* testTimeout -n * ndb/include/kernel/signaldata/DumpStateOrd.hpp: Added DUMP for tc appl timeout ndb/src/kernel/blocks/dbtc/DbtcMain.cpp: Send tckey conf if m_exec_flags is set Added dump for appl timeout ndb/test/include/HugoOperations.hpp: Add scanRead ndb/test/ndbapi/testTimeout.cpp: Reenable ndb/test/ndbapi/testTransactions.cpp: Fix scan test cases ndb/test/run-test/daily-basic-tests.txt: reenable timeout-tests added testTransaction -n Scan* testcases ndb/test/src/HugoOperations.cpp: Fix scan ndb/test/src/NDBT_Test.cpp: Drop table before test...(if createTable==true) --- .../kernel/signaldata/DumpStateOrd.hpp | 1 + ndb/src/kernel/blocks/dbtc/DbtcMain.cpp | 11 +- ndb/test/include/HugoOperations.hpp | 13 +- ndb/test/ndbapi/testTimeout.cpp | 148 ++++++----- ndb/test/ndbapi/testTransactions.cpp | 21 +- ndb/test/run-test/daily-basic-tests.txt | 240 +++++++++++++++--- ndb/test/src/HugoOperations.cpp | 94 ++++++- ndb/test/src/NDBT_Test.cpp | 8 +- 8 files changed, 414 insertions(+), 122 deletions(-) diff --git a/ndb/include/kernel/signaldata/DumpStateOrd.hpp b/ndb/include/kernel/signaldata/DumpStateOrd.hpp index 6403a52926f..1e349fad55a 100644 --- a/ndb/include/kernel/signaldata/DumpStateOrd.hpp +++ b/ndb/include/kernel/signaldata/DumpStateOrd.hpp @@ -94,6 +94,7 @@ public: TcDumpOneApiConnectRec = 2505, TcDumpAllApiConnectRec = 2506, TcSetTransactionTimeout = 2507, + TcSetApplTransactionTimeout = 2508, CmvmiDumpConnections = 2600, CmvmiDumpLongSignalMemory = 2601, CmvmiSetRestartOnErrorInsert = 2602, diff --git a/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp b/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp index ed467db1c6c..a3ec91cce19 100644 --- a/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp +++ b/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp @@ -5043,11 +5043,11 @@ void Dbtc::execLQHKEYREF(Signal* signal) jam(); diverify010Lab(signal); return; - } else if (regApiPtr->tckeyrec > 0) { + } else if (regApiPtr->tckeyrec > 0 || regApiPtr->m_exec_flag) { jam(); sendtckeyconf(signal, 2); return; - }//if + } }//if return; @@ -10533,6 +10533,13 @@ Dbtc::execDUMP_STATE_ORD(Signal* signal) set_timeout_value(signal->theData[1]); } } + + if (dumpState->args[0] == DumpStateOrd::TcSetApplTransactionTimeout){ + jam(); + if(signal->getLength() > 1){ + set_appl_timeout_value(signal->theData[1]); + } + } }//Dbtc::execDUMP_STATE_ORD() void Dbtc::execSET_VAR_REQ(Signal* signal) diff --git a/ndb/test/include/HugoOperations.hpp b/ndb/test/include/HugoOperations.hpp index 37e53e322c8..6bd8f7204b2 100644 --- a/ndb/test/include/HugoOperations.hpp +++ b/ndb/test/include/HugoOperations.hpp @@ -58,9 +58,6 @@ public: int recordNo, int numRecords = 1); - NdbResultSet* scanReadRecords(Ndb* pNdb, ScanLock lock = SL_Read); - int readTuples(NdbResultSet*); - int execute_Commit(Ndb*, AbortOption ao = AbortOnError); int execute_NoCommit(Ndb*, @@ -92,7 +89,11 @@ public: int recordNo, int numRecords = 1, int updatesValue = 0); - + + int scanReadRecords(Ndb*, NdbScanOperation::LockMode = + NdbScanOperation::LM_CommittedRead, + int numRecords = 1); + protected: void allocRows(int rows); void deallocRows(); @@ -101,6 +102,10 @@ protected: HugoCalculator calc; Vector savedRecords; + + struct RsPair { NdbResultSet* m_result_set; int records; }; + Vector m_result_sets; + Vector m_executed_result_sets; private: NdbConnection* pTrans; }; diff --git a/ndb/test/ndbapi/testTimeout.cpp b/ndb/test/ndbapi/testTimeout.cpp index d37c58f7ea6..62e69125073 100644 --- a/ndb/test/ndbapi/testTimeout.cpp +++ b/ndb/test/ndbapi/testTimeout.cpp @@ -20,6 +20,44 @@ #include #include #include +#include + +#define TIMEOUT 3000 + +Uint32 g_org_timeout = 3000; + +int +setTransactionTimeout(NDBT_Context* ctx, NDBT_Step* step){ + NdbRestarter restarter; + + NdbConfig conf(GETNDB(step)->getNodeId()+1); + unsigned int nodeId = conf.getMasterNodeId(); + if (!conf.getProperty(nodeId, + NODE_TYPE_DB, + CFG_DB_TRANSACTION_INACTIVE_TIMEOUT, + &g_org_timeout)){ + return NDBT_FAILED; + } + + int val[] = { DumpStateOrd::TcSetApplTransactionTimeout, TIMEOUT }; + if(restarter.dumpStateAllNodes(val, 2) != 0){ + return NDBT_FAILED; + } + + return NDBT_OK; +} + +int +resetTransactionTimeout(NDBT_Context* ctx, NDBT_Step* step){ + NdbRestarter restarter; + + int val[] = { DumpStateOrd::TcSetApplTransactionTimeout, g_org_timeout }; + if(restarter.dumpStateAllNodes(val, 2) != 0){ + return NDBT_FAILED; + } + + return NDBT_OK; +} int runLoadTable(NDBT_Context* ctx, NDBT_Step* step){ @@ -55,16 +93,10 @@ int runTimeoutTrans(NDBT_Context* ctx, NDBT_Step* step){ NdbConfig conf(GETNDB(step)->getNodeId()+1); unsigned int nodeId = conf.getMasterNodeId(); int stepNo = step->getStepNo(); - Uint32 timeoutVal; - if (!conf.getProperty(nodeId, - NODE_TYPE_DB, - CFG_DB_TRANSACTION_INACTIVE_TIMEOUT, - &timeoutVal)){ - return NDBT_FAILED; - } - int minSleep = (int)(timeoutVal * 1.5); - int maxSleep = timeoutVal * 2; - ndbout << "TransactionInactiveTimeout="<getProperty("Op2", (Uint32)0); int records = ctx->getNumRecords(); - Uint32 timeoutVal; - if (!conf.getProperty(nodeId, - NODE_TYPE_DB, - CFG_DB_TRANSACTION_INACTIVE_TIMEOUT, - &timeoutVal)){ - return NDBT_FAILED; - } - - int minSleep = (int)(timeoutVal * 1.5); - int maxSleep = timeoutVal * 2; + int minSleep = (int)(TIMEOUT * 1.5); + int maxSleep = TIMEOUT * 2; HugoOperations hugoOps(*ctx->getTab()); Ndb* pNdb = GETNDB(step); - for (int l = 0; l < loops && !ctx->isTestStopped(); l++){ + for (int l = 0; lisTestStopped() && result == NDBT_OK; l++){ int op1 = 0 + (l + stepNo) * mul1; int op2 = 0 + (l + stepNo) * mul2; @@ -127,7 +148,7 @@ int runTimeoutTrans2(NDBT_Context* ctx, NDBT_Step* step){ op1 = (op1 % 5); op2 = (op2 % 5); - ndbout << stepNo << ": TransactionInactiveTimeout="<nextResult(); + switch(res){ + case 1: + return 626; + case -1: + const NdbError err = pTrans->getNdbError(); + ERR(err); + return (err.code > 0 ? err.code : NDBT_FAILED); + } + + // A row found + + switch(rows){ + case 0: + return 4000; + default: + m_result_sets[i].records--; + break; + } + } + + m_result_sets.clear(); + return NDBT_OK; } @@ -388,6 +421,35 @@ int HugoOperations::execute_NoCommit(Ndb* pNdb, AbortOption eao){ return NDBT_FAILED; return err.code; } + + for(int i = 0; inextResult(); + switch(res){ + case 1: + return 626; + case -1: + const NdbError err = pTrans->getNdbError(); + ERR(err); + return (err.code > 0 ? err.code : NDBT_FAILED); + } + + // A row found + + switch(rows){ + case 0: + return 4000; + default: + case 1: + break; + } + } + + m_result_sets.clear(); + return NDBT_OK; } @@ -704,3 +766,33 @@ HugoOperations::indexUpdateRecord(Ndb*, } return NDBT_OK; } + +int +HugoOperations::scanReadRecords(Ndb* pNdb, NdbScanOperation::LockMode lm, + int records){ + + allocRows(records); + NdbScanOperation * pOp = pTrans->getNdbScanOperation(tab.getName()); + + if(!pOp) + return -1; + + NdbResultSet * rs = pOp->readTuples(lm, 1, 1); + + if(!rs){ + return -1; + } + + for(int a = 0; aattributeStore(a) = + pOp->getValue(tab.getColumn(a)->getName())) == 0) { + ERR(pTrans->getNdbError()); + return NDBT_FAILED; + } + } + + RsPair p = {rs, records}; + m_result_sets.push_back(p); + + return 0; +} diff --git a/ndb/test/src/NDBT_Test.cpp b/ndb/test/src/NDBT_Test.cpp index ed9967fdb9a..e5ad531675d 100644 --- a/ndb/test/src/NDBT_Test.cpp +++ b/ndb/test/src/NDBT_Test.cpp @@ -820,15 +820,15 @@ void NDBT_TestSuite::execute(Ndb* ndb, const NdbDictionary::Table* pTab, const NdbDictionary::Table* pTab2 = pDict->getTable(pTab->getName()); if (createTable == true){ - if (pTab2 != 0 && !pTab->equal(* pTab2)){ + if(pTab2 != 0 && pDict->dropTable(pTab->getName()) != 0){ numTestsFail++; numTestsExecuted++; - g_err << "ERROR0: Failed to create table " << pTab->getName() << endl; + g_err << "ERROR0: Failed to drop table " << pTab->getName() << endl; tests[t]->saveTestResult(pTab, FAILED_TO_CREATE); continue; } - - if(pTab2 == 0 && pDict->createTable(* pTab) != 0){ + + if(pDict->createTable(* pTab) != 0){ numTestsFail++; numTestsExecuted++; g_err << "ERROR1: Failed to create table " << pTab->getName()