diff options
author | unknown <ndbdev@eel.hemma.oreland.se> | 2004-08-05 22:19:52 +0200 |
---|---|---|
committer | unknown <ndbdev@eel.hemma.oreland.se> | 2004-08-05 22:19:52 +0200 |
commit | e223c07eb18147b809cb885ca267ca43f4870701 (patch) | |
tree | 682d9074ab3a5be1182ff2e58fe002059f0ddca1 /ndb/test | |
parent | 22306d0590f21ed8a43e92cee8fe591df4e88fe2 (diff) | |
parent | ebe79c0b9bbb7bf03cd0ed15e474fed6d74adbff (diff) | |
download | mariadb-git-e223c07eb18147b809cb885ca267ca43f4870701.tar.gz |
Merge joreland@bk-internal.mysql.com:irix
into eel.hemma.oreland.se:/ndb/clone-mysql-4.1-ndb-daily-2004-08-04
BitKeeper/etc/logging_ok:
auto-union
ndb/src/common/debugger/signaldata/SignalDataPrint.cpp:
Auto merged
ndb/src/cw/cpcd/Process.cpp:
Auto merged
ndb/src/kernel/blocks/dblqh/DblqhMain.cpp:
Auto merged
ndb/src/kernel/blocks/dbtux/Dbtux.hpp:
Auto merged
ndb/src/kernel/blocks/dbtux/DbtuxMeta.cpp:
Auto merged
ndb/src/kernel/blocks/dbtux/DbtuxTree.cpp:
Auto merged
ndb/src/mgmsrv/MgmtSrvr.cpp:
Auto merged
ndb/test/ndbapi/testBasic.cpp:
Auto merged
ndb/test/run-test/main.cpp:
Auto merged
ndb/test/src/HugoTransactions.cpp:
Auto merged
sql/ha_ndbcluster.cc:
Auto merged
Diffstat (limited to 'ndb/test')
-rw-r--r-- | ndb/test/include/NDBT_Table.hpp | 2 | ||||
-rw-r--r-- | ndb/test/include/NDBT_Test.hpp | 13 | ||||
-rw-r--r-- | ndb/test/ndbapi/flexAsynch.cpp | 14 | ||||
-rw-r--r-- | ndb/test/ndbapi/flexBench.cpp | 20 | ||||
-rw-r--r-- | ndb/test/ndbapi/flexTT.cpp | 6 | ||||
-rw-r--r-- | ndb/test/ndbapi/testBasic.cpp | 22 | ||||
-rw-r--r-- | ndb/test/ndbapi/testBlobs.cpp | 14 | ||||
-rw-r--r-- | ndb/test/run-test/main.cpp | 2 | ||||
-rw-r--r-- | ndb/test/src/HugoAsynchTransactions.cpp | 32 | ||||
-rw-r--r-- | ndb/test/src/HugoCalculator.cpp | 10 | ||||
-rw-r--r-- | ndb/test/src/HugoOperations.cpp | 45 | ||||
-rw-r--r-- | ndb/test/src/HugoTransactions.cpp | 102 | ||||
-rw-r--r-- | ndb/test/src/NDBT_Tables.cpp | 7 | ||||
-rw-r--r-- | ndb/test/src/NDBT_Test.cpp | 47 | ||||
-rw-r--r-- | ndb/test/src/NdbRestarter.cpp | 2 | ||||
-rw-r--r-- | ndb/test/src/NdbRestarts.cpp | 12 | ||||
-rw-r--r-- | ndb/test/src/UtilTransactions.cpp | 10 | ||||
-rw-r--r-- | ndb/test/tools/cpcc.cpp | 7 | ||||
-rw-r--r-- | ndb/test/tools/hugoPkReadRecord.cpp | 9 |
19 files changed, 202 insertions, 174 deletions
diff --git a/ndb/test/include/NDBT_Table.hpp b/ndb/test/include/NDBT_Table.hpp index bf44e1eb52b..94d7d5dda3b 100644 --- a/ndb/test/include/NDBT_Table.hpp +++ b/ndb/test/include/NDBT_Table.hpp @@ -25,7 +25,7 @@ class NDBT_Attribute : public NdbDictionary::Column { public: NDBT_Attribute(const char* _name, - Column::Type _type, + NdbDictionary::Column::Type _type, int _length = 1, bool _pk = false, bool _nullable = false): diff --git a/ndb/test/include/NDBT_Test.hpp b/ndb/test/include/NDBT_Test.hpp index 2f47c366f4e..6a968c491ae 100644 --- a/ndb/test/include/NDBT_Test.hpp +++ b/ndb/test/include/NDBT_Test.hpp @@ -112,6 +112,7 @@ public: NDBT_Step(NDBT_TestCase* ptest, const char* pname, NDBT_TESTFUNC* pfunc); + virtual ~NDBT_Step() {} int execute(NDBT_Context*); virtual int setUp() = 0; virtual void tearDown() = 0; @@ -134,8 +135,9 @@ public: NDBT_NdbApiStep(NDBT_TestCase* ptest, const char* pname, NDBT_TESTFUNC* pfunc); - int setUp(); - void tearDown(); + virtual ~NDBT_NdbApiStep() {} + virtual int setUp(); + virtual void tearDown(); Ndb* getNdb(); protected: @@ -147,6 +149,7 @@ public: NDBT_ParallelStep(NDBT_TestCase* ptest, const char* pname, NDBT_TESTFUNC* pfunc); + virtual ~NDBT_ParallelStep() {} }; class NDBT_Verifier : public NDBT_NdbApiStep { @@ -154,6 +157,7 @@ public: NDBT_Verifier(NDBT_TestCase* ptest, const char* name, NDBT_TESTFUNC* func); + virtual ~NDBT_Verifier() {} }; class NDBT_Initializer : public NDBT_NdbApiStep { @@ -161,6 +165,7 @@ public: NDBT_Initializer(NDBT_TestCase* ptest, const char* name, NDBT_TESTFUNC* func); + virtual ~NDBT_Initializer() {} }; class NDBT_Finalizer : public NDBT_NdbApiStep { @@ -168,6 +173,7 @@ public: NDBT_Finalizer(NDBT_TestCase* ptest, const char* name, NDBT_TESTFUNC* func); + virtual ~NDBT_Finalizer() {} }; @@ -176,7 +182,8 @@ public: NDBT_TestCase(NDBT_TestSuite* psuite, const char* name, const char* comment); - virtual ~NDBT_TestCase(){}; + virtual ~NDBT_TestCase(){} + // This is the default executor of a test case // When a test case is executed it will need to be suplied with a number of // different parameters and settings, these are passed to the test in the diff --git a/ndb/test/ndbapi/flexAsynch.cpp b/ndb/test/ndbapi/flexAsynch.cpp index 396ac06c87a..9192ec21b93 100644 --- a/ndb/test/ndbapi/flexAsynch.cpp +++ b/ndb/test/ndbapi/flexAsynch.cpp @@ -146,7 +146,7 @@ tellThreads(StartType what) NDB_COMMAND(flexAsynch, "flexAsynch", "flexAsynch", "flexAsynch", 65535) { ThreadNdb* pThreadData; - int tLoops=0; + int tLoops=0, i; int returnValue = NDBT_OK; flexAsynchErrorData = new ErrorData; @@ -256,7 +256,7 @@ NDB_COMMAND(flexAsynch, "flexAsynch", "flexAsynch", "flexAsynch", 65535) PRINT_TIMER("insert", noOfTransacts, tNoOfOpsPerTrans); if (0 < failed) { - int i = retry_opt ; + i = retry_opt ; int ci = 1 ; while (0 < failed && 0 < i){ ndbout << failed << " of the transactions returned errors!" @@ -293,7 +293,7 @@ NDB_COMMAND(flexAsynch, "flexAsynch", "flexAsynch", "flexAsynch", 65535) PRINT_TIMER("read", noOfTransacts, tNoOfOpsPerTrans); if (0 < failed) { - int i = retry_opt ; + i = retry_opt ; int cr = 1; while (0 < failed && 0 < i){ ndbout << failed << " of the transactions returned errors!"<<endl ; @@ -330,7 +330,7 @@ NDB_COMMAND(flexAsynch, "flexAsynch", "flexAsynch", "flexAsynch", 65535) PRINT_TIMER("update", noOfTransacts, tNoOfOpsPerTrans) ; if (0 < failed) { - int i = retry_opt ; + i = retry_opt ; int cu = 1 ; while (0 < failed && 0 < i){ ndbout << failed << " of the transactions returned errors!"<<endl ; @@ -366,7 +366,7 @@ NDB_COMMAND(flexAsynch, "flexAsynch", "flexAsynch", "flexAsynch", 65535) PRINT_TIMER("read", noOfTransacts, tNoOfOpsPerTrans); if (0 < failed) { - int i = retry_opt ; + i = retry_opt ; int cr2 = 1 ; while (0 < failed && 0 < i){ ndbout << failed << " of the transactions returned errors!"<<endl ; @@ -403,7 +403,7 @@ NDB_COMMAND(flexAsynch, "flexAsynch", "flexAsynch", "flexAsynch", 65535) PRINT_TIMER("delete", noOfTransacts, tNoOfOpsPerTrans); if (0 < failed) { - int i = retry_opt ; + i = retry_opt ; int cd = 1 ; while (0 < failed && 0 < i){ ndbout << failed << " of the transactions returned errors!"<< endl ; @@ -438,7 +438,7 @@ NDB_COMMAND(flexAsynch, "flexAsynch", "flexAsynch", "flexAsynch", 65535) execute(stStop); void * tmp; - for(int i = 0; i<tNoOfThreads; i++){ + for(i = 0; i<tNoOfThreads; i++){ NdbThread_WaitFor(threadLife[i], &tmp); NdbThread_Destroy(&threadLife[i]); } diff --git a/ndb/test/ndbapi/flexBench.cpp b/ndb/test/ndbapi/flexBench.cpp index 809d11086bf..38c8f6e280f 100644 --- a/ndb/test/ndbapi/flexBench.cpp +++ b/ndb/test/ndbapi/flexBench.cpp @@ -282,7 +282,7 @@ tellThreads(ThreadData* pt, StartType what) NDB_COMMAND(flexBench, "flexBench", "flexBench", "flexbench", 65535) { ThreadData* pThreadsData; - int tLoops = 0; + int tLoops = 0, i; int returnValue = NDBT_OK; if (readArguments(argc, argv) != 0){ @@ -355,7 +355,7 @@ NDB_COMMAND(flexBench, "flexBench", "flexBench", "flexbench", 65535) ****************************************************************/ resetThreads(pThreadsData); - for (unsigned int i = 0; i < tNoOfThreads; i++){ + for (i = 0; i < tNoOfThreads; i++){ pThreadsData[i].threadNo = i; pThreadsData[i].threadLife = NdbThread_Create(flexBenchThread, (void**)&pThreadsData[i], @@ -531,7 +531,7 @@ NDB_COMMAND(flexBench, "flexBench", "flexBench", "flexbench", 65535) waitForThreads(pThreadsData); void * tmp; - for(Uint32 i = 0; i<tNoOfThreads; i++){ + for(i = 0; i<tNoOfThreads; i++){ NdbThread_WaitFor(pThreadsData[i].threadLife, &tmp); NdbThread_Destroy(&pThreadsData[i].threadLife); } @@ -540,7 +540,7 @@ NDB_COMMAND(flexBench, "flexBench", "flexBench", "flexbench", 65535) if (useLongKeys == true) { // Only free these areas if they have been allocated // Otherwise cores will happen - for (Uint32 i = 0; i < tNoOfLongPK; i++) + for (i = 0; i < tNoOfLongPK; i++) free(longKeyAttrName[i]); free(longKeyAttrName); } // if @@ -629,9 +629,10 @@ static void* flexBenchThread(void* pArg) if(useLongKeys){ // Allocate and populate the longkey array. longKeyAttrValue = (unsigned ***) malloc(sizeof(unsigned**) * tNoOfOperations ); - for (Uint32 n = 0; n < tNoOfOperations; n++) + Uint32 n; + for (n = 0; n < tNoOfOperations; n++) longKeyAttrValue[n] = (unsigned **) malloc(sizeof(unsigned*) * tNoOfLongPK ); - for (Uint32 n = 0; n < tNoOfOperations; n++){ + for (n = 0; n < tNoOfOperations; n++){ for (Uint32 i = 0; i < tNoOfLongPK ; i++) { longKeyAttrValue[n][i] = (unsigned *) malloc(sizeof(unsigned) * tSizeOfLongPK); memset(longKeyAttrValue[n][i], 0, sizeof(unsigned) * tSizeOfLongPK); @@ -1064,13 +1065,14 @@ static void sleepBeforeStartingTest(int seconds){ static int createTables(Ndb* pMyNdb){ - for (Uint32 i = 0; i < tNoOfAttributes; i++){ + int i; + for (i = 0; i < tNoOfAttributes; i++){ snprintf(attrName[i], MAXSTRLEN, "COL%d", i); } // Note! Uses only uppercase letters in table name's // so that we can look at the tables with SQL - for (Uint32 i = 0; i < tNoOfTables; i++){ + for (i = 0; i < tNoOfTables; i++){ if (theStdTableNameFlag == 0){ snprintf(tableName[i], MAXSTRLEN, "TAB%d_%d", i, (int)(NdbTick_CurrentMillisecond() / 1000)); @@ -1079,7 +1081,7 @@ createTables(Ndb* pMyNdb){ } } - for(unsigned i = 0; i < tNoOfTables; i++){ + for(i = 0; i < tNoOfTables; i++){ ndbout << "Creating " << tableName[i] << "... "; NdbDictionary::Table tmpTable(tableName[i]); diff --git a/ndb/test/ndbapi/flexTT.cpp b/ndb/test/ndbapi/flexTT.cpp index a82875de5c2..c0ff31d1677 100644 --- a/ndb/test/ndbapi/flexTT.cpp +++ b/ndb/test/ndbapi/flexTT.cpp @@ -173,7 +173,7 @@ NDB_COMMAND(flexTT, "flexTT", "flexTT", "flexTT", 65535) { ThreadNdb* pThreadData; int returnValue = NDBT_OK; - + int i; flexTTErrorData = new ErrorData; flexTTErrorData->resetErrorCounters(); @@ -250,7 +250,7 @@ NDB_COMMAND(flexTT, "flexTT", "flexTT", "flexTT", 65535) * Create NDB objects. * ****************************************************************/ resetThreads(); - for (int i = 0; i < tNoOfThreads ; i++) { + for (i = 0; i < tNoOfThreads ; i++) { pThreadData[i].threadNo = i; threadLife[i] = NdbThread_Create(threadLoop, (void**)&pThreadData[i], @@ -301,7 +301,7 @@ NDB_COMMAND(flexTT, "flexTT", "flexTT", "flexTT", 65535) execute(stStop); void * tmp; - for(int i = 0; i<tNoOfThreads; i++){ + for(i = 0; i<tNoOfThreads; i++){ NdbThread_WaitFor(threadLife[i], &tmp); NdbThread_Destroy(&threadLife[i]); } diff --git a/ndb/test/ndbapi/testBasic.cpp b/ndb/test/ndbapi/testBasic.cpp index 871179200c8..26622f9b066 100644 --- a/ndb/test/ndbapi/testBasic.cpp +++ b/ndb/test/ndbapi/testBasic.cpp @@ -264,7 +264,7 @@ static int readOneNoCommit(Ndb* pNdb, NdbConnection* pTrans, const NdbDictionary::Table* tab,NDBT_ResultRow * row){ - + int a; NdbOperation * pOp = pTrans->getNdbOperation(tab->getName()); if (pOp == NULL){ ERR(pTrans->getNdbError()); @@ -280,7 +280,7 @@ readOneNoCommit(Ndb* pNdb, NdbConnection* pTrans, } // Define primary keys - for(int a = 0; a<tab->getNoOfColumns(); a++){ + for(a = 0; a<tab->getNoOfColumns(); a++){ if (tab->getColumn(a)->getPrimaryKey() == true){ if(tmp.equalForAttr(pOp, a, 0) != 0){ ERR(pTrans->getNdbError()); @@ -290,7 +290,7 @@ readOneNoCommit(Ndb* pNdb, NdbConnection* pTrans, } // Define attributes to read - for(int a = 0; a<tab->getNoOfColumns(); a++){ + for(a = 0; a<tab->getNoOfColumns(); a++){ if((row->attributeStore(a) = pOp->getValue(tab->getColumn(a)->getName())) == 0) { ERR(pTrans->getNdbError()); @@ -639,35 +639,35 @@ int runNoCommitRollback630(NDBT_Context* ctx, NDBT_Step* step){ int runNoCommitAndClose(NDBT_Context* ctx, NDBT_Step* step){ - int result = NDBT_OK; + int i, result = NDBT_OK; HugoOperations hugoOps(*ctx->getTab()); Ndb* pNdb = GETNDB(step); do{ // Read CHECK(hugoOps.startTransaction(pNdb) == 0); - for (int i = 0; i < 10; i++) + for (i = 0; i < 10; i++) CHECK(hugoOps.pkReadRecord(pNdb, i, true) == 0); CHECK(hugoOps.execute_NoCommit(pNdb) == 0); CHECK(hugoOps.closeTransaction(pNdb) == 0); // Update CHECK(hugoOps.startTransaction(pNdb) == 0); - for (int i = 0; i < 10; i++) + for (i = 0; i < 10; i++) CHECK(hugoOps.pkUpdateRecord(pNdb, i) == 0); CHECK(hugoOps.execute_NoCommit(pNdb) == 0); CHECK(hugoOps.closeTransaction(pNdb) == 0); // Delete CHECK(hugoOps.startTransaction(pNdb) == 0); - for (int i = 0; i < 10; i++) + for (i = 0; i < 10; i++) CHECK(hugoOps.pkDeleteRecord(pNdb, i) == 0); CHECK(hugoOps.execute_NoCommit(pNdb) == 0); CHECK(hugoOps.closeTransaction(pNdb) == 0); // Try to insert, record should already exist CHECK(hugoOps.startTransaction(pNdb) == 0); - for (int i = 0; i < 10; i++) + for (i = 0; i < 10; i++) CHECK(hugoOps.pkInsertRecord(pNdb, i) == 0); CHECK(hugoOps.execute_Commit(pNdb) == 630); CHECK(hugoOps.closeTransaction(pNdb) == 0); @@ -781,14 +781,14 @@ int runCheckRollbackDeleteMultiple(NDBT_Context* ctx, NDBT_Step* step){ CHECK(hugoOps.closeTransaction(pNdb) == 0); Uint32 updatesValue = 0; - + Uint32 j; for(Uint32 i = 0; i<1; i++){ // Read record 5 - 10 CHECK(hugoOps.startTransaction(pNdb) == 0); CHECK(hugoOps.pkReadRecord(pNdb, 5, true, 10) == 0); CHECK(hugoOps.execute_NoCommit(pNdb) == 0); - for(Uint32 j = 0; j<10; j++){ + for(j = 0; j<10; j++){ // Update record 5 - 10 updatesValue++; CHECK(hugoOps.pkUpdateRecord(pNdb, 5, 10, updatesValue) == 0); @@ -799,7 +799,7 @@ int runCheckRollbackDeleteMultiple(NDBT_Context* ctx, NDBT_Step* step){ CHECK(hugoOps.verifyUpdatesValue(updatesValue) == 0); } - for(Uint32 j = 0; j<10; j++){ + for(j = 0; j<10; j++){ // Delete record 5 - 10 times CHECK(hugoOps.pkDeleteRecord(pNdb, 5, 10) == 0); CHECK(hugoOps.execute_NoCommit(pNdb) == 0); diff --git a/ndb/test/ndbapi/testBlobs.cpp b/ndb/test/ndbapi/testBlobs.cpp index 6ffac3028b1..64881ca39ab 100644 --- a/ndb/test/ndbapi/testBlobs.cpp +++ b/ndb/test/ndbapi/testBlobs.cpp @@ -1170,6 +1170,7 @@ deleteScan(bool idx) static int testmain() { + int style; g_ndb = new Ndb("TEST_DB"); CHK(g_ndb->init() == 0); CHK(g_ndb->waitUntilReady() == 0); @@ -1197,7 +1198,7 @@ testmain() if (g_opt.m_seed == 0) srandom(g_loop); // pk - for (int style = 0; style <= 2; style++) { + for (style = 0; style <= 2; style++) { if (skipcase('k') || skipstyle(style)) continue; DBG("--- pk ops " << stylename[style] << " ---"); @@ -1215,7 +1216,7 @@ testmain() CHK(verifyBlob() == 0); } // hash index - for (int style = 0; style <= 2; style++) { + for (style = 0; style <= 2; style++) { if (skipcase('i') || skipstyle(style)) continue; DBG("--- idx ops " << stylename[style] << " ---"); @@ -1233,7 +1234,7 @@ testmain() CHK(verifyBlob() == 0); } // scan table - for (int style = 0; style <= 2; style++) { + for (style = 0; style <= 2; style++) { if (skipcase('s') || skipstyle(style)) continue; DBG("--- table scan " << stylename[style] << " ---"); @@ -1249,7 +1250,7 @@ testmain() CHK(verifyBlob() == 0); } // scan index - for (int style = 0; style <= 2; style++) { + for (style = 0; style <= 2; style++) { if (skipcase('r') || skipstyle(style)) continue; DBG("--- index scan " << stylename[style] << " ---"); @@ -1274,6 +1275,7 @@ testmain() static int bugtest_4088() { + unsigned i; DBG("bug test 4088 - ndb api hang with mixed ops on index table"); // insert rows calcTups(false); @@ -1285,7 +1287,7 @@ bugtest_4088() // read table pk via index as a table const unsigned pkcnt = 2; Tup pktup[pkcnt]; - for (unsigned i = 0; i < pkcnt; i++) { + for (i = 0; i < pkcnt; i++) { char name[20]; // XXX guess table id sprintf(name, "%d/%s", 4, g_opt.m_x1name); @@ -1304,7 +1306,7 @@ bugtest_4088() // BUG 4088: gets 1 tckeyconf, 1 tcindxconf, then hangs CHK(g_con->execute(Commit) == 0); // verify - for (unsigned i = 0; i < pkcnt; i++) { + for (i = 0; i < pkcnt; i++) { CHK(pktup[i].m_pk1 == tup.m_pk1); CHK(memcmp(pktup[i].m_pk2, tup.m_pk2, g_opt.m_pk2len) == 0); } diff --git a/ndb/test/run-test/main.cpp b/ndb/test/run-test/main.cpp index c23133245a7..0ea700e1d66 100644 --- a/ndb/test/run-test/main.cpp +++ b/ndb/test/run-test/main.cpp @@ -984,3 +984,5 @@ setup_hosts(atrt_config& config){ } return true; } + +template class Vector<const ParserRow<SimpleCpcClient::ParserDummy>*>; diff --git a/ndb/test/src/HugoAsynchTransactions.cpp b/ndb/test/src/HugoAsynchTransactions.cpp index 5bedf26aa62..f75293f5a14 100644 --- a/ndb/test/src/HugoAsynchTransactions.cpp +++ b/ndb/test/src/HugoAsynchTransactions.cpp @@ -165,12 +165,13 @@ HugoAsynchTransactions::pkUpdateRecordsAsynch(Ndb* pNdb, allocRows(trans*operations); allocTransactions(trans); + int a, t, r; for (int i = 0; i < batch; i++) { // For each batch while (cRecords < records*batch) { cTrans = 0; cReadIndex = 0; - for (int t = 0; t < trans; t++) { // For each transaction + for (t = 0; t < trans; t++) { // For each transaction transactions[t] = pNdb->startTransaction(); if (transactions[t] == NULL) { ERR(pNdb->getNdbError()); @@ -187,7 +188,7 @@ HugoAsynchTransactions::pkUpdateRecordsAsynch(Ndb* pNdb, // Read // Define primary keys check = pOp->readTupleExclusive(); - for (int a = 0; a < tab.getNoOfColumns(); a++) { + for (a = 0; a < tab.getNoOfColumns(); a++) { if (tab.getColumn(a)->getPrimaryKey() == true) { if (equalForAttr(pOp, a, cReadRecords) != 0){ ERR(transactions[t]->getNdbError()); @@ -197,7 +198,7 @@ HugoAsynchTransactions::pkUpdateRecordsAsynch(Ndb* pNdb, } } // Define attributes to read - for (int a = 0; a < tab.getNoOfColumns(); a++) { + for (a = 0; a < tab.getNoOfColumns(); a++) { if ((rows[cReadIndex]->attributeStore(a) = pOp->getValue(tab.getColumn(a)->getName())) == 0) { ERR(transactions[t]->getNdbError()); @@ -225,7 +226,7 @@ HugoAsynchTransactions::pkUpdateRecordsAsynch(Ndb* pNdb, pNdb->sendPollNdb(3000, 0, 0); // Verify the data! - for (int r = 0; r < trans*operations; r++) { + for (r = 0; r < trans*operations; r++) { if (calc.verifyRowValues(rows[r]) != 0) { g_info << "|- Verify failed..." << endl; // Close all transactions @@ -239,7 +240,7 @@ HugoAsynchTransactions::pkUpdateRecordsAsynch(Ndb* pNdb, // Update cTrans = 0; cIndex = 0; - for (int t = 0; t < trans; t++) { // For each transaction + for (t = 0; t < trans; t++) { // For each transaction for (int k = 0; k < operations; k++) { // For each operation NdbOperation* pOp = transactions[t]->getNdbOperation(tab.getName()); if (pOp == NULL) { @@ -258,7 +259,7 @@ HugoAsynchTransactions::pkUpdateRecordsAsynch(Ndb* pNdb, } // Set search condition for the record - for (int a = 0; a < tab.getNoOfColumns(); a++) { + for (a = 0; a < tab.getNoOfColumns(); a++) { if (tab.getColumn(a)->getPrimaryKey() == true) { if (equalForAttr(pOp, a, cRecords) != 0) { ERR(transactions[t]->getNdbError()); @@ -269,7 +270,7 @@ HugoAsynchTransactions::pkUpdateRecordsAsynch(Ndb* pNdb, } // Update the record - for (int a = 0; a < tab.getNoOfColumns(); a++) { + for (a = 0; a < tab.getNoOfColumns(); a++) { if (tab.getColumn(a)->getPrimaryKey() == false) { if (setValueForAttr(pOp, a, cRecords, updates) != 0) { ERR(transactions[t]->getNdbError()); @@ -298,7 +299,7 @@ HugoAsynchTransactions::pkUpdateRecordsAsynch(Ndb* pNdb, pNdb->sendPollNdb(3000, 0, 0); // Close all transactions - for (int t = 0; t < cTrans; t++) { + for (t = 0; t < cTrans; t++) { pNdb->closeTransaction(transactions[t]); } @@ -346,6 +347,7 @@ HugoAsynchTransactions::executeAsynchOperation(Ndb* pNdb, int cTrans = 0; int cRecords = 0; int cIndex = 0; + int a,t,r; transactionsCompleted = 0; allocTransactions(trans); @@ -354,7 +356,7 @@ HugoAsynchTransactions::executeAsynchOperation(Ndb* pNdb, while (cRecords < records*batch) { cTrans = 0; cIndex = 0; - for (int t = 0; t < trans; t++) { // For each transaction + for (t = 0; t < trans; t++) { // For each transaction transactions[t] = pNdb->startTransaction(); if (transactions[t] == NULL) { ERR(pNdb->getNdbError()); @@ -379,7 +381,7 @@ HugoAsynchTransactions::executeAsynchOperation(Ndb* pNdb, } // Set a calculated value for each attribute in this table - for (int a = 0; a < tab.getNoOfColumns(); a++) { + for (a = 0; a < tab.getNoOfColumns(); a++) { if (setValueForAttr(pOp, a, cRecords, 0 ) != 0) { ERR(transactions[t]->getNdbError()); pNdb->closeTransaction(transactions[t]); @@ -394,7 +396,7 @@ HugoAsynchTransactions::executeAsynchOperation(Ndb* pNdb, case NO_READ: // Define primary keys check = pOp->readTuple(); - for (int a = 0; a < tab.getNoOfColumns(); a++) { + for (a = 0; a < tab.getNoOfColumns(); a++) { if (tab.getColumn(a)->getPrimaryKey() == true) { if (equalForAttr(pOp, a, cRecords) != 0){ ERR(transactions[t]->getNdbError()); @@ -404,7 +406,7 @@ HugoAsynchTransactions::executeAsynchOperation(Ndb* pNdb, } } // Define attributes to read - for (int a = 0; a < tab.getNoOfColumns(); a++) { + for (a = 0; a < tab.getNoOfColumns(); a++) { if ((rows[cIndex]->attributeStore(a) = pOp->getValue(tab.getColumn(a)->getName())) == 0) { ERR(transactions[t]->getNdbError()); @@ -423,7 +425,7 @@ HugoAsynchTransactions::executeAsynchOperation(Ndb* pNdb, } // Define primary keys - for (int a = 0; a < tab.getNoOfColumns(); a++) { + for (a = 0; a < tab.getNoOfColumns(); a++) { if (tab.getColumn(a)->getPrimaryKey() == true){ if (equalForAttr(pOp, a, cRecords) != 0) { ERR(transactions[t]->getNdbError()); @@ -462,7 +464,7 @@ HugoAsynchTransactions::executeAsynchOperation(Ndb* pNdb, switch (theOperation) { case NO_READ: // Verify the data! - for (int r = 0; r < trans*operations; r++) { + for (r = 0; r < trans*operations; r++) { if (calc.verifyRowValues(rows[r]) != 0) { g_info << "|- Verify failed..." << endl; // Close all transactions @@ -480,7 +482,7 @@ HugoAsynchTransactions::executeAsynchOperation(Ndb* pNdb, } // Close all transactions - for (int t = 0; t < cTrans; t++) { + for (t = 0; t < cTrans; t++) { pNdb->closeTransaction(transactions[t]); } diff --git a/ndb/test/src/HugoCalculator.cpp b/ndb/test/src/HugoCalculator.cpp index 55aa96a4909..147c8b104d8 100644 --- a/ndb/test/src/HugoCalculator.cpp +++ b/ndb/test/src/HugoCalculator.cpp @@ -28,7 +28,8 @@ HugoCalculator::HugoCalculator(const NdbDictionary::Table& tab) : m_tab(tab) { // The "id" column of this table is found in the first integer column - for (int i=0; i<m_tab.getNoOfColumns(); i++){ + int i; + for (i=0; i<m_tab.getNoOfColumns(); i++){ const NdbDictionary::Column* attr = m_tab.getColumn(i); if (attr->getType() == NdbDictionary::Column::Unsigned){ m_idCol = i; @@ -37,7 +38,7 @@ HugoCalculator::HugoCalculator(const NdbDictionary::Table& tab) : m_tab(tab) { } // The "number of updates" column for this table is found in the last column - for (int i=m_tab.getNoOfColumns()-1; i>=0; i--){ + for (i=m_tab.getNoOfColumns()-1; i>=0; i--){ const NdbDictionary::Column* attr = m_tab.getColumn(i); if (attr->getType() == NdbDictionary::Column::Unsigned){ m_updatesCol = i; @@ -102,7 +103,8 @@ HugoCalculator::calcValue(int record, // Fill buf with some pattern so that we can detect // anomalies in the area that we don't fill with chars - for (int i = 0; i<attr->getLength(); i++) + int i; + for (i = 0; i<attr->getLength(); i++) buf[i] = ((i+2) % 255); // Calculate length of the string to create. We want the string @@ -116,7 +118,7 @@ HugoCalculator::calcValue(int record, else len++; } - for(int i=0; i < len; i++) + for(i=0; i < len; i++) buf[i] = a[((val^i)%25)]; buf[len] = 0; } diff --git a/ndb/test/src/HugoOperations.cpp b/ndb/test/src/HugoOperations.cpp index d5dbf1388d1..ef37bd815da 100644 --- a/ndb/test/src/HugoOperations.cpp +++ b/ndb/test/src/HugoOperations.cpp @@ -51,7 +51,7 @@ int HugoOperations::pkReadRecord(Ndb* pNdb, int recordNo, bool exclusive, int numRecords){ - + int a; allocRows(numRecords); int check; for(int r=0; r < numRecords; r++){ @@ -71,7 +71,7 @@ int HugoOperations::pkReadRecord(Ndb* pNdb, } // Define primary keys - for(int a = 0; a<tab.getNoOfColumns(); a++){ + for(a = 0; a<tab.getNoOfColumns(); a++){ if (tab.getColumn(a)->getPrimaryKey() == true){ if(equalForAttr(pOp, a, r+recordNo) != 0){ ERR(pTrans->getNdbError()); @@ -81,7 +81,7 @@ int HugoOperations::pkReadRecord(Ndb* pNdb, } // Define attributes to read - for(int a = 0; a<tab.getNoOfColumns(); a++){ + for(a = 0; a<tab.getNoOfColumns(); a++){ if((rows[r]->attributeStore(a) = pOp->getValue(tab.getColumn(a)->getName())) == 0) { ERR(pTrans->getNdbError()); @@ -95,7 +95,7 @@ int HugoOperations::pkReadRecord(Ndb* pNdb, int HugoOperations::pkDirtyReadRecord(Ndb* pNdb, int recordNo, int numRecords){ - + int a; allocRows(numRecords); int check; for(int r=0; r < numRecords; r++){ @@ -113,7 +113,7 @@ int HugoOperations::pkDirtyReadRecord(Ndb* pNdb, } // Define primary keys - for(int a = 0; a<tab.getNoOfColumns(); a++){ + for(a = 0; a<tab.getNoOfColumns(); a++){ if (tab.getColumn(a)->getPrimaryKey() == true){ if(equalForAttr(pOp, a, r+recordNo) != 0){ ERR(pTrans->getNdbError()); @@ -123,7 +123,7 @@ int HugoOperations::pkDirtyReadRecord(Ndb* pNdb, } // Define attributes to read - for(int a = 0; a<tab.getNoOfColumns(); a++){ + for(a = 0; a<tab.getNoOfColumns(); a++){ if((rows[r]->attributeStore(a) = pOp->getValue(tab.getColumn(a)->getName())) == 0) { ERR(pTrans->getNdbError()); @@ -137,7 +137,7 @@ int HugoOperations::pkDirtyReadRecord(Ndb* pNdb, int HugoOperations::pkSimpleReadRecord(Ndb* pNdb, int recordNo, int numRecords){ - + int a; allocRows(numRecords); int check; for(int r=0; r < numRecords; r++){ @@ -155,7 +155,7 @@ int HugoOperations::pkSimpleReadRecord(Ndb* pNdb, } // Define primary keys - for(int a = 0; a<tab.getNoOfColumns(); a++){ + for(a = 0; a<tab.getNoOfColumns(); a++){ if (tab.getColumn(a)->getPrimaryKey() == true){ if(equalForAttr(pOp, a, r+recordNo) != 0){ ERR(pTrans->getNdbError()); @@ -165,7 +165,7 @@ int HugoOperations::pkSimpleReadRecord(Ndb* pNdb, } // Define attributes to read - for(int a = 0; a<tab.getNoOfColumns(); a++){ + for(a = 0; a<tab.getNoOfColumns(); a++){ if((rows[r]->attributeStore(a) = pOp->getValue(tab.getColumn(a)->getName())) == 0) { ERR(pTrans->getNdbError()); @@ -180,7 +180,7 @@ int HugoOperations::pkUpdateRecord(Ndb* pNdb, int recordNo, int numRecords, int updatesValue){ - + int a; allocRows(numRecords); int check; for(int r=0; r < numRecords; r++){ @@ -197,7 +197,7 @@ int HugoOperations::pkUpdateRecord(Ndb* pNdb, } // Define primary keys - for(int a = 0; a<tab.getNoOfColumns(); a++){ + for(a = 0; a<tab.getNoOfColumns(); a++){ if (tab.getColumn(a)->getPrimaryKey() == true){ if(equalForAttr(pOp, a, r+recordNo) != 0){ ERR(pTrans->getNdbError()); @@ -207,7 +207,7 @@ int HugoOperations::pkUpdateRecord(Ndb* pNdb, } // Define attributes to update - for(int a = 0; a<tab.getNoOfColumns(); a++){ + for(a = 0; a<tab.getNoOfColumns(); a++){ if (tab.getColumn(a)->getPrimaryKey() == false){ if(setValueForAttr(pOp, a, recordNo+r, updatesValue ) != 0){ ERR(pTrans->getNdbError()); @@ -224,7 +224,7 @@ int HugoOperations::pkInsertRecord(Ndb* pNdb, int numRecords, int updatesValue){ - int check; + int a, check; for(int r=0; r < numRecords; r++){ NdbOperation* pOp = pTrans->getNdbOperation(tab.getName()); if (pOp == NULL) { @@ -239,7 +239,7 @@ int HugoOperations::pkInsertRecord(Ndb* pNdb, } // Define primary keys - for(int a = 0; a<tab.getNoOfColumns(); a++){ + for(a = 0; a<tab.getNoOfColumns(); a++){ if (tab.getColumn(a)->getPrimaryKey() == true){ if(equalForAttr(pOp, a, r+recordNo) != 0){ ERR(pTrans->getNdbError()); @@ -249,7 +249,7 @@ int HugoOperations::pkInsertRecord(Ndb* pNdb, } // Define attributes to update - for(int a = 0; a<tab.getNoOfColumns(); a++){ + for(a = 0; a<tab.getNoOfColumns(); a++){ if (tab.getColumn(a)->getPrimaryKey() == false){ if(setValueForAttr(pOp, a, recordNo+r, updatesValue ) != 0){ ERR(pTrans->getNdbError()); @@ -265,7 +265,7 @@ int HugoOperations::pkDeleteRecord(Ndb* pNdb, int recordNo, int numRecords){ - int check; + int a, check; for(int r=0; r < numRecords; r++){ NdbOperation* pOp = pTrans->getNdbOperation(tab.getName()); if (pOp == NULL) { @@ -280,7 +280,7 @@ int HugoOperations::pkDeleteRecord(Ndb* pNdb, } // Define primary keys - for(int a = 0; a<tab.getNoOfColumns(); a++){ + for(a = 0; a<tab.getNoOfColumns(); a++){ if (tab.getColumn(a)->getPrimaryKey() == true){ if(equalForAttr(pOp, a, r+recordNo) != 0){ ERR(pTrans->getNdbError()); @@ -619,6 +619,7 @@ int HugoOperations::indexReadRecords(Ndb*, const char * idxName, int recordNo, bool exclusive, int numRecords){ + int a; allocRows(numRecords); int check; for(int r=0; r < numRecords; r++){ @@ -638,7 +639,7 @@ int HugoOperations::indexReadRecords(Ndb*, const char * idxName, int recordNo, } // Define primary keys - for(int a = 0; a<tab.getNoOfColumns(); a++){ + for(a = 0; a<tab.getNoOfColumns(); a++){ if (tab.getColumn(a)->getPrimaryKey() == true){ if(equalForAttr(pOp, a, r+recordNo) != 0){ ERR(pTrans->getNdbError()); @@ -648,7 +649,7 @@ int HugoOperations::indexReadRecords(Ndb*, const char * idxName, int recordNo, } // Define attributes to read - for(int a = 0; a<tab.getNoOfColumns(); a++){ + for(a = 0; a<tab.getNoOfColumns(); a++){ if((rows[r]->attributeStore(a) = pOp->getValue(tab.getColumn(a)->getName())) == 0) { ERR(pTrans->getNdbError()); @@ -665,7 +666,7 @@ HugoOperations::indexUpdateRecord(Ndb*, int recordNo, int numRecords, int updatesValue){ - + int a; allocRows(numRecords); int check; for(int r=0; r < numRecords; r++){ @@ -682,7 +683,7 @@ HugoOperations::indexUpdateRecord(Ndb*, } // Define primary keys - for(int a = 0; a<tab.getNoOfColumns(); a++){ + for(a = 0; a<tab.getNoOfColumns(); a++){ if (tab.getColumn(a)->getPrimaryKey() == true){ if(equalForAttr(pOp, a, r+recordNo) != 0){ ERR(pTrans->getNdbError()); @@ -692,7 +693,7 @@ HugoOperations::indexUpdateRecord(Ndb*, } // Define attributes to update - for(int a = 0; a<tab.getNoOfColumns(); a++){ + for(a = 0; a<tab.getNoOfColumns(); a++){ if (tab.getColumn(a)->getPrimaryKey() == false){ if(setValueForAttr(pOp, a, recordNo+r, updatesValue ) != 0){ ERR(pTrans->getNdbError()); diff --git a/ndb/test/src/HugoTransactions.cpp b/ndb/test/src/HugoTransactions.cpp index 882b9185ea8..05039562c76 100644 --- a/ndb/test/src/HugoTransactions.cpp +++ b/ndb/test/src/HugoTransactions.cpp @@ -46,7 +46,7 @@ HugoTransactions::scanReadRecords(Ndb* pNdb, int retryAttempt = 0; const int retryMax = 100; - int check; + int check, a; NdbConnection *pTrans; NdbScanOperation *pOp; @@ -96,7 +96,7 @@ HugoTransactions::scanReadRecords(Ndb* pNdb, return NDBT_FAILED; } - for(int a = 0; a<tab.getNoOfColumns(); a++){ + for(a = 0; a<tab.getNoOfColumns(); a++){ if((row.attributeStore(a) = pOp->getValue(tab.getColumn(a)->getName())) == 0) { ERR(pTrans->getNdbError()); @@ -220,7 +220,7 @@ HugoTransactions::scanUpdateRecords1(Ndb* pNdb, #else int retryAttempt = 0; const int retryMax = 100; - int check; + int check, a; NdbConnection *pTrans; NdbOperation *pOp; @@ -269,7 +269,7 @@ HugoTransactions::scanUpdateRecords1(Ndb* pNdb, } // Read all attributes from this table - for(int a=0; a<tab.getNoOfColumns(); a++){ + for(a=0; a<tab.getNoOfColumns(); a++){ if((row.attributeStore(a) = pOp->getValue(tab.getColumn(a)->getName())) == NULL){ ERR(pTrans->getNdbError()); pNdb->closeTransaction(pTrans); @@ -387,7 +387,7 @@ HugoTransactions::scanUpdateRecords2(Ndb* pNdb, #else int retryAttempt = 0; const int retryMax = 100; - int check; + int check, a; NdbConnection *pTrans; NdbOperation *pOp; @@ -436,7 +436,7 @@ HugoTransactions::scanUpdateRecords2(Ndb* pNdb, } // Read all attributes from this table - for(int a=0; a<tab.getNoOfColumns(); a++){ + for(a=0; a<tab.getNoOfColumns(); a++){ if((row.attributeStore(a) = pOp->getValue(tab.getColumn(a)->getName())) == NULL){ ERR(pTrans->getNdbError()); pNdb->closeTransaction(pTrans); @@ -553,7 +553,7 @@ HugoTransactions::scanUpdateRecords3(Ndb* pNdb, int parallelism){ int retryAttempt = 0; const int retryMax = 100; - int check; + int check, a; NdbConnection *pTrans; NdbScanOperation *pOp; @@ -592,7 +592,7 @@ HugoTransactions::scanUpdateRecords3(Ndb* pNdb, } // Read all attributes from this table - for(int a=0; a<tab.getNoOfColumns(); a++){ + for(a=0; a<tab.getNoOfColumns(); a++){ if((row.attributeStore(a) = pOp->getValue(tab.getColumn(a)->getName())) == NULL){ ERR(pTrans->getNdbError()); pNdb->closeTransaction(pTrans); @@ -634,7 +634,7 @@ HugoTransactions::scanUpdateRecords3(Ndb* pNdb, } const int updates = calc.getUpdatesValue(&row) + 1; const int r = calc.getIdValue(&row); - for(int a = 0; a<tab.getNoOfColumns(); a++){ + for(a = 0; a<tab.getNoOfColumns(); a++){ if (tab.getColumn(a)->getPrimaryKey() == false){ if(setValueForAttr(pUp, a, r, updates ) != 0){ ERR(pTrans->getNdbError()); @@ -695,7 +695,7 @@ HugoTransactions::loadTable(Ndb* pNdb, bool allowConstraintViolation, int doSleep, bool oneTrans){ - int check; + int check, a; int retryAttempt = 0; int retryMax = 5; NdbConnection *pTrans; @@ -763,7 +763,7 @@ HugoTransactions::loadTable(Ndb* pNdb, } // Set a calculated value for each attribute in this table - for (int a = 0; a<tab.getNoOfColumns(); a++){ + for (a = 0; a<tab.getNoOfColumns(); a++){ if(setValueForAttr(pOp, a, c+b, 0 ) != 0){ ERR(pTrans->getNdbError()); pNdb->closeTransaction(pTrans); @@ -838,7 +838,7 @@ HugoTransactions::loadTable(Ndb* pNdb, int HugoTransactions::fillTable(Ndb* pNdb, int batch){ - int check; + int check, a, b; int retryAttempt = 0; int retryMax = 5; NdbConnection *pTrans; @@ -869,7 +869,7 @@ HugoTransactions::fillTable(Ndb* pNdb, return NDBT_FAILED; } - for(int b = 0; b < batch; b++){ + for(b = 0; b < batch; b++){ pOp = pTrans->getNdbOperation(tab.getName()); if (pOp == NULL) { @@ -886,7 +886,7 @@ HugoTransactions::fillTable(Ndb* pNdb, } // Set a calculated value for each attribute in this table - for (int a = 0; a<tab.getNoOfColumns(); a++){ + for (a = 0; a<tab.getNoOfColumns(); a++){ if(setValueForAttr(pOp, a, c+b, 0 ) != 0){ ERR(pTrans->getNdbError()); pNdb->closeTransaction(pTrans); @@ -1025,7 +1025,7 @@ int HugoTransactions::eventOperation(Ndb* pNdb, void* pstats, int records) { int myXXXXX = XXXXX++; - + Uint32 i; const char function[] = "HugoTransactions::eventOperation: "; struct receivedEvent* recInsertEvent; NdbAutoObjArrayPtr<struct receivedEvent> @@ -1042,7 +1042,7 @@ HugoTransactions::eventOperation(Ndb* pNdb, void* pstats, stats.n_duplicates = 0; stats.n_inconsistent_gcis = 0; - for (int i = 0; i < records; i++) { + for (i = 0; i < records; i++) { recInsertEvent[i].pk = 0xFFFFFFFF; recInsertEvent[i].count = 0; recInsertEvent[i].event = 0xFFFFFFFF; @@ -1150,7 +1150,7 @@ HugoTransactions::eventOperation(Ndb* pNdb, void* pstats, } g_info << "overrun " << overrun << " pk " << pk; - for (int i = 1; i < noEventColumnName; i++) { + for (i = 1; i < noEventColumnName; i++) { if (recAttr[i]->isNULL() >= 0) { // we have a value g_info << " post[" << i << "]="; if (recAttr[i]->isNULL() == 0) // we have a non-null value @@ -1193,7 +1193,7 @@ HugoTransactions::eventOperation(Ndb* pNdb, void* pstats, if (stats.n_updates > 0) { stats.n_consecutive++; } - for (Uint32 i = 0; i < (Uint32)records/3; i++) { + for (i = 0; i < (Uint32)records/3; i++) { if (recInsertEvent[i].pk != i) { stats.n_consecutive ++; ndbout << "missing insert pk " << i << endl; @@ -1232,7 +1232,7 @@ HugoTransactions::pkReadRecords(Ndb* pNdb, int r = 0; int retryAttempt = 0; const int retryMax = 100; - int check; + int check, a; NdbConnection *pTrans; NdbOperation *pOp; @@ -1284,7 +1284,7 @@ HugoTransactions::pkReadRecords(Ndb* pNdb, } // Define primary keys - for(int a = 0; a<tab.getNoOfColumns(); a++){ + for(a = 0; a<tab.getNoOfColumns(); a++){ if (tab.getColumn(a)->getPrimaryKey() == true){ if(equalForAttr(pOp, a, r+b) != 0){ ERR(pTrans->getNdbError()); @@ -1295,7 +1295,7 @@ HugoTransactions::pkReadRecords(Ndb* pNdb, } // Define attributes to read - for(int a = 0; a<tab.getNoOfColumns(); a++){ + for(a = 0; a<tab.getNoOfColumns(); a++){ if((rows[b]->attributeStore(a) = pOp->getValue(tab.getColumn(a)->getName())) == 0) { ERR(pTrans->getNdbError()); @@ -1358,7 +1358,7 @@ HugoTransactions::pkUpdateRecords(Ndb* pNdb, int r = 0; int retryAttempt = 0; const int retryMax = 100; - int check; + int check, a, b; NdbConnection *pTrans; NdbOperation *pOp; @@ -1390,7 +1390,7 @@ HugoTransactions::pkUpdateRecords(Ndb* pNdb, return NDBT_FAILED; } - for(int b = 0; b<batch && (r+b) < records; b++){ + for(b = 0; b<batch && (r+b) < records; b++){ pOp = pTrans->getNdbOperation(tab.getName()); if (pOp == NULL) { ERR(pTrans->getNdbError()); @@ -1406,7 +1406,7 @@ HugoTransactions::pkUpdateRecords(Ndb* pNdb, } // Define primary keys - for(int a = 0; a<tab.getNoOfColumns(); a++){ + for(a = 0; a<tab.getNoOfColumns(); a++){ if (tab.getColumn(a)->getPrimaryKey() == true){ if(equalForAttr(pOp, a, r+b) != 0){ ERR(pTrans->getNdbError()); @@ -1417,7 +1417,7 @@ HugoTransactions::pkUpdateRecords(Ndb* pNdb, } // Define attributes to read - for(int a = 0; a<tab.getNoOfColumns(); a++){ + for(a = 0; a<tab.getNoOfColumns(); a++){ if((rows[b]->attributeStore(a) = pOp->getValue(tab.getColumn(a)->getName())) == 0) { ERR(pTrans->getNdbError()); @@ -1443,7 +1443,7 @@ HugoTransactions::pkUpdateRecords(Ndb* pNdb, return NDBT_FAILED; } - for(int b = 0; b<batch && (b+r)<records; b++){ + for(b = 0; b<batch && (b+r)<records; b++){ if (calc.verifyRowValues(rows[b]) != 0){ pNdb->closeTransaction(pTrans); return NDBT_FAILED; @@ -1466,7 +1466,7 @@ HugoTransactions::pkUpdateRecords(Ndb* pNdb, return NDBT_FAILED; } - for(int a = 0; a<tab.getNoOfColumns(); a++){ + for(a = 0; a<tab.getNoOfColumns(); a++){ if (tab.getColumn(a)->getPrimaryKey() == true){ if(equalForAttr(pUpdOp, a, r+b) != 0){ ERR(pTrans->getNdbError()); @@ -1476,7 +1476,7 @@ HugoTransactions::pkUpdateRecords(Ndb* pNdb, } } - for(int a = 0; a<tab.getNoOfColumns(); a++){ + for(a = 0; a<tab.getNoOfColumns(); a++){ if (tab.getColumn(a)->getPrimaryKey() == false){ if(setValueForAttr(pUpdOp, a, r+b, updates ) != 0){ ERR(pTrans->getNdbError()); @@ -1526,7 +1526,7 @@ HugoTransactions::pkInterpretedUpdateRecords(Ndb* pNdb, int r = 0; int retryAttempt = 0; const int retryMax = 100; - int check; + int check, a; NdbConnection *pTrans; while (r < records){ @@ -1566,7 +1566,7 @@ HugoTransactions::pkInterpretedUpdateRecords(Ndb* pNdb, } // Define primary keys - for(int a = 0; a<tab.getNoOfColumns(); a++){ + for(a = 0; a<tab.getNoOfColumns(); a++){ if (tab.getColumn(a)->getPrimaryKey() == true){ if(equalForAttr(pOp, a, r) != 0){ ERR(pTrans->getNdbError()); @@ -1577,7 +1577,7 @@ HugoTransactions::pkInterpretedUpdateRecords(Ndb* pNdb, } // Read update value - for(int a = 0; a<tab.getNoOfColumns(); a++){ + for(a = 0; a<tab.getNoOfColumns(); a++){ if (calc.isUpdateCol(a) == true){ if((row.attributeStore(a) = pOp->getValue(tab.getColumn(a)->getName())) == 0) { @@ -1622,7 +1622,7 @@ HugoTransactions::pkInterpretedUpdateRecords(Ndb* pNdb, } // PKs - for(int a = 0; a<tab.getNoOfColumns(); a++){ + for(a = 0; a<tab.getNoOfColumns(); a++){ if (tab.getColumn(a)->getPrimaryKey() == true){ if(equalForAttr(pUpdOp, a, r) != 0){ ERR(pTrans->getNdbError()); @@ -1633,7 +1633,7 @@ HugoTransactions::pkInterpretedUpdateRecords(Ndb* pNdb, } // Update col - for(int a = 0; a<tab.getNoOfColumns(); a++){ + for(a = 0; a<tab.getNoOfColumns(); a++){ if ((tab.getColumn(a)->getPrimaryKey() == false) && (calc.isUpdateCol(a) == true)){ @@ -1650,7 +1650,7 @@ HugoTransactions::pkInterpretedUpdateRecords(Ndb* pNdb, } // Remaining attributes - for(int a = 0; a<tab.getNoOfColumns(); a++){ + for(a = 0; a<tab.getNoOfColumns(); a++){ if ((tab.getColumn(a)->getPrimaryKey() == false) && (calc.isUpdateCol(a) == false)){ if(setValueForAttr(pUpdOp, a, r, updates ) != 0){ @@ -1705,7 +1705,7 @@ HugoTransactions::pkDelRecords(Ndb* pNdb, int r = 0; int retryAttempt = 0; const int retryMax = 100; - int check; + int check, a; NdbConnection *pTrans; NdbOperation *pOp; @@ -1750,7 +1750,7 @@ HugoTransactions::pkDelRecords(Ndb* pNdb, } // Define primary keys - for(int a = 0; a<tab.getNoOfColumns(); a++){ + for(a = 0; a<tab.getNoOfColumns(); a++){ if (tab.getColumn(a)->getPrimaryKey() == true){ if(equalForAttr(pOp, a, r) != 0){ ERR(pTrans->getNdbError()); @@ -1820,7 +1820,7 @@ HugoTransactions::lockRecords(Ndb* pNdb, int r = 0; int retryAttempt = 0; const int retryMax = 100; - int check; + int check, a, b; NdbConnection *pTrans; NdbOperation *pOp; @@ -1857,7 +1857,7 @@ HugoTransactions::lockRecords(Ndb* pNdb, return NDBT_FAILED; } - for(int b = 0; (b<lockBatch) && (r+b < records); b++){ + for(b = 0; (b<lockBatch) && (r+b < records); b++){ pOp = pTrans->getNdbOperation(tab.getName()); if (pOp == NULL) { ERR(pTrans->getNdbError()); @@ -1873,7 +1873,7 @@ HugoTransactions::lockRecords(Ndb* pNdb, } // Define primary keys - for(int a = 0; a<tab.getNoOfColumns(); a++){ + for(a = 0; a<tab.getNoOfColumns(); a++){ if (tab.getColumn(a)->getPrimaryKey() == true){ if(equalForAttr(pOp, a, r+b) != 0){ ERR(pTrans->getNdbError()); @@ -1884,7 +1884,7 @@ HugoTransactions::lockRecords(Ndb* pNdb, } // Define attributes to read - for(int a = 0; a<tab.getNoOfColumns(); a++){ + for(a = 0; a<tab.getNoOfColumns(); a++){ if((rows[b]->attributeStore(a) = pOp->getValue(tab.getColumn(a)->getName())) == 0) { ERR(pTrans->getNdbError()); @@ -1967,7 +1967,7 @@ HugoTransactions::indexReadRecords(Ndb* pNdb, int r = 0; int retryAttempt = 0; const int retryMax = 100; - int check; + int check, a; NdbConnection *pTrans; NdbOperation *pOp; NdbIndexScanOperation *sOp; @@ -2039,7 +2039,7 @@ HugoTransactions::indexReadRecords(Ndb* pNdb, } // Define primary keys - for(int a = 0; a<tab.getNoOfColumns(); a++){ + for(a = 0; a<tab.getNoOfColumns(); a++){ if (tab.getColumn(a)->getPrimaryKey() == true){ if(equalForAttr(pOp, a, r+b) != 0){ ERR(pTrans->getNdbError()); @@ -2050,7 +2050,7 @@ HugoTransactions::indexReadRecords(Ndb* pNdb, } // Define attributes to read - for(int a = 0; a<tab.getNoOfColumns(); a++){ + for(a = 0; a<tab.getNoOfColumns(); a++){ if((rows[b]->attributeStore(a) = pOp->getValue(tab.getColumn(a)->getName())) == 0) { ERR(pTrans->getNdbError()); @@ -2118,7 +2118,7 @@ HugoTransactions::indexUpdateRecords(Ndb* pNdb, int r = 0; int retryAttempt = 0; const int retryMax = 100; - int check; + int check, a, b; NdbConnection *pTrans; NdbOperation *pOp; NdbScanOperation * sOp; @@ -2155,7 +2155,7 @@ HugoTransactions::indexUpdateRecords(Ndb* pNdb, return NDBT_FAILED; } - for(int b = 0; b<batchsize && (b+r)<records; b++){ + for(b = 0; b<batchsize && (b+r)<records; b++){ if(!ordered){ pOp = pTrans->getNdbIndexOperation(idxName, tab.getName()); if (pOp == NULL) { @@ -2183,7 +2183,7 @@ HugoTransactions::indexUpdateRecords(Ndb* pNdb, } // Define primary keys - for(int a = 0; a<tab.getNoOfColumns(); a++){ + for(a = 0; a<tab.getNoOfColumns(); a++){ if (tab.getColumn(a)->getPrimaryKey() == true){ if(equalForAttr(pOp, a, r+b) != 0){ ERR(pTrans->getNdbError()); @@ -2194,7 +2194,7 @@ HugoTransactions::indexUpdateRecords(Ndb* pNdb, } // Define attributes to read - for(int a = 0; a<tab.getNoOfColumns(); a++){ + for(a = 0; a<tab.getNoOfColumns(); a++){ if((rows[b]->attributeStore(a) = pOp->getValue(tab.getColumn(a)->getName())) == 0) { ERR(pTrans->getNdbError()); @@ -2225,7 +2225,7 @@ HugoTransactions::indexUpdateRecords(Ndb* pNdb, return NDBT_FAILED; } - for(int b = 0; b<batchsize && (b+r)<records; b++){ + for(b = 0; b<batchsize && (b+r)<records; b++){ if (calc.verifyRowValues(rows[b]) != 0){ pNdb->closeTransaction(pTrans); return NDBT_FAILED; @@ -2254,7 +2254,7 @@ HugoTransactions::indexUpdateRecords(Ndb* pNdb, } if(!ordered){ - for(int a = 0; a<tab.getNoOfColumns(); a++){ + for(a = 0; a<tab.getNoOfColumns(); a++){ if (tab.getColumn(a)->getPrimaryKey() == true){ if(equalForAttr(pUpdOp, a, r+b) != 0){ ERR(pTrans->getNdbError()); @@ -2265,7 +2265,7 @@ HugoTransactions::indexUpdateRecords(Ndb* pNdb, } } - for(int a = 0; a<tab.getNoOfColumns(); a++){ + for(a = 0; a<tab.getNoOfColumns(); a++){ if (tab.getColumn(a)->getPrimaryKey() == false){ if(setValueForAttr(pUpdOp, a, r+b, updates ) != 0){ ERR(pTrans->getNdbError()); @@ -2302,4 +2302,4 @@ HugoTransactions::indexUpdateRecords(Ndb* pNdb, return NDBT_OK; } - +template class Vector<NDBT_ResultRow*>; diff --git a/ndb/test/src/NDBT_Tables.cpp b/ndb/test/src/NDBT_Tables.cpp index ce8fe68d8a4..e1806559150 100644 --- a/ndb/test/src/NDBT_Tables.cpp +++ b/ndb/test/src/NDBT_Tables.cpp @@ -694,17 +694,18 @@ NdbDictionary::Table* NDBT_Tables::getTable(const char* _nam){ // Search tables list to find a table NDBT_Table* tab = NULL; - for (int i=0; i<numTestTables; i++){ + int i; + for (i=0; i<numTestTables; i++){ if (strcmp(test_tables[i]->getName(), _nam) == 0){ return test_tables[i]; } } - for (int i=0; i<numFailTables; i++){ + for (i=0; i<numFailTables; i++){ if (strcmp(fail_tables[i]->getName(), _nam) == 0){ return fail_tables[i]; } } - for (int i=0; i<numUtilTables; i++){ + for (i=0; i<numUtilTables; i++){ if (strcmp(util_tables[i]->getName(), _nam) == 0){ return util_tables[i]; } diff --git a/ndb/test/src/NDBT_Test.cpp b/ndb/test/src/NDBT_Test.cpp index 06eb3f4e9e2..ed9967fdb9a 100644 --- a/ndb/test/src/NDBT_Test.cpp +++ b/ndb/test/src/NDBT_Test.cpp @@ -347,24 +347,24 @@ NDBT_TestCaseImpl1::NDBT_TestCaseImpl1(NDBT_TestSuite* psuite, NDBT_TestCaseImpl1::~NDBT_TestCaseImpl1(){ NdbCondition_Destroy(waitThreadsCondPtr); NdbMutex_Destroy(waitThreadsMutexPtr); - - for(size_t i = 0; i < initializers.size(); i++) + size_t i; + for(i = 0; i < initializers.size(); i++) delete initializers[i]; initializers.clear(); - for(size_t i = 0; i < verifiers.size(); i++) + for(i = 0; i < verifiers.size(); i++) delete verifiers[i]; verifiers.clear(); - for(size_t i = 0; i < finalizers.size(); i++) + for(i = 0; i < finalizers.size(); i++) delete finalizers[i]; finalizers.clear(); - for(size_t i = 0; i < steps.size(); i++) + for(i = 0; i < steps.size(); i++) delete steps[i]; steps.clear(); results.clear(); - for(size_t i = 0; i < testTables.size(); i++) + for(i = 0; i < testTables.size(); i++) delete testTables[i]; testTables.clear(); - for(size_t i = 0; i < testResults.size(); i++) + for(i = 0; i < testResults.size(); i++) delete testResults[i]; testResults.clear(); @@ -498,7 +498,8 @@ void NDBT_TestCaseImpl1::waitSteps(){ waitThreadsMutexPtr); unsigned completedSteps = 0; - for(unsigned i=0; i<steps.size(); i++){ + unsigned i; + for(i=0; i<steps.size(); i++){ if (results[i] != NORESULT){ completedSteps++; if (results[i] == NDBT_OK) @@ -512,7 +513,7 @@ void NDBT_TestCaseImpl1::waitSteps(){ NdbMutex_Unlock(waitThreadsMutexPtr); void *status; - for(unsigned i=0; i<steps.size();i++){ + for(i=0; i<steps.size();i++){ NdbThread_WaitFor(threads[i], &status); NdbThread_Destroy(&threads[i]); } @@ -644,12 +645,12 @@ int NDBT_TestCaseImpl1::runSteps(NDBT_Context* ctx){ numStepsOk = 0; numStepsFail = 0; numStepsCompleted = 0; - - for (unsigned i = 0; i < steps.size(); i++) + unsigned i; + for (i = 0; i < steps.size(); i++) startStepInThread(i, ctx); waitSteps(); - for(unsigned i = 0; i < steps.size(); i++) + for(i = 0; i < steps.size(); i++) if (results[i] != NDBT_OK) res = NDBT_FAILED; return res; @@ -1104,20 +1105,20 @@ void NDBT_TestCaseImpl1::print(){ abort(); } } - - for(unsigned i=0; i<initializers.size(); i++){ + unsigned i; + for(i=0; i<initializers.size(); i++){ ndbout << "Initializers[" << i << "]: " << endl; initializers[i]->print(); } - for(unsigned i=0; i<steps.size(); i++){ + for(i=0; i<steps.size(); i++){ ndbout << "Step[" << i << "]: " << endl; steps[i]->print(); } - for(unsigned i=0; i<verifiers.size(); i++){ + for(i=0; i<verifiers.size(); i++){ ndbout << "Verifier[" << i << "]: " << endl; verifiers[i]->print(); } - for(unsigned i=0; i<finalizers.size(); i++){ + for(i=0; i<finalizers.size(); i++){ ndbout << "Finalizer[" << i << "]: " << endl; finalizers[i]->print(); } @@ -1129,6 +1130,12 @@ void NDBT_Step::print(){ } - - - +template class Vector<NDBT_TestCase*>; +template class Vector<NDBT_TestCaseResult*>; +template class Vector<NDBT_Step*>; +template class Vector<NdbThread*>; +template class Vector<NDBT_Verifier*>; +template class Vector<NDBT_Initializer*>; +template class Vector<NDBT_Finalizer*>; +template class Vector<const NdbDictionary::Table*>; +template class Vector<int>; diff --git a/ndb/test/src/NdbRestarter.cpp b/ndb/test/src/NdbRestarter.cpp index 34184449acc..6d5abccf0e4 100644 --- a/ndb/test/src/NdbRestarter.cpp +++ b/ndb/test/src/NdbRestarter.cpp @@ -670,3 +670,5 @@ NdbRestarter::getConfig(){ m_config = ndb_mgm_get_configuration(handle, 0); return m_config; } + +template class Vector<ndb_mgm_node_state>; diff --git a/ndb/test/src/NdbRestarts.cpp b/ndb/test/src/NdbRestarts.cpp index f6a85d69fc2..b649a60d98b 100644 --- a/ndb/test/src/NdbRestarts.cpp +++ b/ndb/test/src/NdbRestarts.cpp @@ -625,9 +625,9 @@ int restartNFDuringNR(NdbRestarter& _restarter, const NdbRestarts::NdbRestart* _restart){ myRandom48Init(NdbTick_CurrentMillisecond()); - + int i; const int sz = sizeof(NFDuringNR_codes)/sizeof(NFDuringNR_codes[0]); - for(int i = 0; i<sz; i++){ + for(i = 0; i<sz; i++){ int randomId = myRandom48(_restarter.getNumDbNodes()); int nodeId = _restarter.getDbNodeId(randomId); int error = NFDuringNR_codes[i]; @@ -673,7 +673,7 @@ int restartNFDuringNR(NdbRestarter& _restarter, if(NdbEnv_GetEnv("USER", buf, 256) == 0 || strcmp(buf, "ejonore") != 0) return NDBT_OK; - for(int i = 0; i<sz; i++){ + for(i = 0; i<sz; i++){ const int randomId = myRandom48(_restarter.getNumDbNodes()); int nodeId = _restarter.getDbNodeId(randomId); const int error = NFDuringNR_codes[i]; @@ -753,14 +753,14 @@ NRDuringLCP_NonMaster_codes[] = { int restartNodeDuringLCP(NdbRestarter& _restarter, const NdbRestarts::NdbRestart* _restart) { - + int i; // Master int val = DumpStateOrd::DihMinTimeBetweenLCP; CHECK(_restarter.dumpStateAllNodes(&val, 1) == 0, "Failed to set LCP to min value"); // Set LCP to min val int sz = sizeof(NRDuringLCP_Master_codes)/ sizeof(NRDuringLCP_Master_codes[0]); - for(int i = 0; i<sz; i++) { + for(i = 0; i<sz; i++) { int error = NRDuringLCP_Master_codes[i]; int masterNodeId = _restarter.getMasterNodeId(); @@ -798,7 +798,7 @@ int restartNodeDuringLCP(NdbRestarter& _restarter, // NON-Master sz = sizeof(NRDuringLCP_NonMaster_codes)/ sizeof(NRDuringLCP_NonMaster_codes[0]); - for(int i = 0; i<sz; i++) { + for(i = 0; i<sz; i++) { int error = NRDuringLCP_NonMaster_codes[i]; int nodeId = getRandomNodeId(_restarter); diff --git a/ndb/test/src/UtilTransactions.cpp b/ndb/test/src/UtilTransactions.cpp index a5a61cd0a34..9f3f1d33587 100644 --- a/ndb/test/src/UtilTransactions.cpp +++ b/ndb/test/src/UtilTransactions.cpp @@ -1040,7 +1040,7 @@ UtilTransactions::readRowFromTableAndIndex(Ndb* pNdb, NdbDictionary::Index::Type indexType= pIndex->getType(); int retryAttempt = 0; const int retryMax = 100; - int check; + int check, a; NdbConnection *pTrans1=NULL; NdbResultSet *cursor= NULL; NdbOperation *pOp; @@ -1100,7 +1100,7 @@ UtilTransactions::readRowFromTableAndIndex(Ndb* pNdb, #if VERBOSE printf("PK: "); #endif - for(int a = 0; a<tab.getNoOfColumns(); a++){ + for(a = 0; a<tab.getNoOfColumns(); a++){ const NdbDictionary::Column* attr = tab.getColumn(a); if (attr->getPrimaryKey() == true){ if (pOp->equal(attr->getName(), row.attributeStore(a)->aRef()) != 0){ @@ -1119,7 +1119,7 @@ UtilTransactions::readRowFromTableAndIndex(Ndb* pNdb, #if VERBOSE printf("Reading %u attributes: ", tab.getNoOfColumns()); #endif - for(int a = 0; a<tab.getNoOfColumns(); a++){ + for(a = 0; a<tab.getNoOfColumns(); a++){ if((tabRow.attributeStore(a) = pOp->getValue(tab.getColumn(a)->getName())) == 0) { ERR(pTrans1->getNdbError()); @@ -1170,7 +1170,7 @@ UtilTransactions::readRowFromTableAndIndex(Ndb* pNdb, #if VERBOSE printf("SI: "); #endif - for(int a = 0; a<(int)pIndex->getNoOfColumns(); a++){ + for(a = 0; a<(int)pIndex->getNoOfColumns(); a++){ const NdbDictionary::Column * col = pIndex->getColumn(a); int r; @@ -1200,7 +1200,7 @@ UtilTransactions::readRowFromTableAndIndex(Ndb* pNdb, #if VERBOSE printf("Reading %u attributes: ", tab.getNoOfColumns()); #endif - for(int a = 0; a<tab.getNoOfColumns(); a++){ + for(a = 0; a<tab.getNoOfColumns(); a++){ void* pCheck; if (pIndexOp) diff --git a/ndb/test/tools/cpcc.cpp b/ndb/test/tools/cpcc.cpp index e768d707bbc..488bd812681 100644 --- a/ndb/test/tools/cpcc.cpp +++ b/ndb/test/tools/cpcc.cpp @@ -192,7 +192,7 @@ main(int argc, const char** argv){ ,{ "rm", 0, arg_flag, &rm, "-c rm", "undefine process(es)" } }; const int num_args = 10; - + int i; int optind = 0; char desc[] = "[host:[port]]\n"; @@ -215,13 +215,13 @@ main(int argc, const char** argv){ Expression * m_expr = 0; - for(int i = optind; i<argc; i++){ + for(i = optind; i<argc; i++){ add_host(g_hosts, argv[i]); } OrExpr * orE = new OrExpr(new Operate(cmd, g_settings), true); m_expr = orE; - for(int i = optind; i<argc; i++){ + for(i = optind; i<argc; i++){ BaseString tmp(argv[i]); Vector<BaseString> split; tmp.split(split, ":"); @@ -347,3 +347,4 @@ Operate::evaluate(SimpleCpcClient* c, const SimpleCpcClient::Process & pp){ return true; } +template class Vector<const ParserRow<SimpleCpcClient::ParserDummy>*>; diff --git a/ndb/test/tools/hugoPkReadRecord.cpp b/ndb/test/tools/hugoPkReadRecord.cpp index ac17ffffee8..85f20bd2060 100644 --- a/ndb/test/tools/hugoPkReadRecord.cpp +++ b/ndb/test/tools/hugoPkReadRecord.cpp @@ -43,7 +43,7 @@ int main(int argc, const char** argv) }; int num_args = sizeof(args) / sizeof(args[0]); - int optind = 0; + int optind = 0, i; if(getarg(args, num_args, argc, argv, &optind) || argv[optind] == NULL) { arg_printusage(args, num_args, argv[0], "table name\n"); @@ -80,7 +80,7 @@ int main(int argc, const char** argv) } op->readTuple(); NdbRecAttr** data = new NdbRecAttr*[table->getNoOfColumns()]; - for (int i = 0; i < table->getNoOfColumns(); i++) + for (i = 0; i < table->getNoOfColumns(); i++) { const NdbDictionary::Column* c = table->getColumn(i); if (c->getPrimaryKey()) @@ -93,11 +93,10 @@ int main(int argc, const char** argv) data[i] = op->getValue(c->getName(), NULL); } } - if (conn->execute(Commit) == 0) { // Print column names - for (int i = 0; i < table->getNoOfColumns(); i++) + for (i = 0; i < table->getNoOfColumns(); i++) { const NdbDictionary::Column* c = table->getColumn(i); @@ -111,7 +110,7 @@ int main(int argc, const char** argv) { g_info << hex; } - for (int i = 0; i < table->getNoOfColumns(); i++) + for (i = 0; i < table->getNoOfColumns(); i++) { NdbRecAttr* a = data[i]; switch(a->getType()) |