Loading .bzrignore +1 −0 Original line number Diff line number Diff line Loading @@ -1056,3 +1056,4 @@ vio/viotest-ssl ndb/tools/ndb_config support-files/MacOSX/postflight support-files/MacOSX/preflight ndb/test/ndbapi/testSRBank ndb/src/common/portlib/NdbThread.c +10 −0 Original line number Diff line number Diff line Loading @@ -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; Loading ndb/test/include/NDBT_Test.hpp +2 −1 Original line number Diff line number Diff line Loading @@ -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(); Loading ndb/test/ndbapi/Makefile.am +4 −1 Original line number Diff line number Diff line Loading @@ -31,7 +31,8 @@ testTimeout \ testTransactions \ testDeadlock \ test_event ndbapi_slow_select testReadPerf testLcp \ DbCreate DbAsyncGenerator DbCreate DbAsyncGenerator \ testSRBank #flexTimedAsynch #testBlobs Loading Loading @@ -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 Loading @@ -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.% Loading ndb/test/ndbapi/bank/Bank.cpp +86 −82 Original line number Diff line number Diff line Loading @@ -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(){ Loading @@ -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){ Loading @@ -67,7 +67,7 @@ int Bank::performTransactions(int maxSleepBetweenTrans, int yield){ if (yield != 0 && transactions >= yield) return NDBT_OK; } } return NDBT_FAILED; } Loading Loading @@ -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(); Loading Loading @@ -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; Loading @@ -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 * Loading @@ -526,6 +522,7 @@ int Bank::performMakeGLs(int yield){ return NDBT_FAILED; } g_info << "performValidateGLs failed" << endl; return NDBT_FAILED; continue; } Loading @@ -536,7 +533,7 @@ int Bank::performMakeGLs(int yield){ return NDBT_FAILED; } g_info << "performValidatePurged failed" << endl; continue; return NDBT_FAILED; } while (1){ Loading Loading @@ -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 Loading Loading @@ -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; Loading @@ -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; Loading @@ -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; } Loading Loading @@ -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); } Loading Loading @@ -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); } Loading Loading @@ -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); } Loading Loading @@ -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; } Loading Loading @@ -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; } Loading @@ -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 Loading
.bzrignore +1 −0 Original line number Diff line number Diff line Loading @@ -1056,3 +1056,4 @@ vio/viotest-ssl ndb/tools/ndb_config support-files/MacOSX/postflight support-files/MacOSX/preflight ndb/test/ndbapi/testSRBank
ndb/src/common/portlib/NdbThread.c +10 −0 Original line number Diff line number Diff line Loading @@ -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; Loading
ndb/test/include/NDBT_Test.hpp +2 −1 Original line number Diff line number Diff line Loading @@ -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(); Loading
ndb/test/ndbapi/Makefile.am +4 −1 Original line number Diff line number Diff line Loading @@ -31,7 +31,8 @@ testTimeout \ testTransactions \ testDeadlock \ test_event ndbapi_slow_select testReadPerf testLcp \ DbCreate DbAsyncGenerator DbCreate DbAsyncGenerator \ testSRBank #flexTimedAsynch #testBlobs Loading Loading @@ -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 Loading @@ -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.% Loading
ndb/test/ndbapi/bank/Bank.cpp +86 −82 Original line number Diff line number Diff line Loading @@ -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(){ Loading @@ -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){ Loading @@ -67,7 +67,7 @@ int Bank::performTransactions(int maxSleepBetweenTrans, int yield){ if (yield != 0 && transactions >= yield) return NDBT_OK; } } return NDBT_FAILED; } Loading Loading @@ -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(); Loading Loading @@ -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; Loading @@ -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 * Loading @@ -526,6 +522,7 @@ int Bank::performMakeGLs(int yield){ return NDBT_FAILED; } g_info << "performValidateGLs failed" << endl; return NDBT_FAILED; continue; } Loading @@ -536,7 +533,7 @@ int Bank::performMakeGLs(int yield){ return NDBT_FAILED; } g_info << "performValidatePurged failed" << endl; continue; return NDBT_FAILED; } while (1){ Loading Loading @@ -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 Loading Loading @@ -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; Loading @@ -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; Loading @@ -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; } Loading Loading @@ -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); } Loading Loading @@ -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); } Loading Loading @@ -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); } Loading Loading @@ -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; } Loading Loading @@ -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; } Loading @@ -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