List:Commits« Previous MessageNext Message »
From:Frazer Clement Date:April 24 2012 2:47pm
Subject:bzr push into mysql-5.1-telco-7.1 branch (frazer.clement:4532 to 4534)
View as plain text  
 4534 Frazer Clement	2012-04-24 [merge]
      Merge 7.0->7.1

    modified:
      storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
 4533 Frazer Clement	2012-04-24 [merge]
      Merge 7.0->7.1

    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
 4532 Martin Zaun	2012-04-19 [merge]
      merge from ndb-7.1-ndbjtie-constants-test

    added:
      storage/ndb/src/ndbjtie/test/ndbjtie_unit_tests_consts.cpp
      storage/ndb/src/ndbjtie/test/ndbjtie_unit_tests_consts.hpp
      storage/ndb/src/ndbjtie/test/ndbjtie_unit_tests_lib.cpp
      storage/ndb/src/ndbjtie/test/test/NdbJTieConstantsTest.java
      storage/ndb/src/ndbjtie/test/test_ndbjtie_constants.cmd.in
      storage/ndb/src/ndbjtie/test/test_ndbjtie_constants.sh.in
      storage/ndb/src/ndbjtie/test/test_unload_ndbjtie_constants.cmd.in
      storage/ndb/src/ndbjtie/test/test_unload_ndbjtie_constants.sh.in
    modified:
      storage/ndb/ndb_configure.m4
      storage/ndb/src/ndbjtie/Makefile.am
      storage/ndb/src/ndbjtie/com/mysql/ndbjtie/ndbapi/NDBAPIConst.java
      storage/ndb/src/ndbjtie/jtie/test/Makefile.am
      storage/ndb/src/ndbjtie/jtie/test/unload/test/MyLoadUnloadTest.java
      storage/ndb/src/ndbjtie/test/CMakeLists.txt
      storage/ndb/src/ndbjtie/test/Makefile.am
      storage/ndb/src/ndbjtie/test/ndbjtie_unit_tests-t.alt
      storage/ndb/src/ndbjtie/test/ndbjtie_unit_tests-t.cpp
      storage/ndb/src/ndbjtie/test/test/JTieTestBase.java
      storage/ndb/src/ndbjtie/test/test/NdbJTieMultiLibTest.java
      storage/ndb/src/ndbjtie/test/test_ndbjtie_multilib.cmd.in
      storage/ndb/src/ndbjtie/test/test_ndbjtie_multilib.sh.in
      storage/ndb/src/ndbjtie/test/test_unload_ndbjtie_multilib.cmd.in
      storage/ndb/src/ndbjtie/test/test_unload_ndbjtie_multilib.sh.in
=== 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-06-30 15:59:25 +0000
+++ b/storage/ndb/include/kernel/signaldata/DumpStateOrd.hpp	2012-04-24 13:17:43 +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-03 13:27:51 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp	2012-04-24 14:22:40 +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 10:12:21 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp	2012-04-24 14:22:40 +0000
@@ -386,6 +386,7 @@ public:
    * Pool of trigger data record
    */
   ArrayPool<TcDefinedTriggerData> c_theDefinedTriggerPool;
+  RSS_AP_SNAPSHOT(c_theDefinedTriggerPool);
 
   /**
    * The list of active triggers
@@ -494,6 +495,7 @@ public:
   ArrayPool<TcFiredTriggerData> c_theFiredTriggerPool;
   DLHashTable<TcFiredTriggerData> 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<TcIndexData> c_theIndexPool;
+  RSS_AP_SNAPSHOT(c_theIndexPool);
   
   /**
    * The list of defined indexes
@@ -632,6 +635,7 @@ public:
    * Pool of index data record
    */
   ArrayPool<TcIndexOperation> 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<ScanFragRec> c_scan_frag_pool;
+  RSS_AP_SNAPSHOT(c_scan_frag_pool);
   ScanFragRecPtr scanFragptr;
 
   UintR cscanFragrecFileSize;
@@ -1976,6 +1984,7 @@ private:
   
   ArrayPool<CommitAckMarker>   m_commitAckMarkerPool;
   DLHashTable<CommitAckMarker> 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 10:12:21 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp	2012-04-24 14:24:54 +0000
@@ -10573,6 +10573,8 @@ void Dbtc::execSCAN_TABREQ(Signal* signa
   if (unlikely(errCode))
   {
     jam();
+    transP->apiScanRec = scanptr.i;
+    releaseScanResources(signal, scanptr, true /* NotStarted */);
     goto SCAN_TAB_error;
   }
 
@@ -10642,6 +10644,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;
@@ -10712,7 +10715,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);
@@ -10722,7 +10725,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;
@@ -10871,6 +10875,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;
@@ -10905,6 +10910,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)
   {
@@ -11088,18 +11094,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;
@@ -11884,6 +11896,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()
@@ -12404,6 +12417,7 @@ void Dbtc::initialiseScanrec(Signal* sig
   ptrAss(scanptr, scanRecord);
   scanptr.p->nextScan = RNIL;
   cfirstfreeScanrec = 0;
+  cConcScanCount = 0;
 }//Dbtc::initialiseScanrec()
 
 void Dbtc::initialiseScanFragrec(Signal* signal) 
@@ -13187,6 +13201,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)
@@ -13248,6 +13289,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:07:48 +0000
+++ b/storage/ndb/test/ndbapi/testScan.cpp	2012-04-24 14:22:40 +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 (i<loops && !ctx->isTestStopped()) {
+    g_info << i << ": ";
+    
+    ndbout << "insertErrorInAllNodes("<<error<<")"<<endl;
+    if (restarter.insertErrorInAllNodes(error) != 0){
+      ndbout << "Could not insert error in all nodes "<<endl;
+      return NDBT_FAILED;
+    }
+    
+    if (hugoTrans.scanReadRecords(GETNDB(step), records, 0, parallelism) == 0)
+    {
+      /* Expect error 291 */
+      result = NDBT_FAILED;
+      break;
+    }
+    i++;
+  }
+  
+  restarter.insertErrorInAllNodes(0);
+
+  restarter.dumpStateAllNodes(&checksnapshot, 1);
+  return result;
+}
+
 int
 runInsertError(NDBT_Context* ctx, NDBT_Step* step){
   int error = ctx->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 14:39:22 +0000
+++ b/storage/ndb/test/run-test/daily-basic-tests.txt	2012-04-24 13:17:43 +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).
Thread
bzr push into mysql-5.1-telco-7.1 branch (frazer.clement:4532 to 4534) Frazer Clement25 Apr