From e486c5171d41376e8e5f555bc607bf868581cf54 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 10 Oct 2006 09:37:54 +0200 Subject: ndb - bug#23107 fix bug in handling of inactive timeout for scan, when all is delivered ndb/src/kernel/blocks/dbtc/DbtcMain.cpp: 1) set timeout if all scans are at api 2) Use c_appl_timeout_value when getting scan timeout ndb/test/ndbapi/testTimeout.cpp: test program --- ndb/test/ndbapi/testTimeout.cpp | 50 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) (limited to 'ndb/test') diff --git a/ndb/test/ndbapi/testTimeout.cpp b/ndb/test/ndbapi/testTimeout.cpp index 36fb34a50e2..1344034b65a 100644 --- a/ndb/test/ndbapi/testTimeout.cpp +++ b/ndb/test/ndbapi/testTimeout.cpp @@ -388,6 +388,45 @@ int runBuddyTransNoTimeout(NDBT_Context* ctx, NDBT_Step* step){ return result; } +int runBuddyTransTimeout(NDBT_Context* ctx, NDBT_Step* step){ + int result = NDBT_OK; + int loops = ctx->getNumLoops(); + int records = ctx->getNumRecords(); + int stepNo = step->getStepNo(); + ndbout << "TransactionInactiveTimeout="<< TIMEOUT <getTab()); + Ndb* pNdb = GETNDB(step); + + for (int l = 1; l < loops && result == NDBT_OK; l++){ + + NdbTransaction* pTrans = 0; + do{ + pTrans = pNdb->startTransaction(); + NdbScanOperation* pOp = pTrans->getNdbScanOperation(ctx->getTab()); + CHECK(pOp->readTuples(NdbOperation::LM_Read, 0, 0, 1) == 0); + CHECK(pTrans->execute(NoCommit) == 0); + + int sleep = 2 * TIMEOUT; + ndbout << "Sleeping for " << sleep << " milliseconds" << endl; + NdbSleep_MilliSleep(sleep); + + int res = 0; + while((res = pOp->nextResult()) == 0); + ndbout_c("res: %d", res); + CHECK(res == -1); + + } while(false); + + if (pTrans) + { + pTrans->close(); + } + } + + return result; +} + int runError4012(NDBT_Context* ctx, NDBT_Step* step){ int result = NDBT_OK; @@ -495,6 +534,15 @@ TESTCASE("BuddyTransNoTimeout5", FINALIZER(resetTransactionTimeout); FINALIZER(runClearTable); } +TESTCASE("BuddyTransTimeout1", + "Start a scan and check that it gets aborted"){ + INITIALIZER(runLoadTable); + //INITIALIZER(setTransactionTimeout); + STEPS(runBuddyTransTimeout, 1); + //FINALIZER(resetTransactionTimeout); + FINALIZER(runClearTable); +} +#if 0 TESTCASE("Error4012", ""){ TC_PROPERTY("TransactionDeadlockTimeout", 120000); INITIALIZER(runLoadTable); @@ -503,7 +551,7 @@ TESTCASE("Error4012", ""){ STEPS(runError4012, 2); FINALIZER(runClearTable); } - +#endif NDBT_TESTSUITE_END(testTimeout); int main(int argc, const char** argv){ -- cgit v1.2.1 From 6b4507b9ac9fc4b181814df5ecd7b26fcfa726ba Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 10 Oct 2006 09:47:30 +0200 Subject: ndb - bug#23107 fix bug in test prg --- ndb/test/ndbapi/testTimeout.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ndb/test') diff --git a/ndb/test/ndbapi/testTimeout.cpp b/ndb/test/ndbapi/testTimeout.cpp index 1344034b65a..e719cdf03e9 100644 --- a/ndb/test/ndbapi/testTimeout.cpp +++ b/ndb/test/ndbapi/testTimeout.cpp @@ -537,9 +537,9 @@ TESTCASE("BuddyTransNoTimeout5", TESTCASE("BuddyTransTimeout1", "Start a scan and check that it gets aborted"){ INITIALIZER(runLoadTable); - //INITIALIZER(setTransactionTimeout); + INITIALIZER(setTransactionTimeout); STEPS(runBuddyTransTimeout, 1); - //FINALIZER(resetTransactionTimeout); + FINALIZER(resetTransactionTimeout); FINALIZER(runClearTable); } #if 0 -- cgit v1.2.1