diff options
Diffstat (limited to 'ndb')
31 files changed, 284 insertions, 165 deletions
diff --git a/ndb/include/kernel/Interpreter.hpp b/ndb/include/kernel/Interpreter.hpp index 74399f5732e..69c952ea7c3 100644 --- a/ndb/include/kernel/Interpreter.hpp +++ b/ndb/include/kernel/Interpreter.hpp @@ -45,31 +45,31 @@ public: /** * Instructions */ - static const Uint32 READ_ATTR_INTO_REG = 1; - static const Uint32 WRITE_ATTR_FROM_REG = 2; - static const Uint32 LOAD_CONST_NULL = 3; - static const Uint32 LOAD_CONST16 = 4; - static const Uint32 LOAD_CONST32 = 5; - static const Uint32 LOAD_CONST64 = 6; - static const Uint32 ADD_REG_REG = 7; - static const Uint32 SUB_REG_REG = 8; - static const Uint32 BRANCH = 9; - static const Uint32 BRANCH_REG_EQ_NULL = 10; - static const Uint32 BRANCH_REG_NE_NULL = 11; - static const Uint32 BRANCH_EQ_REG_REG = 12; - static const Uint32 BRANCH_NE_REG_REG = 13; - static const Uint32 BRANCH_LT_REG_REG = 14; - static const Uint32 BRANCH_LE_REG_REG = 15; - static const Uint32 BRANCH_GT_REG_REG = 16; - static const Uint32 BRANCH_GE_REG_REG = 17; - static const Uint32 EXIT_OK = 18; - static const Uint32 EXIT_REFUSE = 19; - static const Uint32 CALL = 20; - static const Uint32 RETURN = 21; - static const Uint32 EXIT_OK_LAST = 22; - static const Uint32 BRANCH_ATTR_OP_ARG = 23; - static const Uint32 BRANCH_ATTR_EQ_NULL = 24; - static const Uint32 BRANCH_ATTR_NE_NULL = 25; + STATIC_CONST( READ_ATTR_INTO_REG = 1 ); + STATIC_CONST( WRITE_ATTR_FROM_REG = 2 ); + STATIC_CONST( LOAD_CONST_NULL = 3 ); + STATIC_CONST( LOAD_CONST16 = 4 ); + STATIC_CONST( LOAD_CONST32 = 5 ); + STATIC_CONST( LOAD_CONST64 = 6 ); + STATIC_CONST( ADD_REG_REG = 7 ); + STATIC_CONST( SUB_REG_REG = 8 ); + STATIC_CONST( BRANCH = 9 ); + STATIC_CONST( BRANCH_REG_EQ_NULL = 10 ); + STATIC_CONST( BRANCH_REG_NE_NULL = 11 ); + STATIC_CONST( BRANCH_EQ_REG_REG = 12 ); + STATIC_CONST( BRANCH_NE_REG_REG = 13 ); + STATIC_CONST( BRANCH_LT_REG_REG = 14 ); + STATIC_CONST( BRANCH_LE_REG_REG = 15 ); + STATIC_CONST( BRANCH_GT_REG_REG = 16 ); + STATIC_CONST( BRANCH_GE_REG_REG = 17 ); + STATIC_CONST( EXIT_OK = 18 ); + STATIC_CONST( EXIT_REFUSE = 19 ); + STATIC_CONST( CALL = 20 ); + STATIC_CONST( RETURN = 21 ); + STATIC_CONST( EXIT_OK_LAST = 22 ); + STATIC_CONST( BRANCH_ATTR_OP_ARG = 23 ); + STATIC_CONST( BRANCH_ATTR_EQ_NULL = 24 ); + STATIC_CONST( BRANCH_ATTR_NE_NULL = 25 ); /** * Macros for creating code diff --git a/ndb/include/kernel/LogLevel.hpp b/ndb/include/kernel/LogLevel.hpp index 6cfbe44af86..467f0604edd 100644 --- a/ndb/include/kernel/LogLevel.hpp +++ b/ndb/include/kernel/LogLevel.hpp @@ -66,7 +66,7 @@ public: * No of categories */ #define _LOGLEVEL_CATEGORIES (CFG_MAX_LOGLEVEL - CFG_MIN_LOGLEVEL + 1) - static const Uint32 LOGLEVEL_CATEGORIES = _LOGLEVEL_CATEGORIES; + STATIC_CONST( LOGLEVEL_CATEGORIES = _LOGLEVEL_CATEGORIES ); void clear(); diff --git a/ndb/include/kernel/NodeState.hpp b/ndb/include/kernel/NodeState.hpp index 185e3ea8ea4..16784ecde79 100644 --- a/ndb/include/kernel/NodeState.hpp +++ b/ndb/include/kernel/NodeState.hpp @@ -100,7 +100,7 @@ public: /** * Length in 32-bit words */ - static const Uint32 DataLength = 8 + NdbNodeBitmask::Size; + STATIC_CONST( DataLength = 8 + NdbNodeBitmask::Size ); /** * Constructor(s) diff --git a/ndb/include/kernel/ndb_limits.h b/ndb/include/kernel/ndb_limits.h index 88fcff22da7..48a56c019bb 100644 --- a/ndb/include/kernel/ndb_limits.h +++ b/ndb/include/kernel/ndb_limits.h @@ -117,4 +117,9 @@ */ #define NDB_BLOB_HEAD_SIZE 2 /* sizeof(NdbBlob::Head) >> 2 */ +/* + * Long signals + */ +#define NDB_SECTION_SEGMENT_SZ 60 + #endif diff --git a/ndb/include/kernel/signaldata/DictSchemaInfo.hpp b/ndb/include/kernel/signaldata/DictSchemaInfo.hpp index d7f82abc299..c15dcf2fd7a 100644 --- a/ndb/include/kernel/signaldata/DictSchemaInfo.hpp +++ b/ndb/include/kernel/signaldata/DictSchemaInfo.hpp @@ -26,8 +26,8 @@ class DictSchemaInfo { friend class Dbdict; public: - static const unsigned HeaderLength = 3; - static const unsigned DataLength = 22; + STATIC_CONST( HeaderLength = 3 ); + STATIC_CONST( DataLength = 22 ); private: Uint32 senderRef; diff --git a/ndb/include/kernel/signaldata/DictTabInfo.hpp b/ndb/include/kernel/signaldata/DictTabInfo.hpp index df0ac988e6e..6b4a3f34553 100644 --- a/ndb/include/kernel/signaldata/DictTabInfo.hpp +++ b/ndb/include/kernel/signaldata/DictTabInfo.hpp @@ -221,33 +221,33 @@ public: }; // ScanOptimised constants - static const unsigned updateOptimised = 0; - static const unsigned scanOptimised = 1; + STATIC_CONST( updateOptimised = 0 ); + STATIC_CONST( scanOptimised = 1 ); // AttributeType constants - static const unsigned SignedType = 0; - static const unsigned UnSignedType = 1; - static const unsigned FloatingPointType = 2; - static const unsigned StringType = 3; + STATIC_CONST( SignedType = 0 ); + STATIC_CONST( UnSignedType = 1 ); + STATIC_CONST( FloatingPointType = 2 ); + STATIC_CONST( StringType = 3 ); // AttributeSize constants - static const unsigned an8Bit = 3; - static const unsigned a16Bit = 4; - static const unsigned a32Bit = 5; - static const unsigned a64Bit = 6; - static const unsigned a128Bit = 7; + STATIC_CONST( an8Bit = 3 ); + STATIC_CONST( a16Bit = 4 ); + STATIC_CONST( a32Bit = 5 ); + STATIC_CONST( a64Bit = 6 ); + STATIC_CONST( a128Bit = 7 ); // AttributeDGroup constants - static const unsigned NotDGroup = 0; - static const unsigned DGroup = 1; + STATIC_CONST( NotDGroup = 0 ); + STATIC_CONST( DGroup = 1 ); // AttributeDKey constants - static const unsigned NotDKey = 0; - static const unsigned DKey = 1; + STATIC_CONST( NotDKey = 0 ); + STATIC_CONST( DKey = 1 ); // AttributeStoredInd constants - static const unsigned NotStored = 0; - static const unsigned Stored = 1; + STATIC_CONST( NotStored = 0 ); + STATIC_CONST( Stored = 1 ); // Table data interpretation struct Table { diff --git a/ndb/include/kernel/signaldata/ScanTab.hpp b/ndb/include/kernel/signaldata/ScanTab.hpp index fb5f18eae9e..2029b16197e 100644 --- a/ndb/include/kernel/signaldata/ScanTab.hpp +++ b/ndb/include/kernel/signaldata/ScanTab.hpp @@ -252,7 +252,7 @@ public: * Length of signal */ STATIC_CONST( SignalLength = 4 ); - static const Uint32 EndOfData = (1 << 31); + STATIC_CONST( EndOfData = (1 << 31) ); private: diff --git a/ndb/include/kernel/signaldata/UpgradeStartup.hpp b/ndb/include/kernel/signaldata/UpgradeStartup.hpp index a4450221c59..93fef323789 100644 --- a/ndb/include/kernel/signaldata/UpgradeStartup.hpp +++ b/ndb/include/kernel/signaldata/UpgradeStartup.hpp @@ -7,10 +7,10 @@ struct UpgradeStartup { static void installEXEC(SimulatedBlock*); - static const Uint32 GSN_CM_APPCHG = 131; - static const Uint32 GSN_CNTR_MASTERCONF = 148; - static const Uint32 GSN_CNTR_MASTERREF = 149; - static const Uint32 GSN_CNTR_MASTERREQ = 150; + STATIC_CONST( GSN_CM_APPCHG = 131 ); + STATIC_CONST( GSN_CNTR_MASTERCONF = 148 ); + STATIC_CONST( GSN_CNTR_MASTERREF = 149 ); + STATIC_CONST( GSN_CNTR_MASTERREQ = 150 ); static void sendCmAppChg(Ndbcntr&, Signal *, Uint32 startLevel); static void execCM_APPCHG(SimulatedBlock& block, Signal*); diff --git a/ndb/include/logger/FileLogHandler.hpp b/ndb/include/logger/FileLogHandler.hpp index 08e46c11844..8fb25e72be7 100644 --- a/ndb/include/logger/FileLogHandler.hpp +++ b/ndb/include/logger/FileLogHandler.hpp @@ -37,11 +37,11 @@ class FileLogHandler : public LogHandler { public: /** Max number of log files to archive. */ - static const int MAX_NO_FILES = 6; + STATIC_CONST( MAX_NO_FILES = 6 ); /** Max file size of the log before archiving. */ - static const long MAX_FILE_SIZE = 1024000; + STATIC_CONST( MAX_FILE_SIZE = 1024000 ); /** Max number of log entries before archiving. */ - static const unsigned int MAX_LOG_ENTRIES = 10000; + STATIC_CONST( MAX_LOG_ENTRIES = 10000 ); /** * Default constructor. diff --git a/ndb/include/logger/LogHandler.hpp b/ndb/include/logger/LogHandler.hpp index 8f76783e6b0..ca4bd4c0668 100644 --- a/ndb/include/logger/LogHandler.hpp +++ b/ndb/include/logger/LogHandler.hpp @@ -157,11 +157,11 @@ public: protected: /** Max length of the date and time header in the log. */ - static const int MAX_DATE_TIME_HEADER_LENGTH = 64; + STATIC_CONST( MAX_DATE_TIME_HEADER_LENGTH = 64 ); /** Max length of the header the log. */ - static const int MAX_HEADER_LENGTH = 128; + STATIC_CONST( MAX_HEADER_LENGTH = 128 ); /** Max lenght of footer in the log. */ - static const int MAX_FOOTER_LENGTH = 128; + STATIC_CONST( MAX_FOOTER_LENGTH = 128 ); /** * Write the header to the log. diff --git a/ndb/include/logger/Logger.hpp b/ndb/include/logger/Logger.hpp index d4937c11744..c6145f2091a 100644 --- a/ndb/include/logger/Logger.hpp +++ b/ndb/include/logger/Logger.hpp @@ -279,7 +279,7 @@ private: Logger operator = (const Logger&); bool operator == (const Logger&); - static const int MAX_LOG_LEVELS = 8; + STATIC_CONST( MAX_LOG_LEVELS = 8 ); bool m_logLevels[MAX_LOG_LEVELS]; diff --git a/ndb/include/ndb_global.h b/ndb/include/ndb_global.h index c128323241a..09559f6ddff 100644 --- a/ndb/include/ndb_global.h +++ b/ndb/include/ndb_global.h @@ -63,7 +63,7 @@ static const char table_name_separator = '/'; -#ifdef NDB_VC98 +#if defined(_AIX) || defined(NDB_VC98) #define STATIC_CONST(x) enum { x } #else #define STATIC_CONST(x) static const Uint32 x diff --git a/ndb/include/ndbapi/NdbBlob.hpp b/ndb/include/ndbapi/NdbBlob.hpp index b3c28c9e950..0fb63015da2 100644 --- a/ndb/include/ndbapi/NdbBlob.hpp +++ b/ndb/include/ndbapi/NdbBlob.hpp @@ -182,7 +182,7 @@ public: /** * Get blob parts table name. Useful only to test programs. */ - static const unsigned BlobTableNameSize = 40; + STATIC_CONST( BlobTableNameSize = 40 ); static int getBlobTableName(char* btname, Ndb* anNdb, const char* tableName, const char* columnName); /** * Return error object. The error may be blob specific (below) or may @@ -190,19 +190,19 @@ public: */ const NdbError& getNdbError() const; // "Invalid blob attributes or invalid blob parts table" - static const int ErrTable = 4263; + STATIC_CONST( ErrTable = 4263 ); // "Invalid usage of blob attribute" - static const int ErrUsage = 4264; + STATIC_CONST( ErrUsage = 4264 ); // "Method is not valid in current blob state" - static const int ErrState = 4265; + STATIC_CONST( ErrState = 4265 ); // "Invalid blob seek position" - static const int ErrSeek = 4266; + STATIC_CONST( ErrSeek = 4266 ); // "Corrupted blob value" - static const int ErrCorrupt = 4267; + STATIC_CONST( ErrCorrupt = 4267 ); // "Error in blob head update forced rollback of transaction" - static const int ErrAbort = 4268; + STATIC_CONST( ErrAbort = 4268 ); // "Unknown blob error" - static const int ErrUnknown = 4269; + STATIC_CONST( ErrUnknown = 4269 ); /** * Return info about all blobs in this operation. */ diff --git a/ndb/include/ndbapi/ndbapi_limits.h b/ndb/include/ndbapi/ndbapi_limits.h index 1cf2d9b342d..d1cb135b39d 100644 --- a/ndb/include/ndbapi/ndbapi_limits.h +++ b/ndb/include/ndbapi/ndbapi_limits.h @@ -22,12 +22,13 @@ #define NDB_MAX_DATABASE_NAME_SIZE 128 #define NDB_MAX_SCHEMA_NAME_SIZE 128 #define NDB_MAX_TAB_NAME_SIZE 128 -#define NDB_MAX_ATTRIBUTES_IN_TABLE 91 +#define NDB_MAX_ATTR_NAME_SIZE 32 +#define NDB_MAX_ATTRIBUTES_IN_TABLE 128 -#define NDB_MAX_TUPLE_SIZE_IN_WORDS 1023 +#define NDB_MAX_TUPLE_SIZE_IN_WORDS 2013 #define NDB_MAX_KEYSIZE_IN_WORDS 1023 -#define NDB_MAX_KEY_SIZE NDB_MAX_KEYSIZE_IN_WORDS*sizeof(Uint32) -#define NDB_MAX_TUPLE_SIZE NDB_MAX_TUPLE_SIZE_IN_WORDS*sizeof(uint32) +#define NDB_MAX_KEY_SIZE (NDB_MAX_KEYSIZE_IN_WORDS*4) +#define NDB_MAX_TUPLE_SIZE (NDB_MAX_TUPLE_SIZE_IN_WORDS*4) #define NDB_MAX_ACTIVE_EVENTS 100 #endif diff --git a/ndb/include/util/Properties.hpp b/ndb/include/util/Properties.hpp index df8e2887001..e6668744211 100644 --- a/ndb/include/util/Properties.hpp +++ b/ndb/include/util/Properties.hpp @@ -52,7 +52,7 @@ private: */ class Properties { public: - static const char delimiter = ':'; + static const char delimiter; static const char version[]; Properties(bool case_insensitive= false); diff --git a/ndb/src/common/logger/Logger.cpp b/ndb/src/common/logger/Logger.cpp index fed5c211149..00a2fae67bc 100644 --- a/ndb/src/common/logger/Logger.cpp +++ b/ndb/src/common/logger/Logger.cpp @@ -232,7 +232,7 @@ Logger::enable(LoggerLevel logLevel) { if (logLevel == LL_ALL) { - for (int i = 1; i < MAX_LOG_LEVELS; i++) + for (unsigned i = 1; i < MAX_LOG_LEVELS; i++) { m_logLevels[i] = true; } @@ -264,7 +264,7 @@ Logger::disable(LoggerLevel logLevel) { if (logLevel == LL_ALL) { - for (int i = 0; i < MAX_LOG_LEVELS; i++) + for (unsigned i = 0; i < MAX_LOG_LEVELS; i++) { m_logLevels[i] = false; } diff --git a/ndb/src/common/portlib/NdbSleep.c b/ndb/src/common/portlib/NdbSleep.c index 19ab526fda8..44bafe98a37 100644 --- a/ndb/src/common/portlib/NdbSleep.c +++ b/ndb/src/common/portlib/NdbSleep.c @@ -16,16 +16,21 @@ #include <ndb_global.h> +#include <my_sys.h> #include <NdbSleep.h> int NdbSleep_MilliSleep(int milliseconds){ + my_sleep(milliseconds*1000); + return 0; +#if 0 int result = 0; struct timespec sleeptime; sleeptime.tv_sec = milliseconds / 1000; sleeptime.tv_nsec = (milliseconds - (sleeptime.tv_sec * 1000)) * 1000000; result = nanosleep(&sleeptime, NULL); return result; +#endif } int diff --git a/ndb/src/common/util/Properties.cpp b/ndb/src/common/util/Properties.cpp index a13e31780eb..4443fd45bba 100644 --- a/ndb/src/common/util/Properties.cpp +++ b/ndb/src/common/util/Properties.cpp @@ -31,6 +31,7 @@ char * f_strdup(const char * s){ * Note has to be a multiple of 4 bytes */ const char Properties::version[] = { 2, 0, 0, 1, 1, 1, 1, 4 }; +const char Properties::delimiter = ':'; /** * PropertyImpl diff --git a/ndb/src/common/util/basestring_vsnprintf.c b/ndb/src/common/util/basestring_vsnprintf.c index 10932226d18..87ffb8ad146 100644 --- a/ndb/src/common/util/basestring_vsnprintf.c +++ b/ndb/src/common/util/basestring_vsnprintf.c @@ -18,6 +18,7 @@ #define _XOPEN_SOURCE 500 #include <stdio.h> #include <basestring_vsnprintf.h> +#include <my_config.h> int basestring_snprintf(char *str, size_t size, const char *format, ...) @@ -30,8 +31,27 @@ basestring_snprintf(char *str, size_t size, const char *format, ...) return(ret); } +#ifdef HAVE_SNPRINTF + #define BASESTRING_VSNPRINTF_FUNC(a,b,c,d) vsnprintf(a,b,c,d) +#else + #define SNPRINTF_RETURN_ZERO + #define BASESTRING_VSNPRINTF_FUNC(a,b,c,d) my_vsnprintf(a,b,c,d) + extern int my_vsnprintf(char *str, size_t size, const char *format, va_list ap); +#endif + +#ifdef SNPRINTF_RETURN_ZERO +static char basestring_vsnprintf_buf[16*1024]; +#endif int basestring_vsnprintf(char *str, size_t size, const char *format, va_list ap) { - return(vsnprintf(str, size, format, ap)); + int ret= BASESTRING_VSNPRINTF_FUNC(str, size, format, ap); +#ifdef SNPRINTF_RETURN_ZERO + if (ret == 0 && format != 0 && format[0] != '\0') { + ret= BASESTRING_VSNPRINTF_FUNC(basestring_vsnprintf_buf, + sizeof(basestring_vsnprintf_buf), + format, ap); + } +#endif + return ret; } diff --git a/ndb/src/common/util/version.c b/ndb/src/common/util/version.c index e2515b243b1..f2b3d5bd522 100644 --- a/ndb/src/common/util/version.c +++ b/ndb/src/common/util/version.c @@ -74,6 +74,7 @@ struct NdbUpGradeCompatible ndbCompatibleTable_full[] = { }; struct NdbUpGradeCompatible ndbCompatibleTable_upgrade[] = { + { MAKE_VERSION(3,5,4), MAKE_VERSION(3,5,3), UG_Exact }, { 0, 0, UG_Null } }; diff --git a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp index d1a8128ea7f..882557daae1 100644 --- a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp +++ b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp @@ -3661,9 +3661,8 @@ Dbdict::execCREATE_FRAGMENTATION_CONF(Signal* signal){ req->tableId = tabPtr.i; req->tableVersion = tabEntry->m_tableVersion + 1; - sendSignal(rg, GSN_CREATE_TAB_REQ, signal, - CreateTabReq::SignalLength, JBB); - + sendFragmentedSignal(rg, GSN_CREATE_TAB_REQ, signal, + CreateTabReq::SignalLength, JBB); return; } diff --git a/ndb/src/kernel/blocks/dbdict/Dbdict.hpp b/ndb/src/kernel/blocks/dbdict/Dbdict.hpp index de1d9757b2a..19c03a86e22 100644 --- a/ndb/src/kernel/blocks/dbdict/Dbdict.hpp +++ b/ndb/src/kernel/blocks/dbdict/Dbdict.hpp @@ -1507,19 +1507,19 @@ private: // Common operation record pool public: - static const size_t opCreateTableSize = sizeof(CreateTableRecord); - static const size_t opDropTableSize = sizeof(DropTableRecord); - static const size_t opCreateIndexSize = sizeof(OpCreateIndex); - static const size_t opDropIndexSize = sizeof(OpDropIndex); - static const size_t opAlterIndexSize = sizeof(OpAlterIndex); - static const size_t opBuildIndexSize = sizeof(OpBuildIndex); - static const size_t opCreateEventSize = sizeof(OpCreateEvent); - static const size_t opSubEventSize = sizeof(OpSubEvent); - static const size_t opDropEventSize = sizeof(OpDropEvent); - static const size_t opSignalUtilSize = sizeof(OpSignalUtil); - static const size_t opCreateTriggerSize = sizeof(OpCreateTrigger); - static const size_t opDropTriggerSize = sizeof(OpDropTrigger); - static const size_t opAlterTriggerSize = sizeof(OpAlterTrigger); + STATIC_CONST( opCreateTableSize = sizeof(CreateTableRecord) ); + STATIC_CONST( opDropTableSize = sizeof(DropTableRecord) ); + STATIC_CONST( opCreateIndexSize = sizeof(OpCreateIndex) ); + STATIC_CONST( opDropIndexSize = sizeof(OpDropIndex) ); + STATIC_CONST( opAlterIndexSize = sizeof(OpAlterIndex) ); + STATIC_CONST( opBuildIndexSize = sizeof(OpBuildIndex) ); + STATIC_CONST( opCreateEventSize = sizeof(OpCreateEvent) ); + STATIC_CONST( opSubEventSize = sizeof(OpSubEvent) ); + STATIC_CONST( opDropEventSize = sizeof(OpDropEvent) ); + STATIC_CONST( opSignalUtilSize = sizeof(OpSignalUtil) ); + STATIC_CONST( opCreateTriggerSize = sizeof(OpCreateTrigger) ); + STATIC_CONST( opDropTriggerSize = sizeof(OpDropTrigger) ); + STATIC_CONST( opAlterTriggerSize = sizeof(OpAlterTrigger) ); private: #define PTR_ALIGN(n) ((((n)+sizeof(void*)-1)>>2)&~((sizeof(void*)-1)>>2)) union OpRecordUnion { diff --git a/ndb/src/kernel/blocks/dbdih/Sysfile.hpp b/ndb/src/kernel/blocks/dbdih/Sysfile.hpp index a44992d6ad0..3e2f3b0dd48 100644 --- a/ndb/src/kernel/blocks/dbdih/Sysfile.hpp +++ b/ndb/src/kernel/blocks/dbdih/Sysfile.hpp @@ -63,7 +63,7 @@ public: /** * No of 32 bits words in the sysfile */ - static const Uint32 SYSFILE_SIZE32 = _SYSFILE_SIZE32; + STATIC_CONST( SYSFILE_SIZE32 = _SYSFILE_SIZE32 ); Uint32 systemRestartBits; @@ -106,7 +106,7 @@ public: ,NS_NotDefined = 8 ,NS_Standby = 9 }; - static const Uint32 NODE_STATUS_SIZE = NODE_ARRAY_SIZE(MAX_NDB_NODES, 4); + STATIC_CONST( NODE_STATUS_SIZE = NODE_ARRAY_SIZE(MAX_NDB_NODES, 4) ); Uint32 nodeStatus[NODE_STATUS_SIZE]; static Uint32 getNodeStatus(NodeId, const Uint32 nodeStatus[]); @@ -116,8 +116,8 @@ public: * The node group of each node * Sizeof(NodeGroup) = 8 Bit */ - static const Uint32 NODE_GROUPS_SIZE = NODE_ARRAY_SIZE(MAX_NDB_NODES, - NODEID_BITS); + STATIC_CONST( NODE_GROUPS_SIZE = NODE_ARRAY_SIZE(MAX_NDB_NODES, + NODEID_BITS) ); Uint32 nodeGroups[NODE_GROUPS_SIZE]; static Uint16 getNodeGroup(NodeId, const Uint32 nodeGroups[]); @@ -126,8 +126,8 @@ public: /** * Any node can take over for any node */ - static const Uint32 TAKE_OVER_SIZE = NODE_ARRAY_SIZE(MAX_NDB_NODES, - NODEID_BITS); + STATIC_CONST( TAKE_OVER_SIZE = NODE_ARRAY_SIZE(MAX_NDB_NODES, + NODEID_BITS) ); Uint32 takeOver[TAKE_OVER_SIZE]; static NodeId getTakeOverNode(NodeId, const Uint32 takeOver[]); diff --git a/ndb/src/kernel/blocks/dbtux/Dbtux.hpp b/ndb/src/kernel/blocks/dbtux/Dbtux.hpp index 2b4c86e1394..8896324f793 100644 --- a/ndb/src/kernel/blocks/dbtux/Dbtux.hpp +++ b/ndb/src/kernel/blocks/dbtux/Dbtux.hpp @@ -107,16 +107,16 @@ public: private: // sizes are in words (Uint32) - static const unsigned MaxIndexFragments = 2 * MAX_FRAG_PER_NODE; - static const unsigned MaxIndexAttributes = MAX_ATTRIBUTES_IN_INDEX; - static const unsigned MaxAttrDataSize = 2048; + STATIC_CONST( MaxIndexFragments = 2 * MAX_FRAG_PER_NODE ); + STATIC_CONST( MaxIndexAttributes = MAX_ATTRIBUTES_IN_INDEX ); + STATIC_CONST( MaxAttrDataSize = 2048 ); public: - static const unsigned DescPageSize = 256; + STATIC_CONST( 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; + STATIC_CONST( MaxTreeNodeSize = MAX_TTREE_NODE_SIZE ); + STATIC_CONST( MaxPrefSize = MAX_TTREE_PREF_SIZE ); + STATIC_CONST( ScanBoundSegmentSize = 7 ); + STATIC_CONST( MaxAccLockOps = MAX_PARALLEL_OP_PER_SCAN ); BLOCK_DEFINES(Dbtux); // forward declarations @@ -159,13 +159,13 @@ private: }; // AttributeHeader size is assumed to be 1 word - static const unsigned AttributeHeaderSize = 1; + STATIC_CONST( AttributeHeaderSize = 1 ); /* * Logical tuple address, "local key". Identifies table tuples. */ typedef Uint32 TupAddr; - static const unsigned NullTupAddr = (Uint32)-1; + STATIC_CONST( NullTupAddr = (Uint32)-1 ); /* * Physical tuple address in TUP. Provides fast access to table tuple @@ -216,7 +216,7 @@ private: bool eq(const TreeEnt ent) const; int cmp(const TreeEnt ent) const; }; - static const unsigned TreeEntSize = sizeof(TreeEnt) >> 2; + STATIC_CONST( TreeEntSize = sizeof(TreeEnt) >> 2 ); static const TreeEnt NullTreeEnt; /* @@ -246,7 +246,7 @@ private: Uint32 m_nodeScan; // list of scans at this node TreeNode(); }; - static const unsigned NodeHeadSize = sizeof(TreeNode) >> 2; + STATIC_CONST( NodeHeadSize = sizeof(TreeNode) >> 2 ); /* * Tree node "access size" was for an early version with signal @@ -323,7 +323,7 @@ private: unsigned m_indexId : 24; unsigned pad1 : 8; }; - static const unsigned DescHeadSize = sizeof(DescHead) >> 2; + STATIC_CONST( DescHeadSize = sizeof(DescHead) >> 2 ); /* * Attribute metadata. Size must be multiple of word size. @@ -337,7 +337,7 @@ private: unsigned m_typeId : 6; unsigned m_charset : 10; }; - static const unsigned DescAttrSize = sizeof(DescAttr) >> 2; + STATIC_CONST( DescAttrSize = sizeof(DescAttr) >> 2 ); /* * Complete metadata for one index. The array of attributes has @@ -694,8 +694,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; + STATIC_CONST( DataFillByte = 0xa2 ); + STATIC_CONST( NodeFillByte = 0xa4 ); #endif // start up info diff --git a/ndb/src/kernel/vm/LongSignal.hpp b/ndb/src/kernel/vm/LongSignal.hpp index dfbfdb456da..9818358011f 100644 --- a/ndb/src/kernel/vm/LongSignal.hpp +++ b/ndb/src/kernel/vm/LongSignal.hpp @@ -25,7 +25,7 @@ */ struct SectionSegment { - static const Uint32 DataLength = 60; + STATIC_CONST( DataLength = NDB_SECTION_SEGMENT_SZ ); Uint32 m_ownerRef; Uint32 m_sz; diff --git a/ndb/src/mgmsrv/ConfigInfo.hpp b/ndb/src/mgmsrv/ConfigInfo.hpp index 50190082e3f..512505cbd30 100644 --- a/ndb/src/mgmsrv/ConfigInfo.hpp +++ b/ndb/src/mgmsrv/ConfigInfo.hpp @@ -27,8 +27,8 @@ * A MANDATORY parameters must be specified in the config file * An UNDEFINED parameter may or may not be specified in the config file */ -static const char* MANDATORY = (char*)~(UintPtr)0; // Default value for mandatory params. -static const char* UNDEFINED = 0; // Default value for undefined params. +static const char* MANDATORY = (char*)~(UintPtr)0;// Default value for mandatory params. +static const char* UNDEFINED = 0; // Default value for undefined params. /** * @class ConfigInfo diff --git a/ndb/src/mgmsrv/MgmtSrvr.hpp b/ndb/src/mgmsrv/MgmtSrvr.hpp index 87da145ec51..a5f21b6bc4a 100644 --- a/ndb/src/mgmsrv/MgmtSrvr.hpp +++ b/ndb/src/mgmsrv/MgmtSrvr.hpp @@ -676,7 +676,7 @@ private: //************************************************************************** // General signal handling data - static const unsigned int WAIT_FOR_RESPONSE_TIMEOUT = 300000; // Milliseconds + STATIC_CONST( WAIT_FOR_RESPONSE_TIMEOUT = 300000 ); // Milliseconds // Max time to wait for a signal to arrive NdbApiSignal* theSignalIdleList; diff --git a/ndb/src/ndbapi/NdbScanOperation.cpp b/ndb/src/ndbapi/NdbScanOperation.cpp index fd63ce96f25..86bac7deb16 100644 --- a/ndb/src/ndbapi/NdbScanOperation.cpp +++ b/ndb/src/ndbapi/NdbScanOperation.cpp @@ -612,7 +612,7 @@ NdbScanOperation::send_next_scan(Uint32 cnt, bool stopScanFlag){ LinearSectionPtr ptr[3]; ptr[0].p = prep_array; ptr[0].sz = cnt; - ret = tp->sendFragmentedSignal(&tSignal, nodeId, ptr, 1); + ret = tp->sendSignal(&tSignal, nodeId, ptr, 1); } else { tSignal.setLength(4+cnt); ret = tp->sendSignal(&tSignal, nodeId); @@ -803,7 +803,7 @@ NdbScanOperation::doSendScan(int aProcessorId) LinearSectionPtr ptr[3]; ptr[0].p = m_prepared_receivers; ptr[0].sz = theParallelism; - if (tp->sendFragmentedSignal(tSignal, aProcessorId, ptr, 1) == -1) { + if (tp->sendSignal(tSignal, aProcessorId, ptr, 1) == -1) { setErrorCode(4002); return -1; } diff --git a/ndb/src/ndbapi/ObjectMap.hpp b/ndb/src/ndbapi/ObjectMap.hpp index 6c984c644e2..12bede3aa3f 100644 --- a/ndb/src/ndbapi/ObjectMap.hpp +++ b/ndb/src/ndbapi/ObjectMap.hpp @@ -29,7 +29,7 @@ class NdbObjectIdMap //: NdbLockable { public: - static const Uint32 InvalidId = ~0; + STATIC_CONST( InvalidId = ~0 ); NdbObjectIdMap(Uint32 initalSize = 128, Uint32 expandSize = 10); ~NdbObjectIdMap(); diff --git a/ndb/src/ndbapi/TransporterFacade.cpp b/ndb/src/ndbapi/TransporterFacade.cpp index bc24110ea14..dfb090c8416 100644 --- a/ndb/src/ndbapi/TransporterFacade.cpp +++ b/ndb/src/ndbapi/TransporterFacade.cpp @@ -34,6 +34,7 @@ #include <NdbConfig.h> #include <ndb_version.h> #include <SignalLoggerManager.hpp> +#include <kernel/ndb_limits.h> //#define REPORT_TRANSPORTER //#define API_TRACE; @@ -475,7 +476,8 @@ TransporterFacade::TransporterFacade() : theTransporterRegistry(0), theStopReceive(0), theSendThread(NULL), - theReceiveThread(NULL) + theReceiveThread(NULL), + m_fragmented_signal_id(0) { theOwnId = 0; @@ -833,9 +835,129 @@ TransporterFacade::sendSignalUnCond(NdbApiSignal * aSignal, NodeId aNode){ return (ss == SEND_OK ? 0 : -1); } +#define CHUNK_SZ NDB_SECTION_SEGMENT_SZ*64 // related to MAX_MESSAGE_SIZE int TransporterFacade::sendFragmentedSignal(NdbApiSignal* aSignal, NodeId aNode, - LinearSectionPtr ptr[3], Uint32 secs){ + LinearSectionPtr ptr[3], Uint32 secs) +{ + if(getIsNodeSendable(aNode) != true) + return -1; + +#ifdef API_TRACE + if(setSignalLog() && TRACE_GSN(aSignal->theVerId_signalNumber)){ + Uint32 tmp = aSignal->theSendersBlockRef; + aSignal->theSendersBlockRef = numberToRef(tmp, theOwnId); + signalLogger.sendSignal(* aSignal, + 1, + aSignal->getDataPtrSend(), + aNode, + ptr, secs); + aSignal->theSendersBlockRef = tmp; + } +#endif + + NdbApiSignal tmp_signal(*(SignalHeader*)aSignal); + LinearSectionPtr tmp_ptr[3]; + Uint32 unique_id= m_fragmented_signal_id++; // next unique id + unsigned i; + for (i= 0; i < secs; i++) + tmp_ptr[i]= ptr[i]; + + unsigned start_i= 0; + unsigned chunk_sz= 0; + unsigned fragment_info= 0; + Uint32 *tmp_data= tmp_signal.getDataPtrSend(); + for (i= 0; i < secs;) { + unsigned save_sz= tmp_ptr[i].sz; + tmp_data[i-start_i]= i; + if (chunk_sz + save_sz > CHUNK_SZ) { + // truncate + unsigned send_sz= CHUNK_SZ - chunk_sz; + if (i != start_i) // first piece of a new section has to be a multiple of NDB_SECTION_SEGMENT_SZ + { + send_sz= + NDB_SECTION_SEGMENT_SZ + *(send_sz+NDB_SECTION_SEGMENT_SZ-1) + /NDB_SECTION_SEGMENT_SZ; + if (send_sz > save_sz) + send_sz= save_sz; + } + tmp_ptr[i].sz= send_sz; + + if (fragment_info < 2) // 1 = first fragment, 2 = middle fragments + fragment_info++; + + // send tmp_signal + tmp_data[i-start_i+1]= unique_id; + tmp_signal.setLength(i-start_i+2); + tmp_signal.m_fragmentInfo= fragment_info; + tmp_signal.m_noOfSections= i-start_i+1; + // do prepare send + { + SendStatus ss = theTransporterRegistry->prepareSend + (&tmp_signal, + 1, /*JBB*/ + tmp_data, + aNode, + &tmp_ptr[start_i]); + assert(ss != SEND_MESSAGE_TOO_BIG); + if (ss != SEND_OK) return -1; + } + // setup variables for next signal + start_i= i; + chunk_sz= 0; + tmp_ptr[i].sz= save_sz-send_sz; + tmp_ptr[i].p+= send_sz; + if (tmp_ptr[i].sz == 0) + i++; + } + else + { + chunk_sz+=save_sz; + i++; + } + } + + unsigned a_sz= aSignal->getLength(); + + if (fragment_info > 0) { + // update the original signal to include section info + Uint32 *a_data= aSignal->getDataPtrSend(); + unsigned tmp_sz= i-start_i; + memcpy(a_data+a_sz, + tmp_data, + tmp_sz*sizeof(Uint32)); + a_data[a_sz+tmp_sz]= unique_id; + aSignal->setLength(a_sz+tmp_sz+1); + + // send last fragment + aSignal->m_fragmentInfo= 3; // 3 = last fragment + aSignal->m_noOfSections= i-start_i; + } else { + aSignal->m_noOfSections= secs; + } + + // send aSignal + int ret; + { + SendStatus ss = theTransporterRegistry->prepareSend + (aSignal, + 1/*JBB*/, + aSignal->getDataPtrSend(), + aNode, + &tmp_ptr[start_i]); + assert(ss != SEND_MESSAGE_TOO_BIG); + ret = (ss == SEND_OK ? 0 : -1); + } + aSignal->m_noOfSections = 0; + aSignal->m_fragmentInfo = 0; + aSignal->setLength(a_sz); + return ret; +} + +int +TransporterFacade::sendSignal(NdbApiSignal* aSignal, NodeId aNode, + LinearSectionPtr ptr[3], Uint32 secs){ aSignal->m_noOfSections = secs; if(getIsNodeSendable(aNode) == true){ #ifdef API_TRACE @@ -865,39 +987,6 @@ TransporterFacade::sendFragmentedSignal(NdbApiSignal* aSignal, NodeId aNode, return -1; } - - -int -TransporterFacade::sendFragmentedSignalUnCond(NdbApiSignal* aSignal, - NodeId aNode, - LinearSectionPtr ptr[3], - Uint32 secs){ - aSignal->m_noOfSections = secs; - -#ifdef API_TRACE - if(setSignalLog() && TRACE_GSN(aSignal->theVerId_signalNumber)){ - Uint32 tmp = aSignal->theSendersBlockRef; - aSignal->theSendersBlockRef = numberToRef(tmp, theOwnId); - signalLogger.sendSignal(* aSignal, - 1, - aSignal->getDataPtrSend(), - aNode, - ptr, secs); - aSignal->theSendersBlockRef = tmp; - } -#endif - SendStatus ss = theTransporterRegistry->prepareSend(aSignal, - 1, // JBB - aSignal->getDataPtrSend(), - aNode, - ptr); - assert(ss != SEND_MESSAGE_TOO_BIG); - aSignal->m_noOfSections = 0; - return (ss == SEND_OK ? 0 : -1); -} - - - /****************************************************************************** * CONNECTION METHODS Etc ******************************************************************************/ diff --git a/ndb/src/ndbapi/TransporterFacade.hpp b/ndb/src/ndbapi/TransporterFacade.hpp index 8b6e38a0611..5680e3a6f03 100644 --- a/ndb/src/ndbapi/TransporterFacade.hpp +++ b/ndb/src/ndbapi/TransporterFacade.hpp @@ -69,14 +69,11 @@ public: // Only sends to nodes which are alive int sendSignal(NdbApiSignal * signal, NodeId nodeId); + int sendSignal(NdbApiSignal*, NodeId, + LinearSectionPtr ptr[3], Uint32 secs); int sendFragmentedSignal(NdbApiSignal*, NodeId, LinearSectionPtr ptr[3], Uint32 secs); - //Dirrrrty - int sendFragmentedSignalUnCond(NdbApiSignal*, NodeId, - LinearSectionPtr ptr[3], Uint32 secs); - - // Is node available for running transactions bool get_node_alive(NodeId nodeId) const; bool get_node_stopping(NodeId nodeId) const; @@ -174,13 +171,13 @@ private: * Block number handling */ public: - static const unsigned MAX_NO_THREADS = 4711; + STATIC_CONST( MAX_NO_THREADS = 4711 ); private: struct ThreadData { - static const Uint32 ACTIVE = (1 << 16) | 1; - static const Uint32 INACTIVE = (1 << 16); - static const Uint32 END_OF_LIST = MAX_NO_THREADS + 1; + STATIC_CONST( ACTIVE = (1 << 16) | 1 ); + STATIC_CONST( INACTIVE = (1 << 16) ); + STATIC_CONST( END_OF_LIST = MAX_NO_THREADS + 1 ); ThreadData(Uint32 initialSize = 32); @@ -224,7 +221,8 @@ private: } m_threads; Uint32 m_max_trans_id; - + Uint32 m_fragmented_signal_id; + /** * execute function */ |