List:Internals« Previous MessageNext Message »
From:jonas Date:September 9 2005 10:54am
Subject:bk commit into 5.0 tree (jonas:1.1978)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of jonas. When jonas does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.1978 05/09/09 12:54:03 jonas@eel.(none) +7 -0
  Merge eel.(none):/home/jonas/src/mysql-4.1
  into  eel.(none):/home/jonas/src/mysql-5.0

  ndb/test/src/UtilTransactions.cpp
    1.19 05/09/09 12:53:59 jonas@eel.(none) +3 -19
    merge

  ndb/test/ndbapi/bank/Bank.hpp
    1.7 05/09/09 12:53:59 jonas@eel.(none) +1 -2
    merge

  ndb/test/ndbapi/bank/Bank.cpp
    1.10 05/09/09 12:53:59 jonas@eel.(none) +1 -2
    merge

  ndb/test/ndbapi/Makefile.am
    1.23 05/09/09 12:53:59 jonas@eel.(none) +3 -4
    merge

  ndb/test/src/NDBT_Test.cpp
    1.24 05/09/09 12:41:10 jonas@eel.(none) +0 -0
    Auto merged

  ndb/test/include/NDBT_Test.hpp
    1.12 05/09/09 12:41:10 jonas@eel.(none) +0 -0
    Auto merged

  BitKeeper/etc/ignore
    1.207 05/09/09 12:40:58 jonas@eel.(none) +1 -1
    auto-union

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	jonas
# Host:	eel.(none)
# Root:	/home/jonas/src/mysql-5.0/RESYNC

--- 1.11/ndb/test/include/NDBT_Test.hpp	2005-02-03 16:53:55 +01:00
+++ 1.12/ndb/test/include/NDBT_Test.hpp	2005-09-09 12:41:10 +02:00
@@ -67,7 +67,8 @@
   const char* getPropertyWait(const char*, const char* );
 
   void decProperty(const char *);
-  
+  void incProperty(const char *);
+
   // Communicate with other tests
   void stopTest();
   bool isTestStopped();

