From: Frazer Clement Date: April 24 2012 2:47pm Subject: bzr push into mysql-5.5-cluster-7.2 branch (frazer.clement:3896 to 3897) List-Archive: http://lists.mysql.com/commits/143636 Message-Id: <201204241447.q3OEl7kE030328@acsmt358.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3897 Frazer Clement 2012-04-24 [merge] Merge 7.1->7.2 modified: storage/ndb/include/kernel/signaldata/DihScanTab.hpp storage/ndb/include/kernel/signaldata/DumpStateOrd.hpp storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp storage/ndb/test/ndbapi/testScan.cpp storage/ndb/test/run-test/daily-basic-tests.txt 3896 John David Duncan 2012-04-23 [merge] local merge modified: mysql-test/lib/My/Memcache.pm storage/ndb/memcache/src/ndb_engine.c storage/ndb/memcache/src/ndb_engine_private.h === modified file 'storage/ndb/include/kernel/signaldata/DihScanTab.hpp' --- a/storage/ndb/include/kernel/signaldata/DihScanTab.hpp 2011-02-02 00:40:07 +0000 +++ b/storage/ndb/include/kernel/signaldata/DihScanTab.hpp 2012-04-24 13:17:43 +0000 @@ -38,6 +38,7 @@ struct DihScanTabReq struct DihScanTabConf { STATIC_CONST( SignalLength = 6 ); + STATIC_CONST( InvalidCookie = RNIL ); Uint32 tableId; Uint32 senderData; === modified file 'storage/ndb/include/kernel/signaldata/DumpStateOrd.hpp' --- a/storage/ndb/include/kernel/signaldata/DumpStateOrd.hpp 2011-07-05 12:46:07 +0000 +++ b/storage/ndb/include/kernel/signaldata/DumpStateOrd.hpp 2012-04-24 14:41:37 +0000 @@ -178,7 +178,10 @@ public: DbinfoScanTable = 14003, SchemaResourceSnapshot = 4000, // Save resource consumption - SchemaResourceCheckLeak = 4001 // check same as snapshot + SchemaResourceCheckLeak = 4001, // check same as snapshot + + TcResourceSnapshot = 2553, + TcResourceCheckLeak = 2554 }; public: === modified file 'storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp' --- a/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp 2012-02-23 15:41:31 +0000 +++ b/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp 2012-04-24 14:41:37 +0000 @@ -9500,7 +9500,7 @@ void Dbdih::execDIH_SCAN_TAB_REQ(Signal* } tabPtr.p->m_scan_count[0]++; - + ndbassert(tabPtr.p->m_map_ptr_i != DihScanTabConf::InvalidCookie); { DihScanTabConf* conf = (DihScanTabConf*)signal->getDataPtrSend(); conf->tableId = tabPtr.i; === modified file 'storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp' --- a/storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp 2012-03-19 12:09:39 +0000 +++ b/storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp 2012-04-24 14:41:37 +0000 @@ -386,6 +386,7 @@ public: * Pool of trigger data record */ ArrayPool c_theDefinedTriggerPool; + RSS_AP_SNAPSHOT(c_theDefinedTriggerPool); /** * The list of active triggers @@ -494,6 +495,7 @@ public: ArrayPool c_theFiredTriggerPool; DLHashTable c_firedTriggerHash; AttributeBuffer::DataBufferPool c_theTriggerAttrInfoPool; + RSS_AP_SNAPSHOT(c_theFiredTriggerPool); Uint32 c_maxNumberOfDefinedTriggers; Uint32 c_maxNumberOfFiredTriggers; @@ -573,6 +575,7 @@ public: * Pool of index data record */ ArrayPool c_theIndexPool; + RSS_AP_SNAPSHOT(c_theIndexPool); /** * The list of defined indexes @@ -632,6 +635,7 @@ public: * Pool of index data record */ ArrayPool c_theIndexOperationPool; + RSS_AP_SNAPSHOT(c_theIndexOperationPool); UintR c_maxNumberOfIndexOperations; @@ -1853,6 +1857,7 @@ private: return (Uint32)(curr - old); } } c_counters; + RSS_OP_SNAPSHOT(cconcurrentOp); Uint16 cownNodeid; Uint16 terrorCode; @@ -1865,6 +1870,8 @@ private: UintR clastgcp; UintR cfirstfreeGcp; UintR cfirstfreeScanrec; + UintR cConcScanCount; + RSS_OP_SNAPSHOT(cConcScanCount); TableRecordPtr tabptr; UintR cfirstfreeApiConnectFail; @@ -1879,6 +1886,7 @@ private: UintR cscanrecFileSize; UnsafeArrayPool c_scan_frag_pool; + RSS_AP_SNAPSHOT(c_scan_frag_pool); ScanFragRecPtr scanFragptr; UintR cscanFragrecFileSize; @@ -1976,6 +1984,7 @@ private: ArrayPool m_commitAckMarkerPool; DLHashTable m_commitAckMarkerHash; + RSS_AP_SNAPSHOT(m_commitAckMarkerPool); void execTC_COMMIT_ACK(Signal* signal); void sendRemoveMarkers(Signal*, const CommitAckMarker *); === modified file 'storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp' --- a/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp 2012-03-19 12:09:39 +0000 +++ b/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp 2012-04-24 14:41:37 +0000 @@ -10574,6 +10574,8 @@ void Dbtc::execSCAN_TABREQ(Signal* signa if (unlikely(errCode)) { jam(); + transP->apiScanRec = scanptr.i; + releaseScanResources(signal, scanptr, true /* NotStarted */); goto SCAN_TAB_error; } @@ -10643,6 +10645,7 @@ void Dbtc::execSCAN_TABREQ(Signal* signa goto SCAN_TAB_error; }//if ndbrequire(cfirstfreeScanrec == RNIL); + ndbrequire(cConcScanCount == cscanrecFileSize); jam(); errCode = ZNO_SCANREC_ERROR; goto SCAN_TAB_error; @@ -10713,7 +10716,7 @@ Dbtc::initScanrec(ScanRecordPtr scanptr, scanptr.p->scanStoredProcId = scanTabReq->storedProcId; scanptr.p->scanState = ScanRecord::RUNNING; scanptr.p->m_queued_count = 0; - scanptr.p->m_scan_cookie = RNIL; + scanptr.p->m_scan_cookie = DihScanTabConf::InvalidCookie; scanptr.p->m_close_scan_req = false; scanptr.p->m_pass_all_confs = ScanTabReq::getPassAllConfsFlag(ri); scanptr.p->m_4word_conf = ScanTabReq::get4WordConf(ri); @@ -10723,7 +10726,8 @@ Dbtc::initScanrec(ScanRecordPtr scanptr, for (Uint32 i = 0; i < scanParallel; i++) { jam(); ScanFragRecPtr ptr; - if (unlikely(list.seize(ptr) == false)) + if (unlikely((list.seize(ptr) == false) || + ERROR_INSERTED(8093))) { jam(); goto errout; @@ -10872,6 +10876,7 @@ void Dbtc::diFcountReqLab(Signal* signal /************************************************* * THE FIRST STEP TO RECEIVE IS SUCCESSFULLY COMPLETED. ***************************************************/ + ndbassert(scanptr.p->m_scan_cookie == DihScanTabConf::InvalidCookie); DihScanTabReq * req = (DihScanTabReq*)signal->getDataPtrSend(); req->senderRef = reference(); req->senderData = tcConnectptr.i; @@ -10906,6 +10911,7 @@ void Dbtc::execDIH_SCAN_TAB_CONF(Signal* ptrCheckGuard(scanptr, cscanrecFileSize, scanRecord); ndbrequire(scanptr.p->scanState == ScanRecord::WAIT_FRAGMENT_COUNT); scanptr.p->m_scan_cookie = conf->scanCookie; + ndbrequire(scanptr.p->m_scan_cookie != DihScanTabConf::InvalidCookie); if (conf->reorgFlag) { @@ -11089,18 +11095,24 @@ void Dbtc::releaseScanResources(Signal* ndbassert(scanPtr.p->scanApiRec == apiConnectptr.i); ndbassert(apiConnectptr.p->apiScanRec == scanPtr.i); - DihScanTabCompleteRep* rep = (DihScanTabCompleteRep*)signal->getDataPtrSend(); - rep->tableId = scanPtr.p->scanTableref; - rep->scanCookie = scanPtr.p->m_scan_cookie; - sendSignal(cdihblockref, GSN_DIH_SCAN_TAB_COMPLETE_REP, - signal, DihScanTabCompleteRep::SignalLength, JBB); - + if (scanPtr.p->m_scan_cookie != DihScanTabConf::InvalidCookie) + { + /* Cookie was requested, 'return' it */ + DihScanTabCompleteRep* rep = (DihScanTabCompleteRep*)signal->getDataPtrSend(); + rep->tableId = scanPtr.p->scanTableref; + rep->scanCookie = scanPtr.p->m_scan_cookie; + sendSignal(cdihblockref, GSN_DIH_SCAN_TAB_COMPLETE_REP, + signal, DihScanTabCompleteRep::SignalLength, JBB); + scanPtr.p->m_scan_cookie = DihScanTabConf::InvalidCookie; + } + // link into free list scanPtr.p->nextScan = cfirstfreeScanrec; scanPtr.p->scanState = ScanRecord::IDLE; scanPtr.p->scanTcrec = RNIL; scanPtr.p->scanApiRec = RNIL; cfirstfreeScanrec = scanPtr.i; + cConcScanCount--; apiConnectptr.p->apiScanRec = RNIL; apiConnectptr.p->apiConnectstate = CS_CONNECTED; @@ -11885,6 +11897,7 @@ Dbtc::seizeScanrec(Signal* signal) { ptrCheckGuard(scanptr, cscanrecFileSize, scanRecord); cfirstfreeScanrec = scanptr.p->nextScan; scanptr.p->nextScan = RNIL; + cConcScanCount++; ndbrequire(scanptr.p->scanState == ScanRecord::IDLE); return scanptr; }//Dbtc::seizeScanrec() @@ -12405,6 +12418,7 @@ void Dbtc::initialiseScanrec(Signal* sig ptrAss(scanptr, scanRecord); scanptr.p->nextScan = RNIL; cfirstfreeScanrec = 0; + cConcScanCount = 0; }//Dbtc::initialiseScanrec() void Dbtc::initialiseScanFragrec(Signal* signal) @@ -13188,6 +13202,33 @@ Dbtc::execDUMP_STATE_ORD(Signal* signal) warningEvent(" DBTC: dump-7019 to unknown node: %u", nodeId); } } + + if (arg == DumpStateOrd::TcResourceSnapshot) + { + RSS_OP_SNAPSHOT_SAVE(cConcScanCount); + RSS_AP_SNAPSHOT_SAVE(c_scan_frag_pool); + RSS_AP_SNAPSHOT_SAVE(c_theDefinedTriggerPool); + RSS_AP_SNAPSHOT_SAVE(c_theFiredTriggerPool); + RSS_AP_SNAPSHOT_SAVE(c_theIndexPool); + RSS_AP_SNAPSHOT_SAVE(m_commitAckMarkerPool); + RSS_AP_SNAPSHOT_SAVE(c_theIndexOperationPool); +#ifdef ERROR_INSERT + rss_cconcurrentOp = c_counters.cconcurrentOp; +#endif + } + if (arg == DumpStateOrd::TcResourceCheckLeak) + { + RSS_OP_SNAPSHOT_CHECK(cConcScanCount); + RSS_AP_SNAPSHOT_CHECK(c_scan_frag_pool); + RSS_AP_SNAPSHOT_CHECK(c_theDefinedTriggerPool); + RSS_AP_SNAPSHOT_CHECK(c_theFiredTriggerPool); + RSS_AP_SNAPSHOT_CHECK(c_theIndexPool); + RSS_AP_SNAPSHOT_CHECK(m_commitAckMarkerPool); + RSS_AP_SNAPSHOT_CHECK(c_theIndexOperationPool); +#ifdef ERROR_INSERT + ndbrequire(rss_cconcurrentOp == c_counters.cconcurrentOp); +#endif + } }//Dbtc::execDUMP_STATE_ORD() void Dbtc::execDBINFO_SCANREQ(Signal *signal) @@ -13249,6 +13290,12 @@ void Dbtc::execDBINFO_SCANREQ(Signal *si 0, { CFG_DB_NO_TRANSACTIONS, CFG_DB_NO_OPS,0,0 }}, + { "TC Scan Record", /* TC redundantly included to improve readability */ + cConcScanCount, + cscanrecFileSize, + sizeof(ScanRecord), + 0, /* No HWM */ + {CFG_DB_NO_SCANS, 0, 0, 0}}, { NULL, 0,0,0,0,{0,0,0,0} } }; === modified file 'storage/ndb/test/ndbapi/testScan.cpp' --- a/storage/ndb/test/ndbapi/testScan.cpp 2011-11-28 08:27:10 +0000 +++ b/storage/ndb/test/ndbapi/testScan.cpp 2012-04-24 14:41:37 +0000 @@ -454,6 +454,47 @@ int runScanReadError(NDBT_Context* ctx, return result; } +int runScanReadExhaust(NDBT_Context* ctx, NDBT_Step* step) +{ + int result = NDBT_OK; + int loops = ctx->getNumLoops(); + int records = ctx->getNumRecords(); + int parallelism = 240; // Max parallelism + int error = 8093; + NdbRestarter restarter; + + /* First take a TC resource snapshot */ + int savesnapshot= DumpStateOrd::TcResourceSnapshot; + int checksnapshot= DumpStateOrd::TcResourceCheckLeak; + + restarter.dumpStateAllNodes(&savesnapshot, 1); + int i = 0; + HugoTransactions hugoTrans(*ctx->getTab()); + hugoTrans.setRetryMax(1); + while (iisTestStopped()) { + g_info << i << ": "; + + ndbout << "insertErrorInAllNodes("<getProperty("ErrorCode"); @@ -2182,6 +2223,13 @@ TESTCASE("Bug54945", "") { INITIALIZER(runBug54945); } +TESTCASE("ScanFragRecExhaust", + "Test behaviour when TC scan frag recs exhausted") +{ + INITIALIZER(runLoadTable); + INITIALIZER(runScanReadExhaust); + FINALIZER(runClearTable); +} TESTCASE("Bug12324191", "") { TC_PROPERTY("LockMode", Uint32(NdbOperation::LM_Read)); === modified file 'storage/ndb/test/run-test/daily-basic-tests.txt' --- a/storage/ndb/test/run-test/daily-basic-tests.txt 2012-03-21 17:28:20 +0000 +++ b/storage/ndb/test/run-test/daily-basic-tests.txt 2012-04-24 14:41:37 +0000 @@ -1851,6 +1851,10 @@ max-time: 300 cmd: testNodeRestart args: -n MasterFailSlowLCP T1 +max-time:300 +cmd: testScan +args: -nScanFragRecExhaust T1 + max-time: 300 cmd: testNodeRestart args: -n Bug13464664 T1 No bundle (reason: useless for push emails).