summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xBUILD/compile-irix-mips64-mipspro8
-rw-r--r--BitKeeper/etc/logging_ok2
-rw-r--r--configure.in2
-rw-r--r--ndb/include/kernel/GlobalSignalNumbers.h9
-rw-r--r--ndb/include/kernel/NodeState.hpp15
-rw-r--r--ndb/include/kernel/ndb_limits.h2
-rw-r--r--ndb/include/kernel/signaldata/SignalData.hpp16
-rw-r--r--ndb/include/kernel/signaldata/TupAccess.hpp174
-rw-r--r--ndb/include/mgmcommon/MgmtErrorReporter.hpp6
-rw-r--r--ndb/include/ndbapi/NdbDictionary.hpp2
-rw-r--r--ndb/include/ndbapi/NdbIndexScanOperation.hpp27
-rw-r--r--ndb/include/util/Bitmask.hpp49
-rw-r--r--ndb/src/common/debugger/DebuggerNames.cpp15
-rw-r--r--ndb/src/common/debugger/EventLogger.cpp5
-rw-r--r--ndb/src/common/debugger/SignalLoggerManager.cpp25
-rw-r--r--ndb/src/common/debugger/signaldata/LCP.cpp3
-rw-r--r--ndb/src/common/debugger/signaldata/Makefile.am3
-rw-r--r--ndb/src/common/debugger/signaldata/SignalDataPrint.cpp12
-rw-r--r--ndb/src/common/debugger/signaldata/SignalNames.cpp3
-rw-r--r--ndb/src/common/debugger/signaldata/TupAccess.cpp131
-rw-r--r--ndb/src/common/logger/Logger.cpp1
-rw-r--r--ndb/src/common/mgmcommon/ConfigInfo.cpp23
-rw-r--r--ndb/src/common/transporter/Packer.cpp14
-rw-r--r--ndb/src/common/transporter/TransporterRegistry.cpp12
-rw-r--r--ndb/src/common/util/BaseString.cpp3
-rw-r--r--ndb/src/common/util/ConfigValues.cpp18
-rw-r--r--ndb/src/common/util/Parser.cpp1
-rw-r--r--ndb/src/common/util/Properties.cpp6
-rw-r--r--ndb/src/common/util/SocketServer.cpp13
-rw-r--r--ndb/src/cw/cpcd/CPCD.cpp5
-rw-r--r--ndb/src/cw/cpcd/Makefile.am2
-rw-r--r--ndb/src/cw/cpcd/Process.cpp86
-rw-r--r--ndb/src/kernel/blocks/backup/Backup.cpp5
-rw-r--r--ndb/src/kernel/blocks/backup/BackupInit.cpp3
-rw-r--r--ndb/src/kernel/blocks/backup/restore/Restore.cpp15
-rw-r--r--ndb/src/kernel/blocks/backup/restore/Restore.hpp5
-rw-r--r--ndb/src/kernel/blocks/backup/restore/main.cpp8
-rw-r--r--ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp22
-rw-r--r--ndb/src/kernel/blocks/dbacc/DbaccMain.cpp4
-rw-r--r--ndb/src/kernel/blocks/dbdict/Dbdict.cpp26
-rw-r--r--ndb/src/kernel/blocks/dbdih/DbdihInit.cpp7
-rw-r--r--ndb/src/kernel/blocks/dbdih/DbdihMain.cpp83
-rw-r--r--ndb/src/kernel/blocks/dblqh/Dblqh.hpp3
-rw-r--r--ndb/src/kernel/blocks/dblqh/DblqhMain.cpp149
-rw-r--r--ndb/src/kernel/blocks/dbtc/DbtcMain.cpp6
-rw-r--r--ndb/src/kernel/blocks/dbtup/Dbtup.hpp13
-rw-r--r--ndb/src/kernel/blocks/dbtup/DbtupDebug.cpp5
-rw-r--r--ndb/src/kernel/blocks/dbtup/DbtupGen.cpp3
-rw-r--r--ndb/src/kernel/blocks/dbtup/DbtupIndex.cpp286
-rw-r--r--ndb/src/kernel/blocks/dbtup/DbtupSystemRestart.cpp12
-rw-r--r--ndb/src/kernel/blocks/dbtux/Dbtux.hpp164
-rw-r--r--ndb/src/kernel/blocks/dbtux/DbtuxCmp.cpp256
-rw-r--r--ndb/src/kernel/blocks/dbtux/DbtuxDebug.cpp95
-rw-r--r--ndb/src/kernel/blocks/dbtux/DbtuxGen.cpp45
-rw-r--r--ndb/src/kernel/blocks/dbtux/DbtuxMaint.cpp112
-rw-r--r--ndb/src/kernel/blocks/dbtux/DbtuxMeta.cpp7
-rw-r--r--ndb/src/kernel/blocks/dbtux/DbtuxNode.cpp35
-rw-r--r--ndb/src/kernel/blocks/dbtux/DbtuxScan.cpp201
-rw-r--r--ndb/src/kernel/blocks/dbtux/DbtuxSearch.cpp333
-rw-r--r--ndb/src/kernel/blocks/dbtux/DbtuxTree.cpp111
-rw-r--r--ndb/src/kernel/blocks/dbtux/Makefile.am1
-rw-r--r--ndb/src/kernel/blocks/dbtux/Times.txt47
-rw-r--r--ndb/src/kernel/blocks/dbutil/DbUtil.cpp2
-rw-r--r--ndb/src/kernel/blocks/grep/Grep.cpp7
-rw-r--r--ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp2
-rw-r--r--ndb/src/kernel/blocks/ndbfs/MemoryChannel.hpp3
-rw-r--r--ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp3
-rw-r--r--ndb/src/kernel/blocks/ndbfs/Pool.hpp1
-rw-r--r--ndb/src/kernel/blocks/qmgr/QmgrMain.cpp5
-rw-r--r--ndb/src/kernel/blocks/suma/Suma.cpp3
-rw-r--r--ndb/src/kernel/blocks/trix/Trix.cpp2
-rw-r--r--ndb/src/kernel/error/ErrorReporter.hpp29
-rw-r--r--ndb/src/kernel/main.cpp16
-rw-r--r--ndb/src/kernel/vm/ArrayPool.hpp2
-rw-r--r--ndb/src/kernel/vm/DataBuffer.hpp2
-rw-r--r--ndb/src/kernel/vm/MetaData.cpp2
-rw-r--r--ndb/src/kernel/vm/SimulatedBlock.cpp16
-rw-r--r--ndb/src/kernel/vm/SimulatedBlock.hpp4
-rw-r--r--ndb/src/kernel/vm/TransporterCallback.cpp25
-rw-r--r--ndb/src/mgmapi/Makefile.am5
-rw-r--r--ndb/src/mgmapi/mgmapi.cpp9
-rw-r--r--ndb/src/mgmclient/CommandInterpreter.cpp25
-rw-r--r--ndb/src/mgmclient/CpcClient.cpp3
-rw-r--r--ndb/src/mgmsrv/CommandInterpreter.cpp12
-rw-r--r--ndb/src/mgmsrv/MgmtSrvr.cpp44
-rw-r--r--ndb/src/mgmsrv/Services.cpp5
-rw-r--r--ndb/src/ndbapi/DictCache.cpp11
-rw-r--r--ndb/src/ndbapi/Ndb.cpp8
-rw-r--r--ndb/src/ndbapi/NdbDictionaryImpl.cpp36
-rw-r--r--ndb/src/ndbapi/NdbEventOperationImpl.cpp12
-rw-r--r--ndb/src/ndbapi/NdbLinHash.hpp12
-rw-r--r--ndb/src/ndbapi/NdbScanFilter.cpp9
-rw-r--r--ndb/src/ndbapi/NdbScanOperation.cpp25
-rw-r--r--ndb/src/ndbapi/Ndbif.cpp94
-rw-r--r--ndb/src/ndbapi/Ndbinit.cpp5
-rw-r--r--ndb/src/ndbapi/TransporterFacade.cpp30
-rw-r--r--ndb/test/include/NDBT_Table.hpp2
-rw-r--r--ndb/test/include/NDBT_Test.hpp13
-rw-r--r--ndb/test/ndbapi/flexAsynch.cpp14
-rw-r--r--ndb/test/ndbapi/flexBench.cpp20
-rw-r--r--ndb/test/ndbapi/flexTT.cpp6
-rw-r--r--ndb/test/ndbapi/testBasic.cpp30
-rw-r--r--ndb/test/ndbapi/testBlobs.cpp14
-rw-r--r--ndb/test/ndbapi/testOIBasic.cpp989
-rw-r--r--ndb/test/run-test/daily-basic-tests.txt62
-rw-r--r--ndb/test/run-test/main.cpp28
-rw-r--r--ndb/test/src/HugoAsynchTransactions.cpp32
-rw-r--r--ndb/test/src/HugoCalculator.cpp10
-rw-r--r--ndb/test/src/HugoOperations.cpp45
-rw-r--r--ndb/test/src/HugoTransactions.cpp104
-rw-r--r--ndb/test/src/NDBT_Tables.cpp7
-rw-r--r--ndb/test/src/NDBT_Test.cpp47
-rw-r--r--ndb/test/src/NdbRestarter.cpp2
-rw-r--r--ndb/test/src/NdbRestarts.cpp12
-rw-r--r--ndb/test/src/UtilTransactions.cpp10
-rw-r--r--ndb/test/tools/cpcc.cpp7
-rw-r--r--ndb/test/tools/hugoPkReadRecord.cpp9
-rw-r--r--ndb/tools/desc.cpp5
-rw-r--r--ndb/tools/waiter.cpp5
-rw-r--r--sql/ha_ndbcluster.cc2
120 files changed, 2499 insertions, 2200 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 e80b459e6fb..e4648f7d849 100644
--- a/BitKeeper/etc/logging_ok
+++ b/BitKeeper/etc/logging_ok
@@ -129,6 +129,8 @@ 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
nick@nick.leippe.com
diff --git a/configure.in b/configure.in
index b78881a253c..0fb0ccb9b9b 100644
--- a/configure.in
+++ b/configure.in
@@ -396,7 +396,7 @@ then
# we will gets some problems when linking static programs.
# The following code is used to fix this problem.
- if test "$CXX" = "gcc" -o "$CXX" = "ccache gcc"
+ if echo $CXX | grep gcc > /dev/null 2>&1
then
if $CXX -v 2>&1 | grep 'version 3' > /dev/null 2>&1
then
diff --git a/ndb/include/kernel/GlobalSignalNumbers.h b/ndb/include/kernel/GlobalSignalNumbers.h
index a16860561b5..8941fa6b381 100644
--- a/ndb/include/kernel/GlobalSignalNumbers.h
+++ b/ndb/include/kernel/GlobalSignalNumbers.h
@@ -897,12 +897,9 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES;
#define GSN_TUX_MAINT_CONF 678
#define GSN_TUX_MAINT_REF 679
-/*
- * TUP access
- */
-#define GSN_TUP_READ_ATTRS 680
-#define GSN_TUP_QUERY_TH 712
-#define GSN_TUP_STORE_TH 681
+// not used 680
+// not used 712
+// not used 681
/**
* from mgmtsrvr to NDBCNTR
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/ndb_limits.h b/ndb/include/kernel/ndb_limits.h
index 68ffe310328..f35cc617e86 100644
--- a/ndb/include/kernel/ndb_limits.h
+++ b/ndb/include/kernel/ndb_limits.h
@@ -88,7 +88,7 @@
* Ordered index constants. Make configurable per index later.
*/
#define MAX_TTREE_NODE_SIZE 64 // total words in node
-#define MAX_TTREE_PREF_SIZE 4 // words in min/max prefix each
+#define MAX_TTREE_PREF_SIZE 4 // words in min prefix
#define MAX_TTREE_NODE_SLACK 3 // diff between max and min occupancy
/*
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/kernel/signaldata/TupAccess.hpp b/ndb/include/kernel/signaldata/TupAccess.hpp
deleted file mode 100644
index ab56a73322c..00000000000
--- a/ndb/include/kernel/signaldata/TupAccess.hpp
+++ /dev/null
@@ -1,174 +0,0 @@
-/* Copyright (C) 2003 MySQL AB
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-#ifndef TUP_ACCESS_HPP
-#define TUP_ACCESS_HPP
-
-#include "SignalData.hpp"
-
-/*
- * Direct signals used by ACC and TUX to access the TUP block in the
- * same thread.
- *
- * NOTE: Caller must set errorCode to RNIL. Signal printer uses this to
- * distinguish between input and output (no better way exists).
- */
-
-/*
- * Read attributes from any table.
- */
-class TupReadAttrs {
- friend class Dbtup;
- friend class Dbacc;
- friend class Dbtux;
- friend bool printTUP_READ_ATTRS(FILE*, const Uint32*, Uint32, Uint16);
-public:
- enum Flag {
- /*
- * Read primary key attributes. No input attribute ids are
- * specified. Instead TUP fills in both input and output sections.
- * Tuple version is not used.
- */
- ReadKeys = (1 << 0)
- };
- STATIC_CONST( SignalLength = 10 );
-private:
- /*
- * Error code set by TUP. Zero means no error.
- */
- Uint32 errorCode;
- /*
- * Request info contains flags (see Flags above).
- */
- Uint32 requestInfo;
- /*
- * Table i-value.
- */
- Uint32 tableId;
- /*
- * Fragment is given by logical id within the table or by direct
- * i-value (faster). Unknown values are given as RNIL. On return TUP
- * fills in both values.
- */
- Uint32 fragId;
- Uint32 fragPtrI;
- /*
- * Logical address ("local key") of "original" tuple (the latest
- * version) consisting of logical fragment page id and tuple index
- * within the page (shifted left by 1).
- */
- Uint32 tupAddr;
- /*
- * Version of the tuple to read. Not used if ReadKeys.
- */
- Uint32 tupVersion;
- /*
- * Real page id and offset of the "original" tuple. Unknown page is
- * given as RNIL. On return TUP fills in these.
- */
- Uint32 pageId;
- Uint32 pageOffset;
- /*
- * Shared buffer id. Currently must be 0 which means to use rest of
- * signal data.
- */
- Uint32 bufferId;
- /*
- * Shared buffer 0 starts after signal class. Input is number of
- * attributes and list of attribute ids in AttributeHeader format.
- * Output is placed after the input and consists of a list of entries
- * where each entry has an AttributeHeader followed by words of data.
- */
-};
-
-/*
- * Query status of tuple version. Used by TUX to decide if a tuple
- * version found in index tree is visible to the transaction.
- */
-class TupQueryTh {
- friend class Dbtup;
- friend class Dbtux;
- friend bool printTUP_QUERY_TH(FILE*, const Uint32*, Uint32, Uint16);
-public:
- enum Flag {
- };
- STATIC_CONST( SignalLength = 7 );
-private:
- /*
- TUX wants to check if tuple is visible to the scan query.
- Input data is tuple address (tableId, fragId, tupAddr, tupVersion),
- and transaction data so that TUP knows how to deduct if tuple is
- visible (transId1, transId2, savePointId).
- returnCode is set in return signal to indicate whether tuple is visible.
- */
- union {
- Uint32 returnCode; // 1 if tuple visible
- Uint32 tableId;
- };
- Uint32 fragId;
- Uint32 tupAddr;
- Uint32 tupVersion;
- Uint32 transId1;
- Uint32 transId2;
- Uint32 savePointId;
-};
-
-/*
- * Operate on entire tuple. Used by TUX where the table has a single
- * Uint32 array attribute representing an index tree node.
- *
- * XXX this signal is no longer used by TUX and can be removed
- */
-class TupStoreTh {
- friend class Dbtup;
- friend class Dbtux;
- friend bool printTUP_STORE_TH(FILE*, const Uint32*, Uint32, Uint16);
-public:
- enum OpCode {
- OpUndefined = 0,
- OpRead = 1,
- OpInsert = 2,
- OpUpdate = 3,
- OpDelete = 4
- };
- STATIC_CONST( SignalLength = 12 );
-private:
- /*
- * These are as in TupReadAttrs (except opCode). Version must be
- * zero. Ordered index tuple (tree node) has only current version.
- */
- Uint32 errorCode;
- Uint32 opCode;
- Uint32 tableId;
- Uint32 fragId;
- Uint32 fragPtrI;
- Uint32 tupAddr;
- Uint32 tupVersion;
- Uint32 pageId;
- Uint32 pageOffset;
- Uint32 bufferId;
- /*
- * Data offset and size in words. Applies to both the buffer and the
- * tuple. Used e.g. to read only node header.
- */
- Uint32 dataOffset;
- Uint32 dataSize;
- /*
- * Shared buffer 0 starts after signal class.
- */
-};
-
-#endif
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/ndbapi/NdbIndexScanOperation.hpp b/ndb/include/ndbapi/NdbIndexScanOperation.hpp
index f854fa93945..82aed04a9fc 100644
--- a/ndb/include/ndbapi/NdbIndexScanOperation.hpp
+++ b/ndb/include/ndbapi/NdbIndexScanOperation.hpp
@@ -86,26 +86,25 @@ public:
/**
* Define bound on index key in range scan.
*
- * Each index key can have not null lower and/or upper bound, or can
- * be set equal to not null value. The bounds can be defined in any
- * order but a duplicate definition is an error.
+ * Each index key can have lower and/or upper bound, or can be set
+ * equal to a value. The bounds can be defined in any order but
+ * a duplicate definition is an error.
*
- * The scan is most effective when bounds are given for an initial
- * sequence of non-nullable index keys, and all but the last one is an
- * equality. In this case the scan returns a contiguous range from
- * each ordered index fragment.
+ * The bounds must specify a single range i.e. they are on an initial
+ * sequence of index keys and the condition is equality for all but
+ * (at most) the last key which has a lower and/or upper bound.
*
- * @note This release implements only the case described above,
- * except for the non-nullable limitation. Other sets of
- * bounds return error or empty result set.
+ * NULL is treated like a normal value which is less than any not-NULL
+ * value and equal to another NULL value. To search for NULL use
+ * setBound with null pointer (0).
*
- * @note In this release a null key value satisfies any lower
- * bound and no upper bound. This may change.
+ * An index stores also all-NULL keys (this may become optional).
+ * Doing index scan with empty bound set returns all table tuples.
*
* @param attrName Attribute name, alternatively:
- * @param anAttrId Index column id (starting from 0).
+ * @param anAttrId Index column id (starting from 0)
* @param type Type of bound
- * @param value Pointer to bound value
+ * @param value Pointer to bound value, 0 for NULL
* @param len Value length in bytes.
* Fixed per datatype and can be omitted
* @return 0 if successful otherwise -1
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/Makefile.am b/ndb/src/common/debugger/signaldata/Makefile.am
index 0d6ed45dcef..0a5806e1e00 100644
--- a/ndb/src/common/debugger/signaldata/Makefile.am
+++ b/ndb/src/common/debugger/signaldata/Makefile.am
@@ -22,7 +22,7 @@ libsignaldataprint_la_SOURCES = \
CopyGCI.cpp SystemError.cpp StartRec.cpp NFCompleteRep.cpp \
FailRep.cpp DisconnectRep.cpp SignalDroppedRep.cpp \
SumaImpl.cpp NdbSttor.cpp CreateFragmentation.cpp \
- UtilLock.cpp TuxMaint.cpp TupAccess.cpp AccLock.cpp \
+ UtilLock.cpp TuxMaint.cpp AccLock.cpp \
LqhTrans.cpp ReadNodesConf.cpp CntrStart.cpp
include $(top_srcdir)/ndb/config/common.mk.am
@@ -30,3 +30,4 @@ include $(top_srcdir)/ndb/config/type_ndbapi.mk.am
# Don't update the files from bitkeeper
%::SCCS/s.%
+
diff --git a/ndb/src/common/debugger/signaldata/SignalDataPrint.cpp b/ndb/src/common/debugger/signaldata/SignalDataPrint.cpp
index d49e316ad38..65351663789 100644
--- a/ndb/src/common/debugger/signaldata/SignalDataPrint.cpp
+++ b/ndb/src/common/debugger/signaldata/SignalDataPrint.cpp
@@ -73,7 +73,6 @@
#include <signaldata/CntrStart.hpp>
#include <signaldata/ReadNodesConf.hpp>
#include <signaldata/TuxMaint.hpp>
-#include <signaldata/TupAccess.hpp>
#include <signaldata/AccLock.hpp>
bool printCONTINUEB(FILE *, const Uint32 *, Uint32, Uint16);
@@ -249,14 +248,15 @@ SignalDataPrintFunctions[] = {
,{ GSN_READ_NODESCONF, printREAD_NODES_CONF }
,{ GSN_TUX_MAINT_REQ, printTUX_MAINT_REQ }
- ,{ GSN_TUP_READ_ATTRS, printTUP_READ_ATTRS }
- ,{ GSN_TUP_QUERY_TH, printTUP_QUERY_TH }
- ,{ GSN_TUP_STORE_TH, printTUP_STORE_TH }
,{ GSN_ACC_LOCKREQ, printACC_LOCKREQ }
,{ GSN_LQH_TRANSCONF, printLQH_TRANSCONF }
};
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/debugger/signaldata/SignalNames.cpp b/ndb/src/common/debugger/signaldata/SignalNames.cpp
index bb492fa0411..9d4d5bdf6f5 100644
--- a/ndb/src/common/debugger/signaldata/SignalNames.cpp
+++ b/ndb/src/common/debugger/signaldata/SignalNames.cpp
@@ -640,9 +640,6 @@ const GsnName SignalNames [] = {
,{ GSN_TUX_MAINT_REQ, "TUX_MAINT_REQ" }
,{ GSN_TUX_MAINT_CONF, "TUX_MAINT_CONF" }
,{ GSN_TUX_MAINT_REF, "TUX_MAINT_REF" }
- ,{ GSN_TUP_READ_ATTRS, "TUP_READ_ATTRS" }
- ,{ GSN_TUP_QUERY_TH, "TUP_QUERY_TH" }
- ,{ GSN_TUP_STORE_TH, "TUP_STORE_TH" }
,{ GSN_TUX_BOUND_INFO, "TUX_BOUND_INFO" }
,{ GSN_ACC_LOCKREQ, "ACC_LOCKREQ" }
diff --git a/ndb/src/common/debugger/signaldata/TupAccess.cpp b/ndb/src/common/debugger/signaldata/TupAccess.cpp
deleted file mode 100644
index e94d4636cf5..00000000000
--- a/ndb/src/common/debugger/signaldata/TupAccess.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-/* Copyright (C) 2003 MySQL AB
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-#include <signaldata/TupAccess.hpp>
-#include <SignalLoggerManager.hpp>
-#include <AttributeHeader.hpp>
-
-bool
-printTUP_READ_ATTRS(FILE* output, const Uint32* theData, Uint32 len, Uint16 rbn)
-{
- const TupReadAttrs* const sig = (const TupReadAttrs*)theData;
- if (sig->errorCode == RNIL)
- fprintf(output, " errorCode=RNIL flags=%x\n", sig->requestInfo);
- else
- fprintf(output, " errorCode=%u flags=%x\n", sig->errorCode, sig->requestInfo);
- fprintf(output, " table: id=%u", sig->tableId);
- fprintf(output, " fragment: id=%u ptr=0x%x\n", sig->fragId, sig->fragPtrI);
- fprintf(output, " tuple: addr=0x%x version=%u", sig->tupAddr, sig->tupVersion);
- fprintf(output, " realPage=0x%x offset=%u\n", sig->pageId, sig->pageOffset);
- const Uint32* buffer = (const Uint32*)sig + TupReadAttrs::SignalLength;
- Uint32 attrCount = buffer[0];
- bool readKeys = (sig->requestInfo & TupReadAttrs::ReadKeys);
- if (sig->errorCode == RNIL && ! readKeys ||
- sig->errorCode == 0 && readKeys) {
- fprintf(output, " input: attrCount=%u\n", attrCount);
- for (unsigned i = 0; i < attrCount; i++) {
- AttributeHeader ah(buffer[1 + i]);
- fprintf(output, " %u: attrId=%u\n", i, ah.getAttributeId());
- }
- }
- if (sig->errorCode == 0) {
- fprintf(output, " output: attrCount=%u\n", attrCount);
- Uint32 pos = 1 + attrCount;
- for (unsigned i = 0; i < attrCount; i++) {
- AttributeHeader ah(buffer[pos++]);
- fprintf(output, " %u: attrId=%u dataSize=%u\n", i, ah.getAttributeId(), ah.getDataSize());
- Uint32 next = pos + ah.getDataSize();
- Uint32 printpos = 0;
- while (pos < next) {
- SignalLoggerManager::printDataWord(output, printpos, buffer[pos]);
- pos++;
- }
- if (ah.getDataSize() > 0)
- fprintf(output, "\n");
- }
- }
- return true;
-}
-
-bool
-printTUP_QUERY_TH(FILE* output, const Uint32* theData, Uint32 len, Uint16 rbn)
-{
- const TupQueryTh* const sig = (const TupQueryTh*)theData;
- fprintf(output, "tableId = %u, fragId = %u ", sig->tableId, sig->fragId);
- fprintf(output, "tuple: addr = 0x%x version = %u\n", sig->tupAddr,
- sig->tupVersion);
- fprintf(output, "transId1 = 0x%x, transId2 = 0x%x, savePointId = %u\n",
- sig->transId1, sig->transId2, sig->savePointId);
- return true;
-}
-
-bool
-printTUP_STORE_TH(FILE* output, const Uint32* theData, Uint32 len, Uint16 rbn)
-{
- const TupStoreTh* const sig = (const TupStoreTh*)theData;
- if (sig->errorCode == RNIL)
- fprintf(output, " errorCode=RNIL\n");
- else
- fprintf(output, " errorCode=%u\n", sig->errorCode);
- fprintf(output, " table: id=%u", sig->tableId);
- fprintf(output, " fragment: id=%u ptr=0x%x\n", sig->fragId, sig->fragPtrI);
- fprintf(output, " tuple: addr=0x%x", sig->tupAddr);
- if ((sig->tupAddr & 0x1) == 0) {
- fprintf(output, " fragPage=0x%x index=%u",
- sig->tupAddr >> MAX_TUPLES_BITS,
- (sig->tupAddr & ((1 <<MAX_TUPLES_BITS) - 1)) >> 1);
- fprintf(output, " realPage=0x%x offset=%u\n", sig->pageId, sig->pageOffset);
- } else {
- fprintf(output, " cacheId=%u\n",
- sig->tupAddr >> 1);
- }
- if (sig->tupVersion != 0) {
- fprintf(output, " version=%u ***invalid***\n", sig->tupVersion);
- }
- bool showdata = true;
- switch (sig->opCode) {
- case TupStoreTh::OpRead:
- fprintf(output, " operation=Read\n");
- showdata = false;
- break;
- case TupStoreTh::OpInsert:
- fprintf(output, " operation=Insert\n");
- break;
- case TupStoreTh::OpUpdate:
- fprintf(output, " operation=Update\n");
- break;
- case TupStoreTh::OpDelete:
- fprintf(output, " operation=Delete\n");
- showdata = false;
- break;
- default:
- fprintf(output, " operation=%u ***invalid***\n", sig->opCode);
- break;
- }
- fprintf(output, " data: offset=%u size=%u", sig->dataOffset, sig->dataSize);
- if (! showdata) {
- fprintf(output, " [not printed]\n");
- } else {
- fprintf(output, "\n");
- const Uint32* buffer = (const Uint32*)sig + TupStoreTh::SignalLength;
- Uint32 pos = 0;
- while (pos < sig->dataSize)
- SignalLoggerManager::printDataWord(output, pos, buffer[sig->dataOffset + pos]);
- if (sig->dataSize > 0)
- fprintf(output, "\n");
- }
- return true;
-};
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>&sections,
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>&sections,
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>&sections,
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>&sections,
}
}
- 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>&sections,
return true;
}
+
bool add_server_ports(Vector<ConfigInfo::ConfigRuleSection>&sections,
struct InitConfigFileParser::Context &ctx,
const char * rule_data)
@@ -3028,3 +3032,4 @@ bool add_server_ports(Vector<ConfigInfo::ConfigRuleSection>&sections,
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/Makefile.am b/ndb/src/cw/cpcd/Makefile.am
index 6345bae9bbe..1f7b0d88448 100644
--- a/ndb/src/cw/cpcd/Makefile.am
+++ b/ndb/src/cw/cpcd/Makefile.am
@@ -1,5 +1,5 @@
-ndbtools_PROGRAMS = ndb_cpcd
+ndbbin_PROGRAMS = ndb_cpcd
ndb_cpcd_SOURCES = main.cpp CPCD.cpp Process.cpp APIService.cpp Monitor.cpp common.cpp
diff --git a/ndb/src/cw/cpcd/Process.cpp b/ndb/src/cw/cpcd/Process.cpp
index 74426306a88..a67dba95dc7 100644
--- a/ndb/src/cw/cpcd/Process.cpp
+++ b/ndb/src/cw/cpcd/Process.cpp
@@ -209,54 +209,50 @@ int
set_ulimit(const BaseString & pair){
#ifdef HAVE_GETRLIMIT
errno = 0;
- do {
- Vector<BaseString> list;
- pair.split(list, ":");
- if(list.size() != 2){
- break;
- }
-
- int res;
- rlim_t value = RLIM_INFINITY;
- if(!(list[1].trim() == "unlimited")){
- value = atoi(list[1].c_str());
- }
-
- struct rlimit rlp;
+ Vector<BaseString> list;
+ pair.split(list, ":");
+ if(list.size() != 2){
+ logger.error("Unable to process ulimit: split >%s< list.size()=%d",
+ pair.c_str(), list.size());
+ return -1;
+ }
+
+ int res;
+ rlim_t value = RLIM_INFINITY;
+ if(!(list[1].trim() == "unlimited")){
+ value = atoi(list[1].c_str());
+ }
+
+ struct rlimit rlp;
#define _RLIMIT_FIX(x) { res = getrlimit(x,&rlp); if(!res){ rlp.rlim_cur = value; res = setrlimit(x, &rlp); }}
-
- if(list[0].trim() == "c"){
- _RLIMIT_FIX(RLIMIT_CORE);
- } else if(list[0] == "d"){
- _RLIMIT_FIX(RLIMIT_DATA);
- } else if(list[0] == "f"){
- _RLIMIT_FIX(RLIMIT_FSIZE);
- } else if(list[0] == "n"){
- _RLIMIT_FIX(RLIMIT_NOFILE);
- } else if(list[0] == "s"){
- _RLIMIT_FIX(RLIMIT_STACK);
- } else if(list[0] == "t"){
- _RLIMIT_FIX(RLIMIT_CPU);
- } else {
- errno = EINVAL;
- break;
- }
- if(!res)
- break;
-
- return 0;
- } while(false);
- logger.error("Unable to process ulimit: %s(%s)",
- pair.c_str(), strerror(errno));
- return -1;
-#else
- return 0; // Maybe it's ok anyway...
+
+ if(list[0].trim() == "c"){
+ _RLIMIT_FIX(RLIMIT_CORE);
+ } else if(list[0] == "d"){
+ _RLIMIT_FIX(RLIMIT_DATA);
+ } else if(list[0] == "f"){
+ _RLIMIT_FIX(RLIMIT_FSIZE);
+ } else if(list[0] == "n"){
+ _RLIMIT_FIX(RLIMIT_NOFILE);
+ } else if(list[0] == "s"){
+ _RLIMIT_FIX(RLIMIT_STACK);
+ } else if(list[0] == "t"){
+ _RLIMIT_FIX(RLIMIT_CPU);
+ } else {
+ errno = EINVAL;
+ }
+ if(res){
+ logger.error("Unable to process ulimit: %s res=%d error=%d(%s)",
+ pair.c_str(), res, errno, strerror(errno));
+ return -1;
+ }
#endif
+ return 0;
}
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());
@@ -272,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);
}
@@ -286,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);
@@ -319,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/Dblqh.hpp b/ndb/src/kernel/blocks/dblqh/Dblqh.hpp
index 824f74c59af..e0994955818 100644
--- a/ndb/src/kernel/blocks/dblqh/Dblqh.hpp
+++ b/ndb/src/kernel/blocks/dblqh/Dblqh.hpp
@@ -410,7 +410,6 @@
*/
class Dblqh: public SimulatedBlock {
public:
-
enum LcpCloseState {
LCP_IDLE = 0,
LCP_RUNNING = 1, // LCP is running
@@ -1990,7 +1989,6 @@ public:
UintR nextTcLogQueue;
UintR nextTc;
UintR nextTcConnectrec;
- Uint16 nodeAfterNext[2];
UintR prevHashRec;
UintR prevLogTcrec;
UintR prevTc;
@@ -2027,6 +2025,7 @@ public:
Uint16 nextReplica;
Uint16 primKeyLen;
Uint16 save1;
+ Uint16 nodeAfterNext[3];
Uint8 activeCreat;
Uint8 apiVersionNo;
diff --git a/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp b/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
index 8bef953f522..eb8e2917a8e 100644
--- a/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
+++ b/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
@@ -3574,7 +3574,6 @@ void Dblqh::prepareContinueAfterBlockedLab(Signal* signal)
key.scanNumber = KeyInfo20::getScanNo(regTcPtr->tcScanInfo);
key.fragPtrI = fragptr.i;
c_scanTakeOverHash.find(scanptr, key);
- ndbassert(scanptr.i != RNIL);
}
if (scanptr.i == RNIL) {
jam();
@@ -5995,10 +5994,15 @@ void Dblqh::abortStateHandlerLab(Signal* signal)
break;
case TcConnectionrec::STOPPED:
jam();
-/* ------------------------------------------------------------------------- */
-/*WE ARE CURRENTLY QUEUED FOR ACCESS TO THE FRAGMENT BY A LOCAL CHECKPOINT. */
-/* ------------------------------------------------------------------------- */
+ /* ---------------------------------------------------------------------
+ * WE ARE CURRENTLY QUEUED FOR ACCESS TO THE FRAGMENT BY A LCP
+ * Since nothing has been done, just release operation
+ * i.e. no prepare log record has been written
+ * so no abort log records needs to be written
+ */
releaseWaitQueue(signal);
+ continueAfterLogAbortWriteLab(signal);
+ return;
break;
case TcConnectionrec::WAIT_AI_AFTER_ABORT:
jam();
@@ -6383,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();
@@ -6402,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);
@@ -6600,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){
@@ -9953,9 +9958,11 @@ void Dblqh::execLCP_HOLDOPCONF(Signal* signal)
return;
} else {
jam();
+
/* NO MORE HOLDOPS NEEDED */
lcpLocptr.p->lcpLocstate = LcpLocRecord::HOLDOP_READY;
checkLcpHoldop(signal);
+
if (lcpPtr.p->lcpState == LcpRecord::LCP_WAIT_ACTIVE_FINISH) {
if (fragptr.p->activeList == RNIL) {
jam();
@@ -9973,6 +9980,7 @@ void Dblqh::execLCP_HOLDOPCONF(Signal* signal)
}//if
}//if
}//if
+
/* ----------------------- */
/* ELSE */
/* ------------------------------------------------------------------------
@@ -10045,7 +10053,6 @@ void Dblqh::execTUP_LCPSTARTED(Signal* signal)
void Dblqh::lcpStartedLab(Signal* signal)
{
checkLcpStarted(signal);
-
if (lcpPtr.p->lcpState == LcpRecord::LCP_STARTED) {
jam();
/* ----------------------------------------------------------------------
@@ -10064,7 +10071,7 @@ void Dblqh::lcpStartedLab(Signal* signal)
sendAccContOp(signal); /* START OPERATIONS IN ACC */
moveAccActiveFrag(signal); /* MOVE FROM ACC BLOCKED LIST TO ACTIVE LIST
ON FRAGMENT */
- }//if
+ }
/*---------------*/
/* ELSE */
/*-------------------------------------------------------------------------*/
@@ -10125,32 +10132,27 @@ void Dblqh::execLQH_RESTART_OP(Signal* signal)
lcpPtr.i = signal->theData[1];
ptrCheckGuard(lcpPtr, clcpFileSize, lcpRecord);
- if (fragptr.p->fragStatus == Fragrecord::BLOCKED) {
- if (lcpPtr.p->lcpState == LcpRecord::LCP_STARTED) {
- jam();
- /***********************************************************************/
- /* THIS SIGNAL CAN ONLY BE RECEIVED WHEN FRAGMENT IS BLOCKED AND
- * THE LOCAL CHECKPOINT HAS BEEN STARTED. THE BLOCKING WILL BE
- * REMOVED AS SOON AS ALL OPERATIONS HAVE BEEN STARTED.
- ***********************************************************************/
- restartOperationsLab(signal);
- return;
- } else {
- jam();
- if (lcpPtr.p->lcpState == LcpRecord::LCP_BLOCKED_COMP) {
- jam();
- /*******************************************************************>
- * THE CHECKPOINT IS COMPLETED BUT HAS NOT YET STARTED UP
- * ALL OPERATIONS AGAIN.
- * WE PERFORM THIS START-UP BEFORE CONTINUING WITH THE NEXT
- * FRAGMENT OF THE LOCAL CHECKPOINT TO AVOID ANY STRANGE ERRORS.
- *******************************************************************> */
- restartOperationsLab(signal);
- return;
- }//if
- }//if
- }//if
- ndbrequire(false);
+ ndbrequire(fragptr.p->fragStatus == Fragrecord::BLOCKED);
+ if (lcpPtr.p->lcpState == LcpRecord::LCP_STARTED) {
+ jam();
+ /***********************************************************************/
+ /* THIS SIGNAL CAN ONLY BE RECEIVED WHEN FRAGMENT IS BLOCKED AND
+ * THE LOCAL CHECKPOINT HAS BEEN STARTED. THE BLOCKING WILL BE
+ * REMOVED AS SOON AS ALL OPERATIONS HAVE BEEN STARTED.
+ ***********************************************************************/
+ restartOperationsLab(signal);
+ } else if (lcpPtr.p->lcpState == LcpRecord::LCP_BLOCKED_COMP) {
+ jam();
+ /*******************************************************************>
+ * THE CHECKPOINT IS COMPLETED BUT HAS NOT YET STARTED UP
+ * ALL OPERATIONS AGAIN.
+ * WE PERFORM THIS START-UP BEFORE CONTINUING WITH THE NEXT
+ * FRAGMENT OF THE LOCAL CHECKPOINT TO AVOID ANY STRANGE ERRORS.
+ *******************************************************************> */
+ restartOperationsLab(signal);
+ } else {
+ ndbrequire(false);
+ }
}//Dblqh::execLQH_RESTART_OP()
void Dblqh::restartOperationsLab(Signal* signal)
@@ -10203,13 +10205,13 @@ void Dblqh::restartOperationsAfterStopLab(Signal* signal)
* WHEN ARRIVING HERE THE OPERATION IS ALREADY SET IN THE ACTIVE LIST.
* THUS WE CAN IMMEDIATELY CALL THE METHODS THAT EXECUTE FROM WHERE
* THE OPERATION WAS STOPPED.
- *------------------------------------------------------------------------- */
+ *------------------------------------------------------------------------ */
switch (tcConnectptr.p->transactionState) {
case TcConnectionrec::STOPPED:
jam();
/*-----------------------------------------------------------------------
* STOPPED BEFORE TRYING TO SEND ACCKEYREQ
- *----------------------------------------------------------------------- */
+ *---------------------------------------------------------------------- */
prepareContinueAfterBlockedLab(signal);
return;
break;
@@ -10217,7 +10219,7 @@ void Dblqh::restartOperationsAfterStopLab(Signal* signal)
jam();
/* ----------------------------------------------------------------------
* STOPPED BEFORE TRYING TO SEND ACC_COMMITREQ
- * ---------------------------------------------------------------------- */
+ * --------------------------------------------------------------------- */
releaseActiveFrag(signal);
commitContinueAfterBlockedLab(signal);
return;
@@ -10226,7 +10228,7 @@ void Dblqh::restartOperationsAfterStopLab(Signal* signal)
jam();
/* ----------------------------------------------------------------------
* STOPPED BEFORE TRYING TO SEND ACC_ABORTREQ
- * ---------------------------------------------------------------------- */
+ * --------------------------------------------------------------------- */
abortContinueAfterBlockedLab(signal, true);
return;
break;
@@ -10234,7 +10236,7 @@ void Dblqh::restartOperationsAfterStopLab(Signal* signal)
jam();
/* ----------------------------------------------------------------------
* STOPPED BEFORE TRYING TO SEND NEXT_SCANREQ DURING COPY FRAGMENT
- * ---------------------------------------------------------------------- */
+ * --------------------------------------------------------------------- */
continueCopyAfterBlockedLab(signal);
return;
break;
@@ -10242,7 +10244,7 @@ void Dblqh::restartOperationsAfterStopLab(Signal* signal)
jam();
/* ----------------------------------------------------------------------
* STOPPED BEFORE TRYING TO SEND NEXT_SCANREQ DURING COPY FRAGMENT
- * ---------------------------------------------------------------------- */
+ * --------------------------------------------------------------------- */
continueFirstCopyAfterBlockedLab(signal);
return;
break;
@@ -10250,7 +10252,7 @@ void Dblqh::restartOperationsAfterStopLab(Signal* signal)
jam();
/* ----------------------------------------------------------------------
* STOPPED BEFORE TRYING TO SEND NEXT_SCANREQ DURING SCAN
- * ---------------------------------------------------------------------- */
+ * --------------------------------------------------------------------- */
tcConnectptr.p->transactionState = TcConnectionrec::SCAN_STATE_USED;
continueFirstScanAfterBlockedLab(signal);
return;
@@ -10259,7 +10261,7 @@ void Dblqh::restartOperationsAfterStopLab(Signal* signal)
jam();
/* ----------------------------------------------------------------------
* STOPPED BEFORE TRYING TO SEND NEXT_SCANREQ DURING SCAN
- * ---------------------------------------------------------------------- */
+ * --------------------------------------------------------------------- */
tcConnectptr.p->transactionState = TcConnectionrec::SCAN_STATE_USED;
continueAfterCheckLcpStopBlocked(signal);
return;
@@ -10268,7 +10270,7 @@ void Dblqh::restartOperationsAfterStopLab(Signal* signal)
jam();
/* ----------------------------------------------------------------------
* STOPPED BEFORE TRYING TO SEND NEXT_SCANREQ DURING SCAN
- * ---------------------------------------------------------------------- */
+ * --------------------------------------------------------------------- */
tcConnectptr.p->transactionState = TcConnectionrec::SCAN_STATE_USED;
continueScanAfterBlockedLab(signal);
return;
@@ -10278,7 +10280,7 @@ void Dblqh::restartOperationsAfterStopLab(Signal* signal)
/* ----------------------------------------------------------------------
* STOPPED BEFORE TRYING TO SEND NEXT_SCANREQ DURING RELEASE
* LOCKS IN SCAN
- * ---------------------------------------------------------------------- */
+ * --------------------------------------------------------------------- */
tcConnectptr.p->transactionState = TcConnectionrec::SCAN_STATE_USED;
continueScanReleaseAfterBlockedLab(signal);
return;
@@ -10287,7 +10289,7 @@ void Dblqh::restartOperationsAfterStopLab(Signal* signal)
jam();
/* ----------------------------------------------------------------------
* STOPPED BEFORE TRYING TO SEND NEXT_SCANREQ DURING CLOSE OF SCAN
- * ---------------------------------------------------------------------- */
+ * --------------------------------------------------------------------- */
continueCloseScanAfterBlockedLab(signal);
return;
break;
@@ -10295,7 +10297,7 @@ void Dblqh::restartOperationsAfterStopLab(Signal* signal)
jam();
/* ----------------------------------------------------------------------
* STOPPED BEFORE TRYING TO SEND NEXT_SCANREQ DURING CLOSE OF COPY
- * ---------------------------------------------------------------------- */
+ * --------------------------------------------------------------------- */
continueCloseCopyAfterBlockedLab(signal);
return;
break;
@@ -10421,7 +10423,12 @@ void Dblqh::contChkpNextFragLab(Signal* signal)
* ----------------------------------------------------------------------- */
if (fragptr.p->fragStatus == Fragrecord::BLOCKED) {
jam();
+ /**
+ * LCP of fragment complete
+ * but restarting of operations isn't
+ */
lcpPtr.p->lcpState = LcpRecord::LCP_BLOCKED_COMP;
+ //restartOperationsLab(signal);
return;
}//if
@@ -10698,25 +10705,25 @@ void Dblqh::checkLcpStarted(Signal* signal)
terrorCode = ZOK;
clsLcpLocptr.i = lcpPtr.p->firstLcpLocAcc;
+ int i = 0;
do {
ptrCheckGuard(clsLcpLocptr, clcpLocrecFileSize, lcpLocRecord);
- if (clsLcpLocptr.p->lcpLocstate != LcpLocRecord::ACC_STARTED) {
- ndbrequire((clsLcpLocptr.p->lcpLocstate == LcpLocRecord::ACC_COMPLETED) ||
- (clsLcpLocptr.p->lcpLocstate == LcpLocRecord::ACC_WAIT_STARTED));
+ if (clsLcpLocptr.p->lcpLocstate == LcpLocRecord::ACC_WAIT_STARTED){
return;
}//if
clsLcpLocptr.i = clsLcpLocptr.p->nextLcpLoc;
+ i++;
} while (clsLcpLocptr.i != RNIL);
+ i = 0;
clsLcpLocptr.i = lcpPtr.p->firstLcpLocTup;
do {
ptrCheckGuard(clsLcpLocptr, clcpLocrecFileSize, lcpLocRecord);
- if (clsLcpLocptr.p->lcpLocstate != LcpLocRecord::TUP_STARTED) {
- ndbrequire((clsLcpLocptr.p->lcpLocstate == LcpLocRecord::TUP_COMPLETED) ||
- (clsLcpLocptr.p->lcpLocstate == LcpLocRecord::TUP_WAIT_STARTED));
+ if (clsLcpLocptr.p->lcpLocstate == LcpLocRecord::TUP_WAIT_STARTED){
return;
}//if
clsLcpLocptr.i = clsLcpLocptr.p->nextLcpLoc;
+ i++;
} while (clsLcpLocptr.i != RNIL);
lcpPtr.p->lcpState = LcpRecord::LCP_STARTED;
}//Dblqh::checkLcpStarted()
@@ -10874,18 +10881,28 @@ void Dblqh::sendAccContOp(Signal* signal)
{
LcpLocRecordPtr sacLcpLocptr;
+ int count = 0;
sacLcpLocptr.i = lcpPtr.p->firstLcpLocAcc;
do {
ptrCheckGuard(sacLcpLocptr, clcpLocrecFileSize, lcpLocRecord);
sacLcpLocptr.p->accContCounter = 0;
-/* ------------------------------------------------------------------------- */
-/*SEND START OPERATIONS TO ACC AGAIN */
-/* ------------------------------------------------------------------------- */
- signal->theData[0] = lcpPtr.p->lcpAccptr;
- signal->theData[1] = sacLcpLocptr.p->locFragid;
- sendSignal(fragptr.p->accBlockref, GSN_ACC_CONTOPREQ, signal, 2, JBA);
+ if(sacLcpLocptr.p->lcpLocstate == LcpLocRecord::ACC_STARTED){
+ /* ------------------------------------------------------------------- */
+ /*SEND START OPERATIONS TO ACC AGAIN */
+ /* ------------------------------------------------------------------- */
+ signal->theData[0] = lcpPtr.p->lcpAccptr;
+ signal->theData[1] = sacLcpLocptr.p->locFragid;
+ sendSignal(fragptr.p->accBlockref, GSN_ACC_CONTOPREQ, signal, 2, JBA);
+ count++;
+ } else if(sacLcpLocptr.p->lcpLocstate == LcpLocRecord::ACC_COMPLETED){
+ signal->theData[0] = sacLcpLocptr.i;
+ sendSignal(reference(), GSN_ACC_CONTOPCONF, signal, 1, JBB);
+ } else {
+ ndbrequire(false);
+ }
sacLcpLocptr.i = sacLcpLocptr.p->nextLcpLoc;
} while (sacLcpLocptr.i != RNIL);
+
}//Dblqh::sendAccContOp()
/* ------------------------------------------------------------------------- */
@@ -13206,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];
/* ----------------------------------------------------------------------
@@ -16161,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;
@@ -18125,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/Dbtup.hpp b/ndb/src/kernel/blocks/dbtup/Dbtup.hpp
index 825de4f6c2c..71af563599c 100644
--- a/ndb/src/kernel/blocks/dbtup/Dbtup.hpp
+++ b/ndb/src/kernel/blocks/dbtup/Dbtup.hpp
@@ -1014,9 +1014,15 @@ public:
void tuxReadAttrs(Uint32 fragPtrI, Uint32 pageId, Uint32 pageOffset, Uint32 tupVersion, Uint32 numAttrs, const Uint32* attrIds, const Uint32** attrData);
/*
- * TUX reads primary key for md5 summing and when returning keyinfo.
+ * TUX reads primary key without headers into an array of words. Used
+ * for md5 summing and when returning keyinfo.
*/
- void tuxReadKeys(); // under construction
+ void tuxReadKeys(Uint32 fragPtrI, Uint32 pageId, Uint32 pageOffset, Uint32* pkSize, Uint32* pkData);
+
+ /*
+ * TUX checks if tuple is visible to scan.
+ */
+ bool tuxQueryTh(Uint32 fragPtrI, Uint32 tupAddr, Uint32 tupVersion, Uint32 transId1, Uint32 transId2, Uint32 savePointId);
private:
BLOCK_DEFINES(Dbtup);
@@ -1062,9 +1068,6 @@ private:
void execTUP_WRITELOG_REQ(Signal* signal);
// Ordered index related
- void execTUP_READ_ATTRS(Signal* signal);
- void execTUP_QUERY_TH(Signal* signal);
- void execTUP_STORE_TH(Signal* signal);
void execBUILDINDXREQ(Signal* signal);
void buildIndex(Signal* signal, Uint32 buildPtrI);
void buildIndexReply(Signal* signal, const BuildIndexRec* buildRec);
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/DbtupGen.cpp b/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp
index 3b54817edb0..8133f70a803 100644
--- a/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp
+++ b/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp
@@ -132,9 +132,6 @@ Dbtup::Dbtup(const class Configuration & conf)
addRecSignal(GSN_TUP_WRITELOG_REQ, &Dbtup::execTUP_WRITELOG_REQ);
// Ordered index related
- addRecSignal(GSN_TUP_READ_ATTRS, &Dbtup::execTUP_READ_ATTRS);
- addRecSignal(GSN_TUP_QUERY_TH, &Dbtup::execTUP_QUERY_TH);
- addRecSignal(GSN_TUP_STORE_TH, &Dbtup::execTUP_STORE_TH);
addRecSignal(GSN_BUILDINDXREQ, &Dbtup::execBUILDINDXREQ);
initData();
diff --git a/ndb/src/kernel/blocks/dbtup/DbtupIndex.cpp b/ndb/src/kernel/blocks/dbtup/DbtupIndex.cpp
index f11de5238e2..e7a431f17de 100644
--- a/ndb/src/kernel/blocks/dbtup/DbtupIndex.cpp
+++ b/ndb/src/kernel/blocks/dbtup/DbtupIndex.cpp
@@ -22,7 +22,6 @@
#include <AttributeDescriptor.hpp>
#include "AttributeOffset.hpp"
#include <AttributeHeader.hpp>
-#include <signaldata/TupAccess.hpp>
#include <signaldata/TuxMaint.hpp>
#define ljam() { jamLine(28000 + __LINE__); }
@@ -152,10 +151,10 @@ Dbtup::tuxReadAttrs(Uint32 fragPtrI, Uint32 pageId, Uint32 pageOffset, Uint32 tu
const Uint32* tupleHeader = &pagePtr.p->pageWord[pageOffset];
for (Uint32 i = 0; i < numAttrs; i++) {
AttributeHeader ah(attrIds[i]);
- Uint32 attrId = ah.getAttributeId();
- Uint32 index = tabDescriptor + (attrId << ZAD_LOG_SIZE);
- Uint32 desc1 = tableDescriptor[index].tabDescr;
- Uint32 desc2 = tableDescriptor[index + 1].tabDescr;
+ const Uint32 attrId = ah.getAttributeId();
+ const Uint32 index = tabDescriptor + (attrId << ZAD_LOG_SIZE);
+ const Uint32 desc1 = tableDescriptor[index].tabDescr;
+ const Uint32 desc2 = tableDescriptor[index + 1].tabDescr;
if (AttributeDescriptor::getNullable(desc1)) {
Uint32 offset = AttributeOffset::getNullFlagOffset(desc2);
ndbrequire(offset < tablePtr.p->tupNullWords);
@@ -171,275 +170,78 @@ Dbtup::tuxReadAttrs(Uint32 fragPtrI, Uint32 pageId, Uint32 pageOffset, Uint32 tu
}
}
-void // under construction
-Dbtup::tuxReadKeys()
-{
-}
-
-// deprecated signal interfaces
-
void
-Dbtup::execTUP_READ_ATTRS(Signal* signal)
+Dbtup::tuxReadKeys(Uint32 fragPtrI, Uint32 pageId, Uint32 pageOffset, Uint32* pkSize, Uint32* pkData)
{
ljamEntry();
- TupReadAttrs* const sig = (TupReadAttrs*)signal->getDataPtrSend();
- TupReadAttrs reqCopy = *sig;
- TupReadAttrs* const req = &reqCopy;
- req->errorCode = 0;
- // get table
+ FragrecordPtr fragPtr;
+ fragPtr.i = fragPtrI;
+ ptrCheckGuard(fragPtr, cnoOfFragrec, fragrecord);
TablerecPtr tablePtr;
- tablePtr.i = req->tableId;
+ tablePtr.i = fragPtr.p->fragTableId;
ptrCheckGuard(tablePtr, cnoOfTablerec, tablerec);
- // get fragment
- FragrecordPtr fragPtr;
- if (req->fragPtrI == RNIL) {
- ljam();
- getFragmentrec(fragPtr, req->fragId, tablePtr.p);
- ndbrequire(fragPtr.i != RNIL);
- req->fragPtrI = fragPtr.i;
- } else {
- fragPtr.i = req->fragPtrI;
- ptrCheckGuard(fragPtr, cnoOfFragrec, fragrecord);
- ndbrequire(req->fragId == fragPtr.p->fragmentId);
- }
- // get page
PagePtr pagePtr;
- if (req->pageId == RNIL) {
- ljam();
- Uint32 fragPageId = req->tupAddr >> MAX_TUPLES_BITS;
- Uint32 pageIndex = req->tupAddr & ((1 << MAX_TUPLES_BITS ) - 1);
- ndbrequire((pageIndex & 0x1) == 0);
- // data returned for original tuple
- req->pageId = getRealpid(fragPtr.p, fragPageId);
- req->pageOffset = ZPAGE_HEADER_SIZE + (pageIndex >> 1) * tablePtr.p->tupheadsize;
- }
- pagePtr.i = req->pageId;
+ pagePtr.i = pageId;
ptrCheckGuard(pagePtr, cnoOfPage, page);
- Uint32 pageOffset = req->pageOffset;
- // search for tuple version if not original
- if (! (req->requestInfo & TupReadAttrs::ReadKeys) &&
- pagePtr.p->pageWord[pageOffset + 1] != req->tupVersion) {
- ljam();
- OperationrecPtr opPtr;
- opPtr.i = pagePtr.p->pageWord[pageOffset];
- Uint32 loopGuard = 0;
- while (true) {
- ptrCheckGuard(opPtr, cnoOfOprec, operationrec);
- if (opPtr.p->realPageIdC != RNIL) {
- pagePtr.i = opPtr.p->realPageIdC;
- pageOffset = opPtr.p->pageOffsetC;
- ptrCheckGuard(pagePtr, cnoOfPage, page);
- if (pagePtr.p->pageWord[pageOffset + 1] == req->tupVersion) {
- ljam();
- break;
- }
- }
- ljam();
- // next means before in event order
- opPtr.i = opPtr.p->nextActiveOp;
- ndbrequire(++loopGuard < (1 << ZTUP_VERSION_BITS));
+ const Uint32 tabDescriptor = tablePtr.p->tabDescriptor;
+ const Uint32 numAttrs = tablePtr.p->noOfKeyAttr;
+ const Uint32* attrIds = &tableDescriptor[tablePtr.p->readKeyArray].tabDescr;
+ const Uint32* tupleHeader = &pagePtr.p->pageWord[pageOffset];
+ Uint32 size = 0;
+ for (Uint32 i = 0; i < numAttrs; i++) {
+ AttributeHeader ah(attrIds[i]);
+ const Uint32 attrId = ah.getAttributeId();
+ const Uint32 index = tabDescriptor + (attrId << ZAD_LOG_SIZE);
+ const Uint32 desc1 = tableDescriptor[index].tabDescr;
+ const Uint32 desc2 = tableDescriptor[index + 1].tabDescr;
+ ndbrequire(! AttributeDescriptor::getNullable(desc1));
+ const Uint32 attrSize = AttributeDescriptor::getSizeInWords(desc1);
+ const Uint32* attrData = tupleHeader + AttributeOffset::getOffset(desc2);
+ for (Uint32 j = 0; j < attrSize; j++) {
+ pkData[size + j] = attrData[j];
}
+ size += attrSize;
}
- // shared buffer
- Uint32* buffer = (Uint32*)sig + TupReadAttrs::SignalLength;
- // if request is for keys then we create input section
- if (req->requestInfo & TupReadAttrs::ReadKeys) {
- ljam();
- buffer[0] = tablePtr.p->noOfKeyAttr;
- const Uint32* keyArray = &tableDescriptor[tablePtr.p->readKeyArray].tabDescr;
- MEMCOPY_NO_WORDS(&buffer[1], keyArray, tablePtr.p->noOfKeyAttr);
- }
- Uint32 inBufLen = buffer[0];
- Uint32* inBuffer = &buffer[1];
- Uint32* outBuffer = &buffer[1 + inBufLen];
- Uint32 maxRead = ZATTR_BUFFER_SIZE;
- // save globals
- TablerecPtr tabptr_old = tabptr;
- FragrecordPtr fragptr_old = fragptr;
- OperationrecPtr operPtr_old = operPtr;
- // new globals
- tabptr = tablePtr;
- fragptr = fragPtr;
- operPtr.i = RNIL; // XXX check later
- operPtr.p = NULL;
- int ret = readAttributes(pagePtr.p, pageOffset, inBuffer, inBufLen, outBuffer, maxRead);
- // restore globals
- tabptr = tabptr_old;
- fragptr = fragptr_old;
- operPtr = operPtr_old;
- // check error
- if ((Uint32)ret == (Uint32)-1) {
- ljam();
- req->errorCode = terrorCode;
- }
- // copy back
- *sig = *req;
+ *pkSize = size;
}
-void
-Dbtup::execTUP_QUERY_TH(Signal* signal)
+bool
+Dbtup::tuxQueryTh(Uint32 fragPtrI, Uint32 tupAddr, Uint32 tupVersion, Uint32 transId1, Uint32 transId2, Uint32 savePointId)
{
ljamEntry();
- Operationrec tempOp;
- TupQueryTh* const req = (TupQueryTh*)signal->getDataPtrSend();
- Uint32 tableId = req->tableId;
- Uint32 fragId = req->fragId;
- Uint32 tupAddr = req->tupAddr;
- Uint32 req_tupVersion = req->tupVersion;
- Uint32 transid1 = req->transId1;
- Uint32 transid2 = req->transId2;
- Uint32 savePointId = req->savePointId;
- Uint32 ret_result = 0;
- // get table
+ FragrecordPtr fragPtr;
+ fragPtr.i = fragPtrI;
+ ptrCheckGuard(fragPtr, cnoOfFragrec, fragrecord);
TablerecPtr tablePtr;
- tablePtr.i = tableId;
+ tablePtr.i = fragPtr.p->fragTableId;
ptrCheckGuard(tablePtr, cnoOfTablerec, tablerec);
- // get fragment
- FragrecordPtr fragPtr;
- getFragmentrec(fragPtr, fragId, tablePtr.p);
- ndbrequire(fragPtr.i != RNIL);
// get page
PagePtr pagePtr;
Uint32 fragPageId = tupAddr >> MAX_TUPLES_BITS;
Uint32 pageIndex = tupAddr & ((1 << MAX_TUPLES_BITS ) - 1);
-
+ // use temp op rec
+ Operationrec tempOp;
tempOp.fragPageId = fragPageId;
tempOp.pageIndex = pageIndex;
- tempOp.transid1 = transid1;
- tempOp.transid2 = transid2;
+ tempOp.transid1 = transId1;
+ tempOp.transid2 = transId2;
tempOp.savePointId = savePointId;
tempOp.optype = ZREAD;
tempOp.dirtyOp = 1;
if (getPage(pagePtr, &tempOp, fragPtr.p, tablePtr.p)) {
/*
- We use the normal getPage which will return the tuple to be used
- for this transaction and savepoint id. If its tuple version equals
- the requested then we have a visible tuple otherwise not.
+ * We use the normal getPage which will return the tuple to be used
+ * for this transaction and savepoint id. If its tuple version
+ * equals the requested then we have a visible tuple otherwise not.
*/
ljam();
Uint32 read_tupVersion = pagePtr.p->pageWord[tempOp.pageOffset + 1];
- if (read_tupVersion == req_tupVersion) {
+ if (read_tupVersion == tupVersion) {
ljam();
- ret_result = 1;
- }
- }
- req->returnCode = ret_result;
- return;
-}
-
-void
-Dbtup::execTUP_STORE_TH(Signal* signal)
-{
- ljamEntry();
- TupStoreTh* const sig = (TupStoreTh*)signal->getDataPtrSend();
- TupStoreTh reqCopy = *sig;
- TupStoreTh* const req = &reqCopy;
- req->errorCode = 0;
- ndbrequire(req->tupVersion == 0);
- // get table
- TablerecPtr tablePtr;
- tablePtr.i = req->tableId;
- ptrCheckGuard(tablePtr, cnoOfTablerec, tablerec);
- // offset to attribute 0
- Uint32 attrDescIndex = tablePtr.p->tabDescriptor + (0 << ZAD_LOG_SIZE);
- Uint32 attrDataOffset = AttributeOffset::getOffset(tableDescriptor[attrDescIndex + 1].tabDescr);
- // get fragment
- FragrecordPtr fragPtr;
- if (req->fragPtrI == RNIL) {
- ljam();
- getFragmentrec(fragPtr, req->fragId, tablePtr.p);
- ndbrequire(fragPtr.i != RNIL);
- req->fragPtrI = fragPtr.i;
- } else {
- fragPtr.i = req->fragPtrI;
- ptrCheckGuard(fragPtr, cnoOfFragrec, fragrecord);
- ndbrequire(req->fragId == fragPtr.p->fragmentId);
- }
- // handle each case
- switch (req->opCode) {
- case TupStoreTh::OpRead:
- ljam();
- {
- PagePtr pagePtr;
- if (req->pageId == RNIL) {
- ljam();
- Uint32 fragPageId = req->tupAddr >> MAX_TUPLES_BITS;
- Uint32 pageIndex = req->tupAddr & ((1 << MAX_TUPLES_BITS ) - 1);
- ndbrequire((pageIndex & 0x1) == 0);
- req->pageId = getRealpid(fragPtr.p, fragPageId);
- req->pageOffset = ZPAGE_HEADER_SIZE + (pageIndex >> 1) * tablePtr.p->tupheadsize;
- }
- pagePtr.i = req->pageId;
- ptrCheckGuard(pagePtr, cnoOfPage, page);
- Uint32* data = &pagePtr.p->pageWord[req->pageOffset] + attrDataOffset;
- Uint32* buffer = (Uint32*)sig + TupStoreTh::SignalLength;
- ndbrequire(req->dataOffset + req->dataSize <= tablePtr.p->tupheadsize);
- memcpy(buffer + req->dataOffset, data + req->dataOffset, req->dataSize << 2);
- }
- break;
- case TupStoreTh::OpInsert:
- ljam();
- {
- PagePtr pagePtr;
- if (! allocTh(fragPtr.p, tablePtr.p, NORMAL_PAGE, signal, req->pageOffset, pagePtr)) {
- ljam();
- req->errorCode = terrorCode;
- break;
- }
- req->pageId = pagePtr.i;
- Uint32 fragPageId = pagePtr.p->pageWord[ZPAGE_FRAG_PAGE_ID_POS];
- Uint32 pageIndex = ((req->pageOffset - ZPAGE_HEADER_SIZE) / tablePtr.p->tupheadsize) << 1;
- req->tupAddr = (fragPageId << MAX_TUPLES_BITS) | pageIndex;
- ndbrequire(req->dataOffset + req->dataSize <= tablePtr.p->tupheadsize);
- Uint32* data = &pagePtr.p->pageWord[req->pageOffset] + attrDataOffset;
- Uint32* buffer = (Uint32*)sig + TupStoreTh::SignalLength;
- memcpy(data + req->dataOffset, buffer + req->dataOffset, req->dataSize << 2);
+ return true;
}
- break;
- case TupStoreTh::OpUpdate:
- ljam();
- {
- PagePtr pagePtr;
- if (req->pageId == RNIL) {
- ljam();
- Uint32 fragPageId = req->tupAddr >> MAX_TUPLES_BITS;
- Uint32 pageIndex = req->tupAddr & ((1 << MAX_TUPLES_BITS ) - 1);
- ndbrequire((pageIndex & 0x1) == 0);
- req->pageId = getRealpid(fragPtr.p, fragPageId);
- req->pageOffset = ZPAGE_HEADER_SIZE + (pageIndex >> 1) * tablePtr.p->tupheadsize;
- }
- pagePtr.i = req->pageId;
- ptrCheckGuard(pagePtr, cnoOfPage, page);
- Uint32* data = &pagePtr.p->pageWord[req->pageOffset] + attrDataOffset;
- Uint32* buffer = (Uint32*)sig + TupStoreTh::SignalLength;
- ndbrequire(req->dataOffset + req->dataSize <= tablePtr.p->tupheadsize);
- memcpy(data + req->dataOffset, buffer + req->dataOffset, req->dataSize << 2);
- }
- break;
- case TupStoreTh::OpDelete:
- ljam();
- {
- PagePtr pagePtr;
- if (req->pageId == RNIL) {
- ljam();
- Uint32 fragPageId = req->tupAddr >> MAX_TUPLES_BITS;
- Uint32 pageIndex = req->tupAddr & ((1 << MAX_TUPLES_BITS ) - 1);
- ndbrequire((pageIndex & 0x1) == 0);
- req->pageId = getRealpid(fragPtr.p, fragPageId);
- req->pageOffset = ZPAGE_HEADER_SIZE + (pageIndex >> 1) * tablePtr.p->tupheadsize;
- }
- pagePtr.i = req->pageId;
- ptrCheckGuard(pagePtr, cnoOfPage, page);
- freeTh(fragPtr.p, tablePtr.p, signal, pagePtr.p, req->pageOffset);
- // null location
- req->tupAddr = (Uint32)-1;
- req->pageId = RNIL;
- req->pageOffset = 0;
- }
- break;
}
- // copy back
- *sig = *req;
+ return false;
}
// ordered index build
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 25e85ba9f5f..1a3c7f64ac3 100644
--- a/ndb/src/kernel/blocks/dbtux/Dbtux.hpp
+++ b/ndb/src/kernel/blocks/dbtux/Dbtux.hpp
@@ -37,7 +37,6 @@
#include <signaldata/AlterIndx.hpp>
#include <signaldata/DropTab.hpp>
#include <signaldata/TuxMaint.hpp>
-#include <signaldata/TupAccess.hpp>
#include <signaldata/AccScan.hpp>
#include <signaldata/TuxBound.hpp>
#include <signaldata/NextScan.hpp>
@@ -77,10 +76,14 @@
#define jam() jamLine(60000 + __LINE__)
#define jamEntry() jamEntryLine(60000 + __LINE__)
#endif
-#ifdef DBTUX_CMP_CPP
+#ifdef DBTUX_SEARCH_CPP
#define jam() jamLine(70000 + __LINE__)
#define jamEntry() jamEntryLine(70000 + __LINE__)
#endif
+#ifdef DBTUX_CMP_CPP
+#define jam() jamLine(80000 + __LINE__)
+#define jamEntry() jamEntryLine(80000 + __LINE__)
+#endif
#ifdef DBTUX_DEBUG_CPP
#define jam() jamLine(90000 + __LINE__)
#define jamEntry() jamEntryLine(90000 + __LINE__)
@@ -112,6 +115,7 @@ public:
static const unsigned DescPageSize = 256;
private:
static const unsigned MaxTreeNodeSize = MAX_TTREE_NODE_SIZE;
+ static const unsigned MaxPrefSize = MAX_TTREE_PREF_SIZE;
static const unsigned ScanBoundSegmentSize = 7;
static const unsigned MaxAccLockOps = MAX_PARALLEL_OP_PER_SCAN;
BLOCK_DEFINES(Dbtux);
@@ -206,19 +210,19 @@ private:
unsigned m_fragBit : 1; // which duplicated table fragment
TreeEnt();
// methods
+ bool eq(const TreeEnt ent) const;
int cmp(const TreeEnt ent) const;
};
static const unsigned TreeEntSize = sizeof(TreeEnt) >> 2;
static const TreeEnt NullTreeEnt;
/*
- * Tree node has 1) fixed part 2) actual table data for min and max
- * prefix 3) max and min entries 4) rest of entries 5) one extra entry
+ * Tree node has 1) fixed part 2) a prefix of index key data for min
+ * entry 3) max and min entries 4) rest of entries 5) one extra entry
* used as work space.
*
* struct TreeNode part 1, size 6 words
* min prefix part 2, size TreeHead::m_prefSize
- * max prefix part 2, size TreeHead::m_prefSize
* max entry part 3
* min entry part 3
* rest of entries part 4
@@ -265,14 +269,14 @@ private:
friend struct TreeHead;
struct TreeHead {
Uint8 m_nodeSize; // words in tree node
- Uint8 m_prefSize; // words in min/max prefix each
+ Uint8 m_prefSize; // words in min prefix
Uint8 m_minOccup; // min entries in internal node
Uint8 m_maxOccup; // max entries in node
TupLoc m_root; // root node
TreeHead();
// methods
unsigned getSize(AccSize acc) const;
- Data getPref(TreeNode* node, unsigned i) const;
+ Data getPref(TreeNode* node) const;
TreeEnt* getEntList(TreeNode* node) const;
};
@@ -442,6 +446,7 @@ private:
Uint32 m_descPage; // descriptor page
Uint16 m_descOff; // offset within the page
Uint16 m_numAttrs;
+ bool m_storeNullKey;
union {
Uint32 nextPool;
};
@@ -465,6 +470,7 @@ private:
Uint32 m_descPage; // copy from index level
Uint16 m_descOff;
Uint16 m_numAttrs;
+ bool m_storeNullKey;
TreeHead m_tree;
TupLoc m_freeLoc; // one node pre-allocated for insert
DLList<ScanOp> m_scanList; // current scans on this fragment
@@ -514,6 +520,8 @@ private:
NodeHandle(Frag& frag);
NodeHandle(const NodeHandle& node);
NodeHandle& operator=(const NodeHandle& node);
+ // check if unassigned
+ bool isNull();
// getters
TupLoc getLink(unsigned i);
unsigned getChilds(); // cannot spell
@@ -528,56 +536,13 @@ private:
void setBalance(int b);
void setNodeScan(Uint32 scanPtrI);
// access other parts of the node
- Data getPref(unsigned i);
+ Data getPref();
TreeEnt getEnt(unsigned pos);
TreeEnt getMinMax(unsigned i);
// for ndbrequire and ndbassert
void progError(int line, int cause, const char* file);
};
- // parameters for methods
-
- /*
- * Copy attribute data.
- */
- struct CopyPar {
- unsigned m_items; // number of attributes
- bool m_headers; // copy headers flag (default true)
- unsigned m_maxwords; // limit size (default no limit)
- // output
- unsigned m_numitems; // number of attributes fully copied
- unsigned m_numwords; // number of words copied
- CopyPar();
- };
-
- /*
- * Read index key attributes.
- */
- struct ReadPar;
- friend struct ReadPar;
- struct ReadPar {
- TreeEnt m_ent; // tuple to read
- unsigned m_first; // first index attribute
- unsigned m_count; // number of consecutive index attributes
- Data m_data; // set pointer if 0 else copy result to it
- unsigned m_size; // number of words (set in read keys only)
- ReadPar();
- };
-
- /*
- * Scan bound comparison.
- */
- struct BoundPar;
- friend struct BoundPar;
- struct BoundPar {
- ConstData m_data1; // full bound data
- ConstData m_data2; // full or prefix data
- unsigned m_count1; // number of bounds
- unsigned m_len2; // words in data2 buffer
- unsigned m_dir; // 0-lower bound 1-upper bound
- BoundPar();
- };
-
// methods
/*
@@ -589,7 +554,7 @@ private:
// utils
void setKeyAttrs(const Frag& frag);
void readKeyAttrs(const Frag& frag, TreeEnt ent, unsigned start, TableData keyData);
- void copyAttrs(Data dst, ConstData src, CopyPar& copyPar);
+ void readTablePk(const Frag& frag, TreeEnt ent, unsigned& pkSize, Data pkData);
void copyAttrs(const Frag& frag, TableData data1, Data data2, unsigned maxlen2 = MaxAttrDataSize);
/*
@@ -607,8 +572,6 @@ private:
* DbtuxMaint.cpp
*/
void execTUX_MAINT_REQ(Signal* signal);
- void tupReadAttrs(Signal* signal, const Frag& frag, ReadPar& readPar);
- void tupReadKeys(Signal* signal, const Frag& frag, ReadPar& readPar);
/*
* DbtuxNode.cpp
@@ -618,7 +581,7 @@ private:
void selectNode(Signal* signal, NodeHandle& node, TupLoc loc, AccSize acc);
void insertNode(Signal* signal, NodeHandle& node, AccSize acc);
void deleteNode(Signal* signal, NodeHandle& node);
- void setNodePref(Signal* signal, NodeHandle& node, unsigned i);
+ void setNodePref(Signal* signal, NodeHandle& node);
// node operations
void nodePushUp(Signal* signal, NodeHandle& node, unsigned pos, const TreeEnt& ent);
void nodePopDown(Signal* signal, NodeHandle& node, unsigned pos, TreeEnt& ent);
@@ -633,7 +596,6 @@ private:
/*
* DbtuxTree.cpp
*/
- void treeSearch(Signal* signal, Frag& frag, TableData searchKey, TreeEnt searchEnt, TreePos& treePos);
void treeAdd(Signal* signal, Frag& frag, TreePos treePos, TreeEnt ent);
void treeRemove(Signal* signal, Frag& frag, TreePos treePos);
void treeRotateSingle(Signal* signal, Frag& frag, NodeHandle& node, unsigned i);
@@ -658,11 +620,19 @@ private:
void releaseScanOp(ScanOpPtr& scanPtr);
/*
+ * DbtuxSearch.cpp
+ */
+ void searchToAdd(Signal* signal, Frag& frag, TableData searchKey, TreeEnt searchEnt, TreePos& treePos);
+ void searchToRemove(Signal* signal, Frag& frag, TableData searchKey, TreeEnt searchEnt, TreePos& treePos);
+ void searchToScan(Signal* signal, Frag& frag, ConstData boundInfo, unsigned boundCount, TreePos& treePos);
+
+ /*
* DbtuxCmp.cpp
*/
- int cmpSearchKey(const Frag& frag, unsigned& start, TableData data1, ConstData data2, unsigned maxlen2 = MaxAttrDataSize);
- int cmpSearchKey(const Frag& frag, unsigned& start, TableData data1, TableData data2);
- int cmpScanBound(const Frag& frag, const BoundPar boundPar);
+ int cmpSearchKey(const Frag& frag, unsigned& start, TableData searchKey, ConstData entryData, unsigned maxlen = MaxAttrDataSize);
+ int cmpSearchKey(const Frag& frag, unsigned& start, TableData searchKey, TableData entryKey);
+ int cmpScanBound(const Frag& frag, unsigned dir, ConstData boundInfo, unsigned boundCount, ConstData entryData, unsigned maxlen = MaxAttrDataSize);
+ int cmpScanBound(const Frag& frag, unsigned dir, ConstData boundInfo, unsigned boundCount, TableData entryKey);
/*
* DbtuxDebug.cpp
@@ -675,6 +645,7 @@ private:
TupLoc m_parent; // expected parent address
int m_depth; // returned depth
unsigned m_occup; // returned occupancy
+ TreeEnt m_minmax[2]; // returned subtree min and max
bool m_ok; // returned status
PrintPar();
};
@@ -699,6 +670,8 @@ private:
DebugTree = 4, // log and check tree after each op
DebugScan = 8 // log scans
};
+ static const int DataFillByte = 0xa2;
+ static const int NodeFillByte = 0xa4;
#endif
// start up info
@@ -859,13 +832,18 @@ Dbtux::TreeEnt::TreeEnt() :
{
}
+inline bool
+Dbtux::TreeEnt::eq(const TreeEnt ent) const
+{
+ return
+ m_tupLoc == ent.m_tupLoc &&
+ m_tupVersion == ent.m_tupVersion &&
+ m_fragBit == ent.m_fragBit;
+}
+
inline int
Dbtux::TreeEnt::cmp(const TreeEnt ent) const
{
- if (m_fragBit < ent.m_fragBit)
- return -1;
- if (m_fragBit > ent.m_fragBit)
- return +1;
if (m_tupLoc.m_pageId < ent.m_tupLoc.m_pageId)
return -1;
if (m_tupLoc.m_pageId > ent.m_tupLoc.m_pageId)
@@ -878,6 +856,10 @@ Dbtux::TreeEnt::cmp(const TreeEnt ent) const
return -1;
if (m_tupVersion > ent.m_tupVersion)
return +1;
+ if (m_fragBit < ent.m_fragBit)
+ return -1;
+ if (m_fragBit > ent.m_fragBit)
+ return +1;
return 0;
}
@@ -920,25 +902,25 @@ Dbtux::TreeHead::getSize(AccSize acc) const
case AccHead:
return NodeHeadSize;
case AccPref:
- return NodeHeadSize + 2 * m_prefSize + 2 * TreeEntSize;
+ return NodeHeadSize + m_prefSize + 2 * TreeEntSize;
case AccFull:
return m_nodeSize;
}
- REQUIRE(false, "invalid Dbtux::AccSize");
+ abort();
return 0;
}
inline Dbtux::Data
-Dbtux::TreeHead::getPref(TreeNode* node, unsigned i) const
+Dbtux::TreeHead::getPref(TreeNode* node) const
{
- Uint32* ptr = (Uint32*)node + NodeHeadSize + i * m_prefSize;
+ Uint32* ptr = (Uint32*)node + NodeHeadSize;
return ptr;
}
inline Dbtux::TreeEnt*
Dbtux::TreeHead::getEntList(TreeNode* node) const
{
- Uint32* ptr = (Uint32*)node + NodeHeadSize + 2 * m_prefSize;
+ Uint32* ptr = (Uint32*)node + NodeHeadSize + m_prefSize;
return (TreeEnt*)ptr;
}
@@ -1013,7 +995,8 @@ Dbtux::Index::Index() :
m_numFrags(0),
m_descPage(RNIL),
m_descOff(0),
- m_numAttrs(0)
+ m_numAttrs(0),
+ m_storeNullKey(false)
{
for (unsigned i = 0; i < MaxIndexFragments; i++) {
m_fragId[i] = ZNIL;
@@ -1032,6 +1015,7 @@ Dbtux::Frag::Frag(ArrayPool<ScanOp>& scanOpPool) :
m_descPage(RNIL),
m_descOff(0),
m_numAttrs(ZNIL),
+ m_storeNullKey(false),
m_tree(),
m_freeLoc(),
m_scanList(scanOpPool),
@@ -1087,6 +1071,12 @@ Dbtux::NodeHandle::operator=(const NodeHandle& node)
return *this;
}
+inline bool
+Dbtux::NodeHandle::isNull()
+{
+ return m_node == 0;
+}
+
inline Dbtux::TupLoc
Dbtux::NodeHandle::getLink(unsigned i)
{
@@ -1161,11 +1151,11 @@ Dbtux::NodeHandle::setNodeScan(Uint32 scanPtrI)
}
inline Dbtux::Data
-Dbtux::NodeHandle::getPref(unsigned i)
+Dbtux::NodeHandle::getPref()
{
TreeHead& tree = m_frag.m_tree;
- ndbrequire(m_acc >= AccPref && i <= 1);
- return tree.getPref(m_node, i);
+ ndbrequire(m_acc >= AccPref);
+ return tree.getPref(m_node);
}
inline Dbtux::TreeEnt
@@ -1193,36 +1183,6 @@ Dbtux::NodeHandle::getMinMax(unsigned i)
// parameters for methods
-inline
-Dbtux::CopyPar::CopyPar() :
- m_items(0),
- m_headers(true),
- m_maxwords(~0), // max unsigned
- // output
- m_numitems(0),
- m_numwords(0)
-{
-}
-
-inline
-Dbtux::ReadPar::ReadPar() :
- m_first(0),
- m_count(0),
- m_data(0),
- m_size(0)
-{
-}
-
-inline
-Dbtux::BoundPar::BoundPar() :
- m_data1(0),
- m_data2(0),
- m_count1(0),
- m_len2(0),
- m_dir(255)
-{
-}
-
#ifdef VM_TRACE
inline
Dbtux::PrintPar::PrintPar() :
diff --git a/ndb/src/kernel/blocks/dbtux/DbtuxCmp.cpp b/ndb/src/kernel/blocks/dbtux/DbtuxCmp.cpp
index 7601a14a242..1b8755a1dc4 100644
--- a/ndb/src/kernel/blocks/dbtux/DbtuxCmp.cpp
+++ b/ndb/src/kernel/blocks/dbtux/DbtuxCmp.cpp
@@ -25,14 +25,14 @@
* prefix may be partial in which case CmpUnknown may be returned.
*/
int
-Dbtux::cmpSearchKey(const Frag& frag, unsigned& start, TableData data1, ConstData data2, unsigned maxlen2)
+Dbtux::cmpSearchKey(const Frag& frag, unsigned& start, TableData searchKey, ConstData entryData, unsigned maxlen)
{
const unsigned numAttrs = frag.m_numAttrs;
const DescEnt& descEnt = getDescEnt(frag.m_descPage, frag.m_descOff);
// number of words of attribute data left
- unsigned len2 = maxlen2;
+ unsigned len2 = maxlen;
// skip to right position in search key
- data1 += start;
+ searchKey += start;
int ret = 0;
while (start < numAttrs) {
if (len2 < AttributeHeaderSize) {
@@ -41,20 +41,20 @@ Dbtux::cmpSearchKey(const Frag& frag, unsigned& start, TableData data1, ConstDat
break;
}
len2 -= AttributeHeaderSize;
- if (*data1 != 0) {
- if (! data2.ah().isNULL()) {
+ if (*searchKey != 0) {
+ if (! entryData.ah().isNULL()) {
jam();
// current attribute
const DescAttr& descAttr = descEnt.m_descAttr[start];
const unsigned typeId = descAttr.m_typeId;
// full data size
const unsigned size1 = AttributeDescriptor::getSizeInWords(descAttr.m_attrDesc);
- ndbrequire(size1 != 0 && size1 == data2.ah().getDataSize());
+ ndbrequire(size1 != 0 && size1 == entryData.ah().getDataSize());
const unsigned size2 = min(size1, len2);
len2 -= size2;
// compare
- const Uint32* const p1 = *data1;
- const Uint32* const p2 = &data2[AttributeHeaderSize];
+ const Uint32* const p1 = *searchKey;
+ const Uint32* const p2 = &entryData[AttributeHeaderSize];
ret = NdbSqlUtil::cmp(typeId, p1, p2, size1, size2);
if (ret != 0) {
jam();
@@ -62,20 +62,20 @@ Dbtux::cmpSearchKey(const Frag& frag, unsigned& start, TableData data1, ConstDat
}
} else {
jam();
- // not NULL < NULL
- ret = -1;
+ // not NULL > NULL
+ ret = +1;
break;
}
} else {
- if (! data2.ah().isNULL()) {
+ if (! entryData.ah().isNULL()) {
jam();
- // NULL > not NULL
- ret = +1;
+ // NULL < not NULL
+ ret = -1;
break;
}
}
- data1 += 1;
- data2 += AttributeHeaderSize + data2.ah().getDataSize();
+ searchKey += 1;
+ entryData += AttributeHeaderSize + entryData.ah().getDataSize();
start++;
}
// XXX until data format errors are handled
@@ -89,17 +89,17 @@ Dbtux::cmpSearchKey(const Frag& frag, unsigned& start, TableData data1, ConstDat
* Start position is updated as in previous routine.
*/
int
-Dbtux::cmpSearchKey(const Frag& frag, unsigned& start, TableData data1, TableData data2)
+Dbtux::cmpSearchKey(const Frag& frag, unsigned& start, TableData searchKey, TableData entryKey)
{
const unsigned numAttrs = frag.m_numAttrs;
const DescEnt& descEnt = getDescEnt(frag.m_descPage, frag.m_descOff);
// skip to right position
- data1 += start;
- data2 += start;
+ searchKey += start;
+ entryKey += start;
int ret = 0;
while (start < numAttrs) {
- if (*data1 != 0) {
- if (*data2 != 0) {
+ if (*searchKey != 0) {
+ if (*entryKey != 0) {
jam();
// current attribute
const DescAttr& descAttr = descEnt.m_descAttr[start];
@@ -107,8 +107,8 @@ Dbtux::cmpSearchKey(const Frag& frag, unsigned& start, TableData data1, TableDat
// full data size
const unsigned size1 = AttributeDescriptor::getSizeInWords(descAttr.m_attrDesc);
// compare
- const Uint32* const p1 = *data1;
- const Uint32* const p2 = *data2;
+ const Uint32* const p1 = *searchKey;
+ const Uint32* const p2 = *entryKey;
ret = NdbSqlUtil::cmp(typeId, p1, p2, size1, size1);
if (ret != 0) {
jam();
@@ -116,20 +116,20 @@ Dbtux::cmpSearchKey(const Frag& frag, unsigned& start, TableData data1, TableDat
}
} else {
jam();
- // not NULL < NULL
- ret = -1;
+ // not NULL > NULL
+ ret = +1;
break;
}
} else {
- if (*data2 != 0) {
+ if (*entryKey != 0) {
jam();
- // NULL > not NULL
- ret = +1;
+ // NULL < not NULL
+ ret = -1;
break;
}
}
- data1 += 1;
- data2 += 1;
+ searchKey += 1;
+ entryKey += 1;
start++;
}
// XXX until data format errors are handled
@@ -137,94 +137,96 @@ Dbtux::cmpSearchKey(const Frag& frag, unsigned& start, TableData data1, TableDat
return ret;
}
-
/*
- * Scan bound vs tree entry.
+ * Scan bound vs node prefix.
*
* Compare lower or upper bound and index attribute data. The attribute
* data may be partial in which case CmpUnknown may be returned.
- * Returns -1 if the boundary is to the left of the compared key and +1 if
- * the boundary is to the right of the compared key.
+ * Returns -1 if the boundary is to the left of the compared key and +1
+ * if the boundary is to the right of the compared key.
*
- * To get this behaviour we treat equality a little bit special.
- * If the boundary is a lower bound then the boundary is to the left of all
- * equal keys and if it is an upper bound then the boundary is to the right
- * of all equal keys.
+ * To get this behaviour we treat equality a little bit special. If the
+ * boundary is a lower bound then the boundary is to the left of all
+ * equal keys and if it is an upper bound then the boundary is to the
+ * right of all equal keys.
*
* When searching for the first key we are using the lower bound to try
- * to find the first key that is to the right of the boundary.
- * Then we start scanning from this tuple (including the tuple itself)
- * until we find the first key which is to the right of the boundary. Then
- * we stop and do not include that key in the scan result.
+ * to find the first key that is to the right of the boundary. Then we
+ * start scanning from this tuple (including the tuple itself) until we
+ * find the first key which is to the right of the boundary. Then we
+ * stop and do not include that key in the scan result.
*/
int
-Dbtux::cmpScanBound(const Frag& frag, const BoundPar boundPar)
+Dbtux::cmpScanBound(const Frag& frag, unsigned dir, ConstData boundInfo, unsigned boundCount, ConstData entryData, unsigned maxlen)
{
- unsigned type = 4;
- int ret = 0;
- /*
- No boundary means full scan, low boundary is to the right of all keys.
- Thus we should always return -1. For upper bound we are to the right of
- all keys, thus we should always return +1. We achieve this behaviour
- by initialising return value to 0 and set type to 4.
- */
const DescEnt& descEnt = getDescEnt(frag.m_descPage, frag.m_descOff);
- ConstData data1 = boundPar.m_data1;
- ConstData data2 = boundPar.m_data2;
// direction 0-lower 1-upper
- const unsigned dir = boundPar.m_dir;
ndbrequire(dir <= 1);
// number of words of data left
- unsigned len2 = boundPar.m_len2;
- for (unsigned i = 0; i < boundPar.m_count1; i++) {
+ unsigned len2 = maxlen;
+ /*
+ * No boundary means full scan, low boundary is to the right of all
+ * keys. Thus we should always return -1. For upper bound we are to
+ * the right of all keys, thus we should always return +1. We achieve
+ * this behaviour by initializing type to 4.
+ */
+ unsigned type = 4;
+ while (boundCount != 0) {
if (len2 < AttributeHeaderSize) {
jam();
return NdbSqlUtil::CmpUnknown;
}
len2 -= AttributeHeaderSize;
// get and skip bound type
- type = data1[0];
- data1 += 1;
- ndbrequire(! data1.ah().isNULL());
- if (! data2.ah().isNULL()) {
- jam();
- // current attribute
- const unsigned index = data1.ah().getAttributeId();
- const DescAttr& descAttr = descEnt.m_descAttr[index];
- const unsigned typeId = descAttr.m_typeId;
- ndbrequire(data2.ah().getAttributeId() == descAttr.m_primaryAttrId);
- // full data size
- const unsigned size1 = data1.ah().getDataSize();
- ndbrequire(size1 != 0 && size1 == data2.ah().getDataSize());
- const unsigned size2 = min(size1, len2);
- len2 -= size2;
- // compare
- const Uint32* const p1 = &data1[AttributeHeaderSize];
- const Uint32* const p2 = &data2[AttributeHeaderSize];
- ret = NdbSqlUtil::cmp(typeId, p1, p2, size1, size2);
- if (ret != 0) {
+ type = boundInfo[0];
+ boundInfo += 1;
+ if (! boundInfo.ah().isNULL()) {
+ if (! entryData.ah().isNULL()) {
jam();
- return ret;
+ // current attribute
+ const unsigned index = boundInfo.ah().getAttributeId();
+ const DescAttr& descAttr = descEnt.m_descAttr[index];
+ const unsigned typeId = descAttr.m_typeId;
+ ndbrequire(entryData.ah().getAttributeId() == descAttr.m_primaryAttrId);
+ // full data size
+ const unsigned size1 = boundInfo.ah().getDataSize();
+ ndbrequire(size1 != 0 && size1 == entryData.ah().getDataSize());
+ const unsigned size2 = min(size1, len2);
+ len2 -= size2;
+ // compare
+ const Uint32* const p1 = &boundInfo[AttributeHeaderSize];
+ const Uint32* const p2 = &entryData[AttributeHeaderSize];
+ int ret = NdbSqlUtil::cmp(typeId, p1, p2, size1, size2);
+ // XXX until data format errors are handled
+ ndbrequire(ret != NdbSqlUtil::CmpError);
+ if (ret != 0) {
+ jam();
+ return ret;
+ }
+ } else {
+ jam();
+ // not NULL > NULL
+ return +1;
}
} else {
jam();
- /*
- NULL is bigger than any bound, thus the boundary is always to the
- left of NULL
- */
- return -1;
+ if (! entryData.ah().isNULL()) {
+ jam();
+ // NULL < not NULL
+ return -1;
+ }
}
- data1 += AttributeHeaderSize + data1.ah().getDataSize();
- data2 += AttributeHeaderSize + data2.ah().getDataSize();
+ boundInfo += AttributeHeaderSize + boundInfo.ah().getDataSize();
+ entryData += AttributeHeaderSize + entryData.ah().getDataSize();
+ boundCount -= 1;
}
- ndbassert(ret == 0);
if (dir == 0) {
jam();
/*
- Looking for the lower bound. If strict lower bound then the boundary is
- to the right of the compared key and otherwise (equal included in range)
- then the boundary is to the left of the key.
- */
+ * Looking for the lower bound. If strict lower bound then the
+ * boundary is to the right of the compared key and otherwise (equal
+ * included in range) then the boundary is to the left of the key.
+ */
if (type == 1) {
jam();
return +1;
@@ -233,10 +235,11 @@ Dbtux::cmpScanBound(const Frag& frag, const BoundPar boundPar)
} else {
jam();
/*
- Looking for the upper bound. If strict upper bound then the boundary is
- to the left of all equal keys and otherwise (equal included in the
- range) then the boundary is to the right of all equal keys.
- */
+ * Looking for the upper bound. If strict upper bound then the
+ * boundary is to the left of all equal keys and otherwise (equal
+ * included in the range) then the boundary is to the right of all
+ * equal keys.
+ */
if (type == 3) {
jam();
return -1;
@@ -245,3 +248,72 @@ Dbtux::cmpScanBound(const Frag& frag, const BoundPar boundPar)
}
}
+/*
+ * Scan bound vs tree entry.
+ */
+int
+Dbtux::cmpScanBound(const Frag& frag, unsigned dir, ConstData boundInfo, unsigned boundCount, TableData entryKey)
+{
+ const DescEnt& descEnt = getDescEnt(frag.m_descPage, frag.m_descOff);
+ // direction 0-lower 1-upper
+ ndbrequire(dir <= 1);
+ // initialize type to equality
+ unsigned type = 4;
+ while (boundCount != 0) {
+ // get and skip bound type
+ type = boundInfo[0];
+ boundInfo += 1;
+ if (! boundInfo.ah().isNULL()) {
+ if (*entryKey != 0) {
+ jam();
+ // current attribute
+ const unsigned index = boundInfo.ah().getAttributeId();
+ const DescAttr& descAttr = descEnt.m_descAttr[index];
+ const unsigned typeId = descAttr.m_typeId;
+ // full data size
+ const unsigned size1 = AttributeDescriptor::getSizeInWords(descAttr.m_attrDesc);
+ // compare
+ const Uint32* const p1 = &boundInfo[AttributeHeaderSize];
+ const Uint32* const p2 = *entryKey;
+ int ret = NdbSqlUtil::cmp(typeId, p1, p2, size1, size1);
+ // XXX until data format errors are handled
+ ndbrequire(ret != NdbSqlUtil::CmpError);
+ if (ret != 0) {
+ jam();
+ return ret;
+ }
+ } else {
+ jam();
+ // not NULL > NULL
+ return +1;
+ }
+ } else {
+ jam();
+ if (*entryKey != 0) {
+ jam();
+ // NULL < not NULL
+ return -1;
+ }
+ }
+ boundInfo += AttributeHeaderSize + boundInfo.ah().getDataSize();
+ entryKey += 1;
+ boundCount -= 1;
+ }
+ if (dir == 0) {
+ // lower bound
+ jam();
+ if (type == 1) {
+ jam();
+ return +1;
+ }
+ return -1;
+ } else {
+ // upper bound
+ jam();
+ if (type == 3) {
+ jam();
+ return -1;
+ }
+ return +1;
+ }
+}
diff --git a/ndb/src/kernel/blocks/dbtux/DbtuxDebug.cpp b/ndb/src/kernel/blocks/dbtux/DbtuxDebug.cpp
index c4931685305..11f4f12b7f6 100644
--- a/ndb/src/kernel/blocks/dbtux/DbtuxDebug.cpp
+++ b/ndb/src/kernel/blocks/dbtux/DbtuxDebug.cpp
@@ -137,16 +137,17 @@ Dbtux::printNode(Signal* signal, Frag& frag, NdbOut& out, TupLoc loc, PrintPar&
par.m_ok = false;
}
}
+ static const char* const sep = " *** ";
// check child-parent links
if (node.getLink(2) != par.m_parent) {
par.m_ok = false;
- out << par.m_path << " *** ";
+ out << par.m_path << sep;
out << "parent loc " << hex << node.getLink(2);
out << " should be " << hex << par.m_parent << endl;
}
if (node.getSide() != par.m_side) {
par.m_ok = false;
- out << par.m_path << " *** ";
+ out << par.m_path << sep;
out << "side " << dec << node.getSide();
out << " should be " << dec << par.m_side << endl;
}
@@ -154,26 +155,26 @@ Dbtux::printNode(Signal* signal, Frag& frag, NdbOut& out, TupLoc loc, PrintPar&
const int balance = -cpar[0].m_depth + cpar[1].m_depth;
if (node.getBalance() != balance) {
par.m_ok = false;
- out << par.m_path << " *** ";
+ out << par.m_path << sep;
out << "balance " << node.getBalance();
out << " should be " << balance << endl;
}
if (abs(node.getBalance()) > 1) {
par.m_ok = false;
- out << par.m_path << " *** ";
+ out << par.m_path << sep;
out << "balance " << node.getBalance() << " is invalid" << endl;
}
// check occupancy
- if (node.getOccup() > tree.m_maxOccup) {
+ if (node.getOccup() == 0 || node.getOccup() > tree.m_maxOccup) {
par.m_ok = false;
- out << par.m_path << " *** ";
+ out << par.m_path << sep;
out << "occupancy " << node.getOccup();
- out << " greater than max " << tree.m_maxOccup << endl;
+ out << " zero or greater than max " << tree.m_maxOccup << endl;
}
// check for occupancy of interior node
if (node.getChilds() == 2 && node.getOccup() < tree.m_minOccup) {
par.m_ok = false;
- out << par.m_path << " *** ";
+ out << par.m_path << sep;
out << "occupancy " << node.getOccup() << " of interior node";
out << " less than min " << tree.m_minOccup << endl;
}
@@ -183,13 +184,74 @@ Dbtux::printNode(Signal* signal, Frag& frag, NdbOut& out, TupLoc loc, PrintPar&
node.getLink(1 - i) == NullTupLoc &&
node.getOccup() + cpar[i].m_occup <= tree.m_maxOccup) {
par.m_ok = false;
- out << par.m_path << " *** ";
+ out << par.m_path << sep;
out << "missed merge with child " << i << endl;
}
}
+ // check inline prefix
+ { ConstData data1 = node.getPref();
+ Uint32 data2[MaxPrefSize];
+ memset(data2, DataFillByte, MaxPrefSize << 2);
+ readKeyAttrs(frag, node.getMinMax(0), 0, c_searchKey);
+ copyAttrs(frag, c_searchKey, data2, tree.m_prefSize);
+ for (unsigned n = 0; n < tree.m_prefSize; n++) {
+ if (data1[n] != data2[n]) {
+ par.m_ok = false;
+ out << par.m_path << sep;
+ out << "inline prefix mismatch word " << n;
+ out << " value " << hex << data1[n];
+ out << " should be " << hex << data2[n] << endl;
+ break;
+ }
+ }
+ }
+ // check ordering within node
+ for (unsigned j = 1; j < node.getOccup(); j++) {
+ unsigned start = 0;
+ const TreeEnt ent1 = node.getEnt(j - 1);
+ const TreeEnt ent2 = node.getEnt(j);
+ if (j == 1) {
+ readKeyAttrs(frag, ent1, start, c_searchKey);
+ } else {
+ memcpy(c_searchKey, c_entryKey, frag.m_numAttrs << 2);
+ }
+ readKeyAttrs(frag, ent2, start, c_entryKey);
+ int ret = cmpSearchKey(frag, start, c_searchKey, c_entryKey);
+ if (ret == 0)
+ ret = ent1.cmp(ent2);
+ if (ret != -1) {
+ par.m_ok = false;
+ out << par.m_path << sep;
+ out << " disorder within node at pos " << j << endl;
+ }
+ }
+ // check ordering wrt subtrees
+ for (unsigned i = 0; i <= 1; i++) {
+ if (node.getLink(i) == NullTupLoc)
+ continue;
+ const TreeEnt ent1 = cpar[i].m_minmax[1 - i];
+ const TreeEnt ent2 = node.getMinMax(i);
+ unsigned start = 0;
+ readKeyAttrs(frag, ent1, start, c_searchKey);
+ readKeyAttrs(frag, ent2, start, c_entryKey);
+ int ret = cmpSearchKey(frag, start, c_searchKey, c_entryKey);
+ if (ret == 0)
+ ret = ent1.cmp(ent2);
+ if (ret != (i == 0 ? -1 : +1)) {
+ par.m_ok = false;
+ out << par.m_path << sep;
+ out << " disorder wrt subtree " << i << endl;
+ }
+ }
// return values
par.m_depth = 1 + max(cpar[0].m_depth, cpar[1].m_depth);
par.m_occup = node.getOccup();
+ for (unsigned i = 0; i <= 1; i++) {
+ if (node.getLink(i) == NullTupLoc)
+ par.m_minmax[i] = node.getMinMax(i);
+ else
+ par.m_minmax[i] = cpar[i].m_minmax[i];
+ }
}
NdbOut&
@@ -355,20 +417,19 @@ operator<<(NdbOut& out, const Dbtux::NodeHandle& node)
out << " [acc " << dec << node.m_acc << "]";
out << " [node " << *node.m_node << "]";
if (node.m_acc >= Dbtux::AccPref) {
- for (unsigned i = 0; i <= 1; i++) {
- out << " [pref " << dec << i;
- const Uint32* data = (const Uint32*)node.m_node + Dbtux::NodeHeadSize + i * tree.m_prefSize;
- for (unsigned j = 0; j < node.m_frag.m_tree.m_prefSize; j++)
- out << " " << hex << data[j];
- out << "]";
- }
+ const Uint32* data;
+ out << " [pref";
+ data = (const Uint32*)node.m_node + Dbtux::NodeHeadSize;
+ for (unsigned j = 0; j < tree.m_prefSize; j++)
+ out << " " << hex << data[j];
+ out << "]";
out << " [entList";
unsigned numpos = node.m_node->m_occup;
if (node.m_acc < Dbtux::AccFull && numpos > 2) {
numpos = 2;
out << "(" << dec << numpos << ")";
}
- const Uint32* data = (const Uint32*)node.m_node + Dbtux::NodeHeadSize + 2 * tree.m_prefSize;
+ data = (const Uint32*)node.m_node + Dbtux::NodeHeadSize + tree.m_prefSize;
const Dbtux::TreeEnt* entList = (const Dbtux::TreeEnt*)data;
for (unsigned pos = 0; pos < numpos; pos++)
out << " " << entList[pos];
diff --git a/ndb/src/kernel/blocks/dbtux/DbtuxGen.cpp b/ndb/src/kernel/blocks/dbtux/DbtuxGen.cpp
index 93a5c78338c..22b2ce69838 100644
--- a/ndb/src/kernel/blocks/dbtux/DbtuxGen.cpp
+++ b/ndb/src/kernel/blocks/dbtux/DbtuxGen.cpp
@@ -26,8 +26,13 @@ Dbtux::Dbtux(const Configuration& conf) :
#ifdef VM_TRACE
debugFile(0),
debugOut(*new NullOutputStream()),
+ // until ndb_mgm supports dump
+#ifdef DBTUX_DEBUG_TREE
+ debugFlags(DebugTree),
+#else
debugFlags(0),
#endif
+#endif
c_internalStartPhase(0),
c_typeOfStart(NodeState::ST_ILLEGAL_TYPE),
c_dataBuffer(0)
@@ -241,37 +246,14 @@ Dbtux::readKeyAttrs(const Frag& frag, TreeEnt ent, unsigned start, TableData key
}
void
-Dbtux::copyAttrs(Data dst, ConstData src, CopyPar& copyPar)
+Dbtux::readTablePk(const Frag& frag, TreeEnt ent, unsigned& pkSize, Data pkData)
{
- CopyPar c = copyPar;
- c.m_numitems = 0;
- c.m_numwords = 0;
- while (c.m_numitems < c.m_items) {
- jam();
- if (c.m_headers) {
- unsigned i = 0;
- while (i < AttributeHeaderSize) {
- if (c.m_numwords >= c.m_maxwords) {
- copyPar = c;
- return;
- }
- dst[c.m_numwords++] = src[i++];
- }
- }
- unsigned size = src.ah().getDataSize();
- src += AttributeHeaderSize;
- unsigned i = 0;
- while (i < size) {
- if (c.m_numwords >= c.m_maxwords) {
- copyPar = c;
- return;
- }
- dst[c.m_numwords++] = src[i++];
- }
- src += size;
- c.m_numitems++;
- }
- copyPar = c;
+ const Uint32 tableFragPtrI = frag.m_tupTableFragPtrI[ent.m_fragBit];
+ const TupLoc tupLoc = ent.m_tupLoc;
+ Uint32 size = 0;
+ c_tup->tuxReadKeys(tableFragPtrI, tupLoc.m_pageId, tupLoc.m_pageOffset, &size, pkData);
+ ndbrequire(size != 0);
+ pkSize = size;
}
/*
@@ -314,6 +296,9 @@ Dbtux::copyAttrs(const Frag& frag, TableData data1, Data data2, unsigned maxlen2
keyAttrs += 1;
data1 += 1;
}
+#ifdef VM_TRACE
+ memset(data2, DataFillByte, len2 << 2);
+#endif
}
BLOCK_FUNCTIONS(Dbtux);
diff --git a/ndb/src/kernel/blocks/dbtux/DbtuxMaint.cpp b/ndb/src/kernel/blocks/dbtux/DbtuxMaint.cpp
index fc72611a273..24b030bf8ec 100644
--- a/ndb/src/kernel/blocks/dbtux/DbtuxMaint.cpp
+++ b/ndb/src/kernel/blocks/dbtux/DbtuxMaint.cpp
@@ -82,8 +82,8 @@ Dbtux::execTUX_MAINT_REQ(Signal* signal)
ent.m_fragBit = fragBit;
// read search key
readKeyAttrs(frag, ent, 0, c_searchKey);
- // check if all keys are null
- {
+ if (! frag.m_storeNullKey) {
+ // check if all keys are null
const unsigned numAttrs = frag.m_numAttrs;
bool allNull = true;
for (unsigned i = 0; i < numAttrs; i++) {
@@ -111,19 +111,18 @@ Dbtux::execTUX_MAINT_REQ(Signal* signal)
debugOut << endl;
}
#endif
- // find position in tree
- TreePos treePos;
- treeSearch(signal, frag, c_searchKey, ent, treePos);
-#ifdef VM_TRACE
- if (debugFlags & DebugMaint) {
- debugOut << treePos << endl;
- }
-#endif
// do the operation
req->errorCode = 0;
+ TreePos treePos;
switch (opCode) {
case TuxMaintReq::OpAdd:
jam();
+ searchToAdd(signal, frag, c_searchKey, ent, treePos);
+#ifdef VM_TRACE
+ if (debugFlags & DebugMaint) {
+ debugOut << treePos << endl;
+ }
+#endif
if (treePos.m_match) {
jam();
// there is no "Building" state so this will have to do
@@ -152,6 +151,12 @@ Dbtux::execTUX_MAINT_REQ(Signal* signal)
break;
case TuxMaintReq::OpRemove:
jam();
+ searchToRemove(signal, frag, c_searchKey, ent, treePos);
+#ifdef VM_TRACE
+ if (debugFlags & DebugMaint) {
+ debugOut << treePos << endl;
+ }
+#endif
if (! treePos.m_match) {
jam();
// there is no "Building" state so this will have to do
@@ -167,7 +172,6 @@ Dbtux::execTUX_MAINT_REQ(Signal* signal)
ndbrequire(false);
break;
}
- // commit and release nodes
#ifdef VM_TRACE
if (debugFlags & DebugTree) {
printTree(signal, frag, debugOut);
@@ -176,89 +180,3 @@ Dbtux::execTUX_MAINT_REQ(Signal* signal)
// copy back
*sig = *req;
}
-
-/*
- * Read index key attributes from TUP. If buffer is provided the data
- * is copied to it. Otherwise pointer is set to signal data.
- */
-void
-Dbtux::tupReadAttrs(Signal* signal, const Frag& frag, ReadPar& readPar)
-{
- // define the direct signal
- const TreeEnt ent = readPar.m_ent;
- TupReadAttrs* const req = (TupReadAttrs*)signal->getDataPtrSend();
- req->errorCode = RNIL;
- req->requestInfo = 0;
- req->tableId = frag.m_tableId;
- req->fragId = frag.m_fragId | (ent.m_fragBit << frag.m_fragOff);
- req->fragPtrI = frag.m_tupTableFragPtrI[ent.m_fragBit];
- req->tupAddr = (Uint32)-1;
- req->tupVersion = ent.m_tupVersion;
- req->pageId = ent.m_tupLoc.m_pageId;
- req->pageOffset = ent.m_tupLoc.m_pageOffset;
- req->bufferId = 0;
- // add count and list of attribute ids
- Data data = (Uint32*)req + TupReadAttrs::SignalLength;
- data[0] = readPar.m_count;
- data += 1;
- const DescEnt& descEnt = getDescEnt(frag.m_descPage, frag.m_descOff);
- for (Uint32 i = 0; i < readPar.m_count; i++) {
- jam();
- const DescAttr& descAttr = descEnt.m_descAttr[readPar.m_first + i];
- data.ah() = AttributeHeader(descAttr.m_primaryAttrId, 0);
- data += 1;
- }
- // execute
- EXECUTE_DIRECT(DBTUP, GSN_TUP_READ_ATTRS, signal, TupReadAttrs::SignalLength);
- jamEntry();
- ndbrequire(req->errorCode == 0);
- // data is at output
- if (readPar.m_data == 0) {
- readPar.m_data = data;
- } else {
- jam();
- CopyPar copyPar;
- copyPar.m_items = readPar.m_count;
- copyPar.m_headers = true;
- copyAttrs(readPar.m_data, data, copyPar);
- }
-}
-
-/*
- * Read primary keys. Copy the data without attribute headers into the
- * given buffer. Number of words is returned in ReadPar argument.
- */
-void
-Dbtux::tupReadKeys(Signal* signal, const Frag& frag, ReadPar& readPar)
-{
- // define the direct signal
- const TreeEnt ent = readPar.m_ent;
- TupReadAttrs* const req = (TupReadAttrs*)signal->getDataPtrSend();
- req->errorCode = RNIL;
- req->requestInfo = TupReadAttrs::ReadKeys;
- req->tableId = frag.m_tableId;
- req->fragId = frag.m_fragId | (ent.m_fragBit << frag.m_fragOff);
- req->fragPtrI = frag.m_tupTableFragPtrI[ent.m_fragBit];
- req->tupAddr = (Uint32)-1;
- req->tupVersion = RNIL; // not used
- req->pageId = ent.m_tupLoc.m_pageId;
- req->pageOffset = ent.m_tupLoc.m_pageOffset;
- req->bufferId = 0;
- // execute
- EXECUTE_DIRECT(DBTUP, GSN_TUP_READ_ATTRS, signal, TupReadAttrs::SignalLength);
- jamEntry();
- ndbrequire(req->errorCode == 0);
- // copy out in special format
- ConstData data = (Uint32*)req + TupReadAttrs::SignalLength;
- const Uint32 numKeys = data[0];
- data += 1 + numKeys;
- // copy out without headers
- ndbrequire(readPar.m_data != 0);
- CopyPar copyPar;
- copyPar.m_items = numKeys;
- copyPar.m_headers = false;
- copyAttrs(readPar.m_data, data, copyPar);
- // return counts
- readPar.m_count = numKeys;
- readPar.m_size = copyPar.m_numwords;
-}
diff --git a/ndb/src/kernel/blocks/dbtux/DbtuxMeta.cpp b/ndb/src/kernel/blocks/dbtux/DbtuxMeta.cpp
index 0612f191830..b30b555ccad 100644
--- a/ndb/src/kernel/blocks/dbtux/DbtuxMeta.cpp
+++ b/ndb/src/kernel/blocks/dbtux/DbtuxMeta.cpp
@@ -85,6 +85,7 @@ Dbtux::execTUXFRAGREQ(Signal* signal)
fragPtr.p->m_fragOff = req->fragOff;
fragPtr.p->m_fragId = req->fragId;
fragPtr.p->m_numAttrs = req->noOfAttr;
+ fragPtr.p->m_storeNullKey = true; // not yet configurable
fragPtr.p->m_tupIndexFragPtrI = req->tupIndexFragPtrI;
fragPtr.p->m_tupTableFragPtrI[0] = req->tupTableFragPtrI[0];
fragPtr.p->m_tupTableFragPtrI[1] = req->tupTableFragPtrI[1];
@@ -111,6 +112,7 @@ Dbtux::execTUXFRAGREQ(Signal* signal)
indexPtr.p->m_tableId = req->primaryTableId;
indexPtr.p->m_fragOff = req->fragOff;
indexPtr.p->m_numAttrs = req->noOfAttr;
+ indexPtr.p->m_storeNullKey = true; // not yet configurable
// allocate attribute descriptors
if (! allocDescEnt(indexPtr)) {
jam();
@@ -405,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/DbtuxNode.cpp b/ndb/src/kernel/blocks/dbtux/DbtuxNode.cpp
index c969e35dc82..a1bfa2179bb 100644
--- a/ndb/src/kernel/blocks/dbtux/DbtuxNode.cpp
+++ b/ndb/src/kernel/blocks/dbtux/DbtuxNode.cpp
@@ -85,10 +85,9 @@ Dbtux::insertNode(Signal* signal, NodeHandle& node, AccSize acc)
new (node.m_node) TreeNode();
#ifdef VM_TRACE
TreeHead& tree = frag.m_tree;
- memset(node.getPref(0), 0xa2, tree.m_prefSize << 2);
- memset(node.getPref(1), 0xa2, tree.m_prefSize << 2);
+ memset(node.getPref(), DataFillByte, tree.m_prefSize << 2);
TreeEnt* entList = tree.getEntList(node.m_node);
- memset(entList, 0xa4, (tree.m_maxOccup + 1) * (TreeEntSize << 2));
+ memset(entList, NodeFillByte, (tree.m_maxOccup + 1) * (TreeEntSize << 2));
#endif
}
@@ -116,12 +115,12 @@ Dbtux::deleteNode(Signal* signal, NodeHandle& node)
* attribute headers for now. XXX use null mask instead
*/
void
-Dbtux::setNodePref(Signal* signal, NodeHandle& node, unsigned i)
+Dbtux::setNodePref(Signal* signal, NodeHandle& node)
{
const Frag& frag = node.m_frag;
const TreeHead& tree = frag.m_tree;
- readKeyAttrs(frag, node.getMinMax(i), 0, c_entryKey);
- copyAttrs(frag, c_entryKey, node.getPref(i), tree.m_prefSize);
+ readKeyAttrs(frag, node.getMinMax(0), 0, c_entryKey);
+ copyAttrs(frag, c_entryKey, node.getPref(), tree.m_prefSize);
}
// node operations
@@ -173,11 +172,9 @@ Dbtux::nodePushUp(Signal* signal, NodeHandle& node, unsigned pos, const TreeEnt&
tmpList[pos] = ent;
entList[0] = entList[occup + 1];
node.setOccup(occup + 1);
- // fix prefixes
+ // fix prefix
if (occup == 0 || pos == 0)
- setNodePref(signal, node, 0);
- if (occup == 0 || pos == occup)
- setNodePref(signal, node, 1);
+ setNodePref(signal, node);
}
/*
@@ -248,11 +245,9 @@ Dbtux::nodePopDown(Signal* signal, NodeHandle& node, unsigned pos, TreeEnt& ent)
}
entList[0] = entList[occup - 1];
node.setOccup(occup - 1);
- // fix prefixes
+ // fix prefix
if (occup != 1 && pos == 0)
- setNodePref(signal, node, 0);
- if (occup != 1 && pos == occup - 1)
- setNodePref(signal, node, 1);
+ setNodePref(signal, node);
}
/*
@@ -325,11 +320,9 @@ Dbtux::nodePushDown(Signal* signal, NodeHandle& node, unsigned pos, TreeEnt& ent
tmpList[pos] = ent;
ent = oldMin;
entList[0] = entList[occup];
- // fix prefixes
+ // fix prefix
if (true)
- setNodePref(signal, node, 0);
- if (occup == 1 || pos == occup - 1)
- setNodePref(signal, node, 1);
+ setNodePref(signal, node);
}
/*
@@ -403,11 +396,9 @@ Dbtux::nodePopUp(Signal* signal, NodeHandle& node, unsigned pos, TreeEnt& ent)
}
tmpList[0] = newMin;
entList[0] = entList[occup];
- // fix prefixes
+ // fix prefix
if (true)
- setNodePref(signal, node, 0);
- if (occup == 1 || pos == occup - 1)
- setNodePref(signal, node, 1);
+ setNodePref(signal, node);
}
/*
diff --git a/ndb/src/kernel/blocks/dbtux/DbtuxScan.cpp b/ndb/src/kernel/blocks/dbtux/DbtuxScan.cpp
index 703b0abb683..c4c33ff931f 100644
--- a/ndb/src/kernel/blocks/dbtux/DbtuxScan.cpp
+++ b/ndb/src/kernel/blocks/dbtux/DbtuxScan.cpp
@@ -137,7 +137,7 @@ Dbtux::execTUX_BOUND_INFO(Signal* signal)
const Uint32* const data = (Uint32*)sig + TuxBoundInfo::SignalLength;
unsigned offset = 5;
// walk through entries
- while (offset + 2 < req->boundAiLength) {
+ while (offset + 2 <= req->boundAiLength) {
jam();
const unsigned type = data[offset];
if (type > 4) {
@@ -379,8 +379,8 @@ Dbtux::execACC_CHECK_SCAN(Signal* signal)
scanNext(signal, scanPtr);
}
// for reading tuple key in Current or Locked state
- ReadPar keyPar;
- keyPar.m_data = 0; // indicates not yet done
+ Data pkData = c_dataBuffer;
+ unsigned pkSize = 0; // indicates not yet done
if (scan.m_state == ScanOp::Current) {
// found an entry to return
jam();
@@ -389,9 +389,7 @@ Dbtux::execACC_CHECK_SCAN(Signal* signal)
jam();
const TreeEnt ent = scan.m_scanPos.m_ent;
// read tuple key
- keyPar.m_ent = ent;
- keyPar.m_data = c_dataBuffer;
- tupReadKeys(signal, frag, keyPar);
+ readTablePk(frag, ent, pkSize, pkData);
// get read lock or exclusive lock
AccLockReq* const lockReq = (AccLockReq*)signal->getDataPtrSend();
lockReq->returnCode = RNIL;
@@ -403,9 +401,9 @@ Dbtux::execACC_CHECK_SCAN(Signal* signal)
lockReq->tableId = scan.m_tableId;
lockReq->fragId = frag.m_fragId | (ent.m_fragBit << frag.m_fragOff);
lockReq->fragPtrI = frag.m_accTableFragPtrI[ent.m_fragBit];
- const Uint32* const buf32 = static_cast<Uint32*>(keyPar.m_data);
+ const Uint32* const buf32 = static_cast<Uint32*>(pkData);
const Uint64* const buf64 = reinterpret_cast<const Uint64*>(buf32);
- lockReq->hashValue = md5_hash(buf64, keyPar.m_size);
+ lockReq->hashValue = md5_hash(buf64, pkSize);
lockReq->tupAddr = getTupAddr(frag, ent);
lockReq->transId1 = scan.m_transId1;
lockReq->transId2 = scan.m_transId2;
@@ -480,11 +478,9 @@ Dbtux::execACC_CHECK_SCAN(Signal* signal)
const TreeEnt ent = scan.m_scanPos.m_ent;
if (scan.m_keyInfo) {
jam();
- if (keyPar.m_data == 0) {
+ if (pkSize == 0) {
jam();
- keyPar.m_ent = ent;
- keyPar.m_data = c_dataBuffer;
- tupReadKeys(signal, frag, keyPar);
+ readTablePk(frag, ent, pkSize, pkData);
}
}
// conf signal
@@ -510,10 +506,10 @@ Dbtux::execACC_CHECK_SCAN(Signal* signal)
// add key info
if (scan.m_keyInfo) {
jam();
- conf->keyLength = keyPar.m_size;
+ conf->keyLength = pkSize;
// piggy-back first 4 words of key data
for (unsigned i = 0; i < 4; i++) {
- conf->key[i] = i < keyPar.m_size ? keyPar.m_data[i] : 0;
+ conf->key[i] = i < pkSize ? pkData[i] : 0;
}
signalLength = 11;
}
@@ -525,18 +521,18 @@ Dbtux::execACC_CHECK_SCAN(Signal* signal)
EXECUTE_DIRECT(blockNo, GSN_NEXT_SCANCONF, signal, signalLength);
}
// send rest of key data
- if (scan.m_keyInfo && keyPar.m_size > 4) {
+ if (scan.m_keyInfo && pkSize > 4) {
unsigned total = 4;
- while (total < keyPar.m_size) {
+ while (total < pkSize) {
jam();
- unsigned length = keyPar.m_size - total;
+ unsigned length = pkSize - total;
if (length > 20)
length = 20;
signal->theData[0] = scan.m_userPtr;
signal->theData[1] = 0;
signal->theData[2] = 0;
signal->theData[3] = length;
- memcpy(&signal->theData[4], &keyPar.m_data[total], length << 2);
+ memcpy(&signal->theData[4], &pkData[total], length << 2);
sendSignal(scan.m_userRef, GSN_ACC_SCAN_INFO24,
signal, 4 + length, JBB);
total += length;
@@ -606,6 +602,8 @@ Dbtux::execACCKEYCONF(Signal* signal)
// LQH has the ball
return;
}
+ // lose the lock
+ scan.m_accLockOp = RNIL;
// continue at ACC_ABORTCONF
}
@@ -648,6 +646,8 @@ Dbtux::execACCKEYREF(Signal* signal)
// LQH has the ball
return;
}
+ // lose the lock
+ scan.m_accLockOp = RNIL;
// continue at ACC_ABORTCONF
}
@@ -689,16 +689,9 @@ Dbtux::scanFirst(Signal* signal, ScanOpPtr scanPtr)
ScanOp& scan = *scanPtr.p;
Frag& frag = *c_fragPool.getPtr(scan.m_fragPtrI);
TreeHead& tree = frag.m_tree;
- if (tree.m_root == NullTupLoc) {
- // tree may have become empty
- jam();
- scan.m_state = ScanOp::Last;
- return;
- }
- TreePos pos;
- pos.m_loc = tree.m_root;
- NodeHandle node(frag);
- // unpack lower bound
+ // set up index keys for this operation
+ setKeyAttrs(frag);
+ // unpack lower bound into c_dataBuffer
const ScanBound& bound = *scan.m_bound[0];
ScanBoundIterator iter;
bound.first(iter);
@@ -707,103 +700,22 @@ Dbtux::scanFirst(Signal* signal, ScanOpPtr scanPtr)
c_dataBuffer[j] = *iter.data;
bound.next(iter);
}
- // comparison parameters
- BoundPar boundPar;
- boundPar.m_data1 = c_dataBuffer;
- boundPar.m_count1 = scan.m_boundCnt[0];
- boundPar.m_dir = 0;
-loop: {
+ // search for scan start position
+ TreePos treePos;
+ searchToScan(signal, frag, c_dataBuffer, scan.m_boundCnt[0], treePos);
+ if (treePos.m_loc == NullTupLoc) {
+ // empty tree
jam();
- selectNode(signal, node, pos.m_loc, AccPref);
- const unsigned occup = node.getOccup();
- ndbrequire(occup != 0);
- for (unsigned i = 0; i <= 1; i++) {
- jam();
- // compare prefix
- boundPar.m_data2 = node.getPref(i);
- boundPar.m_len2 = tree.m_prefSize;
- int ret = cmpScanBound(frag, boundPar);
- if (ret == NdbSqlUtil::CmpUnknown) {
- jam();
- // read full value
- ReadPar readPar;
- readPar.m_ent = node.getMinMax(i);
- readPar.m_first = 0;
- readPar.m_count = frag.m_numAttrs;
- readPar.m_data = 0; // leave in signal data
- tupReadAttrs(signal, frag, readPar);
- // compare full value
- boundPar.m_data2 = readPar.m_data;
- boundPar.m_len2 = ZNIL; // big
- ret = cmpScanBound(frag, boundPar);
- ndbrequire(ret != NdbSqlUtil::CmpUnknown);
- }
- if (i == 0 && ret < 0) {
- jam();
- const TupLoc loc = node.getLink(i);
- if (loc != NullTupLoc) {
- jam();
- // continue to left subtree
- pos.m_loc = loc;
- goto loop;
- }
- // start scanning this node
- pos.m_pos = 0;
- pos.m_match = false;
- pos.m_dir = 3;
- scan.m_scanPos = pos;
- scan.m_state = ScanOp::Next;
- linkScan(node, scanPtr);
- return;
- }
- if (i == 1 && ret > 0) {
- jam();
- const TupLoc loc = node.getLink(i);
- if (loc != NullTupLoc) {
- jam();
- // continue to right subtree
- pos.m_loc = loc;
- goto loop;
- }
- // start scanning upwards
- pos.m_dir = 1;
- scan.m_scanPos = pos;
- scan.m_state = ScanOp::Next;
- linkScan(node, scanPtr);
- return;
- }
- }
- // read rest of current node
- accessNode(signal, node, AccFull);
- // look for first entry
- ndbrequire(occup >= 2);
- for (unsigned j = 1; j < occup; j++) {
- jam();
- ReadPar readPar;
- readPar.m_ent = node.getEnt(j);
- readPar.m_first = 0;
- readPar.m_count = frag.m_numAttrs;
- readPar.m_data = 0; // leave in signal data
- tupReadAttrs(signal, frag, readPar);
- // compare
- boundPar.m_data2 = readPar.m_data;
- boundPar.m_len2 = ZNIL; // big
- int ret = cmpScanBound(frag, boundPar);
- ndbrequire(ret != NdbSqlUtil::CmpUnknown);
- if (ret < 0) {
- jam();
- // start scanning this node
- pos.m_pos = j;
- pos.m_match = false;
- pos.m_dir = 3;
- scan.m_scanPos = pos;
- scan.m_state = ScanOp::Next;
- linkScan(node, scanPtr);
- return;
- }
- }
- ndbrequire(false);
+ scan.m_state = ScanOp::Last;
+ return;
}
+ // set position and state
+ scan.m_scanPos = treePos;
+ scan.m_state = ScanOp::Next;
+ // link the scan to node found
+ NodeHandle node(frag);
+ selectNode(signal, node, treePos.m_loc, AccFull);
+ linkScan(node, scanPtr);
}
/*
@@ -830,7 +742,9 @@ Dbtux::scanNext(Signal* signal, ScanOpPtr scanPtr)
if (scan.m_state == ScanOp::Locked) {
jam();
// version of a tuple locked by us cannot disappear (assert only)
+#ifdef dbtux_wl_1942_is_done
ndbassert(false);
+#endif
AccLockReq* const lockReq = (AccLockReq*)signal->getDataPtrSend();
lockReq->returnCode = RNIL;
lockReq->requestInfo = AccLockReq::Unlock;
@@ -841,7 +755,9 @@ Dbtux::scanNext(Signal* signal, ScanOpPtr scanPtr)
scan.m_accLockOp = RNIL;
scan.m_state = ScanOp::Current;
}
- // unpack upper bound
+ // set up index keys for this operation
+ setKeyAttrs(frag);
+ // unpack upper bound into c_dataBuffer
const ScanBound& bound = *scan.m_bound[1];
ScanBoundIterator iter;
bound.first(iter);
@@ -850,11 +766,6 @@ Dbtux::scanNext(Signal* signal, ScanOpPtr scanPtr)
c_dataBuffer[j] = *iter.data;
bound.next(iter);
}
- // comparison parameters
- BoundPar boundPar;
- boundPar.m_data1 = c_dataBuffer;
- boundPar.m_count1 = scan.m_boundCnt[1];
- boundPar.m_dir = 1;
// use copy of position
TreePos pos = scan.m_scanPos;
// get and remember original node
@@ -912,17 +823,9 @@ Dbtux::scanNext(Signal* signal, ScanOpPtr scanPtr)
jam();
pos.m_ent = node.getEnt(pos.m_pos);
pos.m_dir = 3; // unchanged
- // XXX implement prefix optimization
- ReadPar readPar;
- readPar.m_ent = pos.m_ent;
- readPar.m_first = 0;
- readPar.m_count = frag.m_numAttrs;
- readPar.m_data = 0; // leave in signal data
- tupReadAttrs(signal, frag, readPar);
- // compare
- boundPar.m_data2 = readPar.m_data;
- boundPar.m_len2 = ZNIL; // big
- int ret = cmpScanBound(frag, boundPar);
+ // read and compare all attributes
+ readKeyAttrs(frag, pos.m_ent, 0, c_entryKey);
+ int ret = cmpScanBound(frag, 1, c_dataBuffer, scan.m_boundCnt[1], c_entryKey);
ndbrequire(ret != NdbSqlUtil::CmpUnknown);
if (ret < 0) {
jam();
@@ -994,35 +897,25 @@ Dbtux::scanNext(Signal* signal, ScanOpPtr scanPtr)
bool
Dbtux::scanVisible(Signal* signal, ScanOpPtr scanPtr, TreeEnt ent)
{
- TupQueryTh* const req = (TupQueryTh*)signal->getDataPtrSend();
const ScanOp& scan = *scanPtr.p;
const Frag& frag = *c_fragPool.getPtr(scan.m_fragPtrI);
- /* Assign table, fragment, tuple address + version */
- Uint32 tableId = frag.m_tableId;
Uint32 fragBit = ent.m_fragBit;
+ Uint32 tableFragPtrI = frag.m_tupTableFragPtrI[fragBit];
Uint32 fragId = frag.m_fragId | (fragBit << frag.m_fragOff);
Uint32 tupAddr = getTupAddr(frag, ent);
Uint32 tupVersion = ent.m_tupVersion;
- /* Check for same tuple twice in row */
+ // check for same tuple twice in row
if (scan.m_lastEnt.m_tupLoc == ent.m_tupLoc &&
scan.m_lastEnt.m_fragBit == fragBit) {
jam();
return false;
}
- req->tableId = tableId;
- req->fragId = fragId;
- req->tupAddr = tupAddr;
- req->tupVersion = tupVersion;
- /* Assign transaction info, trans id + savepoint id */
Uint32 transId1 = scan.m_transId1;
Uint32 transId2 = scan.m_transId2;
Uint32 savePointId = scan.m_savePointId;
- req->transId1 = transId1;
- req->transId2 = transId2;
- req->savePointId = savePointId;
- EXECUTE_DIRECT(DBTUP, GSN_TUP_QUERY_TH, signal, TupQueryTh::SignalLength);
+ bool ret = c_tup->tuxQueryTh(tableFragPtrI, tupAddr, tupVersion, transId1, transId2, savePointId);
jamEntry();
- return (bool)req->returnCode;
+ return ret;
}
/*
diff --git a/ndb/src/kernel/blocks/dbtux/DbtuxSearch.cpp b/ndb/src/kernel/blocks/dbtux/DbtuxSearch.cpp
new file mode 100644
index 00000000000..84048b308bc
--- /dev/null
+++ b/ndb/src/kernel/blocks/dbtux/DbtuxSearch.cpp
@@ -0,0 +1,333 @@
+/* Copyright (C) 2003 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#define DBTUX_SEARCH_CPP
+#include "Dbtux.hpp"
+
+/*
+ * Search for entry to add.
+ *
+ * Similar to searchToRemove (see below).
+ *
+ * TODO optimize for initial equal attrs in node min/max
+ */
+void
+Dbtux::searchToAdd(Signal* signal, Frag& frag, TableData searchKey, TreeEnt searchEnt, TreePos& treePos)
+{
+ const TreeHead& tree = frag.m_tree;
+ const unsigned numAttrs = frag.m_numAttrs;
+ NodeHandle currNode(frag);
+ currNode.m_loc = tree.m_root;
+ if (currNode.m_loc == NullTupLoc) {
+ // empty tree
+ jam();
+ treePos.m_match = false;
+ return;
+ }
+ NodeHandle glbNode(frag); // potential g.l.b of final node
+ /*
+ * In order to not (yet) change old behaviour, a position between
+ * 2 nodes returns the one at the bottom of the tree.
+ */
+ NodeHandle bottomNode(frag);
+ while (true) {
+ jam();
+ selectNode(signal, currNode, currNode.m_loc, AccPref);
+ int ret;
+ // compare prefix
+ unsigned start = 0;
+ ret = cmpSearchKey(frag, start, searchKey, currNode.getPref(), tree.m_prefSize);
+ if (ret == NdbSqlUtil::CmpUnknown) {
+ jam();
+ // read and compare remaining attributes
+ ndbrequire(start < numAttrs);
+ readKeyAttrs(frag, currNode.getMinMax(0), start, c_entryKey);
+ ret = cmpSearchKey(frag, start, searchKey, c_entryKey);
+ ndbrequire(ret != NdbSqlUtil::CmpUnknown);
+ }
+ if (ret == 0) {
+ jam();
+ // keys are equal, compare entry values
+ ret = searchEnt.cmp(currNode.getMinMax(0));
+ }
+ if (ret < 0) {
+ jam();
+ const TupLoc loc = currNode.getLink(0);
+ if (loc != NullTupLoc) {
+ jam();
+ // continue to left subtree
+ currNode.m_loc = loc;
+ continue;
+ }
+ if (! glbNode.isNull()) {
+ jam();
+ // move up to the g.l.b but remember the bottom node
+ bottomNode = currNode;
+ currNode = glbNode;
+ }
+ } else if (ret > 0) {
+ jam();
+ const TupLoc loc = currNode.getLink(1);
+ if (loc != NullTupLoc) {
+ jam();
+ // save potential g.l.b
+ glbNode = currNode;
+ // continue to right subtree
+ currNode.m_loc = loc;
+ continue;
+ }
+ } else {
+ jam();
+ treePos.m_loc = currNode.m_loc;
+ treePos.m_pos = 0;
+ treePos.m_match = true;
+ return;
+ }
+ break;
+ }
+ // access rest of current node
+ accessNode(signal, currNode, AccFull);
+ for (unsigned j = 0, occup = currNode.getOccup(); j < occup; j++) {
+ jam();
+ int ret;
+ // read and compare attributes
+ unsigned start = 0;
+ readKeyAttrs(frag, currNode.getEnt(j), start, c_entryKey);
+ ret = cmpSearchKey(frag, start, searchKey, c_entryKey);
+ ndbrequire(ret != NdbSqlUtil::CmpUnknown);
+ if (ret == 0) {
+ jam();
+ // keys are equal, compare entry values
+ ret = searchEnt.cmp(currNode.getEnt(j));
+ }
+ if (ret <= 0) {
+ jam();
+ treePos.m_loc = currNode.m_loc;
+ treePos.m_pos = j;
+ treePos.m_match = (ret == 0);
+ return;
+ }
+ }
+ if (! bottomNode.isNull()) {
+ jam();
+ // backwards compatible for now
+ treePos.m_loc = bottomNode.m_loc;
+ treePos.m_pos = 0;
+ treePos.m_match = false;
+ return;
+ }
+ treePos.m_loc = currNode.m_loc;
+ treePos.m_pos = currNode.getOccup();
+ treePos.m_match = false;
+}
+
+/*
+ * Search for entry to remove.
+ *
+ * Compares search key to each node min. A move to right subtree can
+ * overshoot target node. The last such node is saved. The final node
+ * is a half-leaf or leaf. If search key is less than final node min
+ * then the saved node is the g.l.b of the final node and we move back
+ * to it.
+ */
+void
+Dbtux::searchToRemove(Signal* signal, Frag& frag, TableData searchKey, TreeEnt searchEnt, TreePos& treePos)
+{
+ const TreeHead& tree = frag.m_tree;
+ const unsigned numAttrs = frag.m_numAttrs;
+ NodeHandle currNode(frag);
+ currNode.m_loc = tree.m_root;
+ if (currNode.m_loc == NullTupLoc) {
+ // empty tree
+ jam();
+ treePos.m_match = false;
+ return;
+ }
+ NodeHandle glbNode(frag); // potential g.l.b of final node
+ while (true) {
+ jam();
+ selectNode(signal, currNode, currNode.m_loc, AccPref);
+ int ret;
+ // compare prefix
+ unsigned start = 0;
+ ret = cmpSearchKey(frag, start, searchKey, currNode.getPref(), tree.m_prefSize);
+ if (ret == NdbSqlUtil::CmpUnknown) {
+ jam();
+ // read and compare remaining attributes
+ ndbrequire(start < numAttrs);
+ readKeyAttrs(frag, currNode.getMinMax(0), start, c_entryKey);
+ ret = cmpSearchKey(frag, start, searchKey, c_entryKey);
+ ndbrequire(ret != NdbSqlUtil::CmpUnknown);
+ }
+ if (ret == 0) {
+ jam();
+ // keys are equal, compare entry values
+ ret = searchEnt.cmp(currNode.getMinMax(0));
+ }
+ if (ret < 0) {
+ jam();
+ const TupLoc loc = currNode.getLink(0);
+ if (loc != NullTupLoc) {
+ jam();
+ // continue to left subtree
+ currNode.m_loc = loc;
+ continue;
+ }
+ if (! glbNode.isNull()) {
+ jam();
+ // move up to the g.l.b
+ currNode = glbNode;
+ }
+ } else if (ret > 0) {
+ jam();
+ const TupLoc loc = currNode.getLink(1);
+ if (loc != NullTupLoc) {
+ jam();
+ // save potential g.l.b
+ glbNode = currNode;
+ // continue to right subtree
+ currNode.m_loc = loc;
+ continue;
+ }
+ } else {
+ jam();
+ treePos.m_loc = currNode.m_loc;
+ treePos.m_pos = 0;
+ treePos.m_match = true;
+ return;
+ }
+ break;
+ }
+ // access rest of current node
+ accessNode(signal, currNode, AccFull);
+ // pos 0 was handled above
+ for (unsigned j = 1, occup = currNode.getOccup(); j < occup; j++) {
+ jam();
+ // compare only the entry
+ if (searchEnt.eq(currNode.getEnt(j))) {
+ jam();
+ treePos.m_loc = currNode.m_loc;
+ treePos.m_pos = j;
+ treePos.m_match = true;
+ return;
+ }
+ }
+ treePos.m_loc = currNode.m_loc;
+ treePos.m_pos = currNode.getOccup();
+ treePos.m_match = false;
+}
+
+/*
+ * Search for scan start position.
+ *
+ * Similar to searchToAdd.
+ */
+void
+Dbtux::searchToScan(Signal* signal, Frag& frag, ConstData boundInfo, unsigned boundCount, TreePos& treePos)
+{
+ const TreeHead& tree = frag.m_tree;
+ NodeHandle currNode(frag);
+ currNode.m_loc = tree.m_root;
+ if (currNode.m_loc == NullTupLoc) {
+ // empty tree
+ jam();
+ treePos.m_match = false;
+ return;
+ }
+ NodeHandle glbNode(frag); // potential g.l.b of final node
+ NodeHandle bottomNode(frag);
+ while (true) {
+ jam();
+ selectNode(signal, currNode, currNode.m_loc, AccPref);
+ int ret;
+ // compare prefix
+ ret = cmpScanBound(frag, 0, boundInfo, boundCount, currNode.getPref(), tree.m_prefSize);
+ if (ret == NdbSqlUtil::CmpUnknown) {
+ jam();
+ // read and compare all attributes
+ readKeyAttrs(frag, currNode.getMinMax(0), 0, c_entryKey);
+ ret = cmpScanBound(frag, 0, boundInfo, boundCount, c_entryKey);
+ ndbrequire(ret != NdbSqlUtil::CmpUnknown);
+ }
+ if (ret < 0) {
+ jam();
+ const TupLoc loc = currNode.getLink(0);
+ if (loc != NullTupLoc) {
+ jam();
+ // continue to left subtree
+ currNode.m_loc = loc;
+ continue;
+ }
+ if (! glbNode.isNull()) {
+ jam();
+ // move up to the g.l.b but remember the bottom node
+ bottomNode = currNode;
+ currNode = glbNode;
+ } else {
+ // start scanning this node
+ treePos.m_loc = currNode.m_loc;
+ treePos.m_pos = 0;
+ treePos.m_match = false;
+ treePos.m_dir = 3;
+ return;
+ }
+ } else if (ret > 0) {
+ jam();
+ const TupLoc loc = currNode.getLink(1);
+ if (loc != NullTupLoc) {
+ jam();
+ // save potential g.l.b
+ glbNode = currNode;
+ // continue to right subtree
+ currNode.m_loc = loc;
+ continue;
+ }
+ } else {
+ ndbassert(false);
+ }
+ break;
+ }
+ // access rest of current node
+ accessNode(signal, currNode, AccFull);
+ for (unsigned j = 0, occup = currNode.getOccup(); j < occup; j++) {
+ jam();
+ int ret;
+ // read and compare attributes
+ readKeyAttrs(frag, currNode.getEnt(j), 0, c_entryKey);
+ ret = cmpScanBound(frag, 0, boundInfo, boundCount, c_entryKey);
+ ndbrequire(ret != NdbSqlUtil::CmpUnknown);
+ if (ret < 0) {
+ // start scanning from current entry
+ treePos.m_loc = currNode.m_loc;
+ treePos.m_pos = j;
+ treePos.m_match = false;
+ treePos.m_dir = 3;
+ return;
+ }
+ }
+ if (! bottomNode.isNull()) {
+ jam();
+ // start scanning the l.u.b
+ treePos.m_loc = bottomNode.m_loc;
+ treePos.m_pos = 0;
+ treePos.m_match = false;
+ treePos.m_dir = 3;
+ return;
+ }
+ // start scanning upwards (pretend we came from right child)
+ treePos.m_loc = currNode.m_loc;
+ treePos.m_dir = 1;
+}
diff --git a/ndb/src/kernel/blocks/dbtux/DbtuxTree.cpp b/ndb/src/kernel/blocks/dbtux/DbtuxTree.cpp
index 7c3f5fa36b8..3baa62998db 100644
--- a/ndb/src/kernel/blocks/dbtux/DbtuxTree.cpp
+++ b/ndb/src/kernel/blocks/dbtux/DbtuxTree.cpp
@@ -18,112 +18,6 @@
#include "Dbtux.hpp"
/*
- * Search for entry.
- *
- * Search key is index attribute data and tree entry value. Start from
- * root node and compare the key to min/max of each node. Use linear
- * search on the final (bounding) node. Initial attributes which are
- * same in min/max need not be checked.
- */
-void
-Dbtux::treeSearch(Signal* signal, Frag& frag, TableData searchKey, TreeEnt searchEnt, TreePos& treePos)
-{
- const TreeHead& tree = frag.m_tree;
- const unsigned numAttrs = frag.m_numAttrs;
- treePos.m_loc = tree.m_root;
- if (treePos.m_loc == NullTupLoc) {
- // empty tree
- jam();
- treePos.m_pos = 0;
- treePos.m_match = false;
- return;
- }
- NodeHandle node(frag);
-loop: {
- jam();
- selectNode(signal, node, treePos.m_loc, AccPref);
- const unsigned occup = node.getOccup();
- ndbrequire(occup != 0);
- // number of equal initial attributes in bounding node
- unsigned start = ZNIL;
- for (unsigned i = 0; i <= 1; i++) {
- jam();
- unsigned start1 = 0;
- // compare prefix
- int ret = cmpSearchKey(frag, start1, searchKey, node.getPref(i), tree.m_prefSize);
- if (ret == NdbSqlUtil::CmpUnknown) {
- jam();
- // read and compare remaining attributes
- readKeyAttrs(frag, node.getMinMax(i), start1, c_entryKey);
- ret = cmpSearchKey(frag, start1, searchKey, c_entryKey);
- ndbrequire(ret != NdbSqlUtil::CmpUnknown);
- }
- if (start > start1)
- start = start1;
- if (ret == 0) {
- jam();
- // keys are equal, compare entry values
- ret = searchEnt.cmp(node.getMinMax(i));
- }
- if (i == 0 ? (ret < 0) : (ret > 0)) {
- jam();
- const TupLoc loc = node.getLink(i);
- if (loc != NullTupLoc) {
- jam();
- // continue to left/right subtree
- treePos.m_loc = loc;
- goto loop;
- }
- // position is immediately before/after this node
- treePos.m_pos = (i == 0 ? 0 : occup);
- treePos.m_match = false;
- return;
- }
- if (ret == 0) {
- jam();
- // position is at first/last entry
- treePos.m_pos = (i == 0 ? 0 : occup - 1);
- treePos.m_match = true;
- return;
- }
- }
- // access rest of the bounding node
- accessNode(signal, node, AccFull);
- // position is strictly within the node
- ndbrequire(occup >= 2);
- const unsigned numWithin = occup - 2;
- for (unsigned j = 1; j <= numWithin; j++) {
- jam();
- int ret = 0;
- if (start < numAttrs) {
- jam();
- // read and compare remaining attributes
- unsigned start1 = start;
- readKeyAttrs(frag, node.getEnt(j), start1, c_entryKey);
- ret = cmpSearchKey(frag, start1, searchKey, c_entryKey);
- ndbrequire(ret != NdbSqlUtil::CmpUnknown);
- }
- if (ret == 0) {
- jam();
- // keys are equal, compare entry values
- ret = searchEnt.cmp(node.getEnt(j));
- }
- if (ret <= 0) {
- jam();
- // position is before or at this entry
- treePos.m_pos = j;
- treePos.m_match = (ret == 0);
- return;
- }
- }
- // position is before last entry
- treePos.m_pos = occup - 1;
- treePos.m_match = false;
- return;
- }
-}
-
-/*
* Add entry.
*/
void
@@ -283,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) {
@@ -297,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/dbtux/Makefile.am b/ndb/src/kernel/blocks/dbtux/Makefile.am
index 0b48ad5724f..7d012924522 100644
--- a/ndb/src/kernel/blocks/dbtux/Makefile.am
+++ b/ndb/src/kernel/blocks/dbtux/Makefile.am
@@ -7,6 +7,7 @@ libdbtux_a_SOURCES = \
DbtuxNode.cpp \
DbtuxTree.cpp \
DbtuxScan.cpp \
+ DbtuxSearch.cpp \
DbtuxCmp.cpp \
DbtuxDebug.cpp
diff --git a/ndb/src/kernel/blocks/dbtux/Times.txt b/ndb/src/kernel/blocks/dbtux/Times.txt
index 16c4102249b..c4744a23c07 100644
--- a/ndb/src/kernel/blocks/dbtux/Times.txt
+++ b/ndb/src/kernel/blocks/dbtux/Times.txt
@@ -1,17 +1,32 @@
-index maintenance overhead
-==========================
+ordered index performance
+=========================
"mc02" 2x1700 MHz linux-2.4.9 gcc-2.96 -O3 one db-node
-case a: index on Unsigned
-testOIBasic -case u -table 1 -index 1 -fragtype small -threads 10 -rows 100000 -subloop 1 -nologging
+case a: maintenance: index on Unsigned
+testOIBasic -case u -table 1 -index 2 -fragtype small -threads 10 -rows 100000 -subloop 1 -nologging
-case b: index on Varchar(5) + Varchar(5) + Varchar(20) + Unsigned
-testOIBasic -case u -table 2 -index 4 -fragtype small -threads 10 -rows 100000 -subloop 1 -nologging
+case b: maintenance: index on Varchar(5) + Varchar(5) + Varchar(20) + Unsigned
+testOIBasic -case u -table 2 -index 5 -fragtype small -threads 10 -rows 100000 -subloop 1 -nologging
+case c: full scan: index on PK Unsigned
+testOIBasic -case v -table 1 -index 1 -fragtype small -threads 10 -rows 100000 -subloop 1 -nologging
+
+case d: scan 1 tuple via EQ: index on PK Unsigned
+testOIBasic -case w -table 1 -index 1 -fragtype small -threads 10 -rows 100000 -samples 10000 -subloop 1 -nologging -v2
+
+a, b
1 million rows, pk update without index, pk update with index
shows ms / 1000 rows for each and pct overhead
-the figures are based on single run on idle machine
+
+c
+1 million rows, index on PK, full table scan, full index scan
+shows ms / 1000 rows for each and index time overhead
+
+d
+1 million rows, index on PK, read table via each pk, scan index for each pk
+shows ms / 1000 rows for each and index time overhead
+samples 10% of all PKs (100,000 pk reads, 100,000 scans)
040616 mc02/a 40 ms 87 ms 114 pct
mc02/b 51 ms 128 ms 148 pct
@@ -49,4 +64,22 @@ optim 10 mc02/a 44 ms 65 ms 46 pct
optim 11 mc02/a 43 ms 63 ms 46 pct
mc02/b 52 ms 86 ms 63 pct
+optim 12 mc02/a 38 ms 55 ms 43 pct
+ mc02/b 47 ms 77 ms 63 pct
+ mc02/c 10 ms 14 ms 47 pct
+ mc02/d 176 ms 281 ms 59 pct
+
+optim 13 mc02/a 40 ms 57 ms 42 pct
+ mc02/b 47 ms 77 ms 61 pct
+ mc02/c 9 ms 13 ms 50 pct
+ mc02/d 170 ms 256 ms 50 pct
+
+after wl-1884 store all-NULL keys (the tests have pctnull=10 per column)
+[ what happened to PK read performance? ]
+
+optim 13 mc02/a 39 ms 59 ms 50 pct
+ mc02/b 47 ms 77 ms 61 pct
+ mc02/c 9 ms 12 ms 44 pct
+ mc02/d 246 ms 289 ms 17 pct
+
vim: set et:
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/Makefile.am b/ndb/src/mgmapi/Makefile.am
index e4fa1d449c6..bf209ddccb5 100644
--- a/ndb/src/mgmapi/Makefile.am
+++ b/ndb/src/mgmapi/Makefile.am
@@ -9,5 +9,10 @@ DEFS_LOC = -DNO_DEBUG_MESSAGES
include $(top_srcdir)/ndb/config/common.mk.am
include $(top_srcdir)/ndb/config/type_util.mk.am
+#ndbtest_PROGRAMS = ndb_test_mgmapi
+ndb_test_mgmapi_SOURCES = test_mgmapi.cpp
+ndb_test_mgmapi_LDFLAGS = @ndb_bin_am_ldflags@ \
+ $(top_builddir)/ndb/src/libndbclient.la
+
# Don't update the files from bitkeeper
%::SCCS/s.%
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 33ac4ddcf99..ccc63cc7e70 100644
--- a/ndb/src/mgmsrv/MgmtSrvr.cpp
+++ b/ndb/src/mgmsrv/MgmtSrvr.cpp
@@ -172,7 +172,7 @@ MgmtSrvr::signalRecvThreadRun()
siglist.push_back(SigMatch(GSN_MGM_UNLOCK_CONFIG_REQ,
&MgmtSrvr::handle_MGM_UNLOCK_CONFIG_REQ));
- while(1) {
+ while(!_isStopThread) {
SigMatch *handler = NULL;
NdbApiSignal *signal = NULL;
if(m_signalRecvQueue.waitFor(siglist, handler, signal)) {
@@ -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;
}
}
@@ -415,14 +413,18 @@ MgmtSrvr::getPort() const {
ndbout << "Local node id " << getOwnNodeId()
<< " is not defined as management server" << endl
<< "Have you set correct NodeId for this node?" << endl;
+ ndb_mgm_destroy_iterator(iter);
return 0;
}
Uint32 port = 0;
if(ndb_mgm_get_int_parameter(iter, CFG_MGM_PORT, &port) != 0){
ndbout << "Could not find PortNumber in the configuration file." << endl;
+ ndb_mgm_destroy_iterator(iter);
return 0;
}
+
+ ndb_mgm_destroy_iterator(iter);
/*****************
* Set Stat Port *
@@ -517,6 +519,7 @@ MgmtSrvr::MgmtSrvr(NodeId nodeId,
_isStopThread = false;
_logLevelThread = NULL;
_logLevelThreadSleep = 500;
+ m_signalRecvThread = NULL;
_startedNodeId = 0;
theFacade = 0;
@@ -589,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);
+ }
}
@@ -696,6 +701,11 @@ MgmtSrvr::~MgmtSrvr()
NdbThread_WaitFor(_logLevelThread, &res);
NdbThread_Destroy(&_logLevelThread);
}
+
+ if (m_signalRecvThread != NULL) {
+ NdbThread_WaitFor(m_signalRecvThread, &res);
+ NdbThread_Destroy(&m_signalRecvThread);
+ }
}
//****************************************************************************
@@ -1088,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;
@@ -1105,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);
}
@@ -1565,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;
@@ -1596,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];
}
@@ -1625,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;
@@ -1656,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];
}
@@ -1800,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/NdbScanOperation.cpp b/ndb/src/ndbapi/NdbScanOperation.cpp
index 603ae85ad65..7d51974da7c 100644
--- a/ndb/src/ndbapi/NdbScanOperation.cpp
+++ b/ndb/src/ndbapi/NdbScanOperation.cpp
@@ -1120,7 +1120,6 @@ NdbIndexScanOperation::setBound(const NdbColumnImpl* tAttrInfo,
if (theOperationType == OpenRangeScanRequest &&
theStatus == SetBound &&
(0 <= type && type <= 4) &&
- aValue != NULL &&
len <= 8000) {
// bound type
@@ -1131,20 +1130,22 @@ NdbIndexScanOperation::setBound(const NdbColumnImpl* tAttrInfo,
setErrorCodeAbort(4209);
return -1;
}
- len = sizeInBytes;
+ len = aValue != NULL ? sizeInBytes : 0;
Uint32 tIndexAttrId = tAttrInfo->m_attrId;
Uint32 sizeInWords = (len + 3) / 4;
AttributeHeader ah(tIndexAttrId, sizeInWords);
insertATTRINFO(ah.m_value);
- // attribute data
- if ((UintPtr(aValue) & 0x3) == 0 && (len & 0x3) == 0)
- insertATTRINFOloop((const Uint32*)aValue, sizeInWords);
- else {
- Uint32 temp[2000];
- memcpy(temp, aValue, len);
- while ((len & 0x3) != 0)
- ((char*)temp)[len++] = 0;
- insertATTRINFOloop(temp, sizeInWords);
+ if (len != 0) {
+ // attribute data
+ if ((UintPtr(aValue) & 0x3) == 0 && (len & 0x3) == 0)
+ insertATTRINFOloop((const Uint32*)aValue, sizeInWords);
+ else {
+ Uint32 temp[2000];
+ memcpy(temp, aValue, len);
+ while ((len & 0x3) != 0)
+ ((char*)temp)[len++] = 0;
+ insertATTRINFOloop(temp, sizeInWords);
+ }
}
/**
@@ -1231,7 +1232,7 @@ NdbIndexScanOperation::compare(Uint32 skip, Uint32 cols,
Uint32 * d2 = (Uint32*)r2->aRef();
unsigned r1_null = r1->isNULL();
if((r1_null ^ (unsigned)r2->isNULL())){
- return (r1_null ? 1 : -1);
+ return (r1_null ? -1 : 1);
}
Uint32 type = NdbColumnImpl::getImpl(* r1->m_column).m_extType;
Uint32 size = (r1->theAttrSize * r1->theArraySize + 3) / 4;
diff --git a/ndb/src/ndbapi/Ndbif.cpp b/ndb/src/ndbapi/Ndbif.cpp
index ee59e661cfb..7ad37401b9a 100644
--- a/ndb/src/ndbapi/Ndbif.cpp
+++ b/ndb/src/ndbapi/Ndbif.cpp
@@ -350,47 +350,46 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3])
return;
}
- case GSN_TRANSID_AI:
- {
- tFirstDataPtr = int2void(tFirstData);
- assert(tFirstDataPtr);
- if (tFirstDataPtr == 0) goto InvalidSignal;
- NdbReceiver* tRec = void2rec(tFirstDataPtr);
- assert(tRec->checkMagicNumber());
- assert(tRec->getTransaction());
- assert(tRec->getTransaction()->checkState_TransId(((const TransIdAI*)tDataPtr)->transId));
- if(tRec->checkMagicNumber() && (tCon = tRec->getTransaction()) &&
- tCon->checkState_TransId(((const TransIdAI*)tDataPtr)->transId)){
- Uint32 com;
- if(aSignal->m_noOfSections > 0){
- com = tRec->execTRANSID_AI(ptr[0].p, ptr[0].sz);
- } else {
- com = tRec->execTRANSID_AI(tDataPtr + TransIdAI::HeaderLength,
- tLen - TransIdAI::HeaderLength);
- }
-
- if(com == 1){
- switch(tRec->getType()){
- case NdbReceiver::NDB_OPERATION:
- case NdbReceiver::NDB_INDEX_OPERATION:
- if(tCon->OpCompleteSuccess() != -1){
- completedTransaction(tCon);
- return;
- }
- break;
- case NdbReceiver::NDB_SCANRECEIVER:
- tCon->theScanningOp->receiver_delivered(tRec);
- theWaiter.m_state = (tWaitState == WAIT_SCAN? NO_WAIT: tWaitState);
- break;
- default:
- goto InvalidSignal;
+ case GSN_TRANSID_AI:{
+ tFirstDataPtr = int2void(tFirstData);
+ NdbReceiver* tRec;
+ if (tFirstDataPtr && (tRec = void2rec(tFirstDataPtr)) &&
+ tRec->checkMagicNumber() && (tCon = tRec->getTransaction()) &&
+ tCon->checkState_TransId(((const TransIdAI*)tDataPtr)->transId)){
+ Uint32 com;
+ if(aSignal->m_noOfSections > 0){
+ com = tRec->execTRANSID_AI(ptr[0].p, ptr[0].sz);
+ } else {
+ com = tRec->execTRANSID_AI(tDataPtr + TransIdAI::HeaderLength,
+ tLen - TransIdAI::HeaderLength);
+ }
+
+ if(com == 1){
+ switch(tRec->getType()){
+ case NdbReceiver::NDB_OPERATION:
+ case NdbReceiver::NDB_INDEX_OPERATION:
+ if(tCon->OpCompleteSuccess() != -1){
+ completedTransaction(tCon);
+ return;
}
+ break;
+ case NdbReceiver::NDB_SCANRECEIVER:
+ tCon->theScanningOp->receiver_delivered(tRec);
+ theWaiter.m_state = (tWaitState == WAIT_SCAN ? NO_WAIT : tWaitState);
+ break;
+ default:
+ goto InvalidSignal;
}
- break;
- } else {
- goto InvalidSignal;
}
+ break;
+ } else {
+ /**
+ * This is ok as transaction can have been aborted before TRANSID_AI
+ * arrives (if TUP on other node than TC)
+ */
+ return;
}
+ }
case GSN_TCKEY_FAILCONF:
{
tFirstDataPtr = int2void(tFirstData);
@@ -695,7 +694,8 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3])
(tCon = void2con(tFirstDataPtr)) && (tCon->checkMagicNumber() == 0)){
if(aSignal->m_noOfSections > 0){
- tReturnCode = tCon->receiveSCAN_TABCONF(aSignal, ptr[0].p, ptr[0].sz);
+ tReturnCode = tCon->receiveSCAN_TABCONF(aSignal,
+ ptr[0].p, ptr[0].sz);
} else {
tReturnCode =
tCon->receiveSCAN_TABCONF(aSignal,
@@ -730,12 +730,11 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3])
}
case GSN_KEYINFO20: {
tFirstDataPtr = int2void(tFirstData);
- if (tFirstDataPtr == 0) goto InvalidSignal;
- NdbReceiver* tRec = void2rec(tFirstDataPtr);
-
- if(tRec->checkMagicNumber() && (tCon = tRec->getTransaction()) &&
- tCon->checkState_TransId(&((const KeyInfo20*)tDataPtr)->transId1)){
-
+ NdbReceiver* tRec;
+ if (tFirstDataPtr && (tRec = void2rec(tFirstDataPtr)) &&
+ tRec->checkMagicNumber() && (tCon = tRec->getTransaction()) &&
+ tCon->checkState_TransId(&((const KeyInfo20*)tDataPtr)->transId1)){
+
Uint32 len = ((const KeyInfo20*)tDataPtr)->keyLen;
Uint32 info = ((const KeyInfo20*)tDataPtr)->scanInfo_Node;
int com = -1;
@@ -756,8 +755,13 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3])
goto InvalidSignal;
}
break;
+ } else {
+ /**
+ * This is ok as transaction can have been aborted before KEYINFO20
+ * arrives (if TUP on other node than TC)
+ */
+ return;
}
- goto InvalidSignal;
}
case GSN_TCINDXCONF:{
tFirstDataPtr = int2void(tFirstData);
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 af25a36dde2..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);
@@ -962,6 +962,7 @@ int runMassiveRollback(NDBT_Context* ctx, NDBT_Step* step){
const Uint32 OPS_TOTAL = 4096;
for(int row = 0; row < records; row++){
+ int res;
CHECK(hugoOps.startTransaction(pNdb) == 0);
for(int i = 0; i<OPS_TOTAL; i += OPS_PER_TRANS){
for(int j = 0; j<OPS_PER_TRANS; j++){
@@ -972,7 +973,12 @@ int runMassiveRollback(NDBT_Context* ctx, NDBT_Step* step){
if(result != NDBT_OK){
break;
}
- CHECK(hugoOps.execute_NoCommit(pNdb) == 0);
+ res = hugoOps.execute_NoCommit(pNdb);
+ if(res != 0){
+ NdbError err = pNdb->getNdbError(res);
+ CHECK(err.classification == NdbError::TimeoutExpired);
+ break;
+ }
}
if(result != NDBT_OK){
break;
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/ndbapi/testOIBasic.cpp b/ndb/test/ndbapi/testOIBasic.cpp
index cd7b34b647b..c58dd8538e9 100644
--- a/ndb/test/ndbapi/testOIBasic.cpp
+++ b/ndb/test/ndbapi/testOIBasic.cpp
@@ -33,14 +33,18 @@
struct Opt {
// common options
+ unsigned m_batch;
const char* m_case;
bool m_core;
bool m_dups;
NdbDictionary::Object::FragmentType m_fragtype;
+ unsigned m_idxloop;
const char* m_index;
unsigned m_loop;
bool m_nologging;
+ bool m_msglock;
unsigned m_rows;
+ unsigned m_samples;
unsigned m_scanrd;
unsigned m_scanex;
unsigned m_seed;
@@ -49,17 +53,21 @@ struct Opt {
unsigned m_threads;
unsigned m_v;
Opt() :
+ m_batch(32),
m_case(0),
m_core(false),
m_dups(false),
m_fragtype(NdbDictionary::Object::FragUndefined),
+ m_idxloop(4),
m_index(0),
m_loop(1),
m_nologging(false),
+ m_msglock(true),
m_rows(1000),
+ m_samples(0),
m_scanrd(240),
m_scanex(240),
- m_seed(1),
+ m_seed(0),
m_subloop(4),
m_table(0),
m_threads(4),
@@ -78,17 +86,19 @@ printhelp()
Opt d;
ndbout
<< "usage: testOIbasic [options]" << endl
+ << " -batch N pk operations in batch [" << d.m_batch << "]" << endl
<< " -case abc only given test cases (letters a-z)" << endl
<< " -core core dump on error [" << d.m_core << "]" << endl
<< " -dups allow duplicate tuples from index scan [" << d.m_dups << "]" << endl
<< " -fragtype T fragment type single/small/medium/large" << endl
<< " -index xyz only given index numbers (digits 1-9)" << endl
- << " -loop N loop count full suite forever=0 [" << d.m_loop << "]" << endl
+ << " -loop N loop count full suite 0=forever [" << d.m_loop << "]" << endl
<< " -nologging create tables in no-logging mode" << endl
<< " -rows N rows per thread [" << d.m_rows << "]" << endl
+ << " -samples N samples for some timings (0=all) [" << d.m_samples << "]" << endl
<< " -scanrd N scan read parallelism [" << d.m_scanrd << "]" << endl
<< " -scanex N scan exclusive parallelism [" << d.m_scanex << "]" << endl
- << " -seed N srandom seed [" << d.m_seed << "]" << endl
+ << " -seed N srandom seed 0=loop number[" << d.m_seed << "]" << endl
<< " -subloop N subtest loop count [" << d.m_subloop << "]" << endl
<< " -table xyz only given table numbers (digits 1-9)" << endl
<< " -threads N number of threads [" << d.m_threads << "]" << endl
@@ -99,6 +109,12 @@ printhelp()
printtables();
}
+// not yet configurable
+static const bool g_store_null_key = true;
+
+// compare NULL like normal value (NULL < not NULL, NULL == NULL)
+static const bool g_compare_null = true;
+
// log and error macros
static NdbMutex ndbout_mutex = NDB_MUTEX_INITIALIZER;
@@ -124,9 +140,9 @@ getthrstr()
#define LLN(n, s) \
do { \
if ((n) > g_opt.m_v) break; \
- NdbMutex_Lock(&ndbout_mutex); \
+ if (g_opt.m_msglock) NdbMutex_Lock(&ndbout_mutex); \
ndbout << getthrstr() << s << endl; \
- NdbMutex_Unlock(&ndbout_mutex); \
+ if (g_opt.m_msglock) NdbMutex_Unlock(&ndbout_mutex); \
} while(0)
#define LL0(s) LLN(0, s)
@@ -139,11 +155,10 @@ getthrstr()
// following check a condition and return -1 on failure
#undef CHK // simple check
-#undef CHKTRY // execute action (try-catch) on failure
-#undef CHKMSG // print extra message on failure
+#undef CHKTRY // check with action on fail
#undef CHKCON // print NDB API errors on failure
-#define CHK(x) CHKTRY(x, ;)
+#define CHK(x) CHKTRY(x, ;)
#define CHKTRY(x, act) \
do { \
@@ -154,14 +169,6 @@ getthrstr()
return -1; \
} while (0)
-#define CHKMSG(x, msg) \
- do { \
- if (x) break; \
- LL0("line " << __LINE__ << ": " << #x << " failed: " << msg); \
- if (g_opt.m_core) abort(); \
- return -1; \
- } while (0)
-
#define CHKCON(x, con) \
do { \
if (x) break; \
@@ -177,6 +184,7 @@ class Thr;
class Con;
class Tab;
class Set;
+class Tmr;
struct Par : public Opt {
unsigned m_no;
@@ -186,14 +194,17 @@ struct Par : public Opt {
const Tab& tab() const { assert(m_tab != 0); return *m_tab; }
Set* m_set;
Set& set() const { assert(m_set != 0); return *m_set; }
+ Tmr* m_tmr;
+ Tmr& tmr() const { assert(m_tmr != 0); return *m_tmr; }
unsigned m_totrows;
- unsigned m_batch;
// value calculation
unsigned m_pctnull;
unsigned m_range;
unsigned m_pctrange;
// do verify after read
bool m_verify;
+ // deadlock possible
+ bool m_deadlock;
// timer location
Par(const Opt& opt) :
Opt(opt),
@@ -201,12 +212,13 @@ struct Par : public Opt {
m_con(0),
m_tab(0),
m_set(0),
+ m_tmr(0),
m_totrows(m_threads * m_rows),
- m_batch(32),
m_pctnull(10),
m_range(m_rows),
m_pctrange(0),
- m_verify(false) {
+ m_verify(false),
+ m_deadlock(false) {
}
};
@@ -241,19 +253,20 @@ struct Tmr {
void on();
void off(unsigned cnt = 0);
const char* time();
+ const char* pct(const Tmr& t1);
const char* over(const Tmr& t1);
NDB_TICKS m_on;
unsigned m_ms;
unsigned m_cnt;
char m_time[100];
- char m_over[100];
+ char m_text[100];
Tmr() { clr(); }
};
void
Tmr::clr()
{
- m_on = m_ms = m_cnt = m_time[0] = m_over[0] = 0;
+ m_on = m_ms = m_cnt = m_time[0] = m_text[0] = 0;
}
void
@@ -285,14 +298,63 @@ Tmr::time()
}
const char*
+Tmr::pct(const Tmr& t1)
+{
+ if (0 < t1.m_ms) {
+ sprintf(m_text, "%u pct", (100 * m_ms) / t1.m_ms);
+ } else {
+ sprintf(m_text, "[cannot measure]");
+ }
+ return m_text;
+}
+
+const char*
Tmr::over(const Tmr& t1)
{
- if (0 < t1.m_ms && t1.m_ms < m_ms) {
- sprintf(m_over, "%u pct", (100 * (m_ms - t1.m_ms)) / t1.m_ms);
+ if (0 < t1.m_ms) {
+ if (t1.m_ms <= m_ms)
+ sprintf(m_text, "%u pct", (100 * (m_ms - t1.m_ms)) / t1.m_ms);
+ else
+ sprintf(m_text, "-%u pct", (100 * (t1.m_ms - m_ms)) / t1.m_ms);
} else {
- sprintf(m_over, "[cannot measure]");
+ sprintf(m_text, "[cannot measure]");
}
- return m_over;
+ return m_text;
+}
+
+// list of ints
+
+struct Lst {
+ Lst();
+ unsigned m_arr[1000];
+ unsigned m_cnt;
+ void push(unsigned i);
+ unsigned cnt() const;
+ void reset();
+};
+
+Lst::Lst() :
+ m_cnt(0)
+{
+}
+
+void
+Lst::push(unsigned i)
+{
+ assert(m_cnt < sizeof(m_arr)/sizeof(m_arr[0]));
+ m_arr[m_cnt++] = i;
+}
+
+unsigned
+Lst::cnt() const
+{
+ return m_cnt;
+}
+
+void
+Lst::reset()
+{
+ m_cnt = 0;
}
// tables and indexes
@@ -409,7 +471,7 @@ operator<<(NdbOut& out, const Tab& tab)
return out;
}
-// tt1 + tt1x1 tt1x2 tt1x3 tt1x4
+// tt1 + tt1x1 tt1x2 tt1x3 tt1x4 tt1x5
static const Col
tt1col[] = {
@@ -422,24 +484,29 @@ tt1col[] = {
static const ICol
tt1x1col[] = {
- { 0, tt1col[1] }
+ { 0, tt1col[0] }
};
static const ICol
tt1x2col[] = {
+ { 0, tt1col[1] }
+};
+
+static const ICol
+tt1x3col[] = {
{ 0, tt1col[1] },
{ 1, tt1col[2] }
};
static const ICol
-tt1x3col[] = {
+tt1x4col[] = {
{ 0, tt1col[3] },
{ 1, tt1col[2] },
{ 2, tt1col[1] }
};
static const ICol
-tt1x4col[] = {
+tt1x5col[] = {
{ 0, tt1col[1] },
{ 1, tt1col[4] },
{ 2, tt1col[2] },
@@ -453,17 +520,22 @@ tt1x1 = {
static const ITab
tt1x2 = {
- "TT1X2", 2, tt1x2col
+ "TT1X2", 1, tt1x2col
};
static const ITab
tt1x3 = {
- "TT1X3", 3, tt1x3col
+ "TT1X3", 2, tt1x3col
};
static const ITab
tt1x4 = {
- "TT1X4", 4, tt1x4col
+ "TT1X4", 3, tt1x4col
+};
+
+static const ITab
+tt1x5 = {
+ "TT1X5", 4, tt1x5col
};
static const ITab
@@ -471,15 +543,16 @@ tt1itab[] = {
tt1x1,
tt1x2,
tt1x3,
- tt1x4
+ tt1x4,
+ tt1x5
};
static const Tab
tt1 = {
- "TT1", 5, tt1col, 4, tt1itab
+ "TT1", 5, tt1col, 5, tt1itab
};
-// tt2 + tt2x1 tt2x2 tt2x3 tt2x4
+// tt2 + tt2x1 tt2x2 tt2x3 tt2x4 tt2x5
static const Col
tt2col[] = {
@@ -492,24 +565,29 @@ tt2col[] = {
static const ICol
tt2x1col[] = {
+ { 0, tt2col[0] }
+};
+
+static const ICol
+tt2x2col[] = {
{ 0, tt2col[1] },
{ 1, tt2col[2] }
};
static const ICol
-tt2x2col[] = {
+tt2x3col[] = {
{ 0, tt2col[2] },
{ 1, tt2col[1] }
};
static const ICol
-tt2x3col[] = {
+tt2x4col[] = {
{ 0, tt2col[3] },
{ 1, tt2col[4] }
};
static const ICol
-tt2x4col[] = {
+tt2x5col[] = {
{ 0, tt2col[4] },
{ 1, tt2col[3] },
{ 2, tt2col[2] },
@@ -518,7 +596,7 @@ tt2x4col[] = {
static const ITab
tt2x1 = {
- "TT2X1", 2, tt2x1col
+ "TT2X1", 1, tt2x1col
};
static const ITab
@@ -533,7 +611,12 @@ tt2x3 = {
static const ITab
tt2x4 = {
- "TT2X4", 4, tt2x4col
+ "TT2X4", 2, tt2x4col
+};
+
+static const ITab
+tt2x5 = {
+ "TT2X5", 4, tt2x5col
};
static const ITab
@@ -541,12 +624,13 @@ tt2itab[] = {
tt2x1,
tt2x2,
tt2x3,
- tt2x4
+ tt2x4,
+ tt2x5
};
static const Tab
tt2 = {
- "TT2", 5, tt2col, 4, tt2itab
+ "TT2", 5, tt2col, 5, tt2itab
};
// all tables
@@ -577,10 +661,14 @@ struct Con {
Con() :
m_ndb(0), m_dic(0), m_tx(0), m_op(0),
m_scanop(0), m_indexscanop(0), m_resultset(0), m_scanmode(ScanNo), m_errtype(ErrNone) {}
+ ~Con() {
+ if (m_tx != 0)
+ closeTransaction();
+ }
int connect();
+ void connect(const Con& con);
void disconnect();
int startTransaction();
- int startBuddyTransaction(const Con& con);
int getNdbOperation(const Tab& tab);
int getNdbScanOperation(const Tab& tab);
int getNdbScanOperation(const ITab& itab, const Tab& tab);
@@ -589,20 +677,16 @@ struct Con {
int setValue(int num, const char* addr);
int setBound(int num, int type, const void* value);
int execute(ExecType t);
+ int execute(ExecType t, bool& deadlock);
int openScanRead(unsigned parallelism);
int openScanExclusive(unsigned parallelism);
int executeScan();
- int nextScanResult();
- int takeOverForUpdate(Con& scan);
- int takeOverForDelete(Con& scan);
+ int nextScanResult(bool fetchAllowed);
+ int nextScanResult(bool fetchAllowed, bool& deadlock);
+ int updateScanTuple(Con& con2);
+ int deleteScanTuple(Con& con2);
void closeTransaction();
void printerror(NdbOut& out);
- // flush dict cache
- int bugger() {
- //disconnect();
- //CHK(connect() == 0);
- return 0;
- }
};
int
@@ -612,12 +696,18 @@ Con::connect()
m_ndb = new Ndb("TEST_DB");
CHKCON(m_ndb->init() == 0, *this);
CHKCON(m_ndb->waitUntilReady(30) == 0, *this);
- m_dic = m_ndb->getDictionary();
m_tx = 0, m_op = 0;
return 0;
}
void
+Con::connect(const Con& con)
+{
+ assert(m_ndb == 0);
+ m_ndb = con.m_ndb;
+}
+
+void
Con::disconnect()
{
delete m_ndb;
@@ -627,20 +717,14 @@ Con::disconnect()
int
Con::startTransaction()
{
- assert(m_ndb != 0 && m_tx == 0);
+ assert(m_ndb != 0);
+ if (m_tx != 0)
+ closeTransaction();
CHKCON((m_tx = m_ndb->startTransaction()) != 0, *this);
return 0;
}
int
-Con::startBuddyTransaction(const Con& con)
-{
- assert(m_ndb != 0 && m_tx == 0 && con.m_ndb == m_ndb && con.m_tx != 0);
- CHKCON((m_tx = m_ndb->hupp(con.m_tx)) != 0, *this);
- return 0;
-}
-
-int
Con::getNdbOperation(const Tab& tab)
{
assert(m_tx != 0);
@@ -705,6 +789,22 @@ Con::execute(ExecType t)
}
int
+Con::execute(ExecType t, bool& deadlock)
+{
+ int ret = execute(t);
+ if (ret != 0) {
+ if (deadlock && m_errtype == ErrDeadlock) {
+ LL3("caught deadlock");
+ ret = 0;
+ }
+ } else {
+ deadlock = false;
+ }
+ CHK(ret == 0);
+ return 0;
+}
+
+int
Con::openScanRead(unsigned parallelism)
{
assert(m_tx != 0 && m_op != 0);
@@ -728,28 +828,44 @@ Con::executeScan()
}
int
-Con::nextScanResult()
+Con::nextScanResult(bool fetchAllowed)
{
int ret;
assert(m_resultset != 0);
- CHKCON((ret = m_resultset->nextResult()) != -1, *this);
- assert(ret == 0 || ret == 1);
+ CHKCON((ret = m_resultset->nextResult(fetchAllowed)) != -1, *this);
+ assert(ret == 0 || ret == 1 || (! fetchAllowed && ret == 2));
return ret;
}
int
-Con::takeOverForUpdate(Con& scan)
+Con::nextScanResult(bool fetchAllowed, bool& deadlock)
{
- assert(m_tx != 0 && scan.m_op != 0);
- CHKCON((m_op = scan.m_resultset->updateTuple(m_tx)) != 0, scan);
+ int ret = nextScanResult(fetchAllowed);
+ if (ret == -1) {
+ if (deadlock && m_errtype == ErrDeadlock) {
+ LL3("caught deadlock");
+ ret = 0;
+ }
+ } else {
+ deadlock = false;
+ }
+ CHK(ret == 0 || ret == 1 || (! fetchAllowed && ret == 2));
+ return ret;
+}
+
+int
+Con::updateScanTuple(Con& con2)
+{
+ assert(con2.m_tx != 0);
+ CHKCON((con2.m_op = m_resultset->updateTuple(con2.m_tx)) != 0, *this);
return 0;
}
int
-Con::takeOverForDelete(Con& scan)
+Con::deleteScanTuple(Con& con2)
{
- assert(m_tx != 0 && scan.m_op != 0);
- CHKCON(scan.m_resultset->deleteTuple(m_tx) == 0, scan);
+ assert(con2.m_tx != 0);
+ CHKCON(m_resultset->deleteTuple(con2.m_tx) == 0, *this);
return 0;
}
@@ -777,7 +893,7 @@ Con::printerror(NdbOut& out)
if (m_tx) {
if ((code = m_tx->getNdbError().code) != 0) {
LL0(++any << " con: error " << m_tx->getNdbError());
- if (code == 266 || code == 274 || code == 296 || code == 297)
+ if (code == 266 || code == 274 || code == 296 || code == 297 || code == 499)
m_errtype = ErrDeadlock;
}
if (m_op && m_op->getNdbError().code != 0) {
@@ -797,7 +913,7 @@ invalidateindex(Par par, const ITab& itab)
{
Con& con = par.con();
const Tab& tab = par.tab();
- con.m_dic->invalidateIndex(itab.m_name, tab.m_name);
+ con.m_ndb->getDictionary()->invalidateIndex(itab.m_name, tab.m_name);
return 0;
}
@@ -821,7 +937,7 @@ invalidatetable(Par par)
Con& con = par.con();
const Tab& tab = par.tab();
invalidateindex(par);
- con.m_dic->invalidateTable(tab.m_name);
+ con.m_ndb->getDictionary()->invalidateTable(tab.m_name);
return 0;
}
@@ -830,6 +946,7 @@ droptable(Par par)
{
Con& con = par.con();
const Tab& tab = par.tab();
+ con.m_dic = con.m_ndb->getDictionary();
if (con.m_dic->getTable(tab.m_name) == 0) {
// how to check for error
LL4("no table " << tab.m_name);
@@ -837,6 +954,7 @@ droptable(Par par)
LL3("drop table " << tab.m_name);
CHKCON(con.m_dic->dropTable(tab.m_name) == 0, con);
}
+ con.m_dic = 0;
return 0;
}
@@ -844,7 +962,6 @@ static int
createtable(Par par)
{
Con& con = par.con();
- CHK(con.bugger() == 0);
const Tab& tab = par.tab();
LL3("create table " << tab.m_name);
LL4(tab);
@@ -864,7 +981,9 @@ createtable(Par par)
c.setNullable(col.m_nullable);
t.addColumn(c);
}
+ con.m_dic = con.m_ndb->getDictionary();
CHKCON(con.m_dic->createTable(t) == 0, con);
+ con.m_dic = 0;
return 0;
}
@@ -873,6 +992,7 @@ dropindex(Par par, const ITab& itab)
{
Con& con = par.con();
const Tab& tab = par.tab();
+ con.m_dic = con.m_ndb->getDictionary();
if (con.m_dic->getIndex(itab.m_name, tab.m_name) == 0) {
// how to check for error
LL4("no index " << itab.m_name);
@@ -880,6 +1000,7 @@ dropindex(Par par, const ITab& itab)
LL3("drop index " << itab.m_name);
CHKCON(con.m_dic->dropIndex(itab.m_name, tab.m_name) == 0, con);
}
+ con.m_dic = 0;
return 0;
}
@@ -900,7 +1021,6 @@ static int
createindex(Par par, const ITab& itab)
{
Con& con = par.con();
- CHK(con.bugger() == 0);
const Tab& tab = par.tab();
LL3("create index " << itab.m_name);
LL4(itab);
@@ -912,7 +1032,9 @@ createindex(Par par, const ITab& itab)
const Col& col = itab.m_icol[k].m_col;
x.addColumnName(col.m_name);
}
+ con.m_dic = con.m_ndb->getDictionary();
CHKCON(con.m_dic->createIndex(x) == 0, con);
+ con.m_dic = 0;
return 0;
}
@@ -1127,9 +1249,9 @@ Val::cmp(const Val& val2) const
assert(col.m_type == col2.m_type && col.m_length == col2.m_length);
if (m_null || val2.m_null) {
if (! m_null)
- return -1;
- if (! val2.m_null)
return +1;
+ if (! val2.m_null)
+ return -1;
return 0;
}
// verify data formats
@@ -1187,6 +1309,8 @@ struct Row {
const Tab& m_tab;
Val** m_val;
bool m_exist;
+ enum Op { NoOp = 0, ReadOp, InsOp, UpdOp, DelOp };
+ Op m_pending;
Row(const Tab& tab);
~Row();
void copy(const Row& row2);
@@ -1211,6 +1335,7 @@ Row::Row(const Tab& tab) :
m_val[k] = new Val(col);
}
m_exist = false;
+ m_pending = NoOp;
}
Row::~Row()
@@ -1248,7 +1373,7 @@ int
Row::verify(const Row& row2) const
{
const Tab& tab = m_tab;
- assert(&tab == &row2.m_tab);
+ assert(&tab == &row2.m_tab && m_exist && row2.m_exist);
for (unsigned k = 0; k < tab.m_cols; k++) {
const Val& val = *m_val[k];
const Val& val2 = *row2.m_val[k];
@@ -1269,7 +1394,7 @@ Row::insrow(Par par)
const Val& val = *m_val[k];
CHK(val.setval(par) == 0);
}
- m_exist = true;
+ m_pending = InsOp;
return 0;
}
@@ -1285,6 +1410,7 @@ Row::updrow(Par par)
const Val& val = *m_val[k];
CHK(val.setval(par) == 0);
}
+ m_pending = UpdOp;
return 0;
}
@@ -1302,7 +1428,7 @@ Row::delrow(Par par)
if (col.m_pk)
CHK(val.setval(par) == 0);
}
- m_exist = false;
+ m_pending = DelOp;
return 0;
}
@@ -1319,7 +1445,6 @@ Row::selrow(Par par)
if (col.m_pk)
CHK(val.setval(par) == 0);
}
- m_exist = false;
return 0;
}
@@ -1334,6 +1459,7 @@ Row::setrow(Par par)
if (! col.m_pk)
CHK(val.setval(par) == 0);
}
+ m_pending = UpdOp;
return 0;
}
@@ -1361,6 +1487,10 @@ operator<<(NdbOut& out, const Row& row)
out << " ";
out << *row.m_val[i];
}
+ out << " [exist=" << row.m_exist;
+ if (row.m_pending)
+ out << " pending=" << row.m_pending;
+ out << "]";
return out;
}
@@ -1369,15 +1499,19 @@ operator<<(NdbOut& out, const Row& row)
struct Set {
const Tab& m_tab;
unsigned m_rows;
- unsigned m_count;
Row** m_row;
Row** m_saverow;
Row* m_keyrow;
NdbRecAttr** m_rec;
Set(const Tab& tab, unsigned rows);
~Set();
+ void reset();
+ unsigned count() const;
// row methods
bool exist(unsigned i) const;
+ Row::Op pending(unsigned i) const;
+ void notpending(unsigned i);
+ void notpending(const Lst& lst);
void calc(Par par, unsigned i);
int insrow(Par par, unsigned i);
int updrow(Par par, unsigned i);
@@ -1392,7 +1526,7 @@ struct Set {
void savepoint();
void commit();
void rollback();
- // locking (not perfect since ops may complete in different order)
+ // protect structure
NdbMutex* m_mutex;
void lock() {
NdbMutex_Lock(m_mutex);
@@ -1408,9 +1542,9 @@ Set::Set(const Tab& tab, unsigned rows) :
m_tab(tab)
{
m_rows = rows;
- m_count = 0;
m_row = new Row* [m_rows];
for (unsigned i = 0; i < m_rows; i++) {
+ // allocate on need to save space
m_row[i] = 0;
}
m_saverow = 0;
@@ -1437,11 +1571,47 @@ Set::~Set()
NdbMutex_Destroy(m_mutex);
}
+void
+Set::reset()
+{
+ for (unsigned i = 0; i < m_rows; i++) {
+ if (m_row[i] != 0) {
+ Row& row = *m_row[i];
+ row.m_exist = false;
+ }
+ }
+}
+
+unsigned
+Set::count() const
+{
+ unsigned count = 0;
+ for (unsigned i = 0; i < m_rows; i++) {
+ if (m_row[i] != 0) {
+ Row& row = *m_row[i];
+ if (row.m_exist)
+ count++;
+ }
+ }
+ return count;
+}
+
bool
Set::exist(unsigned i) const
{
assert(i < m_rows);
- return m_row[i] != 0 && m_row[i]->m_exist;
+ if (m_row[i] == 0) // not allocated => not exist
+ return false;
+ return m_row[i]->m_exist;
+}
+
+Row::Op
+Set::pending(unsigned i) const
+{
+ assert(i < m_rows);
+ if (m_row[i] == 0) // not allocated => not pending
+ return Row::NoOp;
+ return m_row[i]->m_pending;
}
void
@@ -1460,9 +1630,9 @@ Set::calc(Par par, unsigned i)
int
Set::insrow(Par par, unsigned i)
{
- assert(m_row[i] != 0 && m_count < m_rows);
- CHK(m_row[i]->insrow(par) == 0);
- m_count++;
+ assert(m_row[i] != 0);
+ Row& row = *m_row[i];
+ CHK(row.insrow(par) == 0);
return 0;
}
@@ -1470,16 +1640,17 @@ int
Set::updrow(Par par, unsigned i)
{
assert(m_row[i] != 0);
- CHK(m_row[i]->updrow(par) == 0);
+ Row& row = *m_row[i];
+ CHK(row.updrow(par) == 0);
return 0;
}
int
Set::delrow(Par par, unsigned i)
{
- assert(m_row[i] != 0 && m_count != 0);
- CHK(m_row[i]->delrow(par) == 0);
- m_count--;
+ assert(m_row[i] != 0);
+ Row& row = *m_row[i];
+ CHK(row.delrow(par) == 0);
return 0;
}
@@ -1519,7 +1690,7 @@ Set::getkey(Par par, unsigned* i)
assert(m_rec[0] != 0);
const char* aRef0 = m_rec[0]->aRef();
Uint32 key = *(const Uint32*)aRef0;
- CHKMSG(key < m_rows, "key=" << key << " rows=" << m_rows);
+ CHK(key < m_rows);
*i = key;
return 0;
}
@@ -1544,19 +1715,37 @@ Set::putval(unsigned i, bool force)
val.copy(aRef);
val.m_null = false;
}
- if (! row.m_exist) {
+ if (! row.m_exist)
row.m_exist = true;
- m_count++;
- }
return 0;
}
+void
+Set::notpending(unsigned i)
+{
+ assert(m_row[i] != 0);
+ Row& row = *m_row[i];
+ if (row.m_pending == Row::InsOp)
+ row.m_exist = true;
+ if (row.m_pending == Row::DelOp)
+ row.m_exist = false;
+ row.m_pending = Row::NoOp;
+}
+
+void
+Set::notpending(const Lst& lst)
+{
+ for (unsigned j = 0; j < lst.m_cnt; j++) {
+ unsigned i = lst.m_arr[j];
+ notpending(i);
+ }
+}
+
int
Set::verify(const Set& set2) const
{
const Tab& tab = m_tab;
assert(&tab == &set2.m_tab && m_rows == set2.m_rows);
- CHKMSG(m_count == set2.m_count, "set=" << m_count << " set2=" << set2.m_count);
for (unsigned i = 0; i < m_rows; i++) {
CHK(exist(i) == set2.exist(i));
if (! exist(i))
@@ -1630,8 +1819,8 @@ int
BVal::setbnd(Par par) const
{
Con& con = par.con();
- const char* addr = (const char*)dataaddr();
- assert(! m_null);
+ assert(g_compare_null || ! m_null);
+ const char* addr = ! m_null ? (const char*)dataaddr() : 0;
const ICol& icol = m_icol;
CHK(con.setBound(icol.m_num, m_type, addr) == 0);
return 0;
@@ -1659,7 +1848,10 @@ struct BSet {
unsigned m_bvals;
BVal** m_bval;
BSet(const Tab& tab, const ITab& itab, unsigned rows);
+ ~BSet();
+ void reset();
void calc(Par par);
+ void calcpk(Par par, unsigned i);
int setbnd(Par par) const;
void filter(const Set& set, Set& set2) const;
};
@@ -1671,12 +1863,31 @@ BSet::BSet(const Tab& tab, const ITab& itab, unsigned rows) :
m_bvals(0)
{
m_bval = new BVal* [m_alloc];
+ for (unsigned i = 0; i < m_alloc; i++) {
+ m_bval[i] = 0;
+ }
+}
+
+BSet::~BSet()
+{
+ delete [] m_bval;
+}
+
+void
+BSet::reset()
+{
+ while (m_bvals > 0) {
+ unsigned i = --m_bvals;
+ delete m_bval[i];
+ m_bval[i] = 0;
+ }
}
void
BSet::calc(Par par)
{
const ITab& itab = m_itab;
+ reset();
for (unsigned k = 0; k < itab.m_icols; k++) {
const ICol& icol = itab.m_icol[k];
const Col& col = icol.m_col;
@@ -1698,7 +1909,8 @@ BSet::calc(Par par)
if (k + 1 < itab.m_icols)
bval.m_type = 4;
// value generation parammeters
- par.m_pctnull = 0;
+ if (! g_compare_null)
+ par.m_pctnull = 0;
par.m_pctrange = 50; // bit higher
do {
bval.calc(par, 0);
@@ -1717,6 +1929,23 @@ BSet::calc(Par par)
}
}
+void
+BSet::calcpk(Par par, unsigned i)
+{
+ const ITab& itab = m_itab;
+ reset();
+ for (unsigned k = 0; k < itab.m_icols; k++) {
+ const ICol& icol = itab.m_icol[k];
+ const Col& col = icol.m_col;
+ assert(col.m_pk);
+ assert(m_bvals < m_alloc);
+ BVal& bval = *new BVal(icol);
+ m_bval[m_bvals++] = &bval;
+ bval.m_type = 4;
+ bval.calc(par, i);
+ }
+}
+
int
BSet::setbnd(Par par) const
{
@@ -1733,23 +1962,25 @@ BSet::filter(const Set& set, Set& set2) const
const Tab& tab = m_tab;
const ITab& itab = m_itab;
assert(&tab == &set2.m_tab && set.m_rows == set2.m_rows);
- assert(set2.m_count == 0);
+ assert(set2.count() == 0);
for (unsigned i = 0; i < set.m_rows; i++) {
if (! set.exist(i))
continue;
const Row& row = *set.m_row[i];
- bool ok1 = false;
- for (unsigned k = 0; k < itab.m_icols; k++) {
- const ICol& icol = itab.m_icol[k];
- const Col& col = icol.m_col;
- const Val& val = *row.m_val[col.m_num];
- if (! val.m_null) {
- ok1 = true;
- break;
+ if (! g_store_null_key) {
+ bool ok1 = false;
+ for (unsigned k = 0; k < itab.m_icols; k++) {
+ const ICol& icol = itab.m_icol[k];
+ const Col& col = icol.m_col;
+ const Val& val = *row.m_val[col.m_num];
+ if (! val.m_null) {
+ ok1 = true;
+ break;
+ }
}
+ if (! ok1)
+ continue;
}
- if (! ok1)
- continue;
bool ok2 = true;
for (unsigned j = 0; j < m_bvals; j++) {
const BVal& bval = *m_bval[j];
@@ -1781,7 +2012,6 @@ BSet::filter(const Set& set, Set& set2) const
assert(! row2.m_exist);
row2.copy(row);
row2.m_exist = true;
- set2.m_count++;
}
}
@@ -1806,28 +2036,46 @@ pkinsert(Par par)
Set& set = par.set();
LL3("pkinsert");
CHK(con.startTransaction() == 0);
- unsigned n = 0;
+ Lst lst;
for (unsigned j = 0; j < par.m_rows; j++) {
unsigned i = thrrow(par, j);
set.lock();
- if (set.exist(i)) {
+ if (set.exist(i) || set.pending(i)) {
set.unlock();
continue;
}
set.calc(par, i);
- LL4("pkinsert " << i << ": " << *set.m_row[i]);
- CHKTRY(set.insrow(par, i) == 0, set.unlock());
+ CHK(set.insrow(par, i) == 0);
set.unlock();
- if (++n == par.m_batch) {
- CHK(con.execute(Commit) == 0);
+ LL4("pkinsert " << i << ": " << *set.m_row[i]);
+ lst.push(i);
+ if (lst.cnt() == par.m_batch) {
+ bool deadlock = par.m_deadlock;
+ CHK(con.execute(Commit, deadlock) == 0);
con.closeTransaction();
+ if (deadlock) {
+ LL1("pkinsert: stop on deadlock");
+ return 0;
+ }
+ set.lock();
+ set.notpending(lst);
+ set.unlock();
+ lst.reset();
CHK(con.startTransaction() == 0);
- n = 0;
}
}
- if (n != 0) {
- CHK(con.execute(Commit) == 0);
- n = 0;
+ if (lst.cnt() != 0) {
+ bool deadlock = par.m_deadlock;
+ CHK(con.execute(Commit, deadlock) == 0);
+ con.closeTransaction();
+ if (deadlock) {
+ LL1("pkinsert: stop on deadlock");
+ return 0;
+ }
+ set.lock();
+ set.notpending(lst);
+ set.unlock();
+ return 0;
}
con.closeTransaction();
return 0;
@@ -1840,28 +2088,45 @@ pkupdate(Par par)
Set& set = par.set();
LL3("pkupdate");
CHK(con.startTransaction() == 0);
- unsigned n = 0;
+ Lst lst;
+ bool deadlock = false;
for (unsigned j = 0; j < par.m_rows; j++) {
unsigned i = thrrow(par, j);
set.lock();
- if (! set.exist(i)) {
+ if (! set.exist(i) || set.pending(i)) {
set.unlock();
continue;
}
set.calc(par, i);
- LL4("pkupdate " << i << ": " << *set.m_row[i]);
- CHKTRY(set.updrow(par, i) == 0, set.unlock());
+ CHK(set.updrow(par, i) == 0);
set.unlock();
- if (++n == par.m_batch) {
- CHK(con.execute(Commit) == 0);
+ LL4("pkupdate " << i << ": " << *set.m_row[i]);
+ lst.push(i);
+ if (lst.cnt() == par.m_batch) {
+ deadlock = par.m_deadlock;
+ CHK(con.execute(Commit, deadlock) == 0);
+ if (deadlock) {
+ LL1("pkupdate: stop on deadlock");
+ break;
+ }
con.closeTransaction();
+ set.lock();
+ set.notpending(lst);
+ set.unlock();
+ lst.reset();
CHK(con.startTransaction() == 0);
- n = 0;
}
}
- if (n != 0) {
- CHK(con.execute(Commit) == 0);
- n = 0;
+ if (! deadlock && lst.cnt() != 0) {
+ deadlock = par.m_deadlock;
+ CHK(con.execute(Commit, deadlock) == 0);
+ if (deadlock) {
+ LL1("pkupdate: stop on deadlock");
+ } else {
+ set.lock();
+ set.notpending(lst);
+ set.unlock();
+ }
}
con.closeTransaction();
return 0;
@@ -1874,27 +2139,44 @@ pkdelete(Par par)
Set& set = par.set();
LL3("pkdelete");
CHK(con.startTransaction() == 0);
- unsigned n = 0;
+ Lst lst;
+ bool deadlock = false;
for (unsigned j = 0; j < par.m_rows; j++) {
unsigned i = thrrow(par, j);
set.lock();
- if (! set.exist(i)) {
+ if (! set.exist(i) || set.pending(i)) {
set.unlock();
continue;
}
- LL4("pkdelete " << i << ": " << *set.m_row[i]);
- CHKTRY(set.delrow(par, i) == 0, set.unlock());
+ CHK(set.delrow(par, i) == 0);
set.unlock();
- if (++n == par.m_batch) {
- CHK(con.execute(Commit) == 0);
+ LL4("pkdelete " << i << ": " << *set.m_row[i]);
+ lst.push(i);
+ if (lst.cnt() == par.m_batch) {
+ deadlock = par.m_deadlock;
+ CHK(con.execute(Commit, deadlock) == 0);
+ if (deadlock) {
+ LL1("pkdelete: stop on deadlock");
+ break;
+ }
con.closeTransaction();
+ set.lock();
+ set.notpending(lst);
+ set.unlock();
+ lst.reset();
CHK(con.startTransaction() == 0);
- n = 0;
}
}
- if (n != 0) {
- CHK(con.execute(Commit) == 0);
- n = 0;
+ if (! deadlock && lst.cnt() != 0) {
+ deadlock = par.m_deadlock;
+ CHK(con.execute(Commit, deadlock) == 0);
+ if (deadlock) {
+ LL1("pkdelete: stop on deadlock");
+ } else {
+ set.lock();
+ set.notpending(lst);
+ set.unlock();
+ }
}
con.closeTransaction();
return 0;
@@ -1905,21 +2187,25 @@ pkread(Par par)
{
Con& con = par.con();
const Tab& tab = par.tab();
- const Set& set = par.set();
+ Set& set = par.set();
LL3((par.m_verify ? "pkverify " : "pkread ") << tab.m_name);
// expected
const Set& set1 = set;
Set set2(tab, set.m_rows);
for (unsigned i = 0; i < set.m_rows; i++) {
- if (! set.exist(i))
+ set.lock();
+ if (! set.exist(i) || set.pending(i)) {
+ set.unlock();
continue;
+ }
+ set.unlock();
CHK(con.startTransaction() == 0);
CHK(set2.selrow(par, i) == 0);
CHK(con.execute(Commit) == 0);
unsigned i2 = (unsigned)-1;
CHK(set2.getkey(par, &i2) == 0 && i == i2);
CHK(set2.putval(i, false) == 0);
- LL4("row " << set2.m_count << ": " << *set2.m_row[i]);
+ LL4("row " << set2.count() << ": " << *set2.m_row[i]);
con.closeTransaction();
}
if (par.m_verify)
@@ -1927,6 +2213,32 @@ pkread(Par par)
return 0;
}
+static int
+pkreadfast(Par par, unsigned count)
+{
+ Con& con = par.con();
+ const Tab& tab = par.tab();
+ const Set& set = par.set();
+ LL3("pkfast " << tab.m_name);
+ Row keyrow(tab);
+ // not batched on purpose
+ for (unsigned j = 0; j < count; j++) {
+ unsigned i = urandom(set.m_rows);
+ assert(set.exist(i));
+ CHK(con.startTransaction() == 0);
+ // define key
+ keyrow.calc(par, i);
+ CHK(keyrow.selrow(par) == 0);
+ NdbRecAttr* rec;
+ CHK(con.getValue((Uint32)0, rec) == 0);
+ CHK(con.executeScan() == 0);
+ // get 1st column
+ CHK(con.execute(Commit) == 0);
+ con.closeTransaction();
+ }
+ return 0;
+}
+
// scan read
static int
@@ -1946,13 +2258,13 @@ scanreadtable(Par par)
CHK(con.executeScan() == 0);
while (1) {
int ret;
- CHK((ret = con.nextScanResult()) == 0 || ret == 1);
+ CHK((ret = con.nextScanResult(true)) == 0 || ret == 1);
if (ret == 1)
break;
unsigned i = (unsigned)-1;
CHK(set2.getkey(par, &i) == 0);
CHK(set2.putval(i, false) == 0);
- LL4("row " << set2.m_count << ": " << *set2.m_row[i]);
+ LL4("row " << set2.count() << ": " << *set2.m_row[i]);
}
con.closeTransaction();
if (par.m_verify)
@@ -1961,6 +2273,33 @@ scanreadtable(Par par)
}
static int
+scanreadtablefast(Par par, unsigned countcheck)
+{
+ Con& con = par.con();
+ const Tab& tab = par.tab();
+ const Set& set = par.set();
+ LL3("scanfast " << tab.m_name);
+ CHK(con.startTransaction() == 0);
+ CHK(con.getNdbScanOperation(tab) == 0);
+ CHK(con.openScanRead(par.m_scanrd) == 0);
+ // get 1st column
+ NdbRecAttr* rec;
+ CHK(con.getValue((Uint32)0, rec) == 0);
+ CHK(con.executeScan() == 0);
+ unsigned count = 0;
+ while (1) {
+ int ret;
+ CHK((ret = con.nextScanResult(true)) == 0 || ret == 1);
+ if (ret == 1)
+ break;
+ count++;
+ }
+ con.closeTransaction();
+ CHK(count == countcheck);
+ return 0;
+}
+
+static int
scanreadindex(Par par, const ITab& itab, const BSet& bset)
{
Con& con = par.con();
@@ -1980,14 +2319,14 @@ scanreadindex(Par par, const ITab& itab, const BSet& bset)
CHK(con.executeScan() == 0);
while (1) {
int ret;
- CHK((ret = con.nextScanResult()) == 0 || ret == 1);
+ CHK((ret = con.nextScanResult(true)) == 0 || ret == 1);
if (ret == 1)
break;
unsigned i = (unsigned)-1;
CHK(set2.getkey(par, &i) == 0);
LL4("key " << i);
CHK(set2.putval(i, par.m_dups) == 0);
- LL4("row " << set2.m_count << ": " << *set2.m_row[i]);
+ LL4("row " << set2.count() << ": " << *set2.m_row[i]);
}
con.closeTransaction();
if (par.m_verify)
@@ -1996,10 +2335,39 @@ scanreadindex(Par par, const ITab& itab, const BSet& bset)
}
static int
+scanreadindexfast(Par par, const ITab& itab, const BSet& bset, unsigned countcheck)
+{
+ Con& con = par.con();
+ const Tab& tab = par.tab();
+ const Set& set = par.set();
+ LL3("scanfast " << itab.m_name << " bounds=" << bset.m_bvals);
+ LL4(bset);
+ CHK(con.startTransaction() == 0);
+ CHK(con.getNdbScanOperation(itab, tab) == 0);
+ CHK(con.openScanRead(par.m_scanrd) == 0);
+ CHK(bset.setbnd(par) == 0);
+ // get 1st column
+ NdbRecAttr* rec;
+ CHK(con.getValue((Uint32)0, rec) == 0);
+ CHK(con.executeScan() == 0);
+ unsigned count = 0;
+ while (1) {
+ int ret;
+ CHK((ret = con.nextScanResult(true)) == 0 || ret == 1);
+ if (ret == 1)
+ break;
+ count++;
+ }
+ con.closeTransaction();
+ CHK(count == countcheck);
+ return 0;
+}
+
+static int
scanreadindex(Par par, const ITab& itab)
{
const Tab& tab = par.tab();
- for (unsigned i = 0; i < par.m_subloop; i++) {
+ for (unsigned i = 0; i < par.m_idxloop; i++) {
BSet bset(tab, itab, par.m_rows);
bset.calc(par);
CHK(scanreadindex(par, itab, bset) == 0);
@@ -2029,6 +2397,60 @@ scanreadall(Par par)
return 0;
}
+// timing scans
+
+static int
+timescantable(Par par)
+{
+ par.tmr().on();
+ CHK(scanreadtablefast(par, par.m_totrows) == 0);
+ par.tmr().off(par.set().m_rows);
+ return 0;
+}
+
+static int
+timescanpkindex(Par par)
+{
+ const Tab& tab = par.tab();
+ const ITab& itab = tab.m_itab[0]; // 1st index is on PK
+ BSet bset(tab, itab, par.m_rows);
+ par.tmr().on();
+ CHK(scanreadindexfast(par, itab, bset, par.m_totrows) == 0);
+ par.tmr().off(par.set().m_rows);
+ return 0;
+}
+
+static int
+timepkreadtable(Par par)
+{
+ par.tmr().on();
+ unsigned count = par.m_samples;
+ if (count == 0)
+ count = par.m_totrows;
+ CHK(pkreadfast(par, count) == 0);
+ par.tmr().off(count);
+ return 0;
+}
+
+static int
+timepkreadindex(Par par)
+{
+ const Tab& tab = par.tab();
+ const ITab& itab = tab.m_itab[0]; // 1st index is on PK
+ BSet bset(tab, itab, par.m_rows);
+ unsigned count = par.m_samples;
+ if (count == 0)
+ count = par.m_totrows;
+ par.tmr().on();
+ for (unsigned j = 0; j < count; j++) {
+ unsigned i = urandom(par.m_totrows);
+ bset.calcpk(par, i);
+ CHK(scanreadindexfast(par, itab, bset, 1) == 0);
+ }
+ par.tmr().off(count);
+ return 0;
+}
+
// scan update
static int
@@ -2047,29 +2469,63 @@ scanupdatetable(Par par)
unsigned count = 0;
// updating trans
Con con2;
- con2.m_ndb = con.m_ndb;
- CHK(con2.startBuddyTransaction(con) == 0);
+ con2.connect(con);
+ CHK(con2.startTransaction() == 0);
+ Lst lst;
+ bool deadlock = false;
while (1) {
int ret;
- CHK((ret = con.nextScanResult()) == 0 || ret == 1);
+ deadlock = par.m_deadlock;
+ CHK((ret = con.nextScanResult(true, deadlock)) == 0 || ret == 1);
+ if (ret == 1)
+ break;
+ if (deadlock) {
+ LL1("scanupdatetable: stop on deadlock");
+ break;
+ }
+ do {
+ unsigned i = (unsigned)-1;
+ CHK(set2.getkey(par, &i) == 0);
+ const Row& row = *set.m_row[i];
+ set.lock();
+ if (! set.exist(i) || set.pending(i)) {
+ LL4("scan update " << tab.m_name << ": skip: " << row);
+ } else {
+ CHKTRY(set2.putval(i, false) == 0, set.unlock());
+ CHKTRY(con.updateScanTuple(con2) == 0, set.unlock());
+ Par par2 = par;
+ par2.m_con = &con2;
+ set.calc(par, i);
+ CHKTRY(set.setrow(par2, i) == 0, set.unlock());
+ LL4("scan update " << tab.m_name << ": " << row);
+ lst.push(i);
+ }
+ set.unlock();
+ if (lst.cnt() == par.m_batch) {
+ CHK(con2.execute(Commit) == 0);
+ con2.closeTransaction();
+ set.lock();
+ set.notpending(lst);
+ set.unlock();
+ count += lst.cnt();
+ lst.reset();
+ CHK(con2.startTransaction() == 0);
+ }
+ CHK((ret = con.nextScanResult(false)) == 0 || ret == 1 || ret == 2);
+ if (ret == 2 && lst.cnt() != 0) {
+ CHK(con2.execute(Commit) == 0);
+ con2.closeTransaction();
+ set.lock();
+ set.notpending(lst);
+ set.unlock();
+ count += lst.cnt();
+ lst.reset();
+ CHK(con2.startTransaction() == 0);
+ }
+ } while (ret == 0);
if (ret == 1)
break;
- unsigned i = (unsigned)-1;
- CHK(set2.getkey(par, &i) == 0);
- LL4("key " << i);
- CHK(set2.putval(i, false) == 0);
- CHK(con2.takeOverForUpdate(con) == 0);
- Par par2 = par;
- par2.m_con = &con2;
- set.lock();
- set.calc(par, i);
- LL4("scan update " << tab.m_name << ": " << *set.m_row[i]);
- CHKTRY(set.setrow(par2, i) == 0, set.unlock());
- set.unlock();
- CHK(con2.execute(NoCommit) == 0);
- count++;
}
- CHK(con2.execute(Commit) == 0);
con2.closeTransaction();
LL3("scan update " << tab.m_name << " rows updated=" << count);
con.closeTransaction();
@@ -2093,32 +2549,61 @@ scanupdateindex(Par par, const ITab& itab, const BSet& bset)
unsigned count = 0;
// updating trans
Con con2;
- con2.m_ndb = con.m_ndb;
- CHK(con2.startBuddyTransaction(con) == 0);
+ con2.connect(con);
+ CHK(con2.startTransaction() == 0);
+ Lst lst;
+ bool deadlock = false;
while (1) {
int ret;
- CHK((ret = con.nextScanResult()) == 0 || ret == 1);
+ deadlock = par.m_deadlock;
+ CHK((ret = con.nextScanResult(true, deadlock)) == 0 || ret == 1);
if (ret == 1)
break;
- unsigned i = (unsigned)-1;
- CHK(set2.getkey(par, &i) == 0);
- LL4("key " << i);
- CHK(set2.putval(i, par.m_dups) == 0);
- // avoid deadlock for now
- //if (! isthrrow(par, i))
- //continue;
- CHK(con2.takeOverForUpdate(con) == 0);
- Par par2 = par;
- par2.m_con = &con2;
- set.lock();
- set.calc(par, i);
- LL4("scan update " << itab.m_name << ": " << *set.m_row[i]);
- CHKTRY(set.setrow(par2, i) == 0, set.unlock());
- set.unlock();
- CHK(con2.execute(NoCommit) == 0);
- count++;
+ if (deadlock) {
+ LL1("scanupdateindex: stop on deadlock");
+ break;
+ }
+ do {
+ unsigned i = (unsigned)-1;
+ CHK(set2.getkey(par, &i) == 0);
+ const Row& row = *set.m_row[i];
+ set.lock();
+ if (! set.exist(i) || set.pending(i)) {
+ LL4("scan update " << itab.m_name << ": skip: " << row);
+ } else {
+ CHKTRY(set2.putval(i, par.m_dups) == 0, set.unlock());
+ CHKTRY(con.updateScanTuple(con2) == 0, set.unlock());
+ Par par2 = par;
+ par2.m_con = &con2;
+ set.calc(par, i);
+ CHKTRY(set.setrow(par2, i) == 0, set.unlock());
+ LL4("scan update " << itab.m_name << ": " << row);
+ lst.push(i);
+ }
+ set.unlock();
+ if (lst.cnt() == par.m_batch) {
+ CHK(con2.execute(Commit) == 0);
+ con2.closeTransaction();
+ set.lock();
+ set.notpending(lst);
+ set.unlock();
+ count += lst.cnt();
+ lst.reset();
+ CHK(con2.startTransaction() == 0);
+ }
+ CHK((ret = con.nextScanResult(false)) == 0 || ret == 1 || ret == 2);
+ if (ret == 2 && lst.cnt() != 0) {
+ CHK(con2.execute(Commit) == 0);
+ con2.closeTransaction();
+ set.lock();
+ set.notpending(lst);
+ set.unlock();
+ count += lst.cnt();
+ lst.reset();
+ CHK(con2.startTransaction() == 0);
+ }
+ } while (ret == 0);
}
- CHK(con2.execute(Commit) == 0);
con2.closeTransaction();
LL3("scan update " << itab.m_name << " rows updated=" << count);
con.closeTransaction();
@@ -2129,7 +2614,7 @@ static int
scanupdateindex(Par par, const ITab& itab)
{
const Tab& tab = par.tab();
- for (unsigned i = 0; i < par.m_subloop; i++) {
+ for (unsigned i = 0; i < par.m_idxloop; i++) {
BSet bset(tab, itab, par.m_rows);
bset.calc(par);
CHK(scanupdateindex(par, itab, bset) == 0);
@@ -2160,41 +2645,15 @@ scanupdateall(Par par)
// medium level routines
-static bool
-ignoreverifyerror(Par par)
-{
- Con& con = par.con();
- bool b = par.m_threads > 1;
- if (b) {
- LL1("ignore verify error");
- if (con.m_tx != 0)
- con.closeTransaction();
- return true;
- }
- return b;
-}
-
static int
readverify(Par par)
{
par.m_verify = true;
- CHK(pkread(par) == 0 || ignoreverifyerror(par));
- CHK(scanreadall(par) == 0 || ignoreverifyerror(par));
+ CHK(pkread(par) == 0);
+ CHK(scanreadall(par) == 0);
return 0;
}
-static bool
-ignoredeadlock(Par par)
-{
- Con& con = par.con();
- if (con.m_errtype == Con::ErrDeadlock) {
- LL1("ignore deadlock");
- con.closeTransaction();
- return true;
- }
- return false;
-}
-
static int
pkupdatescanread(Par par)
{
@@ -2216,15 +2675,16 @@ static int
mixedoperations(Par par)
{
par.m_dups = true;
+ par.m_deadlock = true;
unsigned sel = urandom(10);
if (sel < 2) {
- CHK(pkdelete(par) == 0 || ignoredeadlock(par));
+ CHK(pkdelete(par) == 0);
} else if (sel < 4) {
- CHK(pkupdate(par) == 0 || ignoredeadlock(par));
+ CHK(pkupdate(par) == 0);
} else if (sel < 6) {
- CHK(scanupdatetable(par) == 0 || ignoredeadlock(par));
+ CHK(scanupdatetable(par) == 0);
} else {
- CHK(scanupdateindex(par) == 0 || ignoredeadlock(par));
+ CHK(scanupdateindex(par) == 0);
}
return 0;
}
@@ -2358,7 +2818,6 @@ Thr::run()
break;
}
LL4("start");
- CHK(con.bugger() == 0);
assert(m_state == Start);
m_ret = (*m_func)(m_par);
m_state = Stopped;
@@ -2438,6 +2897,7 @@ runstep(Par par, const char* fname, TFunc func, unsigned mode)
Thr& thr = *g_thrlist[n];
thr.m_par.m_tab = par.m_tab;
thr.m_par.m_set = par.m_set;
+ thr.m_par.m_tmr = par.m_tmr;
thr.m_func = func;
thr.start();
}
@@ -2488,13 +2948,13 @@ tpkops(Par par)
RUNSTEP(par, pkinsert, MT);
RUNSTEP(par, createindex, ST);
RUNSTEP(par, invalidateindex, MT);
- RUNSTEP(par, readverify, MT);
+ RUNSTEP(par, readverify, ST);
for (unsigned i = 0; i < par.m_subloop; i++) {
RUNSTEP(par, pkupdatescanread, MT);
- RUNSTEP(par, readverify, MT);
+ RUNSTEP(par, readverify, ST);
}
RUNSTEP(par, pkdelete, MT);
- RUNSTEP(par, readverify, MT);
+ RUNSTEP(par, readverify, ST);
return 0;
}
@@ -2507,10 +2967,10 @@ tmixedops(Par par)
RUNSTEP(par, pkinsert, MT);
RUNSTEP(par, createindex, ST);
RUNSTEP(par, invalidateindex, MT);
- RUNSTEP(par, readverify, MT);
+ RUNSTEP(par, readverify, ST);
for (unsigned i = 0; i < par.m_subloop; i++) {
RUNSTEP(par, mixedoperations, MT);
- RUNSTEP(par, readverify, MT);
+ RUNSTEP(par, readverify, ST);
}
return 0;
}
@@ -2525,7 +2985,7 @@ tbusybuild(Par par)
for (unsigned i = 0; i < par.m_subloop; i++) {
RUNSTEP(par, pkupdateindexbuild, MT);
RUNSTEP(par, invalidateindex, MT);
- RUNSTEP(par, readverify, MT);
+ RUNSTEP(par, readverify, ST);
RUNSTEP(par, dropindex, ST);
}
return 0;
@@ -2576,6 +3036,50 @@ ttimemaint(Par par)
}
static int
+ttimescan(Par par)
+{
+ Tmr t1, t2;
+ RUNSTEP(par, droptable, ST);
+ RUNSTEP(par, createtable, ST);
+ RUNSTEP(par, invalidatetable, MT);
+ for (unsigned i = 0; i < par.m_subloop; i++) {
+ RUNSTEP(par, pkinsert, MT);
+ RUNSTEP(par, createindex, ST);
+ par.m_tmr = &t1;
+ RUNSTEP(par, timescantable, ST);
+ par.m_tmr = &t2;
+ RUNSTEP(par, timescanpkindex, ST);
+ RUNSTEP(par, dropindex, ST);
+ }
+ LL1("full scan table - " << t1.time());
+ LL1("full scan PK index - " << t2.time());
+ LL1("overhead - " << t2.over(t1));
+ return 0;
+}
+
+static int
+ttimepkread(Par par)
+{
+ Tmr t1, t2;
+ RUNSTEP(par, droptable, ST);
+ RUNSTEP(par, createtable, ST);
+ RUNSTEP(par, invalidatetable, MT);
+ for (unsigned i = 0; i < par.m_subloop; i++) {
+ RUNSTEP(par, pkinsert, MT);
+ RUNSTEP(par, createindex, ST);
+ par.m_tmr = &t1;
+ RUNSTEP(par, timepkreadtable, ST);
+ par.m_tmr = &t2;
+ RUNSTEP(par, timepkreadindex, ST);
+ RUNSTEP(par, dropindex, ST);
+ }
+ LL1("pk read table - " << t1.time());
+ LL1("pk read PK index - " << t2.time());
+ LL1("overhead - " << t2.over(t1));
+ return 0;
+}
+
+static int
tdrop(Par par)
{
RUNSTEP(par, droptable, ST);
@@ -2601,6 +3105,8 @@ tcaselist[] = {
TCase("d", tbusybuild, "pk operations and index build"),
TCase("t", ttimebuild, "time index build"),
TCase("u", ttimemaint, "time index maintenance"),
+ TCase("v", ttimescan, "time full scan table vs index on pk"),
+ TCase("w", ttimepkread, "time pk read table vs index on pk"),
TCase("z", tdrop, "drop test tables")
};
@@ -2620,7 +3126,7 @@ printcases()
static void
printtables()
{
- ndbout << "tables and indexes:" << endl;
+ ndbout << "tables and indexes (X1 is on table PK):" << endl;
for (unsigned j = 0; j < tabcount; j++) {
const Tab& tab = tablist[j];
ndbout << " " << tab.m_name;
@@ -2636,7 +3142,8 @@ static int
runtest(Par par)
{
LL1("start");
- srandom(par.m_seed);
+ if (par.m_seed != 0)
+ srandom(par.m_seed);
Con con;
CHK(con.connect() == 0);
par.m_con = &con;
@@ -2651,6 +3158,8 @@ runtest(Par par)
}
for (unsigned l = 0; par.m_loop == 0 || l < par.m_loop; l++) {
LL1("loop " << l);
+ if (par.m_seed == 0)
+ srandom(l);
for (unsigned i = 0; i < tcasecount; i++) {
const TCase& tcase = tcaselist[i];
if (par.m_case != 0 && strchr(par.m_case, tcase.m_name[0]) == 0)
@@ -2661,8 +3170,8 @@ runtest(Par par)
continue;
const Tab& tab = tablist[j];
par.m_tab = &tab;
- Set set(tab, par.m_totrows);
- par.m_set = &set;
+ delete par.m_set;
+ par.m_set = new Set(tab, par.m_totrows);
LL1("table " << tab.m_name);
CHK(tcase.m_func(par) == 0);
}
@@ -2692,6 +3201,12 @@ NDB_COMMAND(testOIBasic, "testOIBasic", "testOIBasic", "testOIBasic", 65535)
ndbout << "testOIBasic: unknown argument " << arg;
goto usage;
}
+ if (strcmp(arg, "-batch") == 0) {
+ if (++argv, --argc > 0) {
+ g_opt.m_batch = atoi(argv[0]);
+ continue;
+ }
+ }
if (strcmp(arg, "-case") == 0) {
if (++argv, --argc > 0) {
g_opt.m_case = strdup(argv[0]);
@@ -2748,6 +3263,12 @@ NDB_COMMAND(testOIBasic, "testOIBasic", "testOIBasic", "testOIBasic", 65535)
continue;
}
}
+ if (strcmp(arg, "-samples") == 0) {
+ if (++argv, --argc > 0) {
+ g_opt.m_samples = atoi(argv[0]);
+ continue;
+ }
+ }
if (strcmp(arg, "-scanrd") == 0) {
if (++argv, --argc > 0) {
g_opt.m_scanrd = atoi(argv[0]);
diff --git a/ndb/test/run-test/daily-basic-tests.txt b/ndb/test/run-test/daily-basic-tests.txt
index 0b64d9cf9c2..d34c37021bf 100644
--- a/ndb/test/run-test/daily-basic-tests.txt
+++ b/ndb/test/run-test/daily-basic-tests.txt
@@ -152,33 +152,33 @@ cmd: testBasic
args: -n MassiveRollback2 T1 T6 T13
#-m 500 1: testBasic -n ReadConsistency T6
-max-time: 500
-cmd: testTimeout
-args: -n DontTimeoutTransaction T1
-
-max-time: 500
-cmd: testTimeout
-args: -n DontTimeoutTransaction5 T1
-
-max-time: 500
-cmd: testTimeout
-args: -n TimeoutTransaction T1
-
-max-time: 500
-cmd: testTimeout
-args: -n TimeoutTransaction5 T1
-
-max-time: 500
-cmd: testTimeout
-args: -n BuddyTransNoTimeout T1
-
-max-time: 500
-cmd: testTimeout
-args: -n BuddyTransNoTimeout5 T1
-
-max-time: 500
-cmd: testTimeout
-args: -n TimeoutRandTransaction T1
+#max-time: 500
+#cmd: testTimeout
+#args: -n DontTimeoutTransaction T1
+#
+#max-time: 500
+#cmd: testTimeout
+#args: -n DontTimeoutTransaction5 T1
+#
+#max-time: 500
+#cmd: testTimeout
+#args: -n TimeoutTransaction T1
+#
+#max-time: 500
+#cmd: testTimeout
+#args: -n TimeoutTransaction5 T1
+#
+#max-time: 500
+#cmd: testTimeout
+#args: -n BuddyTransNoTimeout T1
+#
+#max-time: 500
+#cmd: testTimeout
+#args: -n BuddyTransNoTimeout5 T1
+#
+#max-time: 500
+#cmd: testTimeout
+#args: -n TimeoutRandTransaction T1
#
# SCAN TESTS
#
@@ -474,10 +474,10 @@ max-time: 500
cmd: testNdbApi
args: -n UpdateWithoutValues T6
-max-time: 500
-cmd: testInterpreter
-args: T1
-
+#max-time: 500
+#cmd: testInterpreter
+#args: T1
+#
max-time: 1500
cmd: testOperations
args: -n ReadRead
diff --git a/ndb/test/run-test/main.cpp b/ndb/test/run-test/main.cpp
index 865fe8b49a0..0ea700e1d66 100644
--- a/ndb/test/run-test/main.cpp
+++ b/ndb/test/run-test/main.cpp
@@ -106,13 +106,6 @@ main(int argc, const char ** argv){
if(!setup_hosts(g_config))
goto end;
- if(!start_processes(g_config, atrt_process::NDB_MGM))
- goto end;
-
- if(!connect_ndb_mgm(g_config)){
- goto end;
- }
-
/**
* Main loop
*/
@@ -122,25 +115,32 @@ main(int argc, const char ** argv){
*/
if(restart){
g_logger.info("(Re)starting ndb processes");
+ if(!stop_processes(g_config, atrt_process::NDB_MGM))
+ goto end;
+
if(!stop_processes(g_config, atrt_process::NDB_DB))
goto end;
- if(!wait_ndb(g_config, NDB_MGM_NODE_STATUS_NO_CONTACT))
+ if(!start_processes(g_config, atrt_process::NDB_MGM))
goto end;
+ if(!connect_ndb_mgm(g_config)){
+ goto end;
+ }
+
if(!start_processes(g_config, atrt_process::NDB_DB))
goto end;
-
+
if(!wait_ndb(g_config, NDB_MGM_NODE_STATUS_NOT_STARTED))
goto end;
-
+
for(Uint32 i = 0; i<3; i++)
if(wait_ndb(g_config, NDB_MGM_NODE_STATUS_STARTED))
goto started;
-
+
goto end;
-
-started:
+
+ started:
g_logger.info("Ndb start completed");
}
@@ -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 dc94955d90b..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,13 +1358,13 @@ HugoTransactions::pkUpdateRecords(Ndb* pNdb,
int r = 0;
int retryAttempt = 0;
const int retryMax = 100;
- int check;
+ int check, a, b;
NdbConnection *pTrans;
NdbOperation *pOp;
allocRows(batch);
- g_info << "|- Updating records..." << endl;
+ g_info << "|- Updating records (batch=" << batch << ")..." << endl;
while (r < records){
if (retryAttempt >= retryMax){
@@ -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;