diff options
author | unknown <jonas@perch.ndb.mysql.com> | 2006-10-10 09:37:54 +0200 |
---|---|---|
committer | unknown <jonas@perch.ndb.mysql.com> | 2006-10-10 09:37:54 +0200 |
commit | e486c5171d41376e8e5f555bc607bf868581cf54 (patch) | |
tree | 97398348c47395806dfc8cbac2a1e6812a3f040c /ndb | |
parent | 81c9ab54e8289259f6c3bd173e1688f3767620fa (diff) | |
download | mariadb-git-e486c5171d41376e8e5f555bc607bf868581cf54.tar.gz |
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
Diffstat (limited to 'ndb')
-rw-r--r-- | ndb/src/kernel/blocks/dbtc/DbtcMain.cpp | 23 | ||||
-rw-r--r-- | ndb/test/ndbapi/testTimeout.cpp | 50 |
2 files changed, 72 insertions, 1 deletions
diff --git a/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp b/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp index 07027593898..cc39219590f 100644 --- a/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp +++ b/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp @@ -6305,6 +6305,18 @@ void Dbtc::timeOutFoundLab(Signal* signal, Uint32 TapiConPtr, Uint32 errCode) break; case CS_START_SCAN:{ jam(); + + /* + We are waiting for application to continue the transaction. In this + particular state we will use the application timeout parameter rather + than the shorter Deadlock detection timeout. + */ + if (c_appl_timeout_value == 0 || + (ctcTimer - getApiConTimer(apiConnectptr.i)) <= c_appl_timeout_value) { + jam(); + return; + }//if + ScanRecordPtr scanPtr; scanPtr.i = apiConnectptr.p->apiScanRec; ptrCheckGuard(scanPtr, cscanrecFileSize, scanRecord); @@ -9825,6 +9837,17 @@ void Dbtc::sendScanTabConf(Signal* signal, ScanRecordPtr scanPtr) { conf->requestInfo = op_count | ScanTabConf::EndOfData; releaseScanResources(scanPtr); } + else + { + if (scanPtr.p->m_running_scan_frags.isEmpty()) + { + jam(); + /** + * All scan frags delivered...waiting for API + */ + setApiConTimer(apiConnectptr.i, ctcTimer, __LINE__); + } + } if(4 + 3 * op_count > 25){ jam(); 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 <<endl; + + HugoOperations hugoOps(*ctx->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){ |