Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

[patch 5/5] Test for Bug#28804

From: <stewart(at)flamingspork.com>
Date: Mon Jul 02 2007 - 11:00:39 EDT


Single index lookup, simulate out of txn buffer memory when saving INDXKEYINFO. should get back 4000 no mem.

Index: ndb-work/ndb/src/kernel/blocks/ERROR_codes.txt


  • ndb-work.orig/ndb/src/kernel/blocks/ERROR_codes.txt 2007-07-02 17:56:06.773940868 +1000
    +++ ndb-work/ndb/src/kernel/blocks/ERROR_codes.txt 2007-07-02 17:56:49.948401240 +1000
    @@ -6,7 +6,7 @@ Next DBTUP 4014 Next DBLQH 5043 Next DBDICT 6007 Next DBDIH 7183 -Next DBTC 8039
    +Next DBTC 8040
    Next CMVMI 9000 Next BACKUP 10022 Next DBUTIL 11002 @@ -296,6 +296,8 @@ ABORT OF TCKEYREQ
 8038 : Simulate API disconnect just after SCAN_TAB_REQ  

+8039 : Simulate failure of TransactionBufferMemory allocation for OI lookup
+
 

 CMVMI



Index: ndb-work/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
  • ndb-work.orig/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp 2007-07-02 17:54:51.485650433 +1000
    +++ ndb-work/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp 2007-07-02 17:57:01.005031322 +1000
    @@ -11764,7 +11764,7 @@ bool Dbtc::saveINDXKEYINFO(Signal* signa const Uint32 *src, Uint32 len) { - if (!indexOp->keyInfo.append(src, len)) {
    + if (ERROR_INSERTED(8039) || !indexOp->keyInfo.append(src, len)) {
    jam(); // Failed to seize keyInfo, abort transaction #ifdef VM_TRACE Index: ndb-work/ndb/test/ndbapi/testIndex.cpp
  • ndb-work.orig/ndb/test/ndbapi/testIndex.cpp 2007-07-02 17:59:02.155935318 +1000
    +++ ndb-work/ndb/test/ndbapi/testIndex.cpp 2007-07-02 23:33:03.702037942 +1000
    @@ -1297,6 +1297,47 @@ runBug25059(NDBT_Context* ctx, NDBT_Step return res; }

+int
+runBug28804(NDBT_Context* ctx, NDBT_Step* step)
+{
+ Ndb* pNdb = GETNDB(step);
+ HugoTransactions hugoTrans(*ctx->getTab());
+ NdbRestarter restarter;
+
+ int loops = ctx->getNumLoops();
+ const int rows = ctx->getNumRecords();
+ const int batchsize = ctx->getProperty("BatchSize", 1);
+
+ while (loops--)
+ {
+ if(restarter.insertErrorInAllNodes(8039) != 0)
+ {
+ g_err << "Failed to error insert(8039)" << endl;
+ return NDBT_FAILED;
+ }
+
+ if (hugoTrans.indexReadRecords(pNdb, pkIdxName, rows, batchsize,
+ NoCommit, AO_IgnoreError) == 0)
+ {
+ g_err << "Index succeded (it should have failed" << endl;
+ return NDBT_FAILED;
+ }
+
+ if(restarter.insertErrorInAllNodes(0) != 0)
+ {
+ g_err << "Failed to error insert(0)" << endl;
+ return NDBT_FAILED;
+ }
+
+ if (hugoTrans.indexReadRecords(pNdb, pkIdxName, rows, batchsize) != 0){
+ g_err << "Index read failed" << endl;
+ return NDBT_FAILED;
+ }
+ }
+
+ return NDBT_OK;
+}
+

 NDBT_TESTSUITE(testIndex);
 TESTCASE("CreateAll",

          "Test that we can create all various indexes on each table\n" @@ -1628,6 +1669,16 @@ TESTCASE("Bug25059",

   STEP(runBug25059);
   FINALIZER(createPkIndex_Drop);
 }
+TESTCASE("Bug28804",
+ "Test behaviour on out of TransactionBufferMemory for index lookup"){
+ TC_PROPERTY("LoggedIndexes", (unsigned)0);
+ INITIALIZER(runClearTable);
+ INITIALIZER(createPkIndex);
+ INITIALIZER(runLoadTable);
+ STEP(runBug28804);
+ FINALIZER(createPkIndex_Drop);
+ FINALIZER(runClearTable);
+}

 NDBT_TESTSUITE_END(testIndex);  

 int main(int argc, const char** argv){
Index: ndb-work/ndb/test/include/HugoTransactions.hpp


  • ndb-work.orig/ndb/test/include/HugoTransactions.hpp 2007-07-02 23:06:00.561540437 +1000
    +++ ndb-work/ndb/test/include/HugoTransactions.hpp 2007-07-02 23:13:43.235906746 +1000
    @@ -97,7 +97,9 @@ public: int indexReadRecords(Ndb*, const char * idxName, int records, - int batchsize = 1);
    + int batchsize = 1,
    + ExecType execType= Commit,
    + AbortOption abortOption= AbortOnError);
Do you need help?X

   int indexUpdateRecords(Ndb*,

                          const char * idxName,
Index: ndb-work/ndb/test/src/HugoTransactions.cpp


  • ndb-work.orig/ndb/test/src/HugoTransactions.cpp 2007-07-02 23:05:55.129230867 +1000
    +++ ndb-work/ndb/test/src/HugoTransactions.cpp 2007-07-02 23:13:54.140528165 +1000
    @@ -1434,7 +1434,9 @@ int HugoTransactions::indexReadRecords(Ndb* pNdb, const char * idxName, int records, - int batch){
    + int batch,
    + ExecType execType,
    + AbortOption abortOption){
    int reads = 0; int r = 0; int retryAttempt = 0; @@ -1528,7 +1530,8 @@ HugoTransactions::indexReadRecords(Ndb* } }
    • check = pTrans->execute(Commit);
      + check = pTrans->execute(execType, abortOption, 1);
      +
      check = (check == -1 ? -1 : !ordered ? check : sOp->nextResult(true)); if( check == -1 ) { const NdbError err = pTrans->getNdbError(); Index: ndb-work/ndb/test/run-test/daily-basic-tests.txt
  • ndb-work.orig/ndb/test/run-test/daily-basic-tests.txt 2007-07-02 23:26:08.386370451 +1000
    +++ ndb-work/ndb/test/run-test/daily-basic-tests.txt 2007-07-02 23:39:53.789407489 +1000
    @@ -771,3 +771,7 @@ cmd: DbAsyncGenerator args: -time 60 -p 1 -proc 25 type: bench

+max-time: 60
+cmd: testIndex
+args: -n Bug28804 T1
+

--
Stewart Smith

-- 
MySQL Code Commits Mailing List
For list archives: 
http://lists.mysql.com/commits
To unsubscribe:    
http://lists.mysql.com/commits?unsub=lists@pantek.com
Received on Mon Jul 2 11:01:59 2007

This archive was generated by hypermail 2.1.8 : Mon Jul 02 2007 - 11:10:03 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library