--- 1.6/ndb/test/ndbapi/bank/Bank.hpp	2004-12-29 16:01:39 +01:00
+++ 1.7/ndb/test/ndbapi/bank/Bank.hpp	2005-09-09 12:53:59 +02:00
@@ -27,7 +27,7 @@
 class Bank {
 public:  
 
-  Bank(Ndb_cluster_connection&);
+  Bank(Ndb_cluster_connection&, bool init = true);
 
   int createAndLoadBank(bool overWrite, int num_accounts=10);
   int dropBank();

--- 1.9/ndb/test/ndbapi/bank/Bank.cpp	2004-12-29 16:01:39 +01:00
+++ 1.10/ndb/test/ndbapi/bank/Bank.cpp	2005-09-09 12:53:59 +02:00
@@ -19,12 +19,13 @@
 #include <NdbSleep.h>
 #include <UtilTransactions.hpp>
 
-Bank::Bank(Ndb_cluster_connection& con):
+Bank::Bank(Ndb_cluster_connection& con, bool _init):
   m_ndb(&con, "BANK"),
   m_maxAccount(-1),
   m_initialized(false)
 {
-
+  if(_init)
+    init();
 }
 
 int Bank::init(){
@@ -34,40 +35,39 @@
   myRandom48Init(NdbTick_CurrentMillisecond());
 
   m_ndb.init();   
-  while (m_ndb.waitUntilReady(10) != 0)
-    ndbout << "Waiting for ndb to be ready" << endl;
-
+  if (m_ndb.waitUntilReady(30) != 0)
+  {
+    ndbout << "Ndb not ready" << endl;
+    return NDBT_FAILED;
+  }
+  
   if (getNumAccounts() != NDBT_OK)
     return NDBT_FAILED;
+
+  m_initialized = true;
   return NDBT_OK;
 }
 
 int Bank::performTransactions(int maxSleepBetweenTrans, int yield){
 
-  if (init() != NDBT_OK)
-    return NDBT_FAILED;
   int transactions = 0;
 
-  while(1){
-
-    while(m_ndb.waitUntilReady(10) != 0)
-      ndbout << "Waiting for ndb to be ready" << endl;
-
-    while(performTransaction() != NDBT_FAILED){
-      transactions++;
-
-      if (maxSleepBetweenTrans > 0){
-	int val = myRandom48(maxSleepBetweenTrans);
-	NdbSleep_MilliSleep(val);      
-      }
-
-      if((transactions % 100) == 0)
-	g_info << transactions  << endl;
-
-      if (yield != 0 && transactions >= yield)
-	return NDBT_OK;
+  while(performTransaction() == NDBT_OK)
+  {
+    transactions++;
+    
+    if (maxSleepBetweenTrans > 0){
+      int val = myRandom48(maxSleepBetweenTrans);
+      NdbSleep_MilliSleep(val);      
     }
+    
+    if((transactions % 100) == 0)
+      g_info << transactions  << endl;
+    
+    if (yield != 0 && transactions >= yield)
+      return NDBT_OK;
   }
+
   return NDBT_FAILED;
 
 }
@@ -92,7 +92,7 @@
     
   int amount = myRandom48(maxAmount);
 
- retry_transaction:
+retry_transaction:
   int res = performTransaction(fromAccount, toAccount, amount);
   if (res != 0){
     switch (res){
@@ -158,8 +158,9 @@
     
   // Ok, all clear to do the transaction
   Uint64 transId;
-  if (getNextTransactionId(transId) != NDBT_OK){
-    return NDBT_FAILED;
+  int result = NDBT_OK;
+  if ((result= getNextTransactionId(transId)) != NDBT_OK){
+    return result;
   }
 
   NdbConnection* pTrans = m_ndb.startTransaction();
@@ -500,8 +501,6 @@
 
 int Bank::performMakeGLs(int yield){
   int result;
-  if (init() != NDBT_OK)
-    return NDBT_FAILED;
   
   int counter, maxCounter;
   int yieldCounter = 0;
@@ -512,9 +511,6 @@
     counter = 0;
     maxCounter = 50 + myRandom48(100);
     
-    while(m_ndb.waitUntilReady(10) != 0)
-      ndbout << "Waiting for ndb to be ready" << endl;
-
     /** 
      * Validate GLs and Transactions for previous days
      *
@@ -526,6 +522,7 @@
 	return NDBT_FAILED;
       }
       g_info << "performValidateGLs failed" << endl;
+      return NDBT_FAILED;
       continue;
     }
 
@@ -536,7 +533,7 @@
 	return NDBT_FAILED;
       }
       g_info << "performValidatePurged failed" << endl;
-      continue;
+      return NDBT_FAILED;
     }
 
     while (1){
@@ -607,14 +604,9 @@
 
 int Bank::performValidateAllGLs(){
   int result;
-  if (init() != NDBT_OK)
-    return NDBT_FAILED;
   
   while (1){
     
-    while(m_ndb.waitUntilReady(10) != 0)
-      ndbout << "Waiting for ndb to be ready" << endl;
-
     /** 
      * Validate GLs and Transactions for previous days
      * Set age so that ALL GL's are validated
@@ -1930,39 +1922,29 @@
 }
  
  
- int Bank::performIncreaseTime(int maxSleepBetweenDays, int yield){
-  if (init() != NDBT_OK)
-    return NDBT_FAILED;
-
+int Bank::performIncreaseTime(int maxSleepBetweenDays, int yield)
+{
   int yieldCounter = 0;
-
-   while(1){
-     
-     while(m_ndb.waitUntilReady(10) != 0)
-      ndbout << "Waiting for ndb to be ready" << endl;
-     
-     while(1){
-       
-       Uint64 currTime;
-       if (incCurrTime(currTime) != NDBT_OK)
-	 break;
-
-       g_info << "Current time is " << currTime << endl;
-       if (maxSleepBetweenDays > 0){
-	 int val = myRandom48(maxSleepBetweenDays);
-	 NdbSleep_SecSleep(val);
-       }
-
-       yieldCounter++;
-       if (yield != 0 && yieldCounter >= yield)
-	 return NDBT_OK;
-       
-     }
-   }
-   return NDBT_FAILED;
- }
-
-
+  
+  while(1){
+    
+    Uint64 currTime;
+    if (incCurrTime(currTime) != NDBT_OK)
+      break;
+    
+    g_info << "Current time is " << currTime << endl;
+    if (maxSleepBetweenDays > 0){
+      int val = myRandom48(maxSleepBetweenDays);
+      NdbSleep_SecSleep(val);
+    }
+    
+    yieldCounter++;
+    if (yield != 0 && yieldCounter >= yield)
+      return NDBT_OK;
+    
+  }
+  return NDBT_FAILED;
+}
 
 int Bank::readSystemValue(SystemValueId sysValId, Uint64 & value){
 
@@ -1971,22 +1953,30 @@
   NdbConnection* pTrans = m_ndb.startTransaction();
   if (pTrans == NULL){
     ERR(m_ndb.getNdbError());
+    if(m_ndb.getNdbError().status == NdbError::TemporaryError)
+      return NDBT_TEMPORARY;
     return NDBT_FAILED;
   }
 
-  if (prepareReadSystemValueOp(pTrans, sysValId, value) != NDBT_OK) {
+  int result;
+  if ((result= prepareReadSystemValueOp(pTrans, sysValId, value)) != NDBT_OK) {
     ERR(pTrans->getNdbError());
     m_ndb.closeTransaction(pTrans);
-    return NDBT_FAILED;
+    return result;
   }
 
   check = pTrans->execute(Commit);
   if( check == -1 ) {
     ERR(pTrans->getNdbError());
+    if(pTrans->getNdbError().status == NdbError::TemporaryError)
+    {
+      m_ndb.closeTransaction(pTrans);
+      return NDBT_TEMPORARY;
+    }
     m_ndb.closeTransaction(pTrans);
     return NDBT_FAILED;
   }
-    
+  
   m_ndb.closeTransaction(pTrans);      
   return NDBT_OK;
 
@@ -2092,6 +2082,8 @@
   NdbConnection* pTrans = m_ndb.startTransaction();
   if (pTrans == NULL){
     ERR(m_ndb.getNdbError());
+    if (m_ndb.getNdbError().status == NdbError::TemporaryError)
+      DBUG_RETURN(NDBT_TEMPORARY);
     DBUG_RETURN(NDBT_FAILED);
   }
     
@@ -2127,6 +2119,11 @@
   check = pTrans->execute(NoCommit);
   if( check == -1 ) {
     ERR(pTrans->getNdbError());
+    if (pTrans->getNdbError().status == NdbError::TemporaryError)
+    {
+      m_ndb.closeTransaction(pTrans);
+      DBUG_RETURN(NDBT_TEMPORARY);
+    }
     m_ndb.closeTransaction(pTrans);
     DBUG_RETURN(NDBT_FAILED);
   }
@@ -2201,16 +2198,21 @@
   check = pTrans->execute(Commit);
   if( check == -1 ) {
     ERR(pTrans->getNdbError());
+    if (pTrans->getNdbError().status == NdbError::TemporaryError)
+    {
+      m_ndb.closeTransaction(pTrans);
+      DBUG_RETURN(NDBT_TEMPORARY);
+    }
     m_ndb.closeTransaction(pTrans);
     DBUG_RETURN(NDBT_FAILED);
   }
 
   // Check that value updated equals the value we read after the update
   if (valueNewRec->u_64_value() != value){
-
+    
     printf("value actual=%lld\n", valueNewRec->u_64_value());
     printf("value expected=%lld actual=%lld\n", value, valueNewRec->u_64_value());
-
+    
     DBUG_PRINT("info", ("value expected=%ld actual=%ld", value, valueNewRec->u_64_value()));
     g_err << "getNextTransactionId: value was not updated" << endl;
     m_ndb.closeTransaction(pTrans);
@@ -2218,7 +2220,7 @@
   }
 
   m_ndb.closeTransaction(pTrans);
-
+  
   DBUG_RETURN(0);
 }
 
@@ -2235,6 +2237,8 @@
   NdbConnection* pTrans = m_ndb.startTransaction();
   if (pTrans == NULL){
     ERR(m_ndb.getNdbError());
+    if(m_ndb.getNdbError().status == NdbError::TemporaryError)
+      return NDBT_TEMPORARY;
     return NDBT_FAILED;
   }
     
@@ -2277,6 +2281,11 @@
   check = pTrans->execute(Commit);
   if( check == -1 ) {
     ERR(pTrans->getNdbError());
+    if(pTrans->getNdbError().status == NdbError::TemporaryError)
+    {
+      m_ndb.closeTransaction(pTrans);
+      return NDBT_TEMPORARY;
+    }
     m_ndb.closeTransaction(pTrans);
     return NDBT_FAILED;
   }
@@ -2301,15 +2310,10 @@
 
 
 int Bank::performSumAccounts(int maxSleepBetweenSums, int yield){
-  if (init() != NDBT_OK)
-    return NDBT_FAILED;
   
   int yieldCounter = 0;
 
   while (1){
-
-    while (m_ndb.waitUntilReady(10) != 0)
-      ndbout << "Waiting for ndb to be ready" << endl;
 
     Uint32 sumAccounts = 0;
     Uint32 numAccounts = 0;

--- 1.23/ndb/test/src/NDBT_Test.cpp	2005-02-06 10:43:21 +01:00
+++ 1.24/ndb/test/src/NDBT_Test.cpp	2005-09-09 12:41:10 +02:00
@@ -148,6 +148,15 @@
   NdbCondition_Broadcast(propertyCondPtr);
   NdbMutex_Unlock(propertyMutexPtr);
 }
+void
+NDBT_Context::incProperty(const char * name){
+  NdbMutex_Lock(propertyMutexPtr);
+  Uint32 val = 0;
+  props.get(name, &val);
+  props.put(name, (val + 1), true);
+  NdbCondition_Broadcast(propertyCondPtr);
+  NdbMutex_Unlock(propertyMutexPtr);
+}
 
 void  NDBT_Context::setProperty(const char* _name, const char* _val){ 
   NdbMutex_Lock(propertyMutexPtr);

--- 1.206/BitKeeper/etc/ignore	2005-09-05 07:35:14 +02:00
+++ 1.207/BitKeeper/etc/ignore	2005-09-09 12:40:58 +02:00
@@ -859,6 +859,7 @@
 ndb/test/ndbapi/testOIBasic
 ndb/test/ndbapi/testOperations
 ndb/test/ndbapi/testRestartGci
+ndb/test/ndbapi/testSRBank
 ndb/test/ndbapi/testScan
 ndb/test/ndbapi/testScan.dsp
 ndb/test/ndbapi/testScanInterpreter

--- 1.22/ndb/test/ndbapi/Makefile.am	2005-04-21 08:22:39 +02:00
+++ 1.23/ndb/test/ndbapi/Makefile.am	2005-09-09 12:53:59 +02:00
@@ -34,7 +34,8 @@
 testPartitioning \
 testBitfield \
 DbCreate DbAsyncGenerator \
-test_event_multi_table
+test_event_multi_table \
+testSRBank
 
 #flexTimedAsynch
 #testBlobs
@@ -78,6 +79,7 @@
 DbCreate_SOURCES = bench/mainPopulate.cpp bench/dbPopulate.cpp bench/userInterface.cpp bench/dbPopulate.h bench/userInterface.h bench/testData.h bench/testDefinitions.h bench/ndb_schema.hpp bench/ndb_error.hpp
 DbAsyncGenerator_SOURCES = bench/mainAsyncGenerator.cpp bench/asyncGenerator.cpp bench/ndb_async2.cpp bench/dbGenerator.h bench/macros.h bench/userInterface.h bench/testData.h bench/testDefinitions.h bench/ndb_schema.hpp bench/ndb_error.hpp
 test_event_multi_table_SOURCES = test_event_multi_table.cpp
+testSRBank_SOURCES = testSRBank.cpp
 
 INCLUDES_LOC = -I$(top_srcdir)/ndb/include/kernel
 
@@ -89,6 +91,7 @@
 ##testSystemRestart_INCLUDES = $(INCLUDES) -I$(top_srcdir)/ndb/include/kernel
 ##testTransactions_INCLUDES = $(INCLUDES) -I$(top_srcdir)/ndb/include/kernel
 testBackup_LDADD = $(LDADD) bank/libbank.a
+testSRBank_LDADD = bank/libbank.a $(LDADD) 
 
 # Don't update the files from bitkeeper
 %::SCCS/s.%
Thread
bk commit into 5.0 tree (jonas:1.1978)jonas9 Sep