Commit c29e0f70 authored by unknown's avatar unknown
Browse files

Merge joreland@bk-internal.mysql.com:/home/bk/mysql-4.1

into  eel.(none):/home/jonas/src/mysql-4.1-push

parents 0a3202be c2bdd1c0
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1056,3 +1056,4 @@ vio/viotest-ssl
ndb/tools/ndb_config
support-files/MacOSX/postflight
support-files/MacOSX/preflight
ndb/test/ndbapi/testSRBank
+10 −0
Original line number Diff line number Diff line
@@ -52,6 +52,16 @@ ndb_thread_wrapper(void* _ss){
      pthread_sigmask(SIG_BLOCK, &mask, 0);
    }
#endif
    {
      /**
       * Block all signals to thread by default
       *   let them go to main process instead
       */
      sigset_t mask;
      sigfillset(&mask);
      pthread_sigmask(SIG_BLOCK, &mask, 0);
    }      
    
    {
      void *ret;
      struct NdbThread * ss = (struct NdbThread *)_ss;
+2 −1
Original line number Diff line number Diff line
@@ -64,6 +64,7 @@ public:
  const char* getPropertyWait(const char*, const char* );

  void decProperty(const char *);
  void incProperty(const char *);

  // Communicate with other tests
  void stopTest();
+4 −1
Original line number Diff line number Diff line
@@ -31,7 +31,8 @@ testTimeout \
testTransactions \
testDeadlock \
test_event ndbapi_slow_select testReadPerf testLcp \
DbCreate DbAsyncGenerator
DbCreate DbAsyncGenerator \
testSRBank

#flexTimedAsynch
#testBlobs
@@ -72,6 +73,7 @@ testReadPerf_SOURCES = testReadPerf.cpp
testLcp_SOURCES = testLcp.cpp
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
testSRBank_SOURCES = testSRBank.cpp

INCLUDES_LOC = -I$(top_srcdir)/ndb/include/kernel

@@ -83,6 +85,7 @@ include $(top_srcdir)/ndb/config/type_ndbapitest.mk.am
##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.%
+86 −82
Original line number Diff line number Diff line
@@ -19,12 +19,13 @@
#include <NdbSleep.h>
#include <UtilTransactions.hpp>

Bank::Bank():
Bank::Bank(bool _init):
  m_ndb("BANK"),
  m_maxAccount(-1),
  m_initialized(false)
{

  if(_init)
    init();
}

int Bank::init(){
@@ -34,26 +35,25 @@ int Bank::init(){
  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){
  while(performTransaction() == NDBT_OK)
  {
    transactions++;
    
    if (maxSleepBetweenTrans > 0){
@@ -67,7 +67,7 @@ int Bank::performTransactions(int maxSleepBetweenTrans, int yield){
    if (yield != 0 && transactions >= yield)
      return NDBT_OK;
  }
  }

  return NDBT_FAILED;

}
@@ -158,8 +158,9 @@ int Bank::performTransactionImpl1(int fromAccountId,
    
  // 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::performTransactionImpl1(int fromAccountId,

int Bank::performMakeGLs(int yield){
  int result;
  if (init() != NDBT_OK)
    return NDBT_FAILED;
  
  int counter, maxCounter;
  int yieldCounter = 0;
@@ -512,9 +511,6 @@ int Bank::performMakeGLs(int yield){
    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 @@ int Bank::performMakeGLs(int yield){
	return NDBT_FAILED;
      }
      g_info << "performValidateGLs failed" << endl;
      return NDBT_FAILED;
      continue;
    }

@@ -536,7 +533,7 @@ int Bank::performMakeGLs(int yield){
	return NDBT_FAILED;
      }
      g_info << "performValidatePurged failed" << endl;
      continue;
      return NDBT_FAILED;
    }

    while (1){
@@ -607,14 +604,9 @@ int Bank::performMakeGLs(int yield){

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
@@ -1937,17 +1929,10 @@ int Bank::findTransactionsToPurge(const Uint64 glTime,
}
 
 
 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;
@@ -1965,12 +1950,9 @@ int Bank::findTransactionsToPurge(const Uint64 glTime,
      return NDBT_OK;
    
  }
   }
  return NDBT_FAILED;
}



int Bank::readSystemValue(SystemValueId sysValId, Uint64 & value){

  int check;
@@ -1978,18 +1960,26 @@ int Bank::readSystemValue(SystemValueId sysValId, Uint64 & value){
  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;
  }
@@ -2099,6 +2089,8 @@ int Bank::increaseSystemValue(SystemValueId sysValId, Uint64 &value){
  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);
  }
    
@@ -2134,6 +2126,11 @@ int Bank::increaseSystemValue(SystemValueId sysValId, Uint64 &value){
  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);
  }
@@ -2208,6 +2205,11 @@ int Bank::increaseSystemValue(SystemValueId sysValId, Uint64 &value){
  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);
  }
@@ -2242,6 +2244,8 @@ int Bank::increaseSystemValue2(SystemValueId sysValId, Uint64 &value){
  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;
  }
    
@@ -2284,6 +2288,11 @@ int Bank::increaseSystemValue2(SystemValueId sysValId, Uint64 &value){
  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;
  }
@@ -2308,16 +2317,11 @@ int Bank::prepareGetCurrTimeOp(NdbConnection *pTrans, Uint64 &time){


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;
    if (getSumAccounts(sumAccounts, numAccounts) != NDBT_OK){
Loading