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 | |
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
93 files changed, 661 insertions, 551 deletions
diff --git a/BUILD/compile-irix-mips64-mipspro b/BUILD/compile-irix-mips64-mipspro index d8107ad73c0..1987fa13b1f 100755 --- a/BUILD/compile-irix-mips64-mipspro +++ b/BUILD/compile-irix-mips64-mipspro @@ -6,7 +6,7 @@ if [ ! -f "sql/mysqld.cc" ]; then fi cflags="-64 -mips4" - +config_args= if [ "$#" != 0 ]; then case "$1" in --help) @@ -25,8 +25,7 @@ if [ "$#" != 0 ]; then cflags="" ;; *) - echo "$0: invalid option '$1'; use --help to show usage" - exit 1 + config_args="$config_args $1"; shift ;; esac else @@ -79,6 +78,7 @@ cxxflags="$cxxflags -LANG:libc_in_namespace_std=OFF" CC=cc CXX=CC CFLAGS="$cflags" CXXFLAGS="$cxxflags" \ ./configure --prefix=/usr/local/mysql --disable-shared \ --with-extra-charsets=complex --enable-thread-safe-client \ - --without-extra-tools --disable-dependency-tracking + --without-extra-tools --disable-dependency-tracking \ + $config_args make diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 48434c2e75a..f45647f87c6 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -127,6 +127,7 @@ mysql@home.(none) mysqldev@build.mysql2.com mysqldev@melody.local mysqldev@mysql.com +mysqldev@o2k.irixworld.net ndbdev@eel.hemma.oreland.se ndbdev@ndbmaster.mysql.com nick@mysql.com diff --git a/ndb/include/kernel/NodeState.hpp b/ndb/include/kernel/NodeState.hpp index 3b4925868f5..185e3ea8ea4 100644 --- a/ndb/include/kernel/NodeState.hpp +++ b/ndb/include/kernel/NodeState.hpp @@ -109,7 +109,8 @@ public: NodeState(StartLevel); NodeState(StartLevel, bool systemShutdown); NodeState(StartLevel, Uint32 startPhase, StartType); - + void init(); + /** * Current start level */ @@ -180,6 +181,12 @@ public: inline NodeState::NodeState(){ + init(); +} + +inline +void +NodeState::init(){ startLevel = SL_CMVMI; nodeGroup = 0xFFFFFFFF; dynamicId = 0xFFFFFFFF; @@ -190,7 +197,7 @@ NodeState::NodeState(){ inline NodeState::NodeState(StartLevel sl){ - NodeState::NodeState(); + init(); startLevel = sl; singleUserMode = 0; singleUserApi = 0xFFFFFFFF; @@ -198,7 +205,7 @@ NodeState::NodeState(StartLevel sl){ inline NodeState::NodeState(StartLevel sl, Uint32 sp, StartType typeOfStart){ - NodeState::NodeState(); + init(); startLevel = sl; starting.startPhase = sp; starting.restartType = typeOfStart; @@ -208,7 +215,7 @@ NodeState::NodeState(StartLevel sl, Uint32 sp, StartType typeOfStart){ inline NodeState::NodeState(StartLevel sl, bool sys){ - NodeState::NodeState(); + init(); startLevel = sl; stopping.systemShutdown = sys; singleUserMode = 0; diff --git a/ndb/include/kernel/signaldata/SignalData.hpp b/ndb/include/kernel/signaldata/SignalData.hpp index 511e7d30c21..6e5748217b2 100644 --- a/ndb/include/kernel/signaldata/SignalData.hpp +++ b/ndb/include/kernel/signaldata/SignalData.hpp @@ -21,20 +21,10 @@ #include <ndb_limits.h> #include <kernel_types.h> -#ifndef NDB_ASSERT -#ifdef VM_TRACE -#define NDB_ASSERT(test, message) { if(!(test)) { printf(message); exit(-1); }} -#else -#define NDB_ASSERT(test, message) -#endif -#endif - -// Useful ASSERT macros... -#define ASSERT_BOOL(flag, message) NDB_ASSERT( (flag<=1), (message) ) +#define ASSERT_BOOL(flag, message) assert(flag<=1) #define ASSERT_RANGE(value, min, max, message) \ - NDB_ASSERT((value) >= (min) && (value) <= (max), (message)) -#define ASSERT_MAX(value, max, message) \ - NDB_ASSERT((value) <= (max), (message)) + assert((value) >= (min) && (value) <= (max)) +#define ASSERT_MAX(value, max, message) assert((value) <= (max)) #define SECTION(x) STATIC_CONST(x) diff --git a/ndb/include/mgmcommon/MgmtErrorReporter.hpp b/ndb/include/mgmcommon/MgmtErrorReporter.hpp index 925d9e6407a..0d980aa7245 100644 --- a/ndb/include/mgmcommon/MgmtErrorReporter.hpp +++ b/ndb/include/mgmcommon/MgmtErrorReporter.hpp @@ -63,12 +63,6 @@ // Returns: - //**************************************************************************** -#ifndef NDB_ASSERT -#define NDB_ASSERT(trueToContinue, message) \ - if ( !(trueToContinue) ) { \ -ndbout << "ASSERT FAILED. FILE: " << __FILE__ << ", LINE: " << __LINE__ << ", MSG: " << message << endl;exit(-1);} -#endif - #define MGM_REQUIRE(x) \ if (!(x)) { ndbout << __FILE__ << " " << __LINE__ \ << ": Warning! Requirement failed" << endl; } diff --git a/ndb/include/ndbapi/NdbDictionary.hpp b/ndb/include/ndbapi/NdbDictionary.hpp index 4a3adb61d9e..a69ec355ce8 100644 --- a/ndb/include/ndbapi/NdbDictionary.hpp +++ b/ndb/include/ndbapi/NdbDictionary.hpp @@ -325,7 +325,7 @@ public: /** * Get size of element */ - int Column::getSize() const; + int getSize() const; /** * Set distribution key diff --git a/ndb/include/util/Bitmask.hpp b/ndb/include/util/Bitmask.hpp index ee0140a2099..bb217adab5f 100644 --- a/ndb/include/util/Bitmask.hpp +++ b/ndb/include/util/Bitmask.hpp @@ -19,11 +19,6 @@ #include <ndb_global.h> -#ifndef NDB_ASSERT -#define NDB_ASSERT(x, s) \ - do { if (!(x)) { printf("%s\n", s); abort(); } } while (0) -#endif - /** * Bitmask implementation. Size is given explicitly * (as first argument). All methods are static. @@ -140,7 +135,7 @@ public: inline bool BitmaskImpl::get(unsigned size, const Uint32 data[], unsigned n) { - NDB_ASSERT(n < (size << 5), "bit get out of range"); + assert(n < (size << 5)); return (data[n >> 5] & (1 << (n & 31))) != 0; } @@ -153,7 +148,7 @@ BitmaskImpl::set(unsigned size, Uint32 data[], unsigned n, bool value) inline void BitmaskImpl::set(unsigned size, Uint32 data[], unsigned n) { - NDB_ASSERT(n < (size << 5), "bit set out of range"); + assert(n < (size << 5)); data[n >> 5] |= (1 << (n & 31)); } @@ -176,7 +171,7 @@ BitmaskImpl::assign(unsigned size, Uint32 dst[], const Uint32 src[]) inline void BitmaskImpl::clear(unsigned size, Uint32 data[], unsigned n) { - NDB_ASSERT(n < (size << 5), "bit clear out of range"); + assert(n < (size << 5)); data[n >> 5] &= ~(1 << (n & 31)); } @@ -493,14 +488,14 @@ template <unsigned size> inline void BitmaskPOD<size>::assign(const typename BitmaskPOD<size>::Data & src) { - assign(rep.data, src.data); + BitmaskPOD<size>::assign(rep.data, src.data); } template <unsigned size> inline void BitmaskPOD<size>::assign(const BitmaskPOD<size> & src) { - assign(rep.data, src.rep.data); + BitmaskPOD<size>::assign(rep.data, src.rep.data); } template <unsigned size> @@ -528,7 +523,7 @@ template <unsigned size> inline bool BitmaskPOD<size>::get(unsigned n) const { - return get(rep.data, n); + return BitmaskPOD<size>::get(rep.data, n); } template <unsigned size> @@ -542,7 +537,7 @@ template <unsigned size> inline void BitmaskPOD<size>::set(unsigned n, bool value) { - set(rep.data, n, value); + BitmaskPOD<size>::set(rep.data, n, value); } template <unsigned size> @@ -556,7 +551,7 @@ template <unsigned size> inline void BitmaskPOD<size>::set(unsigned n) { - set(rep.data, n); + BitmaskPOD<size>::set(rep.data, n); } template <unsigned size> @@ -570,7 +565,7 @@ template <unsigned size> inline void BitmaskPOD<size>::set() { - set(rep.data); + BitmaskPOD<size>::set(rep.data); } template <unsigned size> @@ -584,7 +579,7 @@ template <unsigned size> inline void BitmaskPOD<size>::clear(unsigned n) { - clear(rep.data, n); + BitmaskPOD<size>::clear(rep.data, n); } template <unsigned size> @@ -598,7 +593,7 @@ template <unsigned size> inline void BitmaskPOD<size>::clear() { - clear(rep.data); + BitmaskPOD<size>::clear(rep.data); } template <unsigned size> @@ -612,7 +607,7 @@ template <unsigned size> inline bool BitmaskPOD<size>::isclear() const { - return isclear(rep.data); + return BitmaskPOD<size>::isclear(rep.data); } template <unsigned size> @@ -626,7 +621,7 @@ template <unsigned size> inline unsigned BitmaskPOD<size>::count() const { - return count(rep.data); + return BitmaskPOD<size>::count(rep.data); } template <unsigned size> @@ -640,7 +635,7 @@ template <unsigned size> inline unsigned BitmaskPOD<size>::find(unsigned n) const { - return find(rep.data, n); + return BitmaskPOD<size>::find(rep.data, n); } template <unsigned size> @@ -654,7 +649,7 @@ template <unsigned size> inline bool BitmaskPOD<size>::equal(const BitmaskPOD<size>& mask2) const { - return equal(rep.data, mask2.rep.data); + return BitmaskPOD<size>::equal(rep.data, mask2.rep.data); } template <unsigned size> @@ -668,7 +663,7 @@ template <unsigned size> inline BitmaskPOD<size>& BitmaskPOD<size>::bitOR(const BitmaskPOD<size>& mask2) { - bitOR(rep.data, mask2.rep.data); + BitmaskPOD<size>::bitOR(rep.data, mask2.rep.data); return *this; } @@ -683,7 +678,7 @@ template <unsigned size> inline BitmaskPOD<size>& BitmaskPOD<size>::bitAND(const BitmaskPOD<size>& mask2) { - bitAND(rep.data, mask2.rep.data); + BitmaskPOD<size>::bitAND(rep.data, mask2.rep.data); return *this; } @@ -698,7 +693,7 @@ template <unsigned size> inline BitmaskPOD<size>& BitmaskPOD<size>::bitANDC(const BitmaskPOD<size>& mask2) { - bitANDC(rep.data, mask2.rep.data); + BitmaskPOD<size>::bitANDC(rep.data, mask2.rep.data); return *this; } @@ -713,7 +708,7 @@ template <unsigned size> inline BitmaskPOD<size>& BitmaskPOD<size>::bitXOR(const BitmaskPOD<size>& mask2) { - bitXOR(rep.data, mask2.rep.data); + BitmaskPOD<size>::bitXOR(rep.data, mask2.rep.data); return *this; } @@ -728,7 +723,7 @@ template <unsigned size> inline char * BitmaskPOD<size>::getText(char* buf) const { - return getText(rep.data, buf); + return BitmaskPOD<size>::getText(rep.data, buf); } template <unsigned size> @@ -742,7 +737,7 @@ template <unsigned size> inline bool BitmaskPOD<size>::contains(BitmaskPOD<size> that) { - return contains(this->rep.data, that.rep.data); + return BitmaskPOD<size>::contains(this->rep.data, that.rep.data); } template <unsigned size> @@ -756,7 +751,7 @@ template <unsigned size> inline bool BitmaskPOD<size>::overlaps(BitmaskPOD<size> that) { - return overlaps(this->rep.data, that.rep.data); + return BitmaskPOD<size>::overlaps(this->rep.data, that.rep.data); } template <unsigned size> diff --git a/ndb/src/common/debugger/DebuggerNames.cpp b/ndb/src/common/debugger/DebuggerNames.cpp index ebe94a6059f..2142138e435 100644 --- a/ndb/src/common/debugger/DebuggerNames.cpp +++ b/ndb/src/common/debugger/DebuggerNames.cpp @@ -29,10 +29,11 @@ static const char * localBlockNames[NO_OF_BLOCKS]; static int initSignalNames(const char * dst[], const GsnName src[], unsigned short len){ - for(int i = 0; i<=MAX_GSN; i++) + int i; + for(i = 0; i<=MAX_GSN; i++) dst[i] = 0; - for(int i = 0; i<len; i++){ + for(i = 0; i<len; i++){ unsigned short gsn = src[i].gsn; const char * name = src[i].name; @@ -54,10 +55,11 @@ int initSignalPrinters(SignalDataPrintFunction dst[], const NameFunctionPair src[], unsigned short len){ - for(int i = 0; i<=MAX_GSN; i++) + int i; + for(i = 0; i<=MAX_GSN; i++) dst[i] = 0; - for(int i = 0; i<len; i++){ + for(i = 0; i<len; i++){ unsigned short gsn = src[i].gsn; SignalDataPrintFunction fun = src[i].function; @@ -79,10 +81,11 @@ int initBlockNames(const char * dst[], const BlockName src[], unsigned len){ - for(int i = 0; i<NO_OF_BLOCKS; i++) + int i; + for(i = 0; i<NO_OF_BLOCKS; i++) dst[i] = 0; - for(unsigned i = 0; i<len; i++){ + for(i = 0; i<len; i++){ const int index = src[i].number - MIN_BLOCK_NO; if(index < 0 && index >= NO_OF_BLOCKS || dst[index] != 0){ fprintf(stderr, diff --git a/ndb/src/common/debugger/EventLogger.cpp b/ndb/src/common/debugger/EventLogger.cpp index 3bf82f6fb5d..50c3b778731 100644 --- a/ndb/src/common/debugger/EventLogger.cpp +++ b/ndb/src/common/debugger/EventLogger.cpp @@ -1303,14 +1303,15 @@ bool EventLogger::matchEventCategory(const char * str, LogLevel::EventCategory * cat, bool exactMatch){ + unsigned i; if(cat == 0 || str == 0) return false; char * tmp = strdup(str); - for(size_t i = 0; i<strlen(tmp); i++) + for(i = 0; i<strlen(tmp); i++) tmp[i] = toupper(tmp[i]); - for(Uint32 i = 0; i<noOfEventCategoryNames; i++){ + for(i = 0; i<noOfEventCategoryNames; i++){ if(strcmp(tmp, eventCategoryNames[i].name) == 0){ * cat = eventCategoryNames[i].category; free(tmp); diff --git a/ndb/src/common/debugger/SignalLoggerManager.cpp b/ndb/src/common/debugger/SignalLoggerManager.cpp index 3839a348222..d642ed09a68 100644 --- a/ndb/src/common/debugger/SignalLoggerManager.cpp +++ b/ndb/src/common/debugger/SignalLoggerManager.cpp @@ -488,31 +488,6 @@ SignalLoggerManager::printLinearSection(FILE * output, } void -SignalLoggerManager::printSegmentedSection(FILE * output, - const SignalHeader & sh, - const SegmentedSectionPtr ptr[3], - unsigned i) -{ - fprintf(output, "SECTION %u type=segmented", i); - if (i >= 3) { - fprintf(output, " *** invalid ***\n"); - return; - } - const Uint32 len = ptr[i].sz; - SectionSegment * ssp = ptr[i].p; - Uint32 pos = 0; - fprintf(output, " size=%u\n", (unsigned)len); - while (pos < len) { - if (pos > 0 && pos % SectionSegment::DataLength == 0) { - ssp = g_sectionSegmentPool.getPtr(ssp->m_nextSegment); - } - printDataWord(output, pos, ssp->theData[pos % SectionSegment::DataLength]); - } - if (len > 0) - putc('\n', output); -} - -void SignalLoggerManager::printDataWord(FILE * output, Uint32 & pos, const Uint32 data) { const char* const hex = "0123456789abcdef"; diff --git a/ndb/src/common/debugger/signaldata/LCP.cpp b/ndb/src/common/debugger/signaldata/LCP.cpp index 825659d13b3..6b4bb13e2cd 100644 --- a/ndb/src/common/debugger/signaldata/LCP.cpp +++ b/ndb/src/common/debugger/signaldata/LCP.cpp @@ -25,7 +25,8 @@ printSTART_LCP_REQ(FILE * output, const Uint32 * theData, const StartLcpReq * const sig = (StartLcpReq *) theData; - char buf1[sig->participatingDIH.TextLength+1], buf2[sig->participatingLQH.TextLength+1]; + char buf1[8*_NDB_NODE_BITMASK_SIZE+1]; + char buf2[8*_NDB_NODE_BITMASK_SIZE+1]; fprintf(output, " Sender: %d LcpId: %d\n" " ParticipatingDIH = %s\n" diff --git a/ndb/src/common/debugger/signaldata/SignalDataPrint.cpp b/ndb/src/common/debugger/signaldata/SignalDataPrint.cpp index e18ca18b632..65351663789 100644 --- a/ndb/src/common/debugger/signaldata/SignalDataPrint.cpp +++ b/ndb/src/common/debugger/signaldata/SignalDataPrint.cpp @@ -254,5 +254,9 @@ SignalDataPrintFunctions[] = { const unsigned short NO_OF_PRINT_FUNCTIONS = sizeof(SignalDataPrintFunctions)/sizeof(NameFunctionPair); - - +template class Bitmask<1>; +template class Bitmask<2>; +template class Bitmask<4>; +template struct BitmaskPOD<1>; +template struct BitmaskPOD<2>; +template struct BitmaskPOD<4>; diff --git a/ndb/src/common/logger/Logger.cpp b/ndb/src/common/logger/Logger.cpp index 9c9f1eece18..c2fdecb642b 100644 --- a/ndb/src/common/logger/Logger.cpp +++ b/ndb/src/common/logger/Logger.cpp @@ -350,3 +350,4 @@ Logger::log(LoggerLevel logLevel, const char* pMsg, va_list ap) const // PRIVATE // +template class Vector<LogHandler*>; diff --git a/ndb/src/common/mgmcommon/ConfigInfo.cpp b/ndb/src/common/mgmcommon/ConfigInfo.cpp index 89280aa80e8..6076b56de04 100644 --- a/ndb/src/common/mgmcommon/ConfigInfo.cpp +++ b/ndb/src/common/mgmcommon/ConfigInfo.cpp @@ -1878,13 +1878,14 @@ const int ConfigInfo::m_NoOfParams = sizeof(m_ParamInfo) / sizeof(ParamInfo); static void require(bool v) { if(!v) abort();} ConfigInfo::ConfigInfo() { + int i; Properties *section; const Properties *oldpinfo; m_info.setCaseInsensitiveNames(true); m_systemDefaults.setCaseInsensitiveNames(true); - for (int i=0; i<m_NoOfParams; i++) { + for (i=0; i<m_NoOfParams; i++) { const ParamInfo & param = m_ParamInfo[i]; // Create new section if it did not exist @@ -1939,7 +1940,7 @@ ConfigInfo::ConfigInfo() { } } - for (int i=0; i<m_NoOfParams; i++) { + for (i=0; i<m_NoOfParams; i++) { if(m_ParamInfo[i]._section == NULL){ ndbout << "Check that each entry has a section failed." << endl; ndbout << "Parameter \"" << m_ParamInfo[i]._fname << endl; @@ -2777,13 +2778,14 @@ transform(InitConfigFileParser::Context & ctx, bool fixDepricated(InitConfigFileParser::Context & ctx, const char * data){ + const char * name; /** * Transform old values to new values * Transform new values to old values (backward compatible) */ Properties tmp; Properties::Iterator it(ctx.m_currentSection); - for (const char* name = it.first(); name != NULL; name = it.next()) { + for (name = it.first(); name != NULL; name = it.next()) { const DepricationTransform * p = &f_deprication[0]; while(p->m_section != 0){ if(strcmp(p->m_section, ctx.fname) == 0){ @@ -2804,7 +2806,7 @@ fixDepricated(InitConfigFileParser::Context & ctx, const char * data){ } Properties::Iterator it2(&tmp); - for (const char* name = it2.first(); name != NULL; name = it2.next()) { + for (name = it2.first(); name != NULL; name = it2.next()) { PropertiesType type; require(tmp.getTypeOf(name, &type)); switch(type){ @@ -2910,11 +2912,12 @@ add_node_connections(Vector<ConfigInfo::ConfigRuleSection>§ions, struct InitConfigFileParser::Context &ctx, const char * rule_data) { + Uint32 i; Properties * props= ctx.m_config; Properties p_connections; Properties p_connections2; - for (Uint32 i = 0;; i++){ + for (i = 0;; i++){ const Properties * tmp; Uint32 nodeId1, nodeId2; @@ -2935,8 +2938,8 @@ add_node_connections(Vector<ConfigInfo::ConfigRuleSection>§ions, Properties p_db_nodes; Properties p_api_mgm_nodes; - Uint32 i_db= 0, i_api_mgm= 0; - for (Uint32 i= 0, n= 0; n < nNodes; i++){ + Uint32 i_db= 0, i_api_mgm= 0, n; + for (i= 0, n= 0; n < nNodes; i++){ const Properties * tmp; if(!props->get("Node", i, &tmp)) continue; n++; @@ -2953,7 +2956,7 @@ add_node_connections(Vector<ConfigInfo::ConfigRuleSection>§ions, Uint32 nodeId1, nodeId2, dummy; - for (Uint32 i= 0; p_db_nodes.get("", i, &nodeId1); i++){ + for (i= 0; p_db_nodes.get("", i, &nodeId1); i++){ for (Uint32 j= i+1;; j++){ if(!p_db_nodes.get("", j, &nodeId2)) break; if(!p_connections2.get("", nodeId1+nodeId2<<16, &dummy)) { @@ -2970,7 +2973,7 @@ add_node_connections(Vector<ConfigInfo::ConfigRuleSection>§ions, } } - for (Uint32 i= 0; p_api_mgm_nodes.get("", i, &nodeId1); i++){ + for (i= 0; p_api_mgm_nodes.get("", i, &nodeId1); i++){ if(!p_connections.get("", nodeId1, &dummy)) { for (Uint32 j= 0;; j++){ if(!p_db_nodes.get("", j, &nodeId2)) break; @@ -2989,6 +2992,7 @@ add_node_connections(Vector<ConfigInfo::ConfigRuleSection>§ions, return true; } + bool add_server_ports(Vector<ConfigInfo::ConfigRuleSection>§ions, struct InitConfigFileParser::Context &ctx, const char * rule_data) @@ -3028,3 +3032,4 @@ bool add_server_ports(Vector<ConfigInfo::ConfigRuleSection>§ions, return true; } +template class Vector<ConfigInfo::ConfigRuleSection>; diff --git a/ndb/src/common/transporter/Packer.cpp b/ndb/src/common/transporter/Packer.cpp index fa72af12dac..645517a4b1a 100644 --- a/ndb/src/common/transporter/Packer.cpp +++ b/ndb/src/common/transporter/Packer.cpp @@ -391,6 +391,7 @@ Packer::pack(Uint32 * insertPtr, const SignalHeader * header, const Uint32 * theData, const LinearSectionPtr ptr[3]) const { + Uint32 i; Uint32 dataLen32 = header->theLength; Uint32 no_segs = header->m_noOfSections; @@ -400,7 +401,7 @@ Packer::pack(Uint32 * insertPtr, checksumUsed + signalIdUsed + (sizeof(Protocol6)/4); - for(Uint32 i = 0; i<no_segs; i++){ + for(i = 0; i<no_segs; i++){ len32 += ptr[i].sz; } @@ -429,12 +430,12 @@ Packer::pack(Uint32 * insertPtr, memcpy(tmpInserPtr, theData, 4 * dataLen32); tmpInserPtr += dataLen32; - for(Uint32 i = 0; i<no_segs; i++){ + for(i = 0; i<no_segs; i++){ tmpInserPtr[i] = ptr[i].sz; } tmpInserPtr += no_segs; - for(Uint32 i = 0; i<no_segs; i++){ + for(i = 0; i<no_segs; i++){ import(tmpInserPtr, ptr[i]); } @@ -450,6 +451,7 @@ Packer::pack(Uint32 * insertPtr, const Uint32 * theData, class SectionSegmentPool & thePool, const SegmentedSectionPtr ptr[3]) const { + Uint32 i; Uint32 dataLen32 = header->theLength; Uint32 no_segs = header->m_noOfSections; @@ -458,7 +460,7 @@ Packer::pack(Uint32 * insertPtr, dataLen32 + no_segs + checksumUsed + signalIdUsed + (sizeof(Protocol6)/4); - for(Uint32 i = 0; i<no_segs; i++){ + for(i = 0; i<no_segs; i++){ len32 += ptr[i].sz; } @@ -487,12 +489,12 @@ Packer::pack(Uint32 * insertPtr, memcpy(tmpInserPtr, theData, 4 * dataLen32); tmpInserPtr += dataLen32; - for(Uint32 i = 0; i<no_segs; i++){ + for(i = 0; i<no_segs; i++){ tmpInserPtr[i] = ptr[i].sz; } tmpInserPtr += no_segs; - for(Uint32 i = 0; i<no_segs; i++){ + for(i = 0; i<no_segs; i++){ copy(tmpInserPtr, thePool, ptr[i]); } diff --git a/ndb/src/common/transporter/TransporterRegistry.cpp b/ndb/src/common/transporter/TransporterRegistry.cpp index 3d42c40f720..aa1913e3040 100644 --- a/ndb/src/common/transporter/TransporterRegistry.cpp +++ b/ndb/src/common/transporter/TransporterRegistry.cpp @@ -882,7 +882,7 @@ TransporterRegistry::performReceive(){ static int x = 0; void TransporterRegistry::performSend(){ - + int i; sendCounter = 1; #ifdef NDB_OSE_TRANSPORTER @@ -906,7 +906,7 @@ TransporterRegistry::performSend(){ FD_ZERO(&writeset); // Prepare for sending and receiving - for (int i = 0; i < nTCPTransporters; i++) { + for (i = 0; i < nTCPTransporters; i++) { TCP_Transporter * t = theTCPTransporters[i]; // If the transporter is connected @@ -931,7 +931,7 @@ TransporterRegistry::performSend(){ if (tmp == 0) { return; }//if - for (int i = 0; i < nTCPTransporters; i++) { + for (i = 0; i < nTCPTransporters; i++) { TCP_Transporter *t = theTCPTransporters[i]; const NodeId nodeId = t->getRemoteNodeId(); const int socket = t->getSocket(); @@ -944,7 +944,7 @@ TransporterRegistry::performSend(){ } #endif #ifdef NDB_TCP_TRANSPORTER - for (int i = x; i < nTCPTransporters; i++) { + for (i = x; i < nTCPTransporters; i++) { TCP_Transporter *t = theTCPTransporters[i]; if (t && (t->hasDataToSend()) && @@ -953,7 +953,7 @@ TransporterRegistry::performSend(){ t->doSend(); }//if }//for - for (int i = 0; i < x && i < nTCPTransporters; i++) { + for (i = 0; i < x && i < nTCPTransporters; i++) { TCP_Transporter *t = theTCPTransporters[i]; if (t && (t->hasDataToSend()) && @@ -969,7 +969,7 @@ TransporterRegistry::performSend(){ #ifdef NDB_SCI_TRANSPORTER //scroll through the SCI transporters, // get each transporter, check if connected, send data - for (int i=0; i<nSCITransporters; i++) { + for (i=0; i<nSCITransporters; i++) { SCI_Transporter *t = theSCITransporters[i]; const NodeId nodeId = t->getRemoteNodeId(); diff --git a/ndb/src/common/util/BaseString.cpp b/ndb/src/common/util/BaseString.cpp index d15249adf72..8b7df485f77 100644 --- a/ndb/src/common/util/BaseString.cpp +++ b/ndb/src/common/util/BaseString.cpp @@ -412,3 +412,6 @@ int main() } #endif + +template class Vector<char *>; +template class Vector<BaseString>; diff --git a/ndb/src/common/util/ConfigValues.cpp b/ndb/src/common/util/ConfigValues.cpp index 1dcb542e92c..8a14882550c 100644 --- a/ndb/src/common/util/ConfigValues.cpp +++ b/ndb/src/common/util/ConfigValues.cpp @@ -105,19 +105,19 @@ ConfigValues::getByPos(Uint32 pos, Entry * result) const { Uint64 * ConfigValues::get64(Uint32 index) const { assert(index < m_int64Count); - const Uint32 * data = m_values + (m_size << 1); + const Uint32 * data = m_values + (m_size << 1); Uint64 * ptr = (Uint64*)data; - ptr += index; + ptr += index; return ptr; } char ** ConfigValues::getString(Uint32 index) const { assert(index < m_stringCount); - const Uint32 * data = m_values + (m_size << 1); - char * ptr = (char*)data; + const Uint32 * data = m_values + (m_size << 1); + char * ptr = (char*)data; ptr += m_dataSize; - ptr -= (index * sizeof(char *)); + ptr -= (index * sizeof(char *)); return (char**)ptr; } @@ -464,7 +464,7 @@ ConfigValuesFactory::put(const ConfigValues::Entry & entry){ case ConfigValues::StringType:{ Uint32 index = m_cfg->m_stringCount++; m_cfg->m_values[pos+1] = index; - char ** ref = m_cfg->getString(index); + char ** ref = m_cfg->getString(index); * ref = strdup(entry.m_string ? entry.m_string : ""); m_freeKeys--; m_freeData -= sizeof(char *); @@ -580,11 +580,11 @@ ConfigValues::getPackedSize() const { Uint32 ConfigValues::pack(void * _dst, Uint32 _len) const { - + Uint32 i; char * dst = (char*)_dst; memcpy(dst, Magic, sizeof(Magic)); dst += sizeof(Magic); - for(Uint32 i = 0; i < 2 * m_size; i += 2){ + for(i = 0; i < 2 * m_size; i += 2){ Uint32 key = m_values[i]; Uint32 val = m_values[i+1]; if(key != CFV_KEY_FREE){ @@ -623,7 +623,7 @@ ConfigValues::pack(void * _dst, Uint32 _len) const { const Uint32 * sum = (Uint32*)_dst; const Uint32 len = ((Uint32*)dst) - sum; Uint32 chk = 0; - for(Uint32 i = 0; i<len; i++){ + for(i = 0; i<len; i++){ chk ^= htonl(sum[i]); } diff --git a/ndb/src/common/util/Parser.cpp b/ndb/src/common/util/Parser.cpp index 2e8120f88ce..dea128ccf66 100644 --- a/ndb/src/common/util/Parser.cpp +++ b/ndb/src/common/util/Parser.cpp @@ -347,3 +347,4 @@ ParserImpl::checkMandatory(Context* ctx, const Properties* props){ return true; } +template class Vector<const ParserRow<ParserImpl::Dummy>*>; diff --git a/ndb/src/common/util/Properties.cpp b/ndb/src/common/util/Properties.cpp index 3e41056ac18..8db7b075d1b 100644 --- a/ndb/src/common/util/Properties.cpp +++ b/ndb/src/common/util/Properties.cpp @@ -169,6 +169,7 @@ put(PropertiesImpl * impl, const char * name, T value, bool replace){ return tmp->put(new PropertyImpl(short_name, value)); } + bool Properties::put(const char * name, Uint32 value, bool replace){ return ::put(impl, name, value, replace); @@ -1120,3 +1121,8 @@ bool Properties::getCaseInsensitiveNames() const { return impl->m_insensitive; } + +template bool put(PropertiesImpl *, const char *, Uint32, bool); +template bool put(PropertiesImpl *, const char *, Uint64, bool); +template bool put(PropertiesImpl *, const char *, const char *, bool); +template bool put(PropertiesImpl *, const char *, const Properties*, bool); diff --git a/ndb/src/common/util/SocketServer.cpp b/ndb/src/common/util/SocketServer.cpp index 67cbf8aba4a..44c57c766f8 100644 --- a/ndb/src/common/util/SocketServer.cpp +++ b/ndb/src/common/util/SocketServer.cpp @@ -36,10 +36,11 @@ SocketServer::SocketServer(int maxSessions) : } SocketServer::~SocketServer() { - for(unsigned i = 0; i<m_sessions.size(); i++){ + unsigned i; + for(i = 0; i<m_sessions.size(); i++){ delete m_sessions[i].m_session; } - for(unsigned i = 0; i<m_services.size(); i++){ + for(i = 0; i<m_services.size(); i++){ delete m_services[i].m_service; } } @@ -265,10 +266,11 @@ SocketServer::checkSessions(){ void SocketServer::stopSessions(bool wait){ - for(int i = m_sessions.size() - 1; i>=0; i--) + int i; + for(i = m_sessions.size() - 1; i>=0; i--) m_sessions[i].m_session->m_stop = true; - for(int i = m_services.size() - 1; i>=0; i--) + for(i = m_services.size() - 1; i>=0; i--) m_services[i].m_service->stopSessions(); if(wait){ @@ -303,3 +305,6 @@ sessionThread_C(void* _sc){ NdbThread_Exit(0); return 0; } + +template class MutexVector<SocketServer::ServiceInstance>; +template class MutexVector<SocketServer::SessionInstance>; diff --git a/ndb/src/cw/cpcd/CPCD.cpp b/ndb/src/cw/cpcd/CPCD.cpp index f2878b7dea1..40a5fd49493 100644 --- a/ndb/src/cw/cpcd/CPCD.cpp +++ b/ndb/src/cw/cpcd/CPCD.cpp @@ -351,8 +351,9 @@ CPCD::loadProcessList(){ sess.loadFile(); loadingProcessList = false; + size_t i; Vector<int> temporary; - for(size_t i = 0; i<m_processes.size(); i++){ + for(i = 0; i<m_processes.size(); i++){ Process * proc = m_processes[i]; proc->readPid(); if(proc->m_processType == TEMPORARY){ @@ -360,7 +361,7 @@ CPCD::loadProcessList(){ } } - for(size_t i = 0; i<temporary.size(); i++){ + for(i = 0; i<temporary.size(); i++){ RequestStatus rs; undefineProcess(&rs, temporary[i]); } diff --git a/ndb/src/cw/cpcd/Process.cpp b/ndb/src/cw/cpcd/Process.cpp index d99dda2ba0b..a67dba95dc7 100644 --- a/ndb/src/cw/cpcd/Process.cpp +++ b/ndb/src/cw/cpcd/Process.cpp @@ -252,7 +252,7 @@ set_ulimit(const BaseString & pair){ void CPCD::Process::do_exec() { - + size_t i; setup_environment(m_env.c_str()); char **argv = BaseString::argify(m_path.c_str(), m_args.c_str()); @@ -268,7 +268,7 @@ CPCD::Process::do_exec() { Vector<BaseString> ulimit; m_ulimit.split(ulimit); - for(size_t i = 0; i<ulimit.size(); i++){ + for(i = 0; i<ulimit.size(); i++){ if(ulimit[i].trim().length() > 0 && set_ulimit(ulimit[i]) != 0){ _exit(1); } @@ -282,7 +282,7 @@ CPCD::Process::do_exec() { BaseString * redirects[] = { &m_stdin, &m_stdout, &m_stderr }; int fds[3]; - for(int i = 0; i<3; i++){ + for(i = 0; i<3; i++){ if(redirects[i]->empty()){ #ifndef DEBUG dup2(fd, i); @@ -315,7 +315,7 @@ CPCD::Process::do_exec() { } /* Close all filedescriptors */ - for(int i = STDERR_FILENO+1; i < getdtablesize(); i++) + for(i = STDERR_FILENO+1; i < getdtablesize(); i++) close(i); execv(m_path.c_str(), argv); diff --git a/ndb/src/kernel/blocks/backup/Backup.cpp b/ndb/src/kernel/blocks/backup/Backup.cpp index 4342a9d6d94..52a543dbcdc 100644 --- a/ndb/src/kernel/blocks/backup/Backup.cpp +++ b/ndb/src/kernel/blocks/backup/Backup.cpp @@ -3332,7 +3332,8 @@ Backup::execBACKUP_FRAGMENT_REQ(Signal* signal) req->transId1 = 0; req->transId2 = (BACKUP << 20) + (getOwnNodeId() << 8); - for(unsigned int i = 0; i<parallelism; i++) { + Uint32 i; + for(i = 0; i<parallelism; i++) { jam(); req->clientOpPtr[i] = filePtr.i; }//for @@ -3350,7 +3351,7 @@ Backup::execBACKUP_FRAGMENT_REQ(Signal* signal) signal->theData[7] = 0; Uint32 dataPos = 8; - for(Uint32 i = 0; i<table.noOfAttributes; i++) { + for(i = 0; i<table.noOfAttributes; i++) { jam(); AttributePtr attr; table.attributes.getPtr(attr, i); diff --git a/ndb/src/kernel/blocks/backup/BackupInit.cpp b/ndb/src/kernel/blocks/backup/BackupInit.cpp index 36ce1857144..d8cbb36df62 100644 --- a/ndb/src/kernel/blocks/backup/BackupInit.cpp +++ b/ndb/src/kernel/blocks/backup/BackupInit.cpp @@ -213,3 +213,6 @@ Backup::~Backup() BLOCK_FUNCTIONS(Backup); +template class ArrayPool<Backup::Page32>; +template class ArrayPool<Backup::Attribute>; +template class ArrayPool<Backup::Fragment>; diff --git a/ndb/src/kernel/blocks/backup/restore/Restore.cpp b/ndb/src/kernel/blocks/backup/restore/Restore.cpp index 24d2cfbfe35..8adef788365 100644 --- a/ndb/src/kernel/blocks/backup/restore/Restore.cpp +++ b/ndb/src/kernel/blocks/backup/restore/Restore.cpp @@ -34,6 +34,7 @@ Uint64 Twiddle64(Uint64 in); // Byte shift 64-bit data bool BackupFile::Twiddle(const AttributeDesc* attr_desc, AttributeData* attr_data, Uint32 arraySize){ + Uint32 i; if(m_hostByteOrder) return true; @@ -47,17 +48,17 @@ BackupFile::Twiddle(const AttributeDesc* attr_desc, AttributeData* attr_data, Ui return true; case 16: - for(unsigned i = 0; i<arraySize; i++){ + for(i = 0; i<arraySize; i++){ attr_data->u_int16_value[i] = Twiddle16(attr_data->u_int16_value[i]); } return true; case 32: - for(unsigned i = 0; i<arraySize; i++){ + for(i = 0; i<arraySize; i++){ attr_data->u_int32_value[i] = Twiddle32(attr_data->u_int32_value[i]); } return true; case 64: - for(unsigned i = 0; i<arraySize; i++){ + for(i = 0; i<arraySize; i++){ attr_data->u_int64_value[i] = Twiddle64(attr_data->u_int64_value[i]); } return true; @@ -333,8 +334,8 @@ RestoreDataIterator::getNextTuple(int & res) Uint32 *buf_ptr = (Uint32*)_buf_ptr, *ptr = buf_ptr; ptr += m_currentTable->m_nullBitmaskSize; - - for(Uint32 i= 0; i < m_currentTable->m_fixedKeys.size(); i++){ + Uint32 i; + for(i= 0; i < m_currentTable->m_fixedKeys.size(); i++){ assert(ptr < buf_ptr + dataLength); const Uint32 attrId = m_currentTable->m_fixedKeys[i]->attrId; @@ -355,7 +356,7 @@ RestoreDataIterator::getNextTuple(int & res) ptr += sz; } - for(Uint32 i = 0; i < m_currentTable->m_fixedAttribs.size(); i++){ + for(i = 0; i < m_currentTable->m_fixedAttribs.size(); i++){ assert(ptr < buf_ptr + dataLength); const Uint32 attrId = m_currentTable->m_fixedAttribs[i]->attrId; @@ -377,7 +378,7 @@ RestoreDataIterator::getNextTuple(int & res) ptr += sz; } - for(Uint32 i = 0; i < m_currentTable->m_variableAttribs.size(); i++){ + for(i = 0; i < m_currentTable->m_variableAttribs.size(); i++){ const Uint32 attrId = m_currentTable->m_variableAttribs[i]->attrId; AttributeData * attr_data = m_tuple.getData(attrId); diff --git a/ndb/src/kernel/blocks/backup/restore/Restore.hpp b/ndb/src/kernel/blocks/backup/restore/Restore.hpp index e9149e38e44..5a705740c69 100644 --- a/ndb/src/kernel/blocks/backup/restore/Restore.hpp +++ b/ndb/src/kernel/blocks/backup/restore/Restore.hpp @@ -301,9 +301,10 @@ public: } ~LogEntry() { - for(Uint32 i= 0; i< m_values.size(); i++) + Uint32 i; + for(i= 0; i< m_values.size(); i++) delete m_values[i]; - for(Uint32 i= 0; i< m_values_e.size(); i++) + for(i= 0; i< m_values_e.size(); i++) delete m_values_e[i]; } Uint32 size() const { return m_values.size(); } diff --git a/ndb/src/kernel/blocks/backup/restore/main.cpp b/ndb/src/kernel/blocks/backup/restore/main.cpp index 99deeb3115c..be58d72ff72 100644 --- a/ndb/src/kernel/blocks/backup/restore/main.cpp +++ b/ndb/src/kernel/blocks/backup/restore/main.cpp @@ -250,8 +250,8 @@ main(int argc, const char** argv) return -1; } - - for(Uint32 i= 0; i < g_consumers.size(); i++) + Uint32 i; + for(i= 0; i < g_consumers.size(); i++) { if (!g_consumers[i]->init()) { @@ -261,7 +261,7 @@ main(int argc, const char** argv) } - for(Uint32 i = 0; i<metaData.getNoOfTables(); i++) + for(i = 0; i<metaData.getNoOfTables(); i++) { if (checkSysTable(metaData[i]->getTableName())) { @@ -345,7 +345,7 @@ main(int argc, const char** argv) return -1; } logIter.validateFooter(); //not implemented - for (Uint32 i= 0; i < g_consumers.size(); i++) + for (i= 0; i < g_consumers.size(); i++) g_consumers[i]->endOfLogEntrys(); } } diff --git a/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp b/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp index 176b9590c60..ef0f91841dc 100644 --- a/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp +++ b/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp @@ -1071,14 +1071,15 @@ Cmvmi::execDUMP_STATE_ORD(Signal* signal) } if (dumpState->args[0] == DumpStateOrd::CmvmiTestLongSigWithDelay) { + unsigned i; Uint32 loopCount = dumpState->args[1]; const unsigned len0 = 11; const unsigned len1 = 123; Uint32 sec0[len0]; Uint32 sec1[len1]; - for (unsigned i = 0; i < len0; i++) + for (i = 0; i < len0; i++) sec0[i] = i; - for (unsigned i = 0; i < len1; i++) + for (i = 0; i < len1; i++) sec1[i] = 16 * i; Uint32* sig = signal->getDataPtrSend(); sig[0] = reference(); @@ -1131,6 +1132,7 @@ static LinearSectionPtr g_test[3]; void Cmvmi::execTESTSIG(Signal* signal){ + Uint32 i; /** * Test of SafeCounter */ @@ -1155,14 +1157,14 @@ Cmvmi::execTESTSIG(Signal* signal){ getOwnNodeId(), true); ndbout_c("-- Fixed section --"); - for(Uint32 i = 0; i<signal->length(); i++){ + for(i = 0; i<signal->length(); i++){ fprintf(stdout, "H'0x%.8x ", signal->theData[i]); if(((i + 1) % 6) == 0) fprintf(stdout, "\n"); } fprintf(stdout, "\n"); - for(Uint32 i = 0; i<signal->header.m_noOfSections; i++){ + for(i = 0; i<signal->header.m_noOfSections; i++){ SegmentedSectionPtr ptr; ndbout_c("-- Section %d --", i); signal->getSection(ptr, i); @@ -1175,7 +1177,7 @@ Cmvmi::execTESTSIG(Signal* signal){ /** * Validate length:s */ - for(Uint32 i = 0; i<signal->header.m_noOfSections; i++){ + for(i = 0; i<signal->header.m_noOfSections; i++){ SegmentedSectionPtr ptr; signal->getSection(ptr, i); ndbrequire(ptr.p != 0); @@ -1220,7 +1222,7 @@ Cmvmi::execTESTSIG(Signal* signal){ case 4:{ LinearSectionPtr ptr[3]; const Uint32 secs = signal->getNoOfSections(); - for(Uint32 i = 0; i<secs; i++){ + for(i = 0; i<secs; i++){ SegmentedSectionPtr sptr; signal->getSection(sptr, i); ptr[i].sz = sptr.sz; @@ -1269,7 +1271,7 @@ Cmvmi::execTESTSIG(Signal* signal){ case 8:{ LinearSectionPtr ptr[3]; const Uint32 secs = signal->getNoOfSections(); - for(Uint32 i = 0; i<secs; i++){ + for(i = 0; i<secs; i++){ SegmentedSectionPtr sptr; signal->getSection(sptr, i); ptr[i].sz = sptr.sz; @@ -1303,7 +1305,7 @@ Cmvmi::execTESTSIG(Signal* signal){ sendNextLinearFragment(signal, fragSend); } - for(Uint32 i = 0; i<secs; i++){ + for(i = 0; i<secs; i++){ delete[] ptr[i].p; } break; @@ -1335,7 +1337,7 @@ Cmvmi::execTESTSIG(Signal* signal){ const Uint32 secs = signal->getNoOfSections(); memset(g_test, 0, sizeof(g_test)); - for(Uint32 i = 0; i<secs; i++){ + for(i = 0; i<secs; i++){ SegmentedSectionPtr sptr; signal->getSection(sptr, i); g_test[i].sz = sptr.sz; @@ -1379,7 +1381,7 @@ Cmvmi::execTESTSIG(Signal* signal){ case 14:{ Uint32 count = signal->theData[8]; signal->theData[10] = count * rg.m_nodes.count(); - for(Uint32 i = 0; i<count; i++){ + for(i = 0; i<count; i++){ sendSignal(rg, GSN_TESTSIG, signal, signal->length(), JBB); } return; diff --git a/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp b/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp index ccc1acdd273..10fd703e387 100644 --- a/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp +++ b/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp @@ -9245,8 +9245,8 @@ void Dbacc::initFragGeneral(FragmentrecPtr regFragPtr) for (Uint32 i = 0; i < ZWRITEPAGESIZE; i++) { regFragPtr.p->datapages[i] = RNIL; }//for - for (Uint32 i = 0; i < 4; i++) { - regFragPtr.p->longKeyPageArray[i] = RNIL; + for (Uint32 j = 0; j < 4; j++) { + regFragPtr.p->longKeyPageArray[j] = RNIL; }//for }//Dbacc::initFragGeneral() diff --git a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp index 3b99f0d5392..70d27934f1e 100644 --- a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp +++ b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp @@ -5769,6 +5769,7 @@ void Dbdict::execLIST_TABLES_REQ(Signal* signal) { jamEntry(); + Uint32 i; ListTablesReq * req = (ListTablesReq*)signal->getDataPtr(); Uint32 senderRef = req->senderRef; Uint32 senderData = req->senderData; @@ -5782,7 +5783,7 @@ Dbdict::execLIST_TABLES_REQ(Signal* signal) conf->senderData = senderData; conf->counter = 0; Uint32 pos = 0; - for (Uint32 i = 0; i < c_tableRecordPool.getSize(); i++) { + for (i = 0; i < c_tableRecordPool.getSize(); i++) { TableRecordPtr tablePtr; c_tableRecordPool.getPtr(tablePtr, i); // filter @@ -5862,12 +5863,12 @@ Dbdict::execLIST_TABLES_REQ(Signal* signal) conf->counter++; pos = 0; } - Uint32 i = 0; - while (i < size) { + Uint32 k = 0; + while (k < size) { char* p = (char*)&conf->tableData[pos]; for (Uint32 j = 0; j < 4; j++) { - if (i < size) - *p++ = tablePtr.p->tableName[i++]; + if (k < size) + *p++ = tablePtr.p->tableName[k++]; else *p++ = 0; } @@ -5881,7 +5882,7 @@ Dbdict::execLIST_TABLES_REQ(Signal* signal) } } // XXX merge with above somehow - for (Uint32 i = 0; i < c_triggerRecordPool.getSize(); i++) { + for (i = 0; i < c_triggerRecordPool.getSize(); i++) { if (reqListIndexes) break; TriggerRecordPtr triggerPtr; @@ -5925,12 +5926,12 @@ Dbdict::execLIST_TABLES_REQ(Signal* signal) conf->counter++; pos = 0; } - Uint32 i = 0; - while (i < size) { + Uint32 k = 0; + while (k < size) { char* p = (char*)&conf->tableData[pos]; for (Uint32 j = 0; j < 4; j++) { - if (i < size) - *p++ = triggerPtr.p->triggerName[i++]; + if (k < size) + *p++ = triggerPtr.p->triggerName[k++]; else *p++ = 0; } @@ -6167,6 +6168,7 @@ Dbdict::createIndex_slavePrepare(Signal* signal, OpCreateIndexPtr opPtr) void Dbdict::createIndex_toCreateTable(Signal* signal, OpCreateIndexPtr opPtr) { + Uint32 k; jam(); const CreateIndxReq* const req = &opPtr.p->m_request; // signal data writer @@ -6236,7 +6238,7 @@ Dbdict::createIndex_toCreateTable(Signal* signal, OpCreateIndexPtr opPtr) } // hash index attributes must currently be in table order Uint32 prevAttrId = RNIL; - for (Uint32 k = 0; k < opPtr.p->m_attrList.sz; k++) { + for (k = 0; k < opPtr.p->m_attrList.sz; k++) { jam(); bool found = false; for (Uint32 tAttr = tablePtr.p->firstAttribute; tAttr != RNIL; ) { @@ -6296,7 +6298,7 @@ Dbdict::createIndex_toCreateTable(Signal* signal, OpCreateIndexPtr opPtr) // write index key attributes AttributeRecordPtr aRecPtr; c_attributeRecordPool.getPtr(aRecPtr, tablePtr.p->firstAttribute); - for (Uint32 k = 0; k < opPtr.p->m_attrList.sz; k++) { + for (k = 0; k < opPtr.p->m_attrList.sz; k++) { jam(); for (Uint32 tAttr = tablePtr.p->firstAttribute; tAttr != RNIL; ) { AttributeRecord* aRec = c_attributeRecordPool.getPtr(tAttr); diff --git a/ndb/src/kernel/blocks/dbdih/DbdihInit.cpp b/ndb/src/kernel/blocks/dbdih/DbdihInit.cpp index f996a1fe689..7ca45ef4b43 100644 --- a/ndb/src/kernel/blocks/dbdih/DbdihInit.cpp +++ b/ndb/src/kernel/blocks/dbdih/DbdihInit.cpp @@ -50,17 +50,18 @@ void Dbdih::initData() nodeRecord = (NodeRecord*) allocRecord("NodeRecord", sizeof(NodeRecord), MAX_NDB_NODES); - for(Uint32 i = 0; i<MAX_NDB_NODES; i++){ + Uint32 i; + for(i = 0; i<MAX_NDB_NODES; i++){ new (&nodeRecord[i]) NodeRecord(); } takeOverRecord = (TakeOverRecord*)allocRecord("TakeOverRecord", sizeof(TakeOverRecord), MAX_NDB_NODES); - for(Uint32 i = 0; i<MAX_NDB_NODES; i++) + for(i = 0; i<MAX_NDB_NODES; i++) new (&takeOverRecord[i]) TakeOverRecord(); - for(Uint32 i = 0; i<MAX_NDB_NODES; i++) + for(i = 0; i<MAX_NDB_NODES; i++) new (&takeOverRecord[i]) TakeOverRecord(); waitGCPProxyPool.setSize(ZPROXY_FILE_SIZE); diff --git a/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp b/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp index 059f1301ba2..557fed03498 100644 --- a/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp +++ b/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp @@ -1534,11 +1534,12 @@ void Dbdih::execSTART_MECONF(Signal* signal) StartMeConf * const startMe = (StartMeConf *)&signal->theData[0]; Uint32 nodeId = startMe->startingNodeId; const Uint32 startWord = startMe->startWord; + Uint32 i; CRASH_INSERTION(7130); ndbrequire(nodeId == cownNodeId); arrGuard(startWord + StartMeConf::DATA_SIZE, sizeof(cdata)/4); - for(Uint32 i = 0; i < StartMeConf::DATA_SIZE; i++) + for(i = 0; i < StartMeConf::DATA_SIZE; i++) cdata[startWord+i] = startMe->data[i]; if(startWord + StartMeConf::DATA_SIZE < Sysfile::SYSFILE_SIZE32){ @@ -1556,12 +1557,12 @@ void Dbdih::execSTART_MECONF(Signal* signal) * But dont copy lastCompletedGCI:s */ Uint32 tempGCP[MAX_NDB_NODES]; - for(Uint32 i = 0; i < MAX_NDB_NODES; i++) + for(i = 0; i < MAX_NDB_NODES; i++) tempGCP[i] = SYSFILE->lastCompletedGCI[i]; - for(Uint32 i = 0; i < Sysfile::SYSFILE_SIZE32; i++) + for(i = 0; i < Sysfile::SYSFILE_SIZE32; i++) sysfileData[i] = cdata[i]; - for(Uint32 i = 0; i < MAX_NDB_NODES; i++) + for(i = 0; i < MAX_NDB_NODES; i++) SYSFILE->lastCompletedGCI[i] = tempGCP[i]; setNodeActiveStatus(); @@ -3599,6 +3600,7 @@ void Dbdih::writeInitGcpLab(Signal* signal, FileRecordPtr filePtr) /*---------------------------------------------------------------------------*/ void Dbdih::execNODE_FAILREP(Signal* signal) { + Uint32 i; Uint32 failedNodes[MAX_NDB_NODES]; jamEntry(); NodeFailRep * const nodeFail = (NodeFailRep *)&signal->theData[0]; @@ -3611,7 +3613,7 @@ void Dbdih::execNODE_FAILREP(Signal* signal) // The first step is to convert from a bit mask to an array of failed nodes. /*-------------------------------------------------------------------------*/ Uint32 index = 0; - for (Uint32 i = 1; i < MAX_NDB_NODES; i++) { + for (i = 1; i < MAX_NDB_NODES; i++) { jam(); if(NodeBitmask::get(nodeFail->theNodes, i)){ jam(); @@ -3629,7 +3631,7 @@ void Dbdih::execNODE_FAILREP(Signal* signal) // We also set certain state variables ensuring that the node no longer is // used in transactions and also mark that we received this signal. /*-------------------------------------------------------------------------*/ - for (Uint32 i = 0; i < noOfFailedNodes; i++) { + for (i = 0; i < noOfFailedNodes; i++) { jam(); NodeRecordPtr TNodePtr; TNodePtr.i = failedNodes[i]; @@ -3671,7 +3673,7 @@ void Dbdih::execNODE_FAILREP(Signal* signal) const bool masterTakeOver = (oldMasterId != newMasterId); - for(Uint32 i = 0; i < noOfFailedNodes; i++) { + for(i = 0; i < noOfFailedNodes; i++) { NodeRecordPtr failedNodePtr; failedNodePtr.i = failedNodes[i]; ptrCheckGuard(failedNodePtr, MAX_NDB_NODES, nodeRecord); @@ -6882,8 +6884,9 @@ void Dbdih::releaseFragments(TabRecordPtr tabPtr) void Dbdih::initialiseFragstore() { + Uint32 i; FragmentstorePtr fragPtr; - for (Uint32 i = 0; i < cfragstoreFileSize; i++) { + for (i = 0; i < cfragstoreFileSize; i++) { fragPtr.i = i; ptrCheckGuard(fragPtr, cfragstoreFileSize, fragmentstore); initFragstore(fragPtr); @@ -6892,7 +6895,7 @@ void Dbdih::initialiseFragstore() fragPtr.i = 0; cfirstfragstore = RNIL; cremainingfrags = 0; - for (Uint32 i = 0; i < noOfChunks; i++) { + for (i = 0; i < noOfChunks; i++) { ptrCheckGuard(fragPtr, cfragstoreFileSize, fragmentstore); fragPtr.p->nextFragmentChunk = cfirstfragstore; cfirstfragstore = fragPtr.i; @@ -10231,11 +10234,12 @@ void Dbdih::allocStoredReplica(FragmentstorePtr fragPtr, ReplicaRecordPtr& newReplicaPtr, Uint32 nodeId) { + Uint32 i; ReplicaRecordPtr arrReplicaPtr; ReplicaRecordPtr arrPrevReplicaPtr; seizeReplicaRec(newReplicaPtr); - for (Uint32 i = 0; i < MAX_LCP_STORED; i++) { + for (i = 0; i < MAX_LCP_STORED; i++) { newReplicaPtr.p->maxGciCompleted[i] = 0; newReplicaPtr.p->maxGciStarted[i] = 0; newReplicaPtr.p->lcpId[i] = 0; @@ -10243,7 +10247,7 @@ void Dbdih::allocStoredReplica(FragmentstorePtr fragPtr, }//for newReplicaPtr.p->noCrashedReplicas = 0; newReplicaPtr.p->initialGci = currentgcp; - for (Uint32 i = 0; i < 8; i++) { + for (i = 0; i < 8; i++) { newReplicaPtr.p->replicaLastGci[i] = (Uint32)-1; newReplicaPtr.p->createGci[i] = 0; }//for @@ -10354,7 +10358,8 @@ void Dbdih::checkEscalation() { Uint32 TnodeGroup[MAX_NDB_NODES]; NodeRecordPtr nodePtr; - for (Uint32 i = 0; i < MAX_NDB_NODES; i++) { + Uint32 i; + for (i = 0; i < MAX_NDB_NODES; i++) { TnodeGroup[i] = ZFALSE; }//for for (nodePtr.i = 1; nodePtr.i < MAX_NDB_NODES; nodePtr.i++) { @@ -10366,7 +10371,7 @@ void Dbdih::checkEscalation() TnodeGroup[nodePtr.p->nodeGroup] = ZTRUE; } } - for (Uint32 i = 0; i < cnoOfNodeGroups; i++) { + for (i = 0; i < cnoOfNodeGroups; i++) { jam(); if (TnodeGroup[i] == ZFALSE) { jam(); @@ -10929,7 +10934,8 @@ void Dbdih::initNodeState(NodeRecordPtr nodePtr) /*************************************************************************/ void Dbdih::initRestartInfo() { - for (int i = 0; i < MAX_NDB_NODES; i++) { + Uint32 i; + for (i = 0; i < MAX_NDB_NODES; i++) { SYSFILE->lastCompletedGCI[i] = 0; }//for NodeRecordPtr nodePtr; @@ -10950,10 +10956,10 @@ void Dbdih::initRestartInfo() SYSFILE->oldestRestorableGCI = 1; SYSFILE->newestRestorableGCI = 1; SYSFILE->systemRestartBits = 0; - for (Uint32 i = 0; i < NodeBitmask::Size; i++) { + for (i = 0; i < NodeBitmask::Size; i++) { SYSFILE->lcpActive[0] = 0; }//for - for (Uint32 i = 0; i < Sysfile::TAKE_OVER_SIZE; i++) { + for (i = 0; i < Sysfile::TAKE_OVER_SIZE; i++) { SYSFILE->takeOver[i] = 0; }//for Sysfile::setInitialStartOngoing(SYSFILE->systemRestartBits); @@ -11032,10 +11038,11 @@ void Dbdih::initTable(TabRecordPtr tabPtr) tabPtr.p->tabFile[1] = RNIL; tabPtr.p->m_dropTab.tabUserRef = 0; tabPtr.p->m_dropTab.tabUserPtr = RNIL; - for (Uint32 i = 0; i < MAX_NDB_NODES; i++) { + Uint32 i; + for (i = 0; i < MAX_NDB_NODES; i++) { tabPtr.p->startFid[i] = RNIL; }//for - for (Uint32 i = 0; i < 8; i++) { + for (i = 0; i < 8; i++) { tabPtr.p->pageRef[i] = RNIL; }//for tabPtr.p->tableType = DictTabInfo::UndefTableType; @@ -11367,6 +11374,7 @@ void Dbdih::makeNodeGroups(Uint32 nodeArray[]) Uint32 tmngNodeGroup; Uint32 tmngReplica; Uint32 tmngLimit; + Uint32 i; /**----------------------------------------------------------------------- * ASSIGN ALL ACTIVE NODES INTO NODE GROUPS. HOT SPARE NODES ARE ASSIGNED @@ -11376,7 +11384,7 @@ void Dbdih::makeNodeGroups(Uint32 nodeArray[]) tmngReplica = 0; tmngLimit = csystemnodes - cnoHotSpare; ndbrequire(tmngLimit < MAX_NDB_NODES); - for (Uint32 i = 0; i < tmngLimit; i++) { + for (i = 0; i < tmngLimit; i++) { NodeGroupRecordPtr NGPtr; jam(); tmngNode = nodeArray[i]; @@ -11396,14 +11404,14 @@ void Dbdih::makeNodeGroups(Uint32 nodeArray[]) }//for cnoOfNodeGroups = tmngNodeGroup; ndbrequire(csystemnodes < MAX_NDB_NODES); - for (Uint32 i = tmngLimit + 1; i < csystemnodes; i++) { + for (i = tmngLimit + 1; i < csystemnodes; i++) { jam(); tmngNode = nodeArray[i]; mngNodeptr.i = tmngNode; ptrCheckGuard(mngNodeptr, MAX_NDB_NODES, nodeRecord); mngNodeptr.p->nodeGroup = ZNIL; }//for - for(int i = 0; i < MAX_NDB_NODES; i++){ + for(i = 0; i < MAX_NDB_NODES; i++){ jam(); Sysfile::setNodeGroup(i, SYSFILE->nodeGroups, NO_NODE_GROUP_ID); }//for @@ -11690,12 +11698,13 @@ Uint32 Dbdih::readPageWord(RWFragment* rf) void Dbdih::readReplica(RWFragment* rf, ReplicaRecordPtr readReplicaPtr) { + Uint32 i; readReplicaPtr.p->procNode = readPageWord(rf); readReplicaPtr.p->initialGci = readPageWord(rf); readReplicaPtr.p->noCrashedReplicas = readPageWord(rf); readReplicaPtr.p->nextLcp = readPageWord(rf); - for (Uint32 i = 0; i < MAX_LCP_STORED; i++) { + for (i = 0; i < MAX_LCP_STORED; i++) { readReplicaPtr.p->maxGciCompleted[i] = readPageWord(rf); readReplicaPtr.p->maxGciStarted[i] = readPageWord(rf); readReplicaPtr.p->lcpId[i] = readPageWord(rf); @@ -11703,13 +11712,13 @@ void Dbdih::readReplica(RWFragment* rf, ReplicaRecordPtr readReplicaPtr) }//for const Uint32 noCrashedReplicas = readReplicaPtr.p->noCrashedReplicas; ndbrequire(noCrashedReplicas < 8); - for (Uint32 i = 0; i < noCrashedReplicas; i++) { + for (i = 0; i < noCrashedReplicas; i++) { readReplicaPtr.p->createGci[i] = readPageWord(rf); readReplicaPtr.p->replicaLastGci[i] = readPageWord(rf); ndbrequire(readReplicaPtr.p->createGci[i] != 0xF1F1F1F1); ndbrequire(readReplicaPtr.p->replicaLastGci[i] != 0xF1F1F1F1); }//for - for(Uint32 i = noCrashedReplicas; i<8; i++){ + for(i = noCrashedReplicas; i<8; i++){ readReplicaPtr.p->createGci[i] = readPageWord(rf); readReplicaPtr.p->replicaLastGci[i] = readPageWord(rf); // They are not initialized... @@ -11732,7 +11741,7 @@ void Dbdih::readReplica(RWFragment* rf, ReplicaRecordPtr readReplicaPtr) /* WE ALSO HAVE TO INVALIDATE ANY LOCAL CHECKPOINTS THAT HAVE BEEN */ /* INVALIDATED BY MOVING BACK THE RESTART GCI. */ /* ---------------------------------------------------------------------- */ - for (Uint32 i = 0; i < MAX_LCP_STORED; i++) { + for (i = 0; i < MAX_LCP_STORED; i++) { jam(); if ((readReplicaPtr.p->lcpStatus[i] == ZVALID) && (readReplicaPtr.p->maxGciStarted[i] > SYSFILE->newestRestorableGCI)) { @@ -11764,6 +11773,7 @@ void Dbdih::readReplica(RWFragment* rf, ReplicaRecordPtr readReplicaPtr) void Dbdih::readReplicas(RWFragment* rf, FragmentstorePtr fragPtr) { + Uint32 i; ReplicaRecordPtr newReplicaPtr; Uint32 noStoredReplicas = fragPtr.p->noStoredReplicas; Uint32 noOldStoredReplicas = fragPtr.p->noOldStoredReplicas; @@ -11775,7 +11785,7 @@ void Dbdih::readReplicas(RWFragment* rf, FragmentstorePtr fragPtr) fragPtr.p->noOldStoredReplicas = 0; Uint32 replicaIndex = 0; ndbrequire(noStoredReplicas + noOldStoredReplicas <= MAX_REPLICAS); - for (Uint32 i = 0; i < noStoredReplicas; i++) { + for (i = 0; i < noStoredReplicas; i++) { seizeReplicaRec(newReplicaPtr); readReplica(rf, newReplicaPtr); if (checkNodeAlive(newReplicaPtr.p->procNode)) { @@ -11790,7 +11800,7 @@ void Dbdih::readReplicas(RWFragment* rf, FragmentstorePtr fragPtr) }//if }//for fragPtr.p->fragReplicas = noStoredReplicas; - for (Uint32 i = 0; i < noOldStoredReplicas; i++) { + for (i = 0; i < noOldStoredReplicas; i++) { jam(); seizeReplicaRec(newReplicaPtr); readReplica(rf, newReplicaPtr); @@ -12640,11 +12650,11 @@ void Dbdih::setNodeRestartInfoBits() NodeRecordPtr nodePtr; Uint32 tsnrNodeGroup; Uint32 tsnrNodeActiveStatus; - - for(int i = 1; i < MAX_NDB_NODES; i++){ + Uint32 i; + for(i = 1; i < MAX_NDB_NODES; i++){ Sysfile::setNodeStatus(i, SYSFILE->nodeStatus, Sysfile::NS_Active); }//for - for(Uint32 i = 1; i < Sysfile::NODE_GROUPS_SIZE; i++){ + for(i = 1; i < Sysfile::NODE_GROUPS_SIZE; i++){ SYSFILE->nodeGroups[i] = 0; }//for NdbNodeBitmask::clear(SYSFILE->lcpActive); @@ -12786,13 +12796,14 @@ void Dbdih::writeReplicas(RWFragment* wf, Uint32 replicaStartIndex) writePageWord(wf, wfReplicaPtr.p->initialGci); writePageWord(wf, wfReplicaPtr.p->noCrashedReplicas); writePageWord(wf, wfReplicaPtr.p->nextLcp); - for (Uint32 i = 0; i < MAX_LCP_STORED; i++) { + Uint32 i; + for (i = 0; i < MAX_LCP_STORED; i++) { writePageWord(wf, wfReplicaPtr.p->maxGciCompleted[i]); writePageWord(wf, wfReplicaPtr.p->maxGciStarted[i]); writePageWord(wf, wfReplicaPtr.p->lcpId[i]); writePageWord(wf, wfReplicaPtr.p->lcpStatus[i]); }//if - for (Uint32 i = 0; i < 8; i++) { + for (i = 0; i < 8; i++) { writePageWord(wf, wfReplicaPtr.p->createGci[i]); writePageWord(wf, wfReplicaPtr.p->replicaLastGci[i]); }//if @@ -13003,7 +13014,7 @@ Dbdih::execDUMP_STATE_ORD(Signal* signal) } if(signal->theData[0] == 7012){ - char buf[c_lcpState.m_participatingDIH.TextLength+1]; + char buf[8*_NDB_NODE_BITMASK_SIZE+1]; infoEvent("ParticipatingDIH = %s", c_lcpState.m_participatingDIH.getText(buf)); infoEvent("ParticipatingLQH = %s", c_lcpState.m_participatingLQH.getText(buf)); infoEvent("m_LCP_COMPLETE_REP_Counter_DIH = %s", @@ -13020,8 +13031,8 @@ Dbdih::execDUMP_STATE_ORD(Signal* signal) jam(); ptrAss(nodePtr, nodeRecord); if(nodePtr.p->nodeStatus == NodeRecord::ALIVE){ - - for(Uint32 i = 0; i<nodePtr.p->noOfStartedChkpt; i++){ + Uint32 i; + for(i = 0; i<nodePtr.p->noOfStartedChkpt; i++){ infoEvent("Node %d: started: table=%d fragment=%d replica=%d", nodePtr.i, nodePtr.p->startedChkpt[i].tableId, @@ -13029,7 +13040,7 @@ Dbdih::execDUMP_STATE_ORD(Signal* signal) nodePtr.p->startedChkpt[i].replicaPtr); } - for(Uint32 i = 0; i<nodePtr.p->noOfQueuedChkpt; i++){ + for(i = 0; i<nodePtr.p->noOfQueuedChkpt; i++){ infoEvent("Node %d: queued: table=%d fragment=%d replica=%d", nodePtr.i, nodePtr.p->queuedChkpt[i].tableId, diff --git a/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp b/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp index f3a6ce8f994..eb8e2917a8e 100644 --- a/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp +++ b/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp @@ -6387,12 +6387,13 @@ void Dblqh::execNODE_FAILREP(Signal* signal) UintR TfoundNodes = 0; UintR TnoOfNodes; UintR Tdata[MAX_NDB_NODES]; + Uint32 i; NodeFailRep * const nodeFail = (NodeFailRep *)&signal->theData[0]; TnoOfNodes = nodeFail->noOfNodes; UintR index = 0; - for (Uint32 i = 1; i < MAX_NDB_NODES; i++) { + for (i = 1; i < MAX_NDB_NODES; i++) { jam(); if(NodeBitmask::get(nodeFail->theNodes, i)){ jam(); @@ -6406,7 +6407,7 @@ void Dblqh::execNODE_FAILREP(Signal* signal) ndbrequire(index == TnoOfNodes); ndbrequire(cnoOfNodes - 1 < MAX_NDB_NODES); - for (Uint32 i = 0; i < TnoOfNodes; i++) { + for (i = 0; i < TnoOfNodes; i++) { const Uint32 nodeId = Tdata[i]; lcpPtr.p->m_EMPTY_LCP_REQ.clear(nodeId); @@ -6604,7 +6605,7 @@ Dblqh::scanMarkers(Signal* signal, } const Uint32 RT_BREAK = 256; - for(Uint32 i = 0; i<RT_BREAK || iter.bucket == startBucket; i++){ + for(i = 0; i<RT_BREAK || iter.bucket == startBucket; i++){ jam(); if(iter.curr.i == RNIL){ @@ -13222,11 +13223,12 @@ void Dblqh::execSR_FRAGIDCONF(Signal* signal) Uint32 noLocFrag = srFragidConf->noLocFrag; ndbrequire(noLocFrag == 2); Uint32 fragid[2]; - for (Uint32 i = 0; i < noLocFrag; i++) { + Uint32 i; + for (i = 0; i < noLocFrag; i++) { fragid[i] = srFragidConf->fragId[i]; }//for - for (Uint32 i = 0; i < noLocFrag; i++) { + for (i = 0; i < noLocFrag; i++) { jam(); Uint32 fragId = fragid[i]; /* ---------------------------------------------------------------------- @@ -16177,17 +16179,18 @@ void Dblqh::initialisePageRef(Signal* signal) void Dblqh::initialiseRecordsLab(Signal* signal, Uint32 data, Uint32 retRef, Uint32 retData) { + Uint32 i; switch (data) { case 0: jam(); - for (Uint32 i = 0; i < MAX_NDB_NODES; i++) { + for (i = 0; i < MAX_NDB_NODES; i++) { cnodeSrState[i] = ZSTART_SR; cnodeExecSrState[i] = ZSTART_SR; }//for - for (Uint32 i = 0; i < 1024; i++) { + for (i = 0; i < 1024; i++) { ctransidHash[i] = RNIL; }//for - for (Uint32 i = 0; i < 4; i++) { + for (i = 0; i < 4; i++) { cactiveCopy[i] = RNIL; }//for cnoActiveCopy = 0; @@ -18141,7 +18144,7 @@ Dblqh::execDUMP_STATE_ORD(Signal* signal) infoEvent(" lcpQueued=%d reportEmpty=%d", TlcpPtr.p->lcpQueued, TlcpPtr.p->reportEmpty); - char buf[TlcpPtr.p->m_EMPTY_LCP_REQ.TextLength+1]; + char buf[8*_NDB_NODE_BITMASK_SIZE+1]; infoEvent(" m_EMPTY_LCP_REQ=%d", TlcpPtr.p->m_EMPTY_LCP_REQ.getText(buf)); diff --git a/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp b/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp index 066fb24f09c..7d8d0f5fead 100644 --- a/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp +++ b/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp @@ -6721,7 +6721,8 @@ void Dbtc::execNODE_FAILREP(Signal* signal) tcNodeFailptr.i = 0; ptrAss(tcNodeFailptr, tcFailRecord); - for (Uint32 tindex = 0; tindex < tnoOfNodes; tindex++) { + Uint32 tindex; + for (tindex = 0; tindex < tnoOfNodes; tindex++) { jam(); hostptr.i = cdata[tindex]; ptrCheckGuard(hostptr, chostFilesize, hostRecord); @@ -6838,8 +6839,7 @@ void Dbtc::execNODE_FAILREP(Signal* signal) }//if }//for }//if - - for (Uint32 tindex = 0; tindex < tnoOfNodes; tindex++) { + for (tindex = 0; tindex < tnoOfNodes; tindex++) { jam(); hostptr.i = cdata[tindex]; ptrCheckGuard(hostptr, chostFilesize, hostRecord); diff --git a/ndb/src/kernel/blocks/dbtup/DbtupDebug.cpp b/ndb/src/kernel/blocks/dbtup/DbtupDebug.cpp index c38fde23404..930faf6d24a 100644 --- a/ndb/src/kernel/blocks/dbtup/DbtupDebug.cpp +++ b/ndb/src/kernel/blocks/dbtup/DbtupDebug.cpp @@ -238,11 +238,12 @@ void Dbtup::execMEMCHECKREQ(Signal* signal) ljamEntry(); BlockReference blockref = signal->theData[0]; - for (Uint32 i = 0; i < 25; i++) { + Uint32 i; + for (i = 0; i < 25; i++) { ljam(); data[i] = 0; }//for - for (Uint32 i = 0; i < 16; i++) { + for (i = 0; i < 16; i++) { regPagePtr.i = cfreepageList[i]; ljam(); while (regPagePtr.i != RNIL) { diff --git a/ndb/src/kernel/blocks/dbtup/DbtupSystemRestart.cpp b/ndb/src/kernel/blocks/dbtup/DbtupSystemRestart.cpp index 580d764c96f..30701bdbe39 100644 --- a/ndb/src/kernel/blocks/dbtup/DbtupSystemRestart.cpp +++ b/ndb/src/kernel/blocks/dbtup/DbtupSystemRestart.cpp @@ -494,16 +494,17 @@ void Dbtup::readExecUndoLogLab(Signal* signal, DiskBufferSegmentInfoPtr dbsiPtr, Uint32 dataPages[16]; ndbrequire(dbsiPtr.p->pdxFilePage > 0); ndbrequire(dbsiPtr.p->pdxFilePage <= ZUB_SEGMENT_SIZE); - for (Uint32 i = 0; i < dbsiPtr.p->pdxFilePage; i++) { + Uint32 i; + for (i = 0; i < dbsiPtr.p->pdxFilePage; i++) { ljam(); dataPages[i] = dbsiPtr.p->pdxDataPage[i + ZUB_SEGMENT_SIZE]; }//for - for (Uint32 i = 0; i < ZUB_SEGMENT_SIZE; i++) { + for (i = 0; i < ZUB_SEGMENT_SIZE; i++) { ljam(); dataPages[i + dbsiPtr.p->pdxFilePage] = dbsiPtr.p->pdxDataPage[i]; }//for Uint32 limitLoop = ZUB_SEGMENT_SIZE + dbsiPtr.p->pdxFilePage; - for (Uint32 i = 0; i < limitLoop; i++) { + for (i = 0; i < limitLoop; i++) { ljam(); dbsiPtr.p->pdxDataPage[i] = dataPages[i]; }//for @@ -977,7 +978,8 @@ void Dbtup::allocRestartUndoBufferSegment(Signal* signal, DiskBufferSegmentInfoP seizeDiskBufferSegmentRecord(dbsiPtr); dbsiPtr.p->pdxBuffertype = UNDO_RESTART_PAGES; dbsiPtr.p->pdxUndoBufferSet[0] = undoPagePtr.i; - for (Uint32 i = 0; i < ZUB_SEGMENT_SIZE; i++) { + Uint32 i; + for (i = 0; i < ZUB_SEGMENT_SIZE; i++) { dbsiPtr.p->pdxDataPage[i] = undoPagePtr.i + i; }//for @@ -994,7 +996,7 @@ void Dbtup::allocRestartUndoBufferSegment(Signal* signal, DiskBufferSegmentInfoP undoPagePtr.p->undoPageWord[ZPAGE_NEXT_POS] = RNIL; dbsiPtr.p->pdxUndoBufferSet[1] = undoPagePtr.i; // lliPtr.p->lliUndoPage = undoPagePtr.i; - for (Uint32 i = ZUB_SEGMENT_SIZE; i < (2 * ZUB_SEGMENT_SIZE); i++) { + for (i = ZUB_SEGMENT_SIZE; i < (2 * ZUB_SEGMENT_SIZE); i++) { dbsiPtr.p->pdxDataPage[i] = undoPagePtr.i + (i - ZUB_SEGMENT_SIZE); }//for return; diff --git a/ndb/src/kernel/blocks/dbtux/Dbtux.hpp b/ndb/src/kernel/blocks/dbtux/Dbtux.hpp index c5732eea01b..1a3c7f64ac3 100644 --- a/ndb/src/kernel/blocks/dbtux/Dbtux.hpp +++ b/ndb/src/kernel/blocks/dbtux/Dbtux.hpp @@ -906,7 +906,7 @@ Dbtux::TreeHead::getSize(AccSize acc) const case AccFull: return m_nodeSize; } - REQUIRE(false, "invalid Dbtux::AccSize"); + abort(); return 0; } diff --git a/ndb/src/kernel/blocks/dbtux/DbtuxMeta.cpp b/ndb/src/kernel/blocks/dbtux/DbtuxMeta.cpp index 83944f96b96..b30b555ccad 100644 --- a/ndb/src/kernel/blocks/dbtux/DbtuxMeta.cpp +++ b/ndb/src/kernel/blocks/dbtux/DbtuxMeta.cpp @@ -407,14 +407,15 @@ Dbtux::freeDescEnt(IndexPtr indexPtr) index2.m_descPage == pagePtr.i && index2.m_descOff == off + size); // move the entry (overlapping copy if size < size2) - for (unsigned i = 0; i < size2; i++) { + unsigned i; + for (i = 0; i < size2; i++) { jam(); data[off + i] = data[off + size + i]; } off += size2; // adjust page offset in index and all fragments index2.m_descOff -= size; - for (unsigned i = 0; i < index2.m_numFrags; i++) { + for (i = 0; i < index2.m_numFrags; i++) { jam(); Frag& frag2 = *c_fragPool.getPtr(index2.m_fragPtrI[i]); frag2.m_descOff -= size; diff --git a/ndb/src/kernel/blocks/dbtux/DbtuxTree.cpp b/ndb/src/kernel/blocks/dbtux/DbtuxTree.cpp index e66bfc6d05c..3baa62998db 100644 --- a/ndb/src/kernel/blocks/dbtux/DbtuxTree.cpp +++ b/ndb/src/kernel/blocks/dbtux/DbtuxTree.cpp @@ -177,7 +177,8 @@ Dbtux::treeRemove(Signal* signal, Frag& frag, TreePos treePos) nodePopDown(signal, node, pos, ent); ndbrequire(node.getChilds() <= 1); // handle half-leaf - for (unsigned i = 0; i <= 1; i++) { + unsigned i; + for (i = 0; i <= 1; i++) { jam(); TupLoc childLoc = node.getLink(i); if (childLoc != NullTupLoc) { @@ -191,7 +192,7 @@ Dbtux::treeRemove(Signal* signal, Frag& frag, TreePos treePos) // get parent if any TupLoc parentLoc = node.getLink(2); NodeHandle parentNode(frag); - unsigned i = node.getSide(); + i = node.getSide(); // move all that fits into parent if (parentLoc != NullTupLoc) { jam(); diff --git a/ndb/src/kernel/blocks/dbutil/DbUtil.cpp b/ndb/src/kernel/blocks/dbutil/DbUtil.cpp index 92410e1a784..ecaead3ba5a 100644 --- a/ndb/src/kernel/blocks/dbutil/DbUtil.cpp +++ b/ndb/src/kernel/blocks/dbutil/DbUtil.cpp @@ -2581,3 +2581,5 @@ DbUtil::execUTIL_DESTORY_LOCK_REQ(Signal* signal){ sendSignal(req.senderRef, GSN_UTIL_DESTROY_LOCK_REF, signal, UtilDestroyLockRef::SignalLength, JBB); } + +template class ArrayPool<DbUtil::Page32>; diff --git a/ndb/src/kernel/blocks/grep/Grep.cpp b/ndb/src/kernel/blocks/grep/Grep.cpp index ee506ce922a..8b93ef9cd20 100644 --- a/ndb/src/kernel/blocks/grep/Grep.cpp +++ b/ndb/src/kernel/blocks/grep/Grep.cpp @@ -73,7 +73,7 @@ Grep::getNodeGroupMembers(Signal* signal) { c_noNodesInGroup++; } } - ndbrequire(c_noNodesInGroup >= 0); // at least 1 node in the nodegroup + ndbrequire(c_noNodesInGroup > 0); // at least 1 node in the nodegroup #ifdef NODEFAIL_DEBUG for (Uint32 i = 0; i < c_noNodesInGroup; i++) { @@ -253,7 +253,8 @@ Grep::execREAD_NODESCONF(Signal* signal) /****************************** * Check which REP nodes exist ******************************/ - for (Uint32 i = 1; i < MAX_NODES; i++) + Uint32 i; + for (i = 1; i < MAX_NODES; i++) { jam(); #if 0 @@ -279,7 +280,7 @@ Grep::execREAD_NODESCONF(Signal* signal) m_aliveNodes.clear(); Uint32 count = 0; - for(Uint32 i = 0; i<MAX_NDB_NODES; i++) + for(i = 0; i<MAX_NDB_NODES; i++) { if (NodeBitmask::get(conf->allNodes, i)) { diff --git a/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp b/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp index 7ba7d0d25c6..f6607cdbdbb 100644 --- a/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp +++ b/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp @@ -229,7 +229,7 @@ AsyncFile::run() endReq(); return; default: - THREAD_REQUIRE(false, "Using default switch in AsyncFile::run"); + abort(); break; }//switch theReportTo->writeChannel(request); diff --git a/ndb/src/kernel/blocks/ndbfs/MemoryChannel.hpp b/ndb/src/kernel/blocks/ndbfs/MemoryChannel.hpp index 435a6a6b208..03911d195ec 100644 --- a/ndb/src/kernel/blocks/ndbfs/MemoryChannel.hpp +++ b/ndb/src/kernel/blocks/ndbfs/MemoryChannel.hpp @@ -120,8 +120,7 @@ template <class T> void MemoryChannel<T>::writeChannel( T *t) { NdbMutex_Lock(theMutexPtr); - REQUIRE(!full(theWriteIndex, theReadIndex), "Memory Channel Full"); - REQUIRE(theChannel != NULL, "Memory Channel Full"); + if(full(theWriteIndex, theReadIndex) || theChannel == NULL) abort(); theChannel[theWriteIndex]= t; ++theWriteIndex; NdbMutex_Unlock(theMutexPtr); diff --git a/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp b/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp index fe737fc584b..e38ae566430 100644 --- a/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp +++ b/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp @@ -1010,3 +1010,6 @@ Ndbfs::execDUMP_STATE_ORD(Signal* signal) BLOCK_FUNCTIONS(Ndbfs); +template class Vector<AsyncFile*>; +template class Vector<OpenFiles::OpenFileItem>; +template class MemoryChannel<Request>; diff --git a/ndb/src/kernel/blocks/ndbfs/Pool.hpp b/ndb/src/kernel/blocks/ndbfs/Pool.hpp index a26fa730727..0410673af6f 100644 --- a/ndb/src/kernel/blocks/ndbfs/Pool.hpp +++ b/ndb/src/kernel/blocks/ndbfs/Pool.hpp @@ -215,7 +215,6 @@ protected: T** tList = theList; int i; theList = new T*[aSize+theCurrentSize]; - REQUIRE(theList != 0, "Allocate in Pool.hpp failed"); // allocate full list for (i = 0; i < theTop; i++) { theList[i] = tList[i]; diff --git a/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp b/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp index 9bf3bf06fa4..30f4d783c81 100644 --- a/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp +++ b/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp @@ -2141,7 +2141,8 @@ void Qmgr::execPREP_FAILREQ(Signal* signal) Uint16 TfailureNr = prepFail->failNo; cnoPrepFailedNodes = prepFail->noOfNodes; UintR arrayIndex = 0; - for (Uint32 Tindex = 0; Tindex < MAX_NDB_NODES; Tindex++) { + Uint32 Tindex; + for (Tindex = 0; Tindex < MAX_NDB_NODES; Tindex++) { if (NodeBitmask::get(prepFail->theNodes, Tindex)){ cprepFailedNodes[arrayIndex] = Tindex; arrayIndex++; @@ -2169,7 +2170,7 @@ void Qmgr::execPREP_FAILREQ(Signal* signal) guard0 = cnoPrepFailedNodes - 1; arrGuard(guard0, MAX_NDB_NODES); - for (Uint32 Tindex = 0; Tindex <= guard0; Tindex++) { + for (Tindex = 0; Tindex <= guard0; Tindex++) { jam(); failReport(signal, cprepFailedNodes[Tindex], diff --git a/ndb/src/kernel/blocks/suma/Suma.cpp b/ndb/src/kernel/blocks/suma/Suma.cpp index 9718845de43..ec9dc4a3766 100644 --- a/ndb/src/kernel/blocks/suma/Suma.cpp +++ b/ndb/src/kernel/blocks/suma/Suma.cpp @@ -3972,3 +3972,6 @@ Suma::execSUMA_HANDOVER_CONF(Signal* signal) { } } } + +template void append(DataBuffer<11>&,SegmentedSectionPtr,SectionSegmentPool&); + diff --git a/ndb/src/kernel/blocks/trix/Trix.cpp b/ndb/src/kernel/blocks/trix/Trix.cpp index f058433840c..6cbc7a9b371 100644 --- a/ndb/src/kernel/blocks/trix/Trix.cpp +++ b/ndb/src/kernel/blocks/trix/Trix.cpp @@ -965,3 +965,5 @@ void Trix::checkParallelism(Signal* signal, SubscriptionRecord* subRec) } BLOCK_FUNCTIONS(Trix); + +template void append(DataBuffer<15>&,SegmentedSectionPtr,SectionSegmentPool&); diff --git a/ndb/src/kernel/error/ErrorReporter.hpp b/ndb/src/kernel/error/ErrorReporter.hpp index 3e2551d2056..2c79f242eea 100644 --- a/ndb/src/kernel/error/ErrorReporter.hpp +++ b/ndb/src/kernel/error/ErrorReporter.hpp @@ -23,35 +23,6 @@ #include "Error.hpp" #include <Emulator.hpp> - -#ifdef ASSERT -#undef ASSERT -#endif - -#define REQUIRE(trueToContinue, message) \ - if ( (trueToContinue) ) { } else { \ - ErrorReporter::handleAssert(message, __FILE__, __LINE__); } - -#define THREAD_REQUIRE(trueToContinue, message) \ - if ( (trueToContinue) ) { } else { \ - ErrorReporter::handleThreadAssert(message, __FILE__, __LINE__); } - -#ifdef NDEBUG -#define NDB_ASSERT(trueToContinue, message) -#else -#define NDB_ASSERT(trueToContinue, message) \ - if ( !(trueToContinue) ) { \ - ErrorReporter::handleAssert(message, __FILE__, __LINE__); } -#endif - - // Description: - // This macro is used to report programming errors. - // Parameters: - // trueToContinue IN An expression. If it evaluates to 0 - // execution is stopped. - // message IN A message from the programmer - // explaining what went wrong. - class ErrorReporter { public: diff --git a/ndb/src/kernel/main.cpp b/ndb/src/kernel/main.cpp index e6c08b1b96f..f8e852b9d35 100644 --- a/ndb/src/kernel/main.cpp +++ b/ndb/src/kernel/main.cpp @@ -143,7 +143,7 @@ NDB_MAIN(ndb_kernel){ // Set thread concurrency for Solaris' light weight processes int status; status = NdbThread_SetConcurrencyLevel(30); - NDB_ASSERT(status == 0, "Can't set appropriate concurrency level."); + assert(status == 0); #ifdef VM_TRACE // Create a signal logger @@ -168,18 +168,22 @@ NDB_MAIN(ndb_kernel){ globalEmulatorData.theThreadConfig->doStart(NodeState::SL_STARTING); break; default: - NDB_ASSERT(0, "Illegal state globalData.theRestartFlag"); + assert("Illegal state globalData.theRestartFlag" == 0); } SocketServer socket_server; globalTransporterRegistry.startSending(); globalTransporterRegistry.startReceiving(); - if (!globalTransporterRegistry.start_service(socket_server)) - NDB_ASSERT(0, "globalTransporterRegistry.start_service() failed"); + if (!globalTransporterRegistry.start_service(socket_server)){ + ndbout_c("globalTransporterRegistry.start_service() failed"); + exit(-1); + } - if (!globalTransporterRegistry.start_clients()) - NDB_ASSERT(0, "globalTransporterRegistry.start_clients() failed"); + if (!globalTransporterRegistry.start_clients()){ + ndbout_c("globalTransporterRegistry.start_clients() failed"); + exit(-1); + } globalEmulatorData.theWatchDog->doStart(); diff --git a/ndb/src/kernel/vm/ArrayPool.hpp b/ndb/src/kernel/vm/ArrayPool.hpp index 4fc6bb97f73..c06f48f2e8e 100644 --- a/ndb/src/kernel/vm/ArrayPool.hpp +++ b/ndb/src/kernel/vm/ArrayPool.hpp @@ -153,6 +153,7 @@ public: * (Run operator NdbOut<< on every element) */ void print(NdbOut & out){ +#ifdef VM_TRACE out << "FirstFree = " << firstFree << endl; for(Uint32 i = 0; i<size; i++){ #ifdef ARRAY_GUARD @@ -164,6 +165,7 @@ public: out << i << ": " << theArray[i] << " "; } out << endl; +#endif } #ifdef DEBUG diff --git a/ndb/src/kernel/vm/DataBuffer.hpp b/ndb/src/kernel/vm/DataBuffer.hpp index 7dc89aa638c..7f553898eb5 100644 --- a/ndb/src/kernel/vm/DataBuffer.hpp +++ b/ndb/src/kernel/vm/DataBuffer.hpp @@ -33,7 +33,7 @@ public: Uint32 data[sz]; NdbOut& print(NdbOut& out){ out << "[DataBuffer<" << sz << ">::Segment this=" - << hex << (Uint32)this << dec << " nextPool= " + << this << dec << " nextPool= " << nextPool << " ]"; return out; } diff --git a/ndb/src/kernel/vm/MetaData.cpp b/ndb/src/kernel/vm/MetaData.cpp index bcde6c63272..51afbf21503 100644 --- a/ndb/src/kernel/vm/MetaData.cpp +++ b/ndb/src/kernel/vm/MetaData.cpp @@ -47,7 +47,7 @@ MetaData::MetaData(SimulatedBlock* block) : MetaData::~MetaData() { for (int i = false; i <= true; i++) { - NDB_ASSERT(m_common.m_lock[i] >= m_lock[i], "invalid lock count"); + assert(m_common.m_lock[i] >= m_lock[i]); m_common.m_lock[i] -= m_lock[i]; m_lock[i] = 0; } diff --git a/ndb/src/kernel/vm/SimulatedBlock.cpp b/ndb/src/kernel/vm/SimulatedBlock.cpp index a6a8a6242cd..cb3c5dc9d2c 100644 --- a/ndb/src/kernel/vm/SimulatedBlock.cpp +++ b/ndb/src/kernel/vm/SimulatedBlock.cpp @@ -136,12 +136,12 @@ SimulatedBlock::installSimulatedBlockFunctions(){ void SimulatedBlock::addRecSignalImpl(GlobalSignalNumber gsn, ExecFunction f, bool force){ - REQUIRE(gsn <= MAX_GSN, "Illegal signal added in block (GSN too high)"); - char probData[255]; - snprintf(probData, 255, - "Signal (%d) already added in block", - gsn); - REQUIRE(force || theExecArray[gsn] == 0, probData); + if(gsn > MAX_GSN || (!force && theExecArray[gsn] != 0)){ + char errorMsg[255]; + snprintf(errorMsg, 255, + "Illeagal signal (%d %d)", gsn, MAX_GSN); + ERROR_SET(fatal, ERR_ERROR_PRGERR, errorMsg, errorMsg); + } theExecArray[gsn] = f; } @@ -1005,7 +1005,8 @@ SimulatedBlock::assembleFragments(Signal * signal){ /** * FragInfo == 2 or 3 */ - for(Uint32 i = 0; i<secs; i++){ + Uint32 i; + for(i = 0; i<secs; i++){ Uint32 sectionNo = secNos[i]; ndbassert(sectionNo < 3); Uint32 sectionPtrI = signal->m_sectionPtr[i].i; @@ -1027,7 +1028,6 @@ SimulatedBlock::assembleFragments(Signal * signal){ /** * fragInfo = 3 */ - Uint32 i; for(i = 0; i<3; i++){ Uint32 ptrI = fragPtr.p->m_sectionPtrI[i]; if(ptrI != RNIL){ diff --git a/ndb/src/kernel/vm/SimulatedBlock.hpp b/ndb/src/kernel/vm/SimulatedBlock.hpp index 491d432625e..e3eac8c0e20 100644 --- a/ndb/src/kernel/vm/SimulatedBlock.hpp +++ b/ndb/src/kernel/vm/SimulatedBlock.hpp @@ -458,11 +458,11 @@ SimulatedBlock::executeFunction(GlobalSignalNumber gsn, Signal* signal){ char errorMsg[255]; if (!(gsn <= MAX_GSN)) { snprintf(errorMsg, 255, "Illegal signal received (GSN %d too high)", gsn); - REQUIRE(false, errorMsg); + ERROR_SET(fatal, ERR_ERROR_PRGERR, errorMsg, errorMsg); } if (!(theExecArray[gsn] != 0)) { snprintf(errorMsg, 255, "Illegal signal received (GSN %d not added)", gsn); - REQUIRE(false, errorMsg); + ERROR_SET(fatal, ERR_ERROR_PRGERR, errorMsg, errorMsg); } ndbrequire(false); } diff --git a/ndb/src/kernel/vm/TransporterCallback.cpp b/ndb/src/kernel/vm/TransporterCallback.cpp index eb7d138895c..158de64c87f 100644 --- a/ndb/src/kernel/vm/TransporterCallback.cpp +++ b/ndb/src/kernel/vm/TransporterCallback.cpp @@ -434,5 +434,28 @@ reportDisconnect(void * callbackObj, NodeId nodeId, Uint32 errNo){ globalScheduler.execute(&signal, JBA, CMVMI, GSN_DISCONNECT_REP); } - +void +SignalLoggerManager::printSegmentedSection(FILE * output, + const SignalHeader & sh, + const SegmentedSectionPtr ptr[3], + unsigned i) +{ + fprintf(output, "SECTION %u type=segmented", i); + if (i >= 3) { + fprintf(output, " *** invalid ***\n"); + return; + } + const Uint32 len = ptr[i].sz; + SectionSegment * ssp = ptr[i].p; + Uint32 pos = 0; + fprintf(output, " size=%u\n", (unsigned)len); + while (pos < len) { + if (pos > 0 && pos % SectionSegment::DataLength == 0) { + ssp = g_sectionSegmentPool.getPtr(ssp->m_nextSegment); + } + printDataWord(output, pos, ssp->theData[pos % SectionSegment::DataLength]); + } + if (len > 0) + putc('\n', output); +} diff --git a/ndb/src/mgmapi/mgmapi.cpp b/ndb/src/mgmapi/mgmapi.cpp index 8f0c9e3ccf7..963e159424a 100644 --- a/ndb/src/mgmapi/mgmapi.cpp +++ b/ndb/src/mgmapi/mgmapi.cpp @@ -64,7 +64,7 @@ 0, \ 0, 0 } -class ParserDummy : SocketServer::Session +class ParserDummy : private SocketServer::Session { public: ParserDummy(NDB_SOCKET_TYPE sock); @@ -473,11 +473,12 @@ extern "C" const char * ndb_mgm_get_node_status_string(enum ndb_mgm_node_status status) { - for(int i = 0; i<no_of_status_values; i++) + int i; + for(i = 0; i<no_of_status_values; i++) if(status_values[i].value == status) return status_values[i].str; - for(int i = 0; i<no_of_status_values; i++) + for(i = 0; i<no_of_status_values; i++) if(status_values[i].value == NDB_MGM_NODE_STATUS_UNKNOWN) return status_values[i].str; @@ -1591,3 +1592,5 @@ ndb_mgm_rep_command(NdbMgmHandle handle, unsigned int request, delete reply; return 0; } + +template class Vector<const ParserRow<ParserDummy>*>; diff --git a/ndb/src/mgmclient/CommandInterpreter.cpp b/ndb/src/mgmclient/CommandInterpreter.cpp index cf9d885847a..fe9be9bcd44 100644 --- a/ndb/src/mgmclient/CommandInterpreter.cpp +++ b/ndb/src/mgmclient/CommandInterpreter.cpp @@ -634,7 +634,8 @@ CommandInterpreter::executeHelp(char* parameters) void CommandInterpreter::executeShow(char* parameters) -{ +{ + int i; connect(); if (emptyString(parameters)) { ndbout << "Cluster Configuration" << endl @@ -652,7 +653,7 @@ CommandInterpreter::executeShow(char* parameters) api_nodes = 0, mgm_nodes = 0; - for(int i=0; i < state->no_of_nodes; i++) { + for(i=0; i < state->no_of_nodes; i++) { switch(state->node_states[i].node_type) { case NDB_MGM_NODE_TYPE_API: api_nodes++; @@ -673,7 +674,7 @@ CommandInterpreter::executeShow(char* parameters) << " NDB Node(s)" << endl; - for(int i=0; i < state->no_of_nodes; i++) { + for(i=0; i < state->no_of_nodes; i++) { if(state->node_states[i].node_type == NDB_MGM_NODE_TYPE_NDB) { ndbout << "DB node:\t" << state->node_states[i].node_id; if(state->node_states[i].version != 0) { @@ -695,7 +696,7 @@ CommandInterpreter::executeShow(char* parameters) << " API Node(s)" << endl; - for(int i=0; i < state->no_of_nodes; i++) { + for(i=0; i < state->no_of_nodes; i++) { if(state->node_states[i].node_type == NDB_MGM_NODE_TYPE_API) { ndbout << "API node:\t" << state->node_states[i].node_id; if(state->node_states[i].version != 0) { @@ -716,7 +717,7 @@ CommandInterpreter::executeShow(char* parameters) << " MGM Node(s)" << endl; - for(int i=0; i < state->no_of_nodes; i++) { + for(i=0; i < state->no_of_nodes; i++) { if(state->node_states[i].node_type == NDB_MGM_NODE_TYPE_MGM) { ndbout << "MGM node:\t" << state->node_states[i].node_id; if(state->node_states[i].version != 0) { @@ -759,6 +760,7 @@ CommandInterpreter::executeShow(char* parameters) void CommandInterpreter::executeClusterLog(char* parameters) { + int i; connect(); if (parameters != 0 && strlen(parameters) != 0) { enum ndb_mgm_clusterlog_level severity = NDB_MGM_CLUSTERLOG_ALL; @@ -846,10 +848,10 @@ CommandInterpreter::executeClusterLog(char* parameters) ndbout << "Cluster logging is disabled." << endl; - for(int i = 0; i<7;i++) + for(i = 0; i<7;i++) printf("enabled[%d] = %d\n", i, enabled[i]); ndbout << "Severities enabled: "; - for(int i = 1; i < 7; i++) { + for(i = 1; i < 7; i++) { if(enabled[i]) ndbout << names[i] << " "; } @@ -1298,14 +1300,15 @@ CommandInterpreter::executeLog(int processId, return; } int len=0; - for(Uint32 i=0; i<blocks.size(); i++) { + Uint32 i; + for(i=0; i<blocks.size(); i++) { ndbout_c("blocks %s %d",blocks[i], strlen(blocks[i])); len += strlen(blocks[i]); } len += blocks.size()*2; char * blockNames = (char*)malloc(len); - for(Uint32 i=0; i<blocks.size(); i++) { + for(i=0; i<blocks.size(); i++) { strcat(blockNames, blocks[i]); strcat(blockNames, "|"); } @@ -1478,7 +1481,7 @@ CommandInterpreter::executeSet(int /*processId*/, << endl; } else { - NDB_ASSERT(false, ""); + assert(false); } } else { @@ -1497,7 +1500,7 @@ CommandInterpreter::executeSet(int /*processId*/, } else { // The primary is not tried to write if the write of backup file fails - NDB_ASSERT(false, ""); + abort(); } } free(newpar); diff --git a/ndb/src/mgmclient/CpcClient.cpp b/ndb/src/mgmclient/CpcClient.cpp index f11aa797ff1..47e336e2749 100644 --- a/ndb/src/mgmclient/CpcClient.cpp +++ b/ndb/src/mgmclient/CpcClient.cpp @@ -557,4 +557,5 @@ SimpleCpcClient::cpc_call(const char *cmd, SimpleCpcClient::ParserDummy::ParserDummy(NDB_SOCKET_TYPE sock) : SocketServer::Session(sock) { } - + +template class Vector<SimpleCpcClient::Process>; diff --git a/ndb/src/mgmsrv/CommandInterpreter.cpp b/ndb/src/mgmsrv/CommandInterpreter.cpp index 004fc463b70..316b6d5795e 100644 --- a/ndb/src/mgmsrv/CommandInterpreter.cpp +++ b/ndb/src/mgmsrv/CommandInterpreter.cpp @@ -378,7 +378,8 @@ void CommandInterpreter::executeHelp(char* parameters) { (void)parameters; // Don't want compiler warning if (emptyString(parameters)) { - for (int i = 0; i<noOfHelpTexts; i++) { + unsigned i; + for (i = 0; i<noOfHelpTexts; i++) { ndbout << helpTexts[i] << endl; } @@ -388,7 +389,7 @@ void CommandInterpreter::executeHelp(char* parameters) { << endl; ndbout << "<category> = "; - for(Uint32 i = 0; i<EventLogger::noOfEventCategoryNames; i++){ + for(i = 0; i<EventLogger::noOfEventCategoryNames; i++){ ndbout << EventLogger::eventCategoryNames[i].name; if (i < EventLogger::noOfEventCategoryNames - 1) { ndbout << " | "; @@ -1195,11 +1196,12 @@ CommandInterpreter::jonas(int processId, const char* parameters, bool all) { data[0] = 12; data[1] = 13; - - for(Uint32 i = 0; i<70; i++) + + unsigned i; + for(i = 0; i<70; i++) sec0[i] = i; - for(Uint32 i = 0; i<123; i++) + for(i = 0; i<123; i++) sec1[i] = 70+i; signal.set(0, CMVMI, GSN_TESTSIG, 3); diff --git a/ndb/src/mgmsrv/MgmtSrvr.cpp b/ndb/src/mgmsrv/MgmtSrvr.cpp index 2fe4624ab59..ccc63cc7e70 100644 --- a/ndb/src/mgmsrv/MgmtSrvr.cpp +++ b/ndb/src/mgmsrv/MgmtSrvr.cpp @@ -250,14 +250,12 @@ MgmtSrvr::startEventLog() } ndb_mgm_destroy_iterator(iter); - if(logdest.length()==0) { + if(logdest.length() == 0 || logdest == "") { logdest.assfmt("FILE:filename=%s,maxsize=1000000,maxfiles=6", clusterLog); } - if(!g_EventLogger.addHandler(logdest)) { - ndbout << "ERROR: cannot parse \"" << logdest << "\"" << endl; - exit(1); + ndbout << "Warning: could not add log destination \"" << logdest.c_str() << "\"" << endl; } } @@ -594,8 +592,10 @@ MgmtSrvr::MgmtSrvr(NodeId nodeId, _ownNodeId= 0; // did not get nodeid requested } m_allocated_resources.reserve_node(_ownNodeId); - } else - NDB_ASSERT(0, "Unable to retrieve own node id"); + } else { + ndbout_c("Unable to retrieve own node id"); + exit(-1); + } } @@ -1098,13 +1098,13 @@ MgmtSrvr::version(int * stopCount, bool abort, m_versionRec.callback = callback; m_versionRec.inUse = true ; - - for(Uint32 i = 0; i<MAX_NODES; i++) { + Uint32 i; + for(i = 0; i<MAX_NODES; i++) { if (getNodeType(i) == NDB_MGM_NODE_TYPE_MGM) { m_versionRec.callback(i, NDB_VERSION, this,0); } } - for(Uint32 i = 0; i<MAX_NODES; i++) { + for(i = 0; i<MAX_NODES; i++) { if (getNodeType(i) == NDB_MGM_NODE_TYPE_NDB) { node = theFacade->theClusterMgr->getNodeInfo(i); version = node.m_info.m_version; @@ -1115,7 +1115,7 @@ MgmtSrvr::version(int * stopCount, bool abort, } } - for(Uint32 i = 0; i<MAX_NODES; i++) { + for(i = 0; i<MAX_NODES; i++) { if (getNodeType(i) == NDB_MGM_NODE_TYPE_API) { return sendVersionReq(i); } @@ -1575,7 +1575,8 @@ MgmtSrvr::setEventReportingLevelImpl(int processId, const SetLogLevelOrd & ll, bool isResend) { - for(Uint32 i = 0; i<ll.noOfEntries; i++){ + Uint32 i; + for(i = 0; i<ll.noOfEntries; i++){ // Save log level for the cluster log if (!isResend) { NodeLogLevel* n = NULL; @@ -1606,7 +1607,7 @@ MgmtSrvr::setEventReportingLevelImpl(int processId, EventSubscribeReq * dst = CAST_PTR(EventSubscribeReq, signal->getDataPtrSend()); - for(Uint32 i = 0; i<ll.noOfEntries; i++){ + for(i = 0; i<ll.noOfEntries; i++){ dst->theCategories[i] = ll.theCategories[i]; dst->theLevels[i] = ll.theLevels[i]; } @@ -1635,7 +1636,8 @@ int MgmtSrvr::setNodeLogLevel(int processId, const SetLogLevelOrd & ll, bool isResend) { - for(Uint32 i = 0; i<ll.noOfEntries; i++){ + Uint32 i; + for(i = 0; i<ll.noOfEntries; i++){ // Save log level for the cluster log if (!isResend) { NodeLogLevel* n = NULL; @@ -1666,7 +1668,7 @@ MgmtSrvr::setNodeLogLevel(int processId, const SetLogLevelOrd & ll, SetLogLevelOrd * dst = CAST_PTR(SetLogLevelOrd, signal->getDataPtrSend()); - for(Uint32 i = 0; i<ll.noOfEntries; i++){ + for(i = 0; i<ll.noOfEntries; i++){ dst->theCategories[i] = ll.theCategories[i]; dst->theLevels[i] = ll.theLevels[i]; } @@ -1810,7 +1812,7 @@ MgmtSrvr::setSignalLoggingMode(int processId, LogMode mode, logSpec = TestOrd::InputOutputSignals; break; default: - NDB_ASSERT(false, "Unexpected value, MgmtSrvr::setSignalLoggingMode"); + assert("Unexpected value, MgmtSrvr::setSignalLoggingMode" == 0); } NdbApiSignal* signal = getSignal(); diff --git a/ndb/src/mgmsrv/Services.cpp b/ndb/src/mgmsrv/Services.cpp index c94e1455554..4a1b5d71898 100644 --- a/ndb/src/mgmsrv/Services.cpp +++ b/ndb/src/mgmsrv/Services.cpp @@ -1225,7 +1225,8 @@ void MgmStatService::println_statistics(const BaseString &line){ MutexVector<NDB_SOCKET_TYPE> copy(m_sockets.size()); m_sockets.lock(); - for(int i = m_sockets.size() - 1; i >= 0; i--){ + int i; + for(i = m_sockets.size() - 1; i >= 0; i--){ if(println_socket(m_sockets[i], MAX_WRITE_TIMEOUT, line.c_str()) == -1){ copy.push_back(m_sockets[i]); m_sockets.erase(i, false); @@ -1233,7 +1234,7 @@ MgmStatService::println_statistics(const BaseString &line){ } m_sockets.unlock(); - for(int i = copy.size() - 1; i >= 0; i--){ + for(i = copy.size() - 1; i >= 0; i--){ NDB_CLOSE_SOCKET(copy[i]); copy.erase(i); } diff --git a/ndb/src/ndbapi/DictCache.cpp b/ndb/src/ndbapi/DictCache.cpp index f6f2106f2aa..5f620f77906 100644 --- a/ndb/src/ndbapi/DictCache.cpp +++ b/ndb/src/ndbapi/DictCache.cpp @@ -157,6 +157,7 @@ GlobalDictCache::put(const char * name, NdbTableImpl * tab) void GlobalDictCache::drop(NdbTableImpl * tab) { + unsigned i; const Uint32 len = strlen(tab->m_internalName.c_str()); Vector<TableVersion> * vers = m_tableHash.getData(tab->m_internalName.c_str(), len); @@ -173,7 +174,7 @@ GlobalDictCache::drop(NdbTableImpl * tab) abort(); } - for(unsigned i = 0; i < sz; i++){ + for(i = 0; i < sz; i++){ TableVersion & ver = (* vers)[i]; if(ver.m_impl == tab){ if(ver.m_refCount == 0 || ver.m_status == RETREIVING || @@ -193,7 +194,7 @@ GlobalDictCache::drop(NdbTableImpl * tab) } } - for(unsigned i = 0; i<sz; i++){ + for(i = 0; i<sz; i++){ TableVersion & ver = (* vers)[i]; ndbout_c("%d: version: %d refCount: %d status: %d impl: %p", i, ver.m_version, ver.m_refCount, ver.m_status, ver.m_impl); @@ -204,6 +205,7 @@ GlobalDictCache::drop(NdbTableImpl * tab) void GlobalDictCache::release(NdbTableImpl * tab){ + unsigned i; const Uint32 len = strlen(tab->m_internalName.c_str()); Vector<TableVersion> * vers = m_tableHash.getData(tab->m_internalName.c_str(), len); @@ -220,7 +222,7 @@ GlobalDictCache::release(NdbTableImpl * tab){ abort(); } - for(unsigned i = 0; i < sz; i++){ + for(i = 0; i < sz; i++){ TableVersion & ver = (* vers)[i]; if(ver.m_impl == tab){ if(ver.m_refCount == 0 || ver.m_status == RETREIVING || @@ -235,7 +237,7 @@ GlobalDictCache::release(NdbTableImpl * tab){ } } - for(unsigned i = 0; i<sz; i++){ + for(i = 0; i<sz; i++){ TableVersion & ver = (* vers)[i]; ndbout_c("%d: version: %d refCount: %d status: %d impl: %p", i, ver.m_version, ver.m_refCount, ver.m_status, ver.m_impl); @@ -244,3 +246,4 @@ GlobalDictCache::release(NdbTableImpl * tab){ abort(); } +template class Vector<GlobalDictCache::TableVersion>; diff --git a/ndb/src/ndbapi/Ndb.cpp b/ndb/src/ndbapi/Ndb.cpp index 5fff137b54f..9c86d382f8f 100644 --- a/ndb/src/ndbapi/Ndb.cpp +++ b/ndb/src/ndbapi/Ndb.cpp @@ -958,13 +958,13 @@ Ndb::StartTransactionNodeSelectionData::init(Uint32 noOfNodes, */ { fragment2PrimaryNodeMap = new Uint32[noOfFragments]; - - for(Uint32 i = 0; i<noOfNodes; i++){ + Uint32 i; + for(i = 0; i<noOfNodes; i++){ fragment2PrimaryNodeMap[i] = nodeIds[i]; } // Sort them (bubble sort) - for(Uint32 i = 0; i<noOfNodes-1; i++) + for(i = 0; i<noOfNodes-1; i++) for(Uint32 j = i+1; j<noOfNodes; j++) if(fragment2PrimaryNodeMap[i] > fragment2PrimaryNodeMap[j]){ Uint32 tmp = fragment2PrimaryNodeMap[i]; @@ -972,7 +972,7 @@ Ndb::StartTransactionNodeSelectionData::init(Uint32 noOfNodes, fragment2PrimaryNodeMap[j] = tmp; } - for(Uint32 i = 0; i<noOfNodes; i++){ + for(i = 0; i<noOfNodes; i++){ fragment2PrimaryNodeMap[i+noOfNodes] = fragment2PrimaryNodeMap[i]; } } diff --git a/ndb/src/ndbapi/NdbDictionaryImpl.cpp b/ndb/src/ndbapi/NdbDictionaryImpl.cpp index 004ad531b65..6e95f5c5622 100644 --- a/ndb/src/ndbapi/NdbDictionaryImpl.cpp +++ b/ndb/src/ndbapi/NdbDictionaryImpl.cpp @@ -383,7 +383,8 @@ void NdbTableImpl::buildColumnHash(){ const Uint32 size = m_columns.size(); - for(size_t i = 31; i >= 0; i--){ + size_t i; + for(i = 31; i >= 0; i--){ if(((1 << i) & size) != 0){ m_columnHashMask = (1 << (i + 1)) - 1; break; @@ -392,7 +393,7 @@ NdbTableImpl::buildColumnHash(){ Vector<Uint32> hashValues; Vector<Vector<Uint32> > chains; chains.fill(size, hashValues); - for(size_t i = 0; i<size; i++){ + for(i = 0; i<size; i++){ Uint32 hv = Hash(m_columns[i]->getName()) & 0xFFFE; Uint32 bucket = hv & m_columnHashMask; bucket = (bucket < size ? bucket : bucket - size); @@ -406,7 +407,7 @@ NdbTableImpl::buildColumnHash(){ m_columnHash.fill((unsigned)size-1, tmp); // Default no chaining Uint32 pos = 0; // In overflow vector - for(size_t i = 0; i<size; i++){ + for(i = 0; i<size; i++){ Uint32 sz = chains[i].size(); if(sz == 1){ Uint32 col = chains[i][0]; @@ -1314,6 +1315,7 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb, NdbTableImpl & impl, bool alter) { + unsigned i; if((unsigned)impl.getNoOfPrimaryKeys() > NDB_MAX_NO_OF_ATTRIBUTES_IN_KEY){ m_error.code = 4317; return -1; @@ -1339,7 +1341,7 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb, bool haveAutoIncrement = false; Uint64 autoIncrementValue; - for(unsigned i = 0; i<sz; i++){ + for(i = 0; i<sz; i++){ const NdbColumnImpl * col = impl.m_columns[i]; if(col == 0) continue; @@ -1383,7 +1385,7 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb, abort(); } - for(unsigned i = 0; i<sz; i++){ + for(i = 0; i<sz; i++){ const NdbColumnImpl * col = impl.m_columns[i]; if(col == 0) continue; @@ -1795,7 +1797,7 @@ NdbDictInterface::createIndex(Ndb & ndb, { //validate(); //aggregate(); - + unsigned i; UtilBufferWriter w(m_buffer); const size_t len = strlen(impl.m_externalName.c_str()) + 1; if(len > MAX_TAB_NAME_SIZE) { @@ -1835,7 +1837,7 @@ NdbDictInterface::createIndex(Ndb & ndb, req->setOnline(true); AttributeList attributeList; attributeList.sz = impl.m_columns.size(); - for(unsigned i = 0; i<attributeList.sz; i++){ + for(i = 0; i<attributeList.sz; i++){ const NdbColumnImpl* col = table.getColumn(impl.m_columns[i]->m_name.c_str()); if(col == 0){ @@ -1860,7 +1862,7 @@ NdbDictInterface::createIndex(Ndb & ndb, } if (it == DictTabInfo::UniqueHashIndex) { // Sort index attributes according to primary table (using insertion sort) - for(unsigned i = 1; i < attributeList.sz; i++) { + for(i = 1; i < attributeList.sz; i++) { unsigned int temp = attributeList.id[i]; unsigned int j = i; while((j > 0) && (attributeList.id[j - 1] > temp)) { @@ -1870,7 +1872,7 @@ NdbDictInterface::createIndex(Ndb & ndb, attributeList.id[j] = temp; } // Check for illegal duplicate attributes - for(unsigned i = 0; i<attributeList.sz; i++) { + for(i = 0; i<attributeList.sz; i++) { if ((i != (attributeList.sz - 1)) && (attributeList.id[i] == attributeList.id[i+1])) { m_error.code = 4258; @@ -2050,6 +2052,7 @@ NdbDictInterface::execDROP_INDX_REF(NdbApiSignal * signal, int NdbDictionaryImpl::createEvent(NdbEventImpl & evnt) { + int i; NdbTableImpl* tab = getTable(evnt.getTable()); if(tab == 0){ @@ -2072,7 +2075,7 @@ NdbDictionaryImpl::createEvent(NdbEventImpl & evnt) int attributeList_sz = evnt.m_attrIds.size(); - for (int i = 0; i < attributeList_sz; i++) { + for (i = 0; i < attributeList_sz; i++) { NdbColumnImpl *col_impl = table.getColumn(evnt.m_attrIds[i]); if (col_impl) { evnt.m_facade->addColumn(*(col_impl->m_facade)); @@ -2093,7 +2096,7 @@ NdbDictionaryImpl::createEvent(NdbEventImpl & evnt) int pk_count = 0; evnt.m_attrListBitmask.clear(); - for(int i = 0; i<attributeList_sz; i++){ + for(i = 0; i<attributeList_sz; i++){ const NdbColumnImpl* col = table.getColumn(evnt.m_columns[i]->m_name.c_str()); if(col == 0){ @@ -2111,7 +2114,7 @@ NdbDictionaryImpl::createEvent(NdbEventImpl & evnt) } // Sort index attributes according to primary table (using insertion sort) - for(int i = 1; i < attributeList_sz; i++) { + for(i = 1; i < attributeList_sz; i++) { NdbColumnImpl* temp = evnt.m_columns[i]; unsigned int j = i; while((j > 0) && (evnt.m_columns[j - 1]->m_attrId > temp->m_attrId)) { @@ -2121,7 +2124,7 @@ NdbDictionaryImpl::createEvent(NdbEventImpl & evnt) evnt.m_columns[j] = temp; } // Check for illegal duplicate attributes - for(int i = 1; i<attributeList_sz; i++) { + for(i = 1; i<attributeList_sz; i++) { if (evnt.m_columns[i-1]->m_attrId == evnt.m_columns[i]->m_attrId) { m_error.code = 4258; return -1; @@ -2818,3 +2821,10 @@ NdbDictInterface::execLIST_TABLES_CONF(NdbApiSignal* signal, m_waiter.signal(NO_WAIT); } } + +template class Vector<int>; +template class Vector<Uint32>; +template class Vector<Vector<Uint32> >; +template class Vector<NdbTableImpl*>; +template class Vector<NdbColumnImpl*>; + diff --git a/ndb/src/ndbapi/NdbEventOperationImpl.cpp b/ndb/src/ndbapi/NdbEventOperationImpl.cpp index 6730b637684..f5e683b1c29 100644 --- a/ndb/src/ndbapi/NdbEventOperationImpl.cpp +++ b/ndb/src/ndbapi/NdbEventOperationImpl.cpp @@ -93,11 +93,12 @@ NdbEventOperationImpl::NdbEventOperationImpl(NdbEventOperation &N, NdbEventOperationImpl::~NdbEventOperationImpl() { + int i; if (sdata) NdbMem_Free(sdata); - for (int i=0 ; i<3; i++) { + for (i=0 ; i<3; i++) { if (ptr[i].p) NdbMem_Free(ptr[i].p); } - for (int i=0 ; i<2; i++) { + for (i=0 ; i<2; i++) { NdbRecAttr *p = theFirstRecAttrs[i]; while (p) { NdbRecAttr *p_next = p->next(); @@ -1225,8 +1226,9 @@ NdbGlobalEventBuffer::real_wait(NdbGlobalEventBufferHandle *h, int aMillisecondNumber) { // check if there are anything in any of the buffers + int i; int n = 0; - for (int i = 0; i < h->m_nids; i++) + for (i = 0; i < h->m_nids; i++) n += hasData(h->m_bufferIds[i]); if (n) return n; @@ -1235,7 +1237,9 @@ NdbGlobalEventBuffer::real_wait(NdbGlobalEventBufferHandle *h, return -1; n = 0; - for (int i = 0; i < h->m_nids; i++) + for (i = 0; i < h->m_nids; i++) n += hasData(h->m_bufferIds[i]); return n; } + +template class Vector<NdbGlobalEventBufferHandle*>; diff --git a/ndb/src/ndbapi/NdbLinHash.hpp b/ndb/src/ndbapi/NdbLinHash.hpp index f67d4e60200..5d0d52a31d8 100644 --- a/ndb/src/ndbapi/NdbLinHash.hpp +++ b/ndb/src/ndbapi/NdbLinHash.hpp @@ -165,13 +165,14 @@ NdbLinHash<C>::createHashTable() { max = SEGMENTSIZE - 1; slack = SEGMENTSIZE * MAXLOADFCTR; directory[0] = new Segment_t(); - + int i; + /* The first segment cleared before used */ - for(int i = 0; i < SEGMENTSIZE; i++ ) + for(i = 0; i < SEGMENTSIZE; i++ ) directory[0]->elements[i] = 0; /* clear the rest of the directory */ - for( int i = 1; i < DIRECTORYSIZE; i++) + for(i = 1; i < DIRECTORYSIZE; i++) directory[i] = 0; } @@ -203,7 +204,8 @@ NdbLinHash<C>::insertKey( const char* str, Uint32 len, Uint32 lkey1, C* data ) * chain=chainp will copy the contents of HASH_T into chain */ NdbElement_t<C> * oldChain = 0; - for(NdbElement_t<C> * chain = *chainp; chain != 0; chain = chain->next){ + NdbElement_t<C> * chain; + for(chain = *chainp; chain != 0; chain = chain->next){ if(chain->len == len && !memcmp(chain->str, str, len)) return -1; /* Element already exists */ else @@ -211,7 +213,7 @@ NdbLinHash<C>::insertKey( const char* str, Uint32 len, Uint32 lkey1, C* data ) } /* New entry */ - NdbElement_t<C> * chain = new NdbElement_t<C>(); + chain = new NdbElement_t<C>(); chain->len = len; chain->hash = hash; chain->localkey1 = lkey1; diff --git a/ndb/src/ndbapi/NdbScanFilter.cpp b/ndb/src/ndbapi/NdbScanFilter.cpp index 9542b226d7d..eace1a0acf5 100644 --- a/ndb/src/ndbapi/NdbScanFilter.cpp +++ b/ndb/src/ndbapi/NdbScanFilter.cpp @@ -337,7 +337,6 @@ static const tab2 table2[] = { const int tab_sz = sizeof(table)/sizeof(table[0]); const int tab2_sz = sizeof(table2)/sizeof(table2[0]); -template<typename T> int matchType(const NdbDictionary::Column * col){ return 1; @@ -382,7 +381,7 @@ NdbScanFilterImpl::cond_col_const(Interpreter::BinaryCondition op, return -1; } - if(!matchType<T>(col)){ + if(!matchType(col)){ /** * Code not reached */ @@ -777,3 +776,9 @@ main(void){ return 0; } #endif + +template class Vector<NdbScanFilterImpl::State>; +template int NdbScanFilterImpl::cond_col_const(Interpreter::BinaryCondition, Uint32 attrId, Uint32); +template int NdbScanFilterImpl::cond_col_const(Interpreter::BinaryCondition, Uint32 attrId, Uint64); + + diff --git a/ndb/src/ndbapi/Ndbinit.cpp b/ndb/src/ndbapi/Ndbinit.cpp index f451ba885d4..641919d771b 100644 --- a/ndb/src/ndbapi/Ndbinit.cpp +++ b/ndb/src/ndbapi/Ndbinit.cpp @@ -111,12 +111,13 @@ Ndb::Ndb( const char* aDataBase , const char* aSchema) : theCurrentConnectCounter = 1; theCurrentConnectIndex = 0; - for (int i = 0; i < MAX_NDB_NODES ; i++) { + int i; + for (i = 0; i < MAX_NDB_NODES ; i++) { theConnectionArray[i] = NULL; the_release_ind[i] = 0; theDBnodes[i] = 0; }//forg - for (int i = 0; i < 2048 ; i++) { + for (i = 0; i < 2048 ; i++) { theFirstTupleId[i] = 0; theLastTupleId[i] = 0; }//for diff --git a/ndb/src/ndbapi/TransporterFacade.cpp b/ndb/src/ndbapi/TransporterFacade.cpp index 293136b9783..6a25db560c9 100644 --- a/ndb/src/ndbapi/TransporterFacade.cpp +++ b/ndb/src/ndbapi/TransporterFacade.cpp @@ -168,13 +168,6 @@ setSignalLog(){ #endif #endif -// These symbols are needed, but not used in the API -int g_sectionSegmentPool; -struct ErrorReporter { - void handleAssert(const char*, const char*, int); -}; -void ErrorReporter::handleAssert(const char*, const char*, int) {} - /** * The execute function : Handle received signal */ @@ -318,6 +311,14 @@ execute(void * callbackObj, SignalHeader * const header, } } +// These symbols are needed, but not used in the API +void +SignalLoggerManager::printSegmentedSection(FILE *, const SignalHeader &, + const SegmentedSectionPtr ptr[3], + unsigned i){ + abort(); +} + void copy(Uint32 * & insertPtr, class SectionSegmentPool & thePool, const SegmentedSectionPtr & _ptr){ @@ -462,11 +463,15 @@ void TransporterFacade::threadMainSend(void) SocketServer socket_server; theTransporterRegistry->startSending(); - if (!theTransporterRegistry->start_service(socket_server)) - NDB_ASSERT(0, "Unable to start theTransporterRegistry->start_service"); + if (!theTransporterRegistry->start_service(socket_server)){ + ndbout_c("Unable to start theTransporterRegistry->start_service"); + exit(0); + } - if (!theTransporterRegistry->start_clients()) - NDB_ASSERT(0, "Unable to start theTransporterRegistry->start_clients"); + if (!theTransporterRegistry->start_clients()){ + ndbout_c("Unable to start theTransporterRegistry->start_clients"); + exit(0); + } socket_server.startServer(); @@ -1023,3 +1028,6 @@ TransporterFacade::ThreadData::close(int number){ m_statusFunction[number] = 0; return 0; } + +template class Vector<NodeStatusFunction>; +template class Vector<TransporterFacade::ThreadData::Object_Execute>; 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()) diff --git a/ndb/tools/desc.cpp b/ndb/tools/desc.cpp index a5ff11edca9..e5b98c4c8e9 100644 --- a/ndb/tools/desc.cpp +++ b/ndb/tools/desc.cpp @@ -73,7 +73,8 @@ int main(int argc, const char** argv){ ndbout << "-- Indexes -- " << endl; ndbout << "PRIMARY KEY("; - for (unsigned j= 0; j < pTab->getNoOfPrimaryKeys(); j++) + unsigned j; + for (j= 0; j < pTab->getNoOfPrimaryKeys(); j++) { const NdbDictionary::Column * col = pTab->getColumn(j); ndbout << col->getName(); @@ -82,7 +83,7 @@ int main(int argc, const char** argv){ } ndbout << ") - UniqueHashIndex" << endl; - for (unsigned j= 0; j < list.count; j++) { + for (j= 0; j < list.count; j++) { NdbDictionary::Dictionary::List::Element& elt = list.elements[j]; const NdbDictionary::Index *pIdx = dict->getIndex(elt.name, argv[i]); if (!pIdx){ diff --git a/ndb/tools/waiter.cpp b/ndb/tools/waiter.cpp index ffd728ee966..f9d441ab352 100644 --- a/ndb/tools/waiter.cpp +++ b/ndb/tools/waiter.cpp @@ -129,7 +129,8 @@ getStatus(){ retries++; continue; } - for (int i = 0; i < status->no_of_nodes; i++){ + int count = status->no_of_nodes; + for (int i = 0; i < count; i++){ node = &status->node_states[i]; switch(node->node_type){ case NDB_MGM_NODE_TYPE_NDB: @@ -150,7 +151,7 @@ getStatus(){ apiNodes.clear(); free(status); status = NULL; - i = status->no_of_nodes; + count = 0; ndbout << "kalle"<< endl; break; diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index f9dca1b36bb..70ca69c9865 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -554,7 +554,7 @@ int ha_ndbcluster::build_index_list() DBUG_ENTER("build_index_list"); // Save information about all known indexes - for (uint i= 0; i < table->keys; i++) + for (i= 0; i < table->keys; i++) { NDB_INDEX_TYPE idx_type= get_index_type_from_table(i); m_indextype[i]= idx_type; |