Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

[NDB patch 1/5] Test for Bug#28804

From: <stewart(at)flamingspork.com>
Date: Mon Jul 16 2007 - 01:35:55 EDT


Single index lookup, simulate out of txn buffer memory when saving INDXKEYINFO. Then multiple lookups, in different batch sizes with errors injected in different places.

should get back 4000 no mem.

NOTE: currently if run on T3, NF leading to CF.

Works (with my fixes) for T1 though.

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


  • ndb-work.orig/ndb/src/kernel/blocks/ERROR_codes.txt 2007-07-11 17:15:36.638636236 +1000
    +++ ndb-work/ndb/src/kernel/blocks/ERROR_codes.txt 2007-07-12 12:43:43.084635176 +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-12 12:32:27.142115407 +1000
    +++ ndb-work/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp 2007-07-12 12:43:43.272645890 +1000
    @@ -11771,7 +11771,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-11 17:15:36.682638744 +1000
    +++ ndb-work/ndb/test/ndbapi/testIndex.cpp 2007-07-12 12:43:43.360650905 +1000
    @@ -1297,6 +1297,69 @@ runBug25059(NDBT_Context* ctx, NDBT_Step return res; }

+struct bug28804_callback_param {
+ NdbRestarter *r;
+ int count;
+};
+void bug28804_callback(void* param)
+{
+ struct bug28804_callback_param *p= (struct bug28804_callback_param*)param;
+ if(--p->count==0)
+ {
+ g_err << "inserting" << endl;
+ p->r->insertErrorInAllNodes(8039);
+ }
+ else
+ g_err << "not inserting" << endl;
+}
+
+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);
+
+ for(int bs=1; bs < loops; bs++)
+ {
+ int c= 0;
+ while (c++ < loops)
+ {
+ g_err << "BS " << bs << " LOOP #" << c << endl;
+
+ struct bug28804_callback_param p;
+ p.r= &restarter;
+ p.count= c;
+ g_err << "inserting error on op#" << c << endl;
+
+ if(hugoTrans.indexReadRecords(pNdb, pkIdxName, c, bs,
+ NoCommit, AO_IgnoreError,
+ bug28804_callback, (void*)&p) == 0)
+ {
+ g_err << "Index succeded (it should have failed)" << endl;
+ return NDBT_FAILED;
+ }
+ g_err << "done, doing test read" << endl;
+ 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",

Do you need help?X

          "Test that we can create all various indexes on each table\n" @@ -1628,6 +1691,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-11 17:15:36.686638972 +1000
    +++ ndb-work/ndb/test/include/HugoTransactions.hpp 2007-07-12 12:43:43.936683731 +1000
    @@ -97,7 +97,11 @@ public: int indexReadRecords(Ndb*, const char * idxName, int records, - int batchsize = 1);
    + int batchsize = 1,
    + ExecType execType= Commit,
    + AbortOption abortOption= AbortOnError,
    + void(*record_callback)(void*)= NULL,
    + void *callback_param= NULL);

   int indexUpdateRecords(Ndb*,

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


  • ndb-work.orig/ndb/test/src/HugoTransactions.cpp 2007-07-11 17:15:36.710640340 +1000
    +++ ndb-work/ndb/test/src/HugoTransactions.cpp 2007-07-12 12:43:44.428711770 +1000
    @@ -1434,7 +1434,11 @@ int HugoTransactions::indexReadRecords(Ndb* pNdb, const char * idxName, int records, - int batch){
    + int batch,
    + ExecType execType,
    + AbortOption abortOption,
    + void(*record_callback)(void*),
    + void *callback_param){
    int reads = 0; int r = 0; int retryAttempt = 0; @@ -1526,9 +1530,13 @@ HugoTransactions::indexReadRecords(Ndb* return NDBT_FAILED; } }
    +
    + if(record_callback)
    + (record_callback)(callback_param);
    }
    • 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-12 12:32:27.386129312 +1000
    +++ ndb-work/ndb/test/run-test/daily-basic-tests.txt 2007-07-12 12:43:44.788732287 +1000
    @@ -779,3 +779,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 16 01:39:14 2007

This archive was generated by hypermail 2.1.8 : Thu Aug 02 2007 - 01:56:42 EDT


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