diff options
Diffstat (limited to 'ndb/include')
68 files changed, 1199 insertions, 1125 deletions
diff --git a/ndb/include/Makefile.am b/ndb/include/Makefile.am index b1b7951f216..7b3f80b5560 100644 --- a/ndb/include/Makefile.am +++ b/ndb/include/Makefile.am @@ -16,6 +16,7 @@ ndbapi/NdbError.hpp \ ndbapi/NdbEventOperation.hpp \ ndbapi/NdbIndexOperation.hpp \ ndbapi/NdbOperation.hpp \ +ndbapi/ndb_cluster_connection.hpp \ ndbapi/NdbBlob.hpp \ ndbapi/NdbPool.hpp \ ndbapi/NdbRecAttr.hpp \ diff --git a/ndb/include/debugger/EventLogger.hpp b/ndb/include/debugger/EventLogger.hpp index 6cd6a83e68d..686989089ae 100644 --- a/ndb/include/debugger/EventLogger.hpp +++ b/ndb/include/debugger/EventLogger.hpp @@ -24,6 +24,32 @@ #include <kernel/LogLevel.hpp> #include <signaldata/EventReport.hpp> +class EventLoggerBase { +public: + virtual ~EventLoggerBase(); + + /** + * LogLevel settings + */ + LogLevel m_logLevel; + + /** + * This matrix defines which event should be printed when + * + * threshold - is in range [0-15] + * severity - DEBUG to ALERT (Type of log message) + */ + struct EventRepLogLevelMatrix { + EventReport::EventType eventType; + LogLevel::EventCategory eventCategory; + Uint32 threshold; + Logger::LoggerLevel severity; + }; + + static const EventRepLogLevelMatrix matrix[]; + static const Uint32 matrixSize; +}; + /** * The EventLogger is primarily used for logging NDB events * in the Management Server. It inherits all logging functionality of Logger. @@ -58,7 +84,7 @@ * @see Logger * @version #@ $Id: EventLogger.hpp,v 1.3 2003/09/01 10:15:52 innpeno Exp $ */ -class EventLogger : public Logger +class EventLogger : public EventLoggerBase, public Logger { public: /** @@ -70,7 +96,7 @@ public: /** * Destructor. */ - ~EventLogger(); + virtual ~EventLogger(); /** * Opens/creates the eventlog with the specified filename. @@ -95,47 +121,13 @@ public: /** * Logs the NDB event. * - * @param nodeId the node id of event origin. - * @param eventType the type of event. - * @param theData the event data. - * @deprecated use log(int eventType, const Uint32* theData, NodeId nodeId) - */ - void log(NodeId nodeId, int eventType, const Uint32* theData); - - /** - * Logs the NDB event. - * * @param eventType the type of event. * @param theData the event data. * @param nodeId the node id of event origin. */ - void log(int eventType, const Uint32* theData, NodeId nodeId = 0); - - /** - * Returns the current log levels. - * Enable, disable log levels to filter the events that are sent to the - * eventlog. - * - * @return the log level. - */ - LogLevel& getLoglevel(); + virtual void log(int, const Uint32*, NodeId = 0,const class LogLevel * = 0); /** - * Returns the log level that is used to filter an event. The event will not - * be logged unless its event category's log level is <= levelFilter. - * - * @return the log level filter that is used for all event categories. - */ - int getFilterLevel() const; - /** - * Sets log level filter. The event will be logged if - * the event category's log level is <= 'filterLevel'. - * - * @param level the log level to filter. - */ - void setFilterLevel(int filterLevel); - - /** * Returns the event text for the specified event report type. * * @param type the event type. @@ -143,72 +135,25 @@ public: * @param nodeId a node id. * @return the event report text. */ - static const char* getText(int type, + static const char* getText(char * dst, size_t dst_len, + int type, const Uint32* theData, NodeId nodeId = 0); - - /** - * Find a category matching the string - * - * @param str string to match. - * @param cat the event category. - * @param exactMatch only do exact matching. - * - * @return TRUE if match is found, then cat is modified - * FALSE if match is not found - */ - static bool matchEventCategory(const char * str, - LogLevel::EventCategory * cat, - bool exactMatch = false); /** - * Returns category name or NULL if not found. + * Returns the log level that is used to filter an event. The event will not + * be logged unless its event category's log level is <= levelFilter. * - * @param cat the event category. - * @return category name. - */ - static const char * getEventCategoryName(LogLevel::EventCategory cat); - - /** - * Specifies allowed event categories/log levels. + * @return the log level filter that is used for all event categories. */ - struct EventCategoryName { - LogLevel::EventCategory category; - const char * name; - }; - - static const EventCategoryName eventCategoryNames[]; - static const Uint32 noOfEventCategoryNames; - - /** - * This matrix defines which event should be printed when - * - * threshold - is in range [0-15] - * severity - DEBUG to ALERT (Type of log message) - */ - struct EventRepLogLevelMatrix { - EventReport::EventType eventType; - LogLevel::EventCategory eventCategory; - Uint32 threshold; - Logger::LoggerLevel severity; - }; - - static const EventRepLogLevelMatrix matrix[]; + int getFilterLevel() const; /** - * Default log levels for management nodes. + * Sets log level filter. The event will be logged if + * the event category's log level is <= 'filterLevel'. * - * threshold - is in range [0-15] + * @param level the log level to filter. */ - struct EventLogMatrix { - LogLevel::EventCategory eventCategory; - Uint32 threshold; - }; - - static const EventLogMatrix defEventLogMatrix[]; - - - static const Uint32 matrixSize; - static const Uint32 defEventLogMatrixSize; + void setFilterLevel(int filterLevel); private: /** Prohibit */ @@ -216,11 +161,10 @@ private: EventLogger operator = (const EventLogger&); bool operator == (const EventLogger&); - LogLevel m_logLevel; Uint32 m_filterLevel; STATIC_CONST(MAX_TEXT_LENGTH = 256); - static char m_text[MAX_TEXT_LENGTH]; + char m_text[MAX_TEXT_LENGTH]; }; diff --git a/ndb/include/kernel/AttributeHeader.hpp b/ndb/include/kernel/AttributeHeader.hpp index 91190fdd223..b807b4ef4f1 100644 --- a/ndb/include/kernel/AttributeHeader.hpp +++ b/ndb/include/kernel/AttributeHeader.hpp @@ -30,6 +30,14 @@ class AttributeHeader { friend class Suma; public: + /** + * Psuedo columns + */ + STATIC_CONST( PSUEDO = 0x8000 ); + STATIC_CONST( FRAGMENT = 0xFFFE ); + STATIC_CONST( ROW_COUNT = 0xFFFD ); + STATIC_CONST( COMMIT_COUNT = 0xFFFC ); + /** Initialize AttributeHeader at location aHeaderPtr */ static AttributeHeader& init(void* aHeaderPtr, Uint32 anAttributeId, Uint32 aDataSize); diff --git a/ndb/include/kernel/BlockNumbers.h b/ndb/include/kernel/BlockNumbers.h index e89a82ee0cb..cb3cc697eee 100644 --- a/ndb/include/kernel/BlockNumbers.h +++ b/ndb/include/kernel/BlockNumbers.h @@ -20,13 +20,13 @@ #include <kernel_types.h> #include <RefConvert.hpp> -// 240 +/* 240 */ #define MIN_API_BLOCK_NO 0x8000 -// 2047 +/* 2047 */ #define API_PACKED 0x07ff -// 4002 +/* 4002 */ #define API_CLUSTERMGR 0x0FA2 #define BACKUP 0xF4 diff --git a/ndb/include/kernel/GlobalSignalNumbers.h b/ndb/include/kernel/GlobalSignalNumbers.h index 8941fa6b381..9413f4ef56a 100644 --- a/ndb/include/kernel/GlobalSignalNumbers.h +++ b/ndb/include/kernel/GlobalSignalNumbers.h @@ -23,14 +23,8 @@ * * When adding a new signal, remember to update MAX_GSN and SignalNames.cpp */ - - - const GlobalSignalNumber MAX_GSN = 712; - - - struct GsnName { GlobalSignalNumber gsn; const char * name; @@ -84,7 +78,7 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES; #define GSN_SCAN_NEXTREQ 28 #define GSN_SCAN_TABCONF 29 -// 30 unused +/* 30 unused */ #define GSN_SCAN_TABREF 31 #define GSN_SCAN_TABREQ 32 #define GSN_KEYINFO20 33 @@ -97,42 +91,42 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES; #define GSN_TCSEIZEREF 38 #define GSN_TCSEIZEREQ 39 -// 40 unused -// 41 unused -// 42 unused -// 43 unused -// 44 unused -// 45 unused -// 46 unused -// 47 unused -// 48 unused -// 49 unused -// 50 unused -// 51 unused -// 52 unused -// 53 unused -// 54 unused -// 55 unused -// 56 unused -// 57 unused -// 58 unused -// 59 unused -// 60 unused -// 61 unused -// 62 unused -// 63 unused -// 64 unused -// 65 unused -// 66 unused +/* 40 unused */ +/* 41 unused */ +/* 42 unused */ +/* 43 unused */ +/* 44 unused */ +/* 45 unused */ +/* 46 unused */ +/* 47 unused */ +/* 48 unused */ +/* 49 unused */ +/* 50 unused */ +/* 51 unused */ +/* 52 unused */ +/* 53 unused */ +/* 54 unused */ +/* 55 unused */ +/* 56 unused */ +/* 57 unused */ +/* 58 unused */ +/* 59 unused */ +/* 60 unused */ +/* 61 unused */ +/* 62 unused */ +/* 63 unused */ +/* 64 unused */ +/* 65 unused */ +/* 66 unused */ /** * These are used only by kernel */ #define GSN_ACC_ABORTCONF 67 -// 68 unused -// 69 unused -// 70 unused +/* 68 unused */ +/* 69 unused */ +/* 70 unused */ #define GSN_ACC_ABORTREQ 71 #define GSN_ACC_CHECK_SCAN 72 #define GSN_ACC_COMMITCONF 73 @@ -178,42 +172,42 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES; #define GSN_API_FAILCONF 113 #define GSN_API_FAILREQ 114 #define GSN_CNTR_START_REQ 115 -// 116 not unused +/* 116 not unused */ #define GSN_CNTR_START_REF 117 #define GSN_CNTR_START_CONF 118 #define GSN_CNTR_START_REP 119 -// 120 unused -// 121 unused -// 122 unused -// 123 unused -// 124 unused +/* 120 unused */ +/* 121 unused */ +/* 122 unused */ +/* 123 unused */ +/* 124 unused */ #define GSN_CHECK_LCP_STOP 125 -#define GSN_CLOSE_COMCONF 126 // local -#define GSN_CLOSE_COMREQ 127 // local -#define GSN_CM_ACKADD 128 // distr. -// 129 unused -#define GSN_CM_ADD 130 // distr. -// 131 unused -// 132 not unused -// 133 not unused -#define GSN_CM_HEARTBEAT 134 // distr. -// 135 unused -// 136 unused -// 137 unused -#define GSN_CM_NODEINFOCONF 138 // distr. -#define GSN_CM_NODEINFOREF 139 // distr. -#define GSN_CM_NODEINFOREQ 140 // distr. -#define GSN_CM_REGCONF 141 // distr. -#define GSN_CM_REGREF 142 // distr. -#define GSN_CM_REGREQ 143 // distr. -// 144 unused -// 145 unused -// 146 unused -#define GSN_CM_ADD_REP 147 // local -// 148 unused -// 149 unused -// 150 unused -#define GSN_CNTR_WAITREP 151 // distr. +#define GSN_CLOSE_COMCONF 126 /* local */ +#define GSN_CLOSE_COMREQ 127 /* local */ +#define GSN_CM_ACKADD 128 /* distr. */ +/* 129 unused */ +#define GSN_CM_ADD 130 /* distr. */ +/* 131 unused */ +/* 132 not unused */ +/* 133 not unused */ +#define GSN_CM_HEARTBEAT 134 /* distr. */ +/* 135 unused */ +/* 136 unused */ +/* 137 unused */ +#define GSN_CM_NODEINFOCONF 138 /* distr. */ +#define GSN_CM_NODEINFOREF 139 /* distr. */ +#define GSN_CM_NODEINFOREQ 140 /* distr. */ +#define GSN_CM_REGCONF 141 /* distr. */ +#define GSN_CM_REGREF 142 /* distr. */ +#define GSN_CM_REGREQ 143 /* distr. */ +/* 144 unused */ +/* 145 unused */ +/* 146 unused */ +#define GSN_CM_ADD_REP 147 /* local */ +/* 148 unused */ +/* 149 unused */ +/* 150 unused */ +#define GSN_CNTR_WAITREP 151 /* distr. */ #define GSN_COMMIT 152 #define GSN_COMMIT_FAILCONF 153 #define GSN_COMMIT_FAILREQ 154 @@ -226,7 +220,7 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES; #define GSN_COMPLETEREQ 162 #define GSN_CONNECT_REP 163 #define GSN_CONTINUEB 164 -// 165 not unused +/* 165 not unused */ #define GSN_COPY_ACTIVECONF 166 #define GSN_COPY_ACTIVEREF 167 #define GSN_COPY_ACTIVEREQ 168 @@ -249,9 +243,9 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES; #define GSN_DIADDTABCONF 185 #define GSN_DIADDTABREF 186 #define GSN_DIADDTABREQ 187 -// 188 not unused -// 189 not unused -// 190 not unused +/* 188 not unused */ +/* 189 not unused */ +/* 190 not unused */ #define GSN_DICTSTARTCONF 191 #define GSN_DICTSTARTREQ 192 @@ -307,9 +301,9 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES; #define GSN_DIH_RESTARTREF 218 #define GSN_DIH_RESTARTREQ 219 -// 220 not unused -// 221 not unused -// 222 not unused +/* 220 not unused */ +/* 221 not unused */ +/* 222 not unused */ #define GSN_EMPTY_LCP_REQ 223 #define GSN_EMPTY_LCP_CONF 224 @@ -321,8 +315,8 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES; #define GSN_MASTER_GCPREF 228 #define GSN_MASTER_GCPREQ 229 -// 230 not unused -// 231 not unused +/* 230 not unused */ +/* 231 not unused */ #define GSN_DIRELEASECONF 232 #define GSN_DIRELEASEREF 233 @@ -394,8 +388,8 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES; #define GSN_LCP_HOLDOPREQ 299 #define GSN_SHRINKCHECK2 301 #define GSN_GET_SCHEMA_INFOREQ 302 -// 303 not unused -// 304 not unused +/* 303 not unused */ +/* 304 not unused */ #define GSN_LQH_RESTART_OP 305 #define GSN_LQH_TRANSCONF 306 #define GSN_LQH_TRANSREQ 307 @@ -427,12 +421,12 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES; #define GSN_NEXT_SCANREQ 332 #define GSN_NEXTOPERATION 333 -#define GSN_READ_CONFIG_REQ 334 // new name for sizealt, local -#define GSN_READ_CONFIG_CONF 335 // new name for sizealt, local +#define GSN_READ_CONFIG_REQ 334 /* new name for sizealt, local */ +#define GSN_READ_CONFIG_CONF 335 /* new name for sizealt, local */ -// 336 unused -// 337 unused -// 338 unused +/* 336 unused */ +/* 337 unused */ +/* 338 unused */ #define GSN_OPEN_COMCONF 339 #define GSN_OPEN_COMREF 340 #define GSN_OPEN_COMREQ 341 @@ -458,7 +452,7 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES; #define GSN_TUP_ALLOCREQ 360 #define GSN_TUP_DEALLOCREQ 361 -// 362 not unused +/* 362 not unused */ #define GSN_TUP_WRITELOG_REQ 363 #define GSN_LQH_WRITELOG_REQ 364 @@ -513,16 +507,16 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES; #define GSN_TEST_ORD 407 #define GSN_TESTSIG 408 #define GSN_TIME_SIGNAL 409 -// 410 unused -// 411 unused -// 412 unused +/* 410 unused */ +/* 411 unused */ +/* 412 unused */ #define GSN_TUP_ABORTREQ 414 #define GSN_TUP_ADD_ATTCONF 415 #define GSN_TUP_ADD_ATTRREF 416 #define GSN_TUP_ADD_ATTRREQ 417 #define GSN_TUP_ATTRINFO 418 #define GSN_TUP_COMMITREQ 419 -// 420 unused +/* 420 unused */ #define GSN_TUP_LCPCONF 421 #define GSN_TUP_LCPREF 422 #define GSN_TUP_LCPREQ 423 @@ -559,8 +553,8 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES; #define GSN_STATISTICS_CONF 454 #define GSN_START_ORD 455 -// 456 unused -// 457 unused +/* 456 unused */ +/* 457 unused */ #define GSN_EVENT_SUBSCRIBE_REQ 458 #define GSN_EVENT_SUBSCRIBE_CONF 459 @@ -582,7 +576,7 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES; #define GSN_CHECKNODEGROUPSREQ 471 #define GSN_CHECKNODEGROUPSCONF 472 -// 473 unused +/* 473 unused */ #define GSN_ARBIT_PREPREQ 474 #define GSN_ARBIT_PREPCONF 475 #define GSN_ARBIT_PREPREF 476 @@ -618,7 +612,7 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES; #define GSN_WAIT_GCP_REF 500 #define GSN_WAIT_GCP_CONF 501 -// 502 not used +/* 502 not used */ /** * Trigger and index signals @@ -738,7 +732,7 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES; #define GSN_SUB_STOP_REQ 572 #define GSN_SUB_STOP_REF 573 #define GSN_SUB_STOP_CONF 574 -// 575 unused +/* 575 unused */ #define GSN_SUB_CREATE_REQ 576 #define GSN_SUB_CREATE_REF 577 #define GSN_SUB_CREATE_CONF 578 @@ -838,7 +832,7 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES; #define GSN_GREP_REMOVE_REF 654 #define GSN_GREP_REMOVE_CONF 655 -// Start Global Replication +/* Start Global Replication */ #define GSN_GREP_REQ 656 /** @@ -897,9 +891,8 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES; #define GSN_TUX_MAINT_CONF 678 #define GSN_TUX_MAINT_REF 679 -// not used 680 -// not used 712 -// not used 681 +/* not used 680 */ +/* not used 681 */ /** * from mgmtsrvr to NDBCNTR @@ -910,10 +903,10 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES; #define GSN_API_VERSION_REQ 697 #define GSN_API_VERSION_CONF 698 -// not used 686 -// not used 687 -// not used 689 -// not used 690 +/* not used 686 */ +/* not used 687 */ +/* not used 689 */ +/* not used 690 */ /** * SUMA restart protocol @@ -922,9 +915,9 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES; #define GSN_SUMA_HANDOVER_REQ 692 #define GSN_SUMA_HANDOVER_CONF 693 -// not used 694 -// not used 695 -// not used 696 +/* not used 694 */ +/* not used 695 */ +/* not used 696 */ /** * GREP restart protocol @@ -951,6 +944,6 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES; #define GSN_TUX_BOUND_INFO 710 #define GSN_ACC_LOCKREQ 711 - +#define GSN_READ_PSUEDO_REQ 712 #endif 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 10cd0d43bee..467f0604edd 100644 --- a/ndb/include/kernel/LogLevel.hpp +++ b/ndb/include/kernel/LogLevel.hpp @@ -45,81 +45,31 @@ public: * Copy operator */ LogLevel & operator= (const LogLevel &); - - static const Uint32 MIN_LOGLEVEL_ID = CFG_LOGLEVEL_STARTUP; - - enum EventCategory { - /** - * Events during all kind of startups - */ - llStartUp = CFG_LOGLEVEL_STARTUP - MIN_LOGLEVEL_ID, - - /** - * Events during shutdown - */ - llShutdown = CFG_LOGLEVEL_SHUTDOWN - MIN_LOGLEVEL_ID, - - /** - * Transaction statistics - * Job level - * TCP/IP speed - */ - llStatistic = CFG_LOGLEVEL_STATISTICS - MIN_LOGLEVEL_ID, - - /** - * Checkpoints - */ - llCheckpoint = CFG_LOGLEVEL_CHECKPOINT - MIN_LOGLEVEL_ID, - - /** - * Events during node restart - */ - llNodeRestart = CFG_LOGLEVEL_NODERESTART - MIN_LOGLEVEL_ID, - - /** - * Events related to connection / communication - */ - llConnection = CFG_LOGLEVEL_CONNECTION - MIN_LOGLEVEL_ID, - - /** - * Assorted event w.r.t unexpected happenings - */ - llError = CFG_LOGLEVEL_ERROR - MIN_LOGLEVEL_ID, - - /** - * Assorted event w.r.t warning - */ - llWarning = CFG_LOGLEVEL_WARNING - MIN_LOGLEVEL_ID, - - /** - * Assorted event w.r.t information - */ - llInfo = CFG_LOGLEVEL_INFO - MIN_LOGLEVEL_ID, - - /** - * Events related to global replication - */ - llGrep = CFG_LOGLEVEL_GREP - MIN_LOGLEVEL_ID - }; - struct LogLevelCategoryName { - const char* name; + enum EventCategory { + llInvalid = -1, + llStartUp = CFG_LOGLEVEL_STARTUP - CFG_MIN_LOGLEVEL, + llShutdown = CFG_LOGLEVEL_SHUTDOWN - CFG_MIN_LOGLEVEL, + llStatistic = CFG_LOGLEVEL_STATISTICS - CFG_MIN_LOGLEVEL, + llCheckpoint = CFG_LOGLEVEL_CHECKPOINT - CFG_MIN_LOGLEVEL, + llNodeRestart = CFG_LOGLEVEL_NODERESTART - CFG_MIN_LOGLEVEL, + llConnection = CFG_LOGLEVEL_CONNECTION - CFG_MIN_LOGLEVEL, + llInfo = CFG_LOGLEVEL_INFO - CFG_MIN_LOGLEVEL, + llWarning = CFG_LOGLEVEL_WARNING - CFG_MIN_LOGLEVEL, + llError = CFG_LOGLEVEL_ERROR - CFG_MIN_LOGLEVEL, + llGrep = CFG_LOGLEVEL_GREP - CFG_MIN_LOGLEVEL, + llDebug = CFG_LOGLEVEL_DEBUG - CFG_MIN_LOGLEVEL + ,llBackup = CFG_LOGLEVEL_BACKUP - CFG_MIN_LOGLEVEL }; /** - * Log/event level category names. Remember to update the names whenever - * a new category is added. - */ - static const LogLevelCategoryName LOGLEVEL_CATEGORY_NAME[]; - - /** * No of categories */ -#define _LOGLEVEL_CATEGORIES 10 - static const Uint32 LOGLEVEL_CATEGORIES = _LOGLEVEL_CATEGORIES; - +#define _LOGLEVEL_CATEGORIES (CFG_MAX_LOGLEVEL - CFG_MIN_LOGLEVEL + 1) + STATIC_CONST( LOGLEVEL_CATEGORIES = _LOGLEVEL_CATEGORIES ); + void clear(); - + /** * Note level is valid as 0-15 */ @@ -130,26 +80,33 @@ public: */ Uint32 getLogLevel(EventCategory ec) const; + /** + * Set this= max(this, ll) per category + */ + LogLevel& set_max(const LogLevel& ll); + + bool operator==(const LogLevel& l) const { + return memcmp(this, &l, sizeof(* this)) == 0; + } + + LogLevel& operator=(const class EventSubscribeReq & req); + private: /** * The actual data */ - Uint32 logLevelData[LOGLEVEL_CATEGORIES]; - - LogLevel(const LogLevel &); + Uint8 logLevelData[LOGLEVEL_CATEGORIES]; }; inline LogLevel::LogLevel(){ - clear(); + clear(); } inline LogLevel & LogLevel::operator= (const LogLevel & org){ - for(Uint32 i = 0; i<LOGLEVEL_CATEGORIES; i++){ - logLevelData[i] = org.logLevelData[i]; - } + memcpy(logLevelData, org.logLevelData, sizeof(logLevelData)); return * this; } @@ -165,7 +122,7 @@ inline void LogLevel::setLogLevel(EventCategory ec, Uint32 level){ assert(ec >= 0 && (Uint32) ec < LOGLEVEL_CATEGORIES); - logLevelData[ec] = level; + logLevelData[ec] = (Uint8)level; } inline @@ -173,8 +130,30 @@ Uint32 LogLevel::getLogLevel(EventCategory ec) const{ assert(ec >= 0 && (Uint32) ec < LOGLEVEL_CATEGORIES); - return logLevelData[ec]; + return (Uint32)logLevelData[ec]; +} + +inline +LogLevel & +LogLevel::set_max(const LogLevel & org){ + for(Uint32 i = 0; i<LOGLEVEL_CATEGORIES; i++){ + if(logLevelData[i] < org.logLevelData[i]) + logLevelData[i] = org.logLevelData[i]; + } + return * this; } +#include <signaldata/EventSubscribeReq.hpp> + +inline +LogLevel& +LogLevel::operator=(const EventSubscribeReq& req) +{ + clear(); + for(size_t i = 0; i<req.noOfEntries; i++){ + logLevelData[(req.theData[i] >> 16)] = req.theData[i] & 0xFFFF; + } + return * this; +} #endif 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 f35cc617e86..88fcff22da7 100644 --- a/ndb/include/kernel/ndb_limits.h +++ b/ndb/include/kernel/ndb_limits.h @@ -50,7 +50,7 @@ **/ #define MAX_TUPLES_PER_PAGE 8191 #define MAX_TUPLES_BITS 13 /* 13 bits = 8191 tuples per page */ -//#define MAX_NO_OF_TUPLEKEY 16 Not currently used +/*#define MAX_NO_OF_TUPLEKEY 16 Not currently used */ #define MAX_TABLES 1600 #define MAX_TAB_NAME_SIZE 128 #define MAX_ATTR_NAME_SIZE 32 @@ -64,11 +64,32 @@ #define MIN_ATTRBUF ((MAX_ATTRIBUTES_IN_TABLE/24) + 1) /* - * Number of Records to fetch per SCAN_NEXTREQ in a scan in LQH. The + * Max Number of Records to fetch per SCAN_NEXTREQ in a scan in LQH. The * API can order a multiple of this number of records at a time since * fragments can be scanned in parallel. */ -#define MAX_PARALLEL_OP_PER_SCAN 16 +#define MAX_PARALLEL_OP_PER_SCAN 992 +/* +* The default batch size. Configurable parameter. +*/ +#define DEF_BATCH_SIZE 64 +/* +* When calculating the number of records sent from LQH in each batch +* one uses SCAN_BATCH_SIZE divided by the expected size of signals +* per row. This gives the batch size used for the scan. The NDB API +* will receive one batch from each node at a time so there has to be +* some care taken also so that the NDB API is not overloaded with +* signals. +* This parameter is configurable, this is the default value. +*/ +#define SCAN_BATCH_SIZE 32768 +/* +* To protect the NDB API from overload we also define a maximum total +* batch size from all nodes. This parameter should most likely be +* configurable, or dependent on sendBufferSize. +* This parameter is configurable, this is the default value. +*/ +#define MAX_SCAN_BATCH_SIZE 262144 /* * Maximum number of Parallel Scan queries on one hash index fragment */ @@ -87,13 +108,13 @@ /* * 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 prefix -#define MAX_TTREE_NODE_SLACK 3 // diff between max and min occupancy +#define MAX_TTREE_NODE_SIZE 64 /* total words in node */ +#define MAX_TTREE_PREF_SIZE 4 /* words in min prefix */ +#define MAX_TTREE_NODE_SLACK 2 /* diff between max and min occupancy */ /* * Blobs. */ -#define NDB_BLOB_HEAD_SIZE 2 // sizeof(NdbBlob::Head) >> 2 +#define NDB_BLOB_HEAD_SIZE 2 /* sizeof(NdbBlob::Head) >> 2 */ #endif diff --git a/ndb/include/kernel/signaldata/ArbitSignalData.hpp b/ndb/include/kernel/signaldata/ArbitSignalData.hpp index 271b9920cd0..f255b8dcbbe 100644 --- a/ndb/include/kernel/signaldata/ArbitSignalData.hpp +++ b/ndb/include/kernel/signaldata/ArbitSignalData.hpp @@ -54,7 +54,7 @@ public: } inline void getText(char *buf, size_t buf_len) const { - snprintf(buf, buf_len, "%08x%08x", data[0], data[1]); + BaseString::snprintf(buf, buf_len, "%08x%08x", data[0], data[1]); } /* inline char* getText() const { @@ -113,19 +113,19 @@ public: static inline void getErrText(Uint32 code, char* buf, size_t buf_len) { switch (code) { case ErrTicket: - snprintf(buf, buf_len, "invalid arbitrator-ticket"); + BaseString::snprintf(buf, buf_len, "invalid arbitrator-ticket"); break; case ErrToomany: - snprintf(buf, buf_len, "too many requests"); + BaseString::snprintf(buf, buf_len, "too many requests"); break; case ErrState: - snprintf(buf, buf_len, "invalid state"); + BaseString::snprintf(buf, buf_len, "invalid state"); break; case ErrTimeout: - snprintf(buf, buf_len, "timeout"); + BaseString::snprintf(buf, buf_len, "timeout"); break; default: - snprintf(buf, buf_len, "unknown error [code=%u]", code); + BaseString::snprintf(buf, buf_len, "unknown error [code=%u]", code); break; } } diff --git a/ndb/include/kernel/signaldata/AttrInfo.hpp b/ndb/include/kernel/signaldata/AttrInfo.hpp index 18bd9b22c40..c87470db8b0 100644 --- a/ndb/include/kernel/signaldata/AttrInfo.hpp +++ b/ndb/include/kernel/signaldata/AttrInfo.hpp @@ -35,7 +35,8 @@ class AttrInfo { */ friend class Dbtc; friend class Dblqh; - + friend class NdbScanOperation; + friend bool printATTRINFO(FILE *, const Uint32 *, Uint32, Uint16); public: diff --git a/ndb/include/kernel/signaldata/CreateTable.hpp b/ndb/include/kernel/signaldata/CreateTable.hpp index 424367f28d5..67e510d2ed0 100644 --- a/ndb/include/kernel/signaldata/CreateTable.hpp +++ b/ndb/include/kernel/signaldata/CreateTable.hpp @@ -89,7 +89,8 @@ public: ArraySizeTooBig = 737, RecordTooBig = 738, InvalidPrimaryKeySize = 739, - NullablePrimaryKey = 740 + NullablePrimaryKey = 740, + InvalidCharset = 743 }; private: 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 dec7145c897..6b4a3f34553 100644 --- a/ndb/include/kernel/signaldata/DictTabInfo.hpp +++ b/ndb/include/kernel/signaldata/DictTabInfo.hpp @@ -38,7 +38,7 @@ offsetof(x, l) } #define DTIBREAK(x) \ - { DictTabInfo::x, 0, SimpleProperties::InvalidValue, 0, 0 } + { DictTabInfo::x, 0, SimpleProperties::InvalidValue, 0, 0, 0 } class DictTabInfo { /** @@ -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 { @@ -438,8 +438,8 @@ public: case DictTabInfo::ExtText: AttributeType = DictTabInfo::StringType; AttributeSize = DictTabInfo::an8Bit; - // head + inline part [ attr precision ] - AttributeArraySize = (NDB_BLOB_HEAD_SIZE << 2) + AttributeExtPrecision; + // head + inline part [ attr precision lower half ] + AttributeArraySize = (NDB_BLOB_HEAD_SIZE << 2) + (AttributeExtPrecision & 0xFFFF); return true; }; return false; diff --git a/ndb/include/kernel/signaldata/DihContinueB.hpp b/ndb/include/kernel/signaldata/DihContinueB.hpp index e683b55351c..77ecf360601 100644 --- a/ndb/include/kernel/signaldata/DihContinueB.hpp +++ b/ndb/include/kernel/signaldata/DihContinueB.hpp @@ -24,7 +24,8 @@ class DihContinueB { * Sender(s)/Reciver(s) */ friend class Dbdih; - friend bool printCONTINUEB_DBDIH(FILE * output, const Uint32 * theData, Uint32 len); + friend bool printCONTINUEB_DBDIH(FILE * output, const Uint32 * theData, + Uint32 len, Uint16); private: enum Type { ZPACK_TABLE_INTO_PAGES = 1, diff --git a/ndb/include/kernel/signaldata/DumpStateOrd.hpp b/ndb/include/kernel/signaldata/DumpStateOrd.hpp index 1e349fad55a..7368a0ec40d 100644 --- a/ndb/include/kernel/signaldata/DumpStateOrd.hpp +++ b/ndb/include/kernel/signaldata/DumpStateOrd.hpp @@ -95,6 +95,9 @@ public: TcDumpAllApiConnectRec = 2506, TcSetTransactionTimeout = 2507, TcSetApplTransactionTimeout = 2508, + StartTcTimer = 2509, + StopTcTimer = 2510, + StartPeriodicTcTimer = 2511, CmvmiDumpConnections = 2600, CmvmiDumpLongSignalMemory = 2601, CmvmiSetRestartOnErrorInsert = 2602, diff --git a/ndb/include/kernel/signaldata/EventReport.hpp b/ndb/include/kernel/signaldata/EventReport.hpp index b6106bb0ca4..1ad6e1bf7ac 100644 --- a/ndb/include/kernel/signaldata/EventReport.hpp +++ b/ndb/include/kernel/signaldata/EventReport.hpp @@ -135,12 +135,17 @@ public: //GREP GrepSubscriptionInfo = 52, - GrepSubscriptionAlert = 53 - }; + GrepSubscriptionAlert = 53, + //BACKUP + BackupStarted = 54, + BackupFailedToStart = 55, + BackupCompleted = 56, + BackupAborted = 57 + }; + void setEventType(EventType type); EventType getEventType() const; -private: UintR eventType; // DATA 0 }; diff --git a/ndb/include/kernel/signaldata/EventSubscribeReq.hpp b/ndb/include/kernel/signaldata/EventSubscribeReq.hpp index fd2821ea31d..84a1717b1de 100644 --- a/ndb/include/kernel/signaldata/EventSubscribeReq.hpp +++ b/ndb/include/kernel/signaldata/EventSubscribeReq.hpp @@ -27,7 +27,7 @@ * RECIVER: SimBlockCMCtrBlck */ -class EventSubscribeReq { +struct EventSubscribeReq { /** * Receiver(s) */ @@ -38,9 +38,8 @@ class EventSubscribeReq { */ friend class MgmtSrvr; -public: - STATIC_CONST( SignalLength = 22 ); -private: + STATIC_CONST( SignalLength = 2 + LogLevel::LOGLEVEL_CATEGORIES ); + /** * Note: If you use the same blockRef as you have used earlier, * you update your ongoing subscription @@ -53,8 +52,15 @@ private: */ Uint32 noOfEntries; - Uint32 theCategories[10]; - Uint32 theLevels[10]; + Uint32 theData[LogLevel::LOGLEVEL_CATEGORIES]; + + EventSubscribeReq& operator= (const LogLevel& ll){ + noOfEntries = LogLevel::LOGLEVEL_CATEGORIES; + for(size_t i = 0; i<noOfEntries; i++){ + theData[i] = (i << 16) | ll.getLogLevel((LogLevel::EventCategory)i); + } + return * this; + } }; #endif diff --git a/ndb/include/kernel/signaldata/FsCloseReq.hpp b/ndb/include/kernel/signaldata/FsCloseReq.hpp index 8ff47145f87..c42afa143e6 100644 --- a/ndb/include/kernel/signaldata/FsCloseReq.hpp +++ b/ndb/include/kernel/signaldata/FsCloseReq.hpp @@ -74,7 +74,7 @@ FsCloseReq::getRemoveFileFlag(const UintR & fileflag){ inline void FsCloseReq::setRemoveFileFlag(UintR & fileflag, bool removefile){ - ASSERT_BOOL(removefile, "FsCloseReq::setRemoveFileFlag"); +// ASSERT_BOOL(removefile, "FsCloseReq::setRemoveFileFlag"); if (removefile == true) fileflag = 1; else diff --git a/ndb/include/kernel/signaldata/KeyInfo.hpp b/ndb/include/kernel/signaldata/KeyInfo.hpp index a4c698f89b2..686f3ae053d 100644 --- a/ndb/include/kernel/signaldata/KeyInfo.hpp +++ b/ndb/include/kernel/signaldata/KeyInfo.hpp @@ -26,6 +26,7 @@ class KeyInfo { friend class DbUtil; friend class NdbOperation; friend class NdbScanOperation; + friend class NdbIndexScanOperation; /** * Reciver(s) diff --git a/ndb/include/kernel/signaldata/LqhFrag.hpp b/ndb/include/kernel/signaldata/LqhFrag.hpp index 116e9c01ca0..13dfafcc653 100644 --- a/ndb/include/kernel/signaldata/LqhFrag.hpp +++ b/ndb/include/kernel/signaldata/LqhFrag.hpp @@ -130,7 +130,7 @@ private: Uint32 keyLength; Uint32 nextLCP; Uint32 noOfKeyAttr; - Uint32 noOfNewAttr; + Uint32 noOfNewAttr; // noOfCharsets in upper half Uint32 checksumIndicator; Uint32 noOfAttributeGroups; Uint32 GCPIndicator; diff --git a/ndb/include/kernel/signaldata/NdbfsContinueB.hpp b/ndb/include/kernel/signaldata/NdbfsContinueB.hpp index 2d569be721f..6154e5c19b1 100644 --- a/ndb/include/kernel/signaldata/NdbfsContinueB.hpp +++ b/ndb/include/kernel/signaldata/NdbfsContinueB.hpp @@ -24,7 +24,8 @@ class NdbfsContinueB { * Sender(s)/Reciver(s) */ friend class Ndbfs; - friend bool printCONTINUEB_NDBFS(FILE * output, const Uint32 * theData, Uint32 len); + friend bool printCONTINUEB_NDBFS(FILE * output, const Uint32 * theData, + Uint32 len, Uint16); private: enum { ZSCAN_MEMORYCHANNEL_10MS_DELAY = 0, diff --git a/ndb/include/kernel/signaldata/ScanFrag.hpp b/ndb/include/kernel/signaldata/ScanFrag.hpp index 2b37e544e1f..41ea569c45d 100644 --- a/ndb/include/kernel/signaldata/ScanFrag.hpp +++ b/ndb/include/kernel/signaldata/ScanFrag.hpp @@ -33,21 +33,24 @@ class ScanFragReq { */ friend class Dblqh; public: - STATIC_CONST( SignalLength = 25 ); - + STATIC_CONST( SignalLength = 12 ); + + friend bool printSCAN_FRAGREQ(FILE *, const Uint32*, Uint32, Uint16); + public: Uint32 senderData; Uint32 resultRef; // Where to send the result Uint32 savePointId; Uint32 requestInfo; Uint32 tableId; - Uint32 fragmentNo; + Uint32 fragmentNoKeyLen; Uint32 schemaVersion; Uint32 transId1; Uint32 transId2; - Uint32 clientOpPtr[MAX_PARALLEL_OP_PER_SCAN]; - - static Uint32 getConcurrency(const Uint32 & requestInfo); + Uint32 clientOpPtr; + Uint32 batch_size_rows; + Uint32 batch_size_bytes; + static Uint32 getLockMode(const Uint32 & requestInfo); static Uint32 getHoldLockFlag(const Uint32 & requestInfo); static Uint32 getKeyinfoFlag(const Uint32 & requestInfo); @@ -56,7 +59,6 @@ public: static Uint32 getAttrLen(const Uint32 & requestInfo); static Uint32 getScanPrio(const Uint32 & requestInfo); - static void setConcurrency(Uint32 & requestInfo, Uint32 concurrency); static void setLockMode(Uint32 & requestInfo, Uint32 lockMode); static void setHoldLockFlag(Uint32 & requestInfo, Uint32 holdLock); static void setKeyinfoFlag(Uint32 & requestInfo, Uint32 keyinfo); @@ -79,7 +81,6 @@ class KeyInfo20 { friend class NdbOperation; friend class NdbScanReceiver; public: - //STATIC_CONST( SignalLength = 21 ); STATIC_CONST( HeaderLength = 5); STATIC_CONST( DataLength = 20 ); @@ -110,15 +111,15 @@ class ScanFragConf { friend class Backup; friend class Suma; public: - STATIC_CONST( SignalLength = 21 ); + STATIC_CONST( SignalLength = 6 ); public: Uint32 senderData; Uint32 completedOps; Uint32 fragmentCompleted; - Uint32 opReturnDataLen[16]; Uint32 transId1; Uint32 transId2; + Uint32 total_len; }; class ScanFragRef { @@ -143,6 +144,7 @@ public: ZSCAN_NO_FRAGMENT_ERROR = 487, ZTOO_MANY_ACTIVE_SCAN_ERROR = 488, ZNO_FREE_SCANREC_ERROR = 489, + ZWRONG_BATCH_SIZE = 1230, ZSTANDBY_SCAN_ERROR = 1209, ZSCAN_BOOK_ACC_OP_ERROR = 1219, ZUNKNOWN_TRANS_ERROR = 1227 @@ -175,20 +177,21 @@ class ScanFragNextReq { friend bool printSCANFRAGNEXTREQ(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo); public: - STATIC_CONST( SignalLength = 4 ); + STATIC_CONST( SignalLength = 6 ); public: Uint32 senderData; Uint32 closeFlag; Uint32 transId1; Uint32 transId2; + Uint32 batch_size_rows; + Uint32 batch_size_bytes; }; /** * Request Info * * a = Length of attrinfo - 16 Bits (16-31) - * c = Concurrency - 5 Bits (0-4) -> Max 31 * l = Lock Mode - 1 Bit 5 * h = Hold lock - 1 Bit 7 * k = Keyinfo - 1 Bit 8 @@ -198,11 +201,8 @@ public: * * 1111111111222222222233 * 01234567890123456789012345678901 - * ccccclxhkr ppppaaaaaaaaaaaaaaaa + * lxhkr ppppaaaaaaaaaaaaaaaa */ -#define SF_CONCURRENCY_SHIFT (0) -#define SF_CONCURRENCY_MASK (31) - #define SF_LOCK_MODE_SHIFT (5) #define SF_LOCK_MODE_MASK (1) @@ -219,12 +219,6 @@ public: inline Uint32 -ScanFragReq::getConcurrency(const Uint32 & requestInfo){ - return (requestInfo >> SF_CONCURRENCY_SHIFT) & SF_CONCURRENCY_MASK; -} - -inline -Uint32 ScanFragReq::getLockMode(const Uint32 & requestInfo){ return (requestInfo >> SF_LOCK_MODE_SHIFT) & SF_LOCK_MODE_MASK; } @@ -274,13 +268,6 @@ ScanFragReq::setScanPrio(UintR & requestInfo, UintR val){ inline void -ScanFragReq::setConcurrency(UintR & requestInfo, UintR val){ - ASSERT_MAX(val, SF_CONCURRENCY_MASK, "ScanFragReq::setConcurrency"); - requestInfo |= (val << SF_CONCURRENCY_SHIFT); -} - -inline -void ScanFragReq::setLockMode(UintR & requestInfo, UintR val){ ASSERT_MAX(val, SF_LOCK_MODE_MASK, "ScanFragReq::setLockMode"); requestInfo |= (val << SF_LOCK_MODE_SHIFT); @@ -324,7 +311,7 @@ ScanFragReq::setAttrLen(UintR & requestInfo, UintR val){ inline Uint32 KeyInfo20::setScanInfo(Uint32 opNo, Uint32 scanNo){ - ASSERT_MAX(opNo, 15, "KeyInfo20::setScanInfo"); + ASSERT_MAX(opNo, 1023, "KeyInfo20::setScanInfo"); ASSERT_MAX(scanNo, 255, "KeyInfo20::setScanInfo"); return (opNo << 8) + scanNo; } @@ -338,7 +325,7 @@ KeyInfo20::getScanNo(Uint32 scanInfo){ inline Uint32 KeyInfo20::getScanOp(Uint32 scanInfo){ - return (scanInfo >> 8) & 0xF; + return (scanInfo >> 8) & 0x3FF; } #endif diff --git a/ndb/include/kernel/signaldata/ScanTab.hpp b/ndb/include/kernel/signaldata/ScanTab.hpp index ab2978e48da..2029b16197e 100644 --- a/ndb/include/kernel/signaldata/ScanTab.hpp +++ b/ndb/include/kernel/signaldata/ScanTab.hpp @@ -45,7 +45,7 @@ public: /** * Length of signal */ - STATIC_CONST( SignalLength = 25 ); + STATIC_CONST( StaticLength = 11 ); private: @@ -55,7 +55,7 @@ private: * DATA VARIABLES */ UintR apiConnectPtr; // DATA 0 - UintR attrLen; // DATA 1 + UintR attrLenKeyLen; // DATA 1 UintR requestInfo; // DATA 2 UintR tableId; // DATA 3 UintR tableSchemaVersion; // DATA 4 @@ -63,7 +63,8 @@ private: UintR transId1; // DATA 6 UintR transId2; // DATA 7 UintR buddyConPtr; // DATA 8 - UintR apiOperationPtr[16]; // DATA 9-25 + UintR batch_byte_size; // DATA 9 + UintR first_batch_size; // DATA 10 /** * Get:ers for requestInfo @@ -73,7 +74,8 @@ private: static Uint8 getHoldLockFlag(const UintR & requestInfo); static Uint8 getReadCommittedFlag(const UintR & requestInfo); static Uint8 getRangeScanFlag(const UintR & requestInfo); - static Uint8 getScanBatch(const UintR & requestInfo); + static Uint8 getKeyinfoFlag(const UintR & requestInfo); + static Uint16 getScanBatch(const UintR & requestInfo); /** * Set:ers for requestInfo @@ -84,6 +86,7 @@ private: static void setHoldLockFlag(UintR & requestInfo, Uint32 flag); static void setReadCommittedFlag(UintR & requestInfo, Uint32 flag); static void setRangeScanFlag(UintR & requestInfo, Uint32 flag); + static void setKeyinfoFlag(UintR & requestInfo, Uint32 flag); static void setScanBatch(Uint32& requestInfo, Uint32 sz); }; @@ -94,12 +97,13 @@ private: l = Lock mode - 1 Bit 8 h = Hold lock mode - 1 Bit 10 c = Read Committed - 1 Bit 11 + k = Keyinfo - 1 Bit 12 x = Range Scan (TUX) - 1 Bit 15 - b = Scan batch - 5 Bit 16-19 (max 15) + b = Scan batch - 10 Bit 16-25 (max 1023) 1111111111222222222233 01234567890123456789012345678901 - ppppppppl hc xbbbbb + ppppppppl hck xbbbbbbbbbb */ #define PARALLELL_SHIFT (0) @@ -111,6 +115,9 @@ private: #define HOLD_LOCK_SHIFT (10) #define HOLD_LOCK_MASK (1) +#define KEYINFO_SHIFT (12) +#define KEYINFO_MASK (1) + #define READ_COMMITTED_SHIFT (11) #define READ_COMMITTED_MASK (1) @@ -118,7 +125,7 @@ private: #define RANGE_SCAN_MASK (1) #define SCAN_BATCH_SHIFT (16) -#define SCAN_BATCH_MASK (31) +#define SCAN_BATCH_MASK (1023) inline Uint8 @@ -151,9 +158,9 @@ ScanTabReq::getRangeScanFlag(const UintR & requestInfo){ } inline -Uint8 +Uint16 ScanTabReq::getScanBatch(const Uint32 & requestInfo){ - return (Uint8)((requestInfo >> SCAN_BATCH_SHIFT) & SCAN_BATCH_MASK); + return (Uint16)((requestInfo >> SCAN_BATCH_SHIFT) & SCAN_BATCH_MASK); } inline @@ -201,9 +208,24 @@ inline void ScanTabReq::setScanBatch(Uint32 & requestInfo, Uint32 flag){ ASSERT_MAX(flag, SCAN_BATCH_MASK, "ScanTabReq::setScanBatch"); + requestInfo &= ~(SCAN_BATCH_MASK << SCAN_BATCH_SHIFT); requestInfo |= (flag << SCAN_BATCH_SHIFT); } +inline +Uint8 +ScanTabReq::getKeyinfoFlag(const UintR & requestInfo){ + return (Uint8)((requestInfo >> KEYINFO_SHIFT) & KEYINFO_MASK); +} + +inline +void +ScanTabReq::setKeyinfoFlag(UintR & requestInfo, Uint32 flag){ + ASSERT_BOOL(flag, "ScanTabReq::setKeyinfoFlag"); + requestInfo |= (flag << KEYINFO_SHIFT); +} + + /** * * SENDER: Dbtc @@ -230,7 +252,7 @@ public: * Length of signal */ STATIC_CONST( SignalLength = 4 ); - static const Uint32 EndOfData = (1 << 31); + STATIC_CONST( EndOfData = (1 << 31) ); private: @@ -250,8 +272,8 @@ private: Uint32 info; }; - static Uint32 getLength(Uint32 opDataInfo) { return opDataInfo >> 5; }; - static Uint32 getRows(Uint32 opDataInfo) { return opDataInfo & 31;} + static Uint32 getLength(Uint32 opDataInfo) { return opDataInfo >> 10; }; + static Uint32 getRows(Uint32 opDataInfo) { return opDataInfo & 1023;} }; /** diff --git a/ndb/include/kernel/signaldata/SetLogLevelOrd.hpp b/ndb/include/kernel/signaldata/SetLogLevelOrd.hpp index c3be808cc41..2923029f8f6 100644 --- a/ndb/include/kernel/signaldata/SetLogLevelOrd.hpp +++ b/ndb/include/kernel/signaldata/SetLogLevelOrd.hpp @@ -18,6 +18,7 @@ #define SET_LOGLEVEL_ORD_HPP #include <LogLevel.hpp> +#include "EventSubscribeReq.hpp" #include "SignalData.hpp" /** @@ -39,11 +40,10 @@ class SetLogLevelOrd { friend class NodeLogLevel; private: - STATIC_CONST( SignalLength = 25 ); - + STATIC_CONST( SignalLength = 1 + LogLevel::LOGLEVEL_CATEGORIES ); + Uint32 noOfEntries; - Uint32 theCategories[12]; - Uint32 theLevels[12]; + Uint32 theData[LogLevel::LOGLEVEL_CATEGORIES]; void clear(); @@ -51,6 +51,22 @@ private: * Note level is valid as 0-15 */ void setLogLevel(LogLevel::EventCategory ec, int level = 7); + + SetLogLevelOrd& operator= (const LogLevel& ll){ + noOfEntries = LogLevel::LOGLEVEL_CATEGORIES; + for(size_t i = 0; i<noOfEntries; i++){ + theData[i] = (i << 16) | ll.getLogLevel((LogLevel::EventCategory)i); + } + return * this; + } + + SetLogLevelOrd& operator= (const EventSubscribeReq& ll){ + noOfEntries = ll.noOfEntries; + for(size_t i = 0; i<noOfEntries; i++){ + theData[i] = ll.theData[i]; + } + return * this; + } }; inline @@ -62,9 +78,7 @@ SetLogLevelOrd::clear(){ inline void SetLogLevelOrd::setLogLevel(LogLevel::EventCategory ec, int level){ - assert(noOfEntries < 12); - theCategories[noOfEntries] = ec; - theLevels[noOfEntries] = level; + theData[noOfEntries] = (ec << 16) | level; noOfEntries++; } diff --git a/ndb/include/kernel/signaldata/SignalData.hpp b/ndb/include/kernel/signaldata/SignalData.hpp index 6e5748217b2..f9d3a6faa64 100644 --- a/ndb/include/kernel/signaldata/SignalData.hpp +++ b/ndb/include/kernel/signaldata/SignalData.hpp @@ -20,6 +20,7 @@ #include <ndb_global.h> #include <ndb_limits.h> #include <kernel_types.h> +#include <BaseString.hpp> #define ASSERT_BOOL(flag, message) assert(flag<=1) #define ASSERT_RANGE(value, min, max, message) \ @@ -50,4 +51,169 @@ Uint32 getTCErrorCode() { return TCErrorCode; }; \ void setTCErrorCode(Uint32 _s) { TCErrorCode = _s; }; +#define GSN_PRINT_SIGNATURE(f) bool f(FILE *, const Uint32 *, Uint32, Uint16) + +GSN_PRINT_SIGNATURE(printTCKEYREQ); +GSN_PRINT_SIGNATURE(printTCKEYCONF); +GSN_PRINT_SIGNATURE(printTCKEYREF); +GSN_PRINT_SIGNATURE(printLQHKEYREQ); +GSN_PRINT_SIGNATURE(printLQHKEYCONF); +GSN_PRINT_SIGNATURE(printLQHKEYREF); +GSN_PRINT_SIGNATURE(printTUPKEYREQ); +GSN_PRINT_SIGNATURE(printTUPKEYCONF); +GSN_PRINT_SIGNATURE(printTUPKEYREF); +GSN_PRINT_SIGNATURE(printTUPCOMMITREQ); +GSN_PRINT_SIGNATURE(printCONTINUEB); +GSN_PRINT_SIGNATURE(printFSOPENREQ); +GSN_PRINT_SIGNATURE(printFSCLOSEREQ); +GSN_PRINT_SIGNATURE(printFSREADWRITEREQ); +GSN_PRINT_SIGNATURE(printFSREADWRITEREQ); +GSN_PRINT_SIGNATURE(printFSREF); +GSN_PRINT_SIGNATURE(printFSREF); +GSN_PRINT_SIGNATURE(printFSREF); +GSN_PRINT_SIGNATURE(printFSREF); +GSN_PRINT_SIGNATURE(printFSREF); +GSN_PRINT_SIGNATURE(printFSCONF); +GSN_PRINT_SIGNATURE(printFSCONF); +GSN_PRINT_SIGNATURE(printFSCONF); +GSN_PRINT_SIGNATURE(printFSCONF); +GSN_PRINT_SIGNATURE(printFSCONF); +GSN_PRINT_SIGNATURE(printCLOSECOMREQCONF); +GSN_PRINT_SIGNATURE(printCLOSECOMREQCONF); +GSN_PRINT_SIGNATURE(printPACKED_SIGNAL); +GSN_PRINT_SIGNATURE(printPREPFAILREQREF); +GSN_PRINT_SIGNATURE(printPREPFAILREQREF); +GSN_PRINT_SIGNATURE(printALTER_TABLE_REQ); +GSN_PRINT_SIGNATURE(printALTER_TABLE_CONF); +GSN_PRINT_SIGNATURE(printALTER_TABLE_REF); +GSN_PRINT_SIGNATURE(printALTER_TAB_REQ); +GSN_PRINT_SIGNATURE(printALTER_TAB_CONF); +GSN_PRINT_SIGNATURE(printALTER_TAB_REF); +GSN_PRINT_SIGNATURE(printCREATE_TRIG_REQ); +GSN_PRINT_SIGNATURE(printCREATE_TRIG_CONF); +GSN_PRINT_SIGNATURE(printCREATE_TRIG_REF); +GSN_PRINT_SIGNATURE(printALTER_TRIG_REQ); +GSN_PRINT_SIGNATURE(printALTER_TRIG_CONF); +GSN_PRINT_SIGNATURE(printALTER_TRIG_REF); +GSN_PRINT_SIGNATURE(printDROP_TRIG_REQ); +GSN_PRINT_SIGNATURE(printDROP_TRIG_CONF); +GSN_PRINT_SIGNATURE(printDROP_TRIG_REF); +GSN_PRINT_SIGNATURE(printFIRE_TRIG_ORD); +GSN_PRINT_SIGNATURE(printTRIG_ATTRINFO); +GSN_PRINT_SIGNATURE(printCREATE_INDX_REQ); +GSN_PRINT_SIGNATURE(printCREATE_INDX_CONF); +GSN_PRINT_SIGNATURE(printCREATE_INDX_REF); +GSN_PRINT_SIGNATURE(printDROP_INDX_REQ); +GSN_PRINT_SIGNATURE(printDROP_INDX_CONF); +GSN_PRINT_SIGNATURE(printDROP_INDX_REF); +GSN_PRINT_SIGNATURE(printALTER_INDX_REQ); +GSN_PRINT_SIGNATURE(printALTER_INDX_CONF); +GSN_PRINT_SIGNATURE(printALTER_INDX_REF); +GSN_PRINT_SIGNATURE(printTCINDXREQ); +GSN_PRINT_SIGNATURE(printTCINDXCONF); +GSN_PRINT_SIGNATURE(printTCINDXREF); +GSN_PRINT_SIGNATURE(printINDXKEYINFO); +GSN_PRINT_SIGNATURE(printINDXATTRINFO); +GSN_PRINT_SIGNATURE(printFSAPPENDREQ); +GSN_PRINT_SIGNATURE(printBACKUP_REQ); +GSN_PRINT_SIGNATURE(printBACKUP_DATA); +GSN_PRINT_SIGNATURE(printBACKUP_REF); +GSN_PRINT_SIGNATURE(printBACKUP_CONF); +GSN_PRINT_SIGNATURE(printABORT_BACKUP_ORD); +GSN_PRINT_SIGNATURE(printBACKUP_ABORT_REP); +GSN_PRINT_SIGNATURE(printBACKUP_COMPLETE_REP); +GSN_PRINT_SIGNATURE(printBACKUP_NF_COMPLETE_REP); +GSN_PRINT_SIGNATURE(printDEFINE_BACKUP_REQ); +GSN_PRINT_SIGNATURE(printDEFINE_BACKUP_REF); +GSN_PRINT_SIGNATURE(printDEFINE_BACKUP_CONF); +GSN_PRINT_SIGNATURE(printSTART_BACKUP_REQ); +GSN_PRINT_SIGNATURE(printSTART_BACKUP_REF); +GSN_PRINT_SIGNATURE(printSTART_BACKUP_CONF); +GSN_PRINT_SIGNATURE(printBACKUP_FRAGMENT_REQ); +GSN_PRINT_SIGNATURE(printBACKUP_FRAGMENT_REF); +GSN_PRINT_SIGNATURE(printBACKUP_FRAGMENT_CONF); +GSN_PRINT_SIGNATURE(printSTOP_BACKUP_REQ); +GSN_PRINT_SIGNATURE(printSTOP_BACKUP_REF); +GSN_PRINT_SIGNATURE(printSTOP_BACKUP_CONF); +GSN_PRINT_SIGNATURE(printBACKUP_STATUS_REQ); +GSN_PRINT_SIGNATURE(printBACKUP_STATUS_CONF); +GSN_PRINT_SIGNATURE(printUTIL_SEQUENCE_REQ); +GSN_PRINT_SIGNATURE(printUTIL_SEQUENCE_REF); +GSN_PRINT_SIGNATURE(printUTIL_SEQUENCE_CONF); +GSN_PRINT_SIGNATURE(printUTIL_PREPARE_REQ); +GSN_PRINT_SIGNATURE(printUTIL_PREPARE_REF); +GSN_PRINT_SIGNATURE(printUTIL_PREPARE_CONF); +GSN_PRINT_SIGNATURE(printUTIL_EXECUTE_REQ); +GSN_PRINT_SIGNATURE(printUTIL_EXECUTE_REF); +GSN_PRINT_SIGNATURE(printUTIL_EXECUTE_CONF); +GSN_PRINT_SIGNATURE(printSCANTABREQ); +GSN_PRINT_SIGNATURE(printSCANTABCONF); +GSN_PRINT_SIGNATURE(printSCANTABREF); +GSN_PRINT_SIGNATURE(printSCANNEXTREQ); +GSN_PRINT_SIGNATURE(printLQH_FRAG_REQ); +GSN_PRINT_SIGNATURE(printLQH_FRAG_REF); +GSN_PRINT_SIGNATURE(printLQH_FRAG_CONF); +GSN_PRINT_SIGNATURE(printPREP_DROP_TAB_REQ); +GSN_PRINT_SIGNATURE(printPREP_DROP_TAB_REF); +GSN_PRINT_SIGNATURE(printPREP_DROP_TAB_CONF); +GSN_PRINT_SIGNATURE(printDROP_TAB_REQ); +GSN_PRINT_SIGNATURE(printDROP_TAB_REF); +GSN_PRINT_SIGNATURE(printDROP_TAB_CONF); +GSN_PRINT_SIGNATURE(printLCP_FRAG_ORD); +GSN_PRINT_SIGNATURE(printLCP_FRAG_REP); +GSN_PRINT_SIGNATURE(printLCP_COMPLETE_REP); +GSN_PRINT_SIGNATURE(printSTART_LCP_REQ); +GSN_PRINT_SIGNATURE(printSTART_LCP_CONF); +GSN_PRINT_SIGNATURE(printMASTER_LCP_REQ); +GSN_PRINT_SIGNATURE(printMASTER_LCP_REF); +GSN_PRINT_SIGNATURE(printMASTER_LCP_CONF); +GSN_PRINT_SIGNATURE(printCOPY_GCI_REQ); +GSN_PRINT_SIGNATURE(printSYSTEM_ERROR); +GSN_PRINT_SIGNATURE(printSTART_REC_REQ); +GSN_PRINT_SIGNATURE(printSTART_REC_CONF); +GSN_PRINT_SIGNATURE(printNF_COMPLETE_REP); +GSN_PRINT_SIGNATURE(printSIGNAL_DROPPED_REP); +GSN_PRINT_SIGNATURE(printFAIL_REP); +GSN_PRINT_SIGNATURE(printDISCONNECT_REP); +GSN_PRINT_SIGNATURE(printSUB_CREATE_REQ); +GSN_PRINT_SIGNATURE(printSUB_CREATE_CONF); +GSN_PRINT_SIGNATURE(printSUB_START_REQ); +GSN_PRINT_SIGNATURE(printSUB_START_REF); +GSN_PRINT_SIGNATURE(printSUB_START_CONF); +GSN_PRINT_SIGNATURE(printSUB_SYNC_REQ); +GSN_PRINT_SIGNATURE(printSUB_SYNC_REF); +GSN_PRINT_SIGNATURE(printSUB_SYNC_CONF); +GSN_PRINT_SIGNATURE(printSUB_META_DATA); +GSN_PRINT_SIGNATURE(printSUB_TABLE_DATA); +GSN_PRINT_SIGNATURE(printSUB_SYNC_CONTINUE_REQ); +GSN_PRINT_SIGNATURE(printSUB_SYNC_CONTINUE_REF); +GSN_PRINT_SIGNATURE(printSUB_SYNC_CONTINUE_CONF); +GSN_PRINT_SIGNATURE(printSUB_GCP_COMPLETE_REP); +GSN_PRINT_SIGNATURE(printCREATE_FRAGMENTATION_REQ); +GSN_PRINT_SIGNATURE(printCREATE_FRAGMENTATION_REF); +GSN_PRINT_SIGNATURE(printCREATE_FRAGMENTATION_CONF); +GSN_PRINT_SIGNATURE(printUTIL_CREATE_LOCK_REQ); +GSN_PRINT_SIGNATURE(printUTIL_CREATE_LOCK_REF); +GSN_PRINT_SIGNATURE(printUTIL_CREATE_LOCK_CONF); +GSN_PRINT_SIGNATURE(printUTIL_DESTROY_LOCK_REQ); +GSN_PRINT_SIGNATURE(printUTIL_DESTROY_LOCK_REF); +GSN_PRINT_SIGNATURE(printUTIL_DESTROY_LOCK_CONF); +GSN_PRINT_SIGNATURE(printUTIL_LOCK_REQ); +GSN_PRINT_SIGNATURE(printUTIL_LOCK_REF); +GSN_PRINT_SIGNATURE(printUTIL_LOCK_CONF); +GSN_PRINT_SIGNATURE(printUTIL_UNLOCK_REQ); +GSN_PRINT_SIGNATURE(printUTIL_UNLOCK_REF); +GSN_PRINT_SIGNATURE(printUTIL_UNLOCK_CONF); +GSN_PRINT_SIGNATURE(printCNTR_START_REQ); +GSN_PRINT_SIGNATURE(printCNTR_START_REF); +GSN_PRINT_SIGNATURE(printCNTR_START_CONF); +GSN_PRINT_SIGNATURE(printREAD_NODES_CONF); +GSN_PRINT_SIGNATURE(printTUX_MAINT_REQ); +GSN_PRINT_SIGNATURE(printACC_LOCKREQ); +GSN_PRINT_SIGNATURE(printLQH_TRANSCONF); +GSN_PRINT_SIGNATURE(printSCAN_FRAGREQ); + +GSN_PRINT_SIGNATURE(printCONTINUEB_NDBFS); +GSN_PRINT_SIGNATURE(printCONTINUEB_DBDIH); + #endif diff --git a/ndb/include/kernel/signaldata/TcContinueB.hpp b/ndb/include/kernel/signaldata/TcContinueB.hpp index 7a093b457e8..85213791b2a 100644 --- a/ndb/include/kernel/signaldata/TcContinueB.hpp +++ b/ndb/include/kernel/signaldata/TcContinueB.hpp @@ -42,7 +42,9 @@ private: ZWAIT_ABORT_ALL = 14, ZCHECK_SCAN_ACTIVE_FAILED_LQH = 15, CHECK_WAIT_DROP_TAB_FAILED_LQH = 16, - TRIGGER_PENDING = 17 + TRIGGER_PENDING = 17, + + DelayTCKEYCONF = 18 }; }; diff --git a/ndb/include/kernel/signaldata/TcKeyConf.hpp b/ndb/include/kernel/signaldata/TcKeyConf.hpp index 27ff344f793..277872b990b 100644 --- a/ndb/include/kernel/signaldata/TcKeyConf.hpp +++ b/ndb/include/kernel/signaldata/TcKeyConf.hpp @@ -47,7 +47,8 @@ public: */ STATIC_CONST( StaticLength = 5 ); STATIC_CONST( OperationLength = 2 ); - + STATIC_CONST( SimpleReadBit = (((Uint32)1) << 31) ); + private: /** diff --git a/ndb/include/kernel/signaldata/TcKeyReq.hpp b/ndb/include/kernel/signaldata/TcKeyReq.hpp index f7d3c2e3282..9e42f2a70d5 100644 --- a/ndb/include/kernel/signaldata/TcKeyReq.hpp +++ b/ndb/include/kernel/signaldata/TcKeyReq.hpp @@ -143,7 +143,7 @@ private: */ static Uint8 getTakeOverScanFlag(const UintR & scanInfo); static Uint16 getTakeOverScanNode(const UintR & scanInfo); - static Uint16 getTakeOverScanInfo(const UintR & scanInfo); + static Uint32 getTakeOverScanInfo(const UintR & scanInfo); /** @@ -172,7 +172,7 @@ private: */ static void setTakeOverScanFlag(UintR & scanInfo, Uint8 flag); static void setTakeOverScanNode(UintR & scanInfo, Uint16 node); - static void setTakeOverScanInfo(UintR & scanInfo, Uint16 aScanInfo); + static void setTakeOverScanInfo(UintR & scanInfo, Uint32 aScanInfo); }; /** @@ -228,21 +228,21 @@ private: * Scan Info * t = Scan take over indicator - 1 Bit - n = Take over node - 16 Bits -> max 65535 - p = Scan Info - 12 Bits -> max 4095 + n = Take over node - 12 Bits -> max 65535 + p = Scan Info - 18 Bits -> max 4095 1111111111222222222233 01234567890123456789012345678901 - tpppppppppppp nnnnnnnnnnnnnnnn + tpppppppppppppppppp nnnnnnnnnnnn */ #define TAKE_OVER_SHIFT (0) -#define TAKE_OVER_NODE_SHIFT (16) -#define TAKE_OVER_NODE_MASK (65535) +#define TAKE_OVER_NODE_SHIFT (20) +#define TAKE_OVER_NODE_MASK (4095) #define SCAN_INFO_SHIFT (1) -#define SCAN_INFO_MASK (4095) +#define SCAN_INFO_MASK (262143) /** * Attr Len @@ -490,9 +490,9 @@ TcKeyReq::getTakeOverScanNode(const UintR & scanInfo){ } inline -Uint16 +Uint32 TcKeyReq::getTakeOverScanInfo(const UintR & scanInfo){ - return (Uint16)((scanInfo >> SCAN_INFO_SHIFT) & SCAN_INFO_MASK); + return (Uint32)((scanInfo >> SCAN_INFO_SHIFT) & SCAN_INFO_MASK); } @@ -512,7 +512,7 @@ TcKeyReq::setTakeOverScanNode(UintR & scanInfo, Uint16 node){ inline void -TcKeyReq::setTakeOverScanInfo(UintR & scanInfo, Uint16 aScanInfo){ +TcKeyReq::setTakeOverScanInfo(UintR & scanInfo, Uint32 aScanInfo){ // ASSERT_MAX(aScanInfo, SCAN_INFO_MASK, "TcKeyReq::setTakeOverScanInfo"); scanInfo |= (aScanInfo << SCAN_INFO_SHIFT); } diff --git a/ndb/include/kernel/signaldata/TupFrag.hpp b/ndb/include/kernel/signaldata/TupFrag.hpp index fc88dacd48f..c1e861c5dff 100644 --- a/ndb/include/kernel/signaldata/TupFrag.hpp +++ b/ndb/include/kernel/signaldata/TupFrag.hpp @@ -105,8 +105,6 @@ public: enum ErrorCode { NoError = 0, InvalidRequest = 800, - NoFreeFragmentOper = 830, - NoFreeIndexFragment = 852, NoFreeFragment = 604, NoFreeAttributes = 827 }; @@ -121,12 +119,13 @@ class TupAddAttrReq { friend class Dblqh; friend class Dbtux; public: - STATIC_CONST( SignalLength = 4 ); + STATIC_CONST( SignalLength = 5 ); private: Uint32 tupConnectPtr; Uint32 notused1; Uint32 attrId; Uint32 attrDescriptor; + Uint32 extTypeInfo; }; class TupAddAttrConf { @@ -143,6 +142,10 @@ class TupAddAttrRef { friend class Dbtup; public: STATIC_CONST( SignalLength = 2 ); + enum ErrorCode { + NoError = 0, + InvalidCharset = 743 + }; private: Uint32 userPtr; Uint32 errorCode; @@ -180,7 +183,8 @@ public: STATIC_CONST( SignalLength = 2 ); enum ErrorCode { NoError = 0, - InvalidAttributeType = 831, + InvalidAttributeType = 742, + InvalidCharset = 743, InvalidNodeSize = 832 }; private: diff --git a/ndb/include/kernel/signaldata/TupKey.hpp b/ndb/include/kernel/signaldata/TupKey.hpp index 304bebbec88..ffd57d81e64 100644 --- a/ndb/include/kernel/signaldata/TupKey.hpp +++ b/ndb/include/kernel/signaldata/TupKey.hpp @@ -80,7 +80,7 @@ class TupKeyConf { friend bool printTUPKEYCONF(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo); public: - STATIC_CONST( SignalLength = 6 ); + STATIC_CONST( SignalLength = 5 ); private: @@ -88,11 +88,10 @@ private: * DATA VARIABLES */ Uint32 userPtr; - Uint32 pageId; - Uint32 pageIndex; Uint32 readLength; Uint32 writeLength; Uint32 noFiredTriggers; + Uint32 lastRow; }; class TupKeyRef { diff --git a/ndb/include/kernel/signaldata/TuxBound.hpp b/ndb/include/kernel/signaldata/TuxBound.hpp index 1f256150573..87ce3c3c098 100644 --- a/ndb/include/kernel/signaldata/TuxBound.hpp +++ b/ndb/include/kernel/signaldata/TuxBound.hpp @@ -48,7 +48,6 @@ private: Uint32 tuxScanPtrI; /* * Number of words of bound info included after fixed signal data. - * Starts with 5 unused words (word 0 is length used by LQH). */ Uint32 boundAiLength; }; diff --git a/ndb/include/kernel/signaldata/UpgradeStartup.hpp b/ndb/include/kernel/signaldata/UpgradeStartup.hpp index badc7ca0e4d..93fef323789 100644 --- a/ndb/include/kernel/signaldata/UpgradeStartup.hpp +++ b/ndb/include/kernel/signaldata/UpgradeStartup.hpp @@ -1,14 +1,16 @@ #ifndef NDB_UPGRADE_STARTUP #define NDB_UPGRADE_STARTUP +class Ndbcntr; + 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/kernel/trigger_definitions.h b/ndb/include/kernel/trigger_definitions.h index 439d65c6c30..7ce74877de4 100644 --- a/ndb/include/kernel/trigger_definitions.h +++ b/ndb/include/kernel/trigger_definitions.h @@ -47,11 +47,11 @@ struct TriggerType { struct TriggerActionTime { enum Value { - TA_BEFORE = 0, // Immediate, before operation - TA_AFTER = 1, // Immediate, after operation - TA_DEFERRED = 2, // Before commit - TA_DETACHED = 3, // After commit in a separate transaction, NYI - TA_CUSTOM = 4 // Hardcoded per TriggerType + TA_BEFORE = 0, /* Immediate, before operation */ + TA_AFTER = 1, /* Immediate, after operation */ + TA_DEFERRED = 2, /* Before commit */ + TA_DETACHED = 3, /* After commit in a separate transaction, NYI */ + TA_CUSTOM = 4 /* Hardcoded per TriggerType */ }; }; @@ -60,7 +60,7 @@ struct TriggerEvent { TE_INSERT = 0, TE_DELETE = 1, TE_UPDATE = 2, - TE_CUSTOM = 3 // Hardcoded per TriggerType + TE_CUSTOM = 3 /* Hardcoded per TriggerType */ }; }; 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/mgmapi/mgmapi.h b/ndb/include/mgmapi/mgmapi.h index 123297b0d71..6dcf58b44e2 100644 --- a/ndb/include/mgmapi/mgmapi.h +++ b/ndb/include/mgmapi/mgmapi.h @@ -56,24 +56,6 @@ extern "C" { #endif /** - * Format of statistical information from the NDB Cluster. - * STATISTIC_LINE is sent on the statistical port from the Management server, - * each line is timestamped with STATISTIC_DATE. - */ -#define STATISTIC_LINE "date=%s epochsecs=%d nodeid=%u trans=%u commit=%u " \ - "read=%u insert=%u attrinfo=%u cops=%u abort=%u" - /** - * Format of statistical information from the NDB Cluster. - * STATISTIC_LINE is sent on the statistical port from the Management server, - * each line is timestamped with STATISTIC_DATE. - */ -#define STATISTIC_DATE "%d-%.2d-%.2d/%.2d:%.2d:%.2d" - /** - * Format of statistical information from the NDB Cluster. - */ -#define OP_STATISTIC_LINE "date=%s epochsecs=%d nodeid=%d operations=%u" - - /** * The NdbMgmHandle. */ typedef struct ndb_mgm_handle * NdbMgmHandle; @@ -82,32 +64,32 @@ extern "C" { * NDB Cluster node types */ enum ndb_mgm_node_type { - NDB_MGM_NODE_TYPE_UNKNOWN = -1, /*/< Node type not known*/ - NDB_MGM_NODE_TYPE_API = NODE_TYPE_API, /*/< An application node (API)*/ - NDB_MGM_NODE_TYPE_NDB = NODE_TYPE_DB, /*/< A database node (DB)*/ - NDB_MGM_NODE_TYPE_MGM = NODE_TYPE_MGM, /*/< A management server node (MGM)*/ - NDB_MGM_NODE_TYPE_REP = NODE_TYPE_REP, ///< A replication node - - NDB_MGM_NODE_TYPE_MIN = 0, /*/< Min valid value*/ - NDB_MGM_NODE_TYPE_MAX = 3 /*/< Max valid value*/ + NDB_MGM_NODE_TYPE_UNKNOWN = -1, /*< Node type not known*/ + NDB_MGM_NODE_TYPE_API = NODE_TYPE_API,/*< An application node (API)*/ + NDB_MGM_NODE_TYPE_NDB = NODE_TYPE_DB, /*< A database node (DB)*/ + NDB_MGM_NODE_TYPE_MGM = NODE_TYPE_MGM,/*< A mgmt server node (MGM)*/ + NDB_MGM_NODE_TYPE_REP = NODE_TYPE_REP,/*< A replication node */ + + NDB_MGM_NODE_TYPE_MIN = 0, /*< Min valid value*/ + NDB_MGM_NODE_TYPE_MAX = 3 /*< Max valid value*/ }; /** * Database node status */ enum ndb_mgm_node_status { - NDB_MGM_NODE_STATUS_UNKNOWN = 0, ///< Node status not known - NDB_MGM_NODE_STATUS_NO_CONTACT = 1, ///< No contact with node - NDB_MGM_NODE_STATUS_NOT_STARTED = 2, ///< Has not run starting protocol - NDB_MGM_NODE_STATUS_STARTING = 3, ///< Is running starting protocol - NDB_MGM_NODE_STATUS_STARTED = 4, ///< Running - NDB_MGM_NODE_STATUS_SHUTTING_DOWN = 5, ///< Is shutting down - NDB_MGM_NODE_STATUS_RESTARTING = 6, ///< Is restarting - NDB_MGM_NODE_STATUS_SINGLEUSER = 7, ///< Maintenance mode - NDB_MGM_NODE_STATUS_RESUME = 8, ///< Resume mode - - NDB_MGM_NODE_STATUS_MIN = 0, ///< Min valid value - NDB_MGM_NODE_STATUS_MAX = 6 ///< Max valid value + NDB_MGM_NODE_STATUS_UNKNOWN = 0, /*< Node status not known*/ + NDB_MGM_NODE_STATUS_NO_CONTACT = 1, /*< No contact with node*/ + NDB_MGM_NODE_STATUS_NOT_STARTED = 2, /*< Has not run starting protocol*/ + NDB_MGM_NODE_STATUS_STARTING = 3, /*< Is running starting protocol*/ + NDB_MGM_NODE_STATUS_STARTED = 4, /*< Running*/ + NDB_MGM_NODE_STATUS_SHUTTING_DOWN = 5, /*< Is shutting down*/ + NDB_MGM_NODE_STATUS_RESTARTING = 6, /*< Is restarting*/ + NDB_MGM_NODE_STATUS_SINGLEUSER = 7, /*< Maintenance mode*/ + NDB_MGM_NODE_STATUS_RESUME = 8, /*< Resume mode*/ + + NDB_MGM_NODE_STATUS_MIN = 0, /*< Min valid value*/ + NDB_MGM_NODE_STATUS_MAX = 6 /*< Max valid value*/ }; /** @@ -140,7 +122,10 @@ extern "C" { /* Service errors - Single User Mode */ NDB_MGM_COULD_NOT_ENTER_SINGLE_USER_MODE = 4001, - NDB_MGM_COULD_NOT_EXIT_SINGLE_USER_MODE = 4002 + NDB_MGM_COULD_NOT_EXIT_SINGLE_USER_MODE = 4002, + + /* Usage errors */ + NDB_MGM_USAGE_ERROR = 5001 }; struct Ndb_Mgm_Error_Msg { @@ -176,7 +161,11 @@ extern "C" { { NDB_MGM_COULD_NOT_ENTER_SINGLE_USER_MODE, "Could not enter single user mode" }, { NDB_MGM_COULD_NOT_EXIT_SINGLE_USER_MODE, - "Could not exit single user mode" } + "Could not exit single user mode" }, + + /* Usage errors */ + { NDB_MGM_USAGE_ERROR, + "Usage error" } }; const int ndb_mgm_noOfErrorMsgs = @@ -186,51 +175,58 @@ extern "C" { * Structure returned by ndb_mgm_get_status */ struct ndb_mgm_node_state { - int node_id; ///< NDB Cluster node id - enum ndb_mgm_node_type node_type; ///< Type of NDB Cluster node - enum ndb_mgm_node_status node_status; ///< State of node - int start_phase; ///< Start phase. - ///< @note Start phase is only - ///< valid if - ///< node_type is - ///< NDB_MGM_NODE_TYPE_NDB and - ///< node_status is - ///< NDB_MGM_NODE_STATUS_STARTING - int dynamic_id; ///< Id for heartbeats and - ///< master take-over - ///< (only valid for DB nodes) - int node_group; ///< Node group of node - ///< (only valid for DB nodes) - int version; ///< Internal version number - int connect_count; ///< No of times node has connected - ///< or disconnected to the mgm srv + int node_id; /*< NDB Cluster node id*/ + enum ndb_mgm_node_type node_type; /*< Type of NDB Cluster node*/ + enum ndb_mgm_node_status node_status; /*< State of node*/ + int start_phase; /*< Start phase. + *< @note Start phase is only + *< valid if + *< node_type is + *< NDB_MGM_NODE_TYPE_NDB and + *< node_status is + *< NDB_MGM_NODE_STATUS_STARTING + */ + int dynamic_id; /*< Id for heartbeats and + *< master take-over + *< (only valid for DB nodes) + */ + int node_group; /*< Node group of node + *< (only valid for DB nodes)*/ + int version; /*< Internal version number*/ + int connect_count; /*< No of times node has connected + *< or disconnected to the mgm srv + */ + char connect_address[sizeof("000.000.000.000")+1]; }; /** * Cluster status */ struct ndb_mgm_cluster_state { - int no_of_nodes; ///< No of entries in the - ///< node_states array - struct ndb_mgm_node_state ///< An array with node_states + int no_of_nodes; /*< No of entries in the + *< node_states array + */ + struct ndb_mgm_node_state /*< An array with node_states*/ node_states[1]; + const char *hostname; }; /** * Default reply from the server */ struct ndb_mgm_reply { - int return_code; ///< 0 if successful, - ///< otherwise error code. - char message[256]; ///< Error or reply message. + int return_code; /*< 0 if successful, + *< otherwise error code. + */ + char message[256]; /*< Error or reply message.*/ }; /** * Default information types */ enum ndb_mgm_info { - NDB_MGM_INFO_CLUSTER, ///< ? - NDB_MGM_INFO_CLUSTERLOG ///< Cluster log + NDB_MGM_INFO_CLUSTER, /*< ?*/ + NDB_MGM_INFO_CLUSTERLOG /*< Cluster log*/ }; /** @@ -238,51 +234,75 @@ extern "C" { * (Used only in the development of NDB Cluster.) */ enum ndb_mgm_signal_log_mode { - NDB_MGM_SIGNAL_LOG_MODE_IN, ///< Log receiving signals - NDB_MGM_SIGNAL_LOG_MODE_OUT, ///< Log sending signals - NDB_MGM_SIGNAL_LOG_MODE_INOUT, ///< Log both sending/receiving - NDB_MGM_SIGNAL_LOG_MODE_OFF ///< Log off + NDB_MGM_SIGNAL_LOG_MODE_IN, /*< Log receiving signals */ + NDB_MGM_SIGNAL_LOG_MODE_OUT, /*< Log sending signals*/ + NDB_MGM_SIGNAL_LOG_MODE_INOUT, /*< Log both sending/receiving*/ + NDB_MGM_SIGNAL_LOG_MODE_OFF /*< Log off*/ }; /** * Log severities (used to filter the cluster log) */ enum ndb_mgm_clusterlog_level { - NDB_MGM_CLUSTERLOG_OFF = 0, ///< Cluster log off - NDB_MGM_CLUSTERLOG_DEBUG = 1, ///< Used in NDB Cluster - ///< developement - NDB_MGM_CLUSTERLOG_INFO = 2, ///< Informational messages - NDB_MGM_CLUSTERLOG_WARNING = 3, ///< Conditions that are not - ///< error condition, but - ///< might require handling - NDB_MGM_CLUSTERLOG_ERROR = 4, ///< Conditions that should be - ///< corrected - NDB_MGM_CLUSTERLOG_CRITICAL = 5, ///< Critical conditions, like - ///< device errors or out of - ///< resources - NDB_MGM_CLUSTERLOG_ALERT = 6, ///< A condition that should be - ///< corrected immediately, - ///< such as a corrupted system - NDB_MGM_CLUSTERLOG_ALL = 7 ///< All severities on + NDB_MGM_CLUSTERLOG_OFF = 0, /*< Cluster log off*/ + NDB_MGM_CLUSTERLOG_DEBUG = 1, /*< Used in NDB Cluster + *< developement + */ + NDB_MGM_CLUSTERLOG_INFO = 2, /*< Informational messages*/ + NDB_MGM_CLUSTERLOG_WARNING = 3, /*< Conditions that are not + *< error condition, but + *< might require handling + */ + NDB_MGM_CLUSTERLOG_ERROR = 4, /*< Conditions that should be + *< corrected + */ + NDB_MGM_CLUSTERLOG_CRITICAL = 5, /*< Critical conditions, like + *< device errors or out of + *< resources + */ + NDB_MGM_CLUSTERLOG_ALERT = 6, /*< A condition that should be + *< corrected immediately, + *< such as a corrupted system + */ + NDB_MGM_CLUSTERLOG_ALL = 7 /*< All severities on*/ }; /** * Log categories */ enum ndb_mgm_event_category { - NDB_MGM_EVENT_CATEGORY_STARTUP, ///< Events during all kinds - ///< of startups - NDB_MGM_EVENT_CATEGORY_SHUTDOWN, ///< Events during shutdown - NDB_MGM_EVENT_CATEGORY_STATISTIC, ///< Transaction statistics - ///< (Job level, TCP/IP speed) - NDB_MGM_EVENT_CATEGORY_CHECKPOINT, ///< Checkpoints - NDB_MGM_EVENT_CATEGORY_NODE_RESTART, ///< Events during node restart - NDB_MGM_EVENT_CATEGORY_CONNECTION, ///< Events related to connection - ///< and communication - NDB_MGM_EVENT_CATEGORY_ERROR ///< Assorted event w.r.t. - ///< unexpected happenings + /** + * Invalid + */ + NDB_MGM_ILLEGAL_EVENT_CATEGORY = -1, + /** + * Events during all kinds of startups + */ + NDB_MGM_EVENT_CATEGORY_STARTUP = CFG_LOGLEVEL_STARTUP, + + /** + * Events during shutdown + */ + NDB_MGM_EVENT_CATEGORY_SHUTDOWN = CFG_LOGLEVEL_SHUTDOWN, + + /** + * Transaction statistics (Job level, TCP/IP speed) + */ + NDB_MGM_EVENT_CATEGORY_STATISTIC = CFG_LOGLEVEL_STATISTICS, + NDB_MGM_EVENT_CATEGORY_CHECKPOINT = CFG_LOGLEVEL_CHECKPOINT, + NDB_MGM_EVENT_CATEGORY_NODE_RESTART = CFG_LOGLEVEL_NODERESTART, + NDB_MGM_EVENT_CATEGORY_CONNECTION = CFG_LOGLEVEL_CONNECTION, + NDB_MGM_EVENT_CATEGORY_DEBUG = CFG_LOGLEVEL_DEBUG, + NDB_MGM_EVENT_CATEGORY_INFO = CFG_LOGLEVEL_INFO, + NDB_MGM_EVENT_CATEGORY_WARNING = CFG_LOGLEVEL_WARNING, + NDB_MGM_EVENT_CATEGORY_ERROR = CFG_LOGLEVEL_ERROR, + NDB_MGM_EVENT_CATEGORY_GREP = CFG_LOGLEVEL_GREP, + NDB_MGM_EVENT_CATEGORY_BACKUP = CFG_LOGLEVEL_BACKUP, + + NDB_MGM_MIN_EVENT_CATEGORY = CFG_MIN_LOGLEVEL, + NDB_MGM_MAX_EVENT_CATEGORY = CFG_MAX_LOGLEVEL }; - + /***************************************************************************/ /** * @name Functions: Error Handling @@ -395,6 +415,14 @@ extern "C" { const char * ndb_mgm_get_node_type_string(enum ndb_mgm_node_type type); /** + * Convert an ndb_mgm_node_type to a alias string + * + * @param type Node type. + * @return NULL if invalid id. + */ + const char * ndb_mgm_get_node_type_alias_string(enum ndb_mgm_node_type type, const char **str); + + /** * Convert a string to a ndb_mgm_node_status * * @param status NDB node status string. @@ -410,6 +438,9 @@ extern "C" { */ const char * ndb_mgm_get_node_status_string(enum ndb_mgm_node_status status); + ndb_mgm_event_category ndb_mgm_match_event_category(const char *); + const char * ndb_mgm_get_event_category_string(enum ndb_mgm_event_category); + /** @} *********************************************************************/ /** * @name Functions: State of cluster @@ -570,8 +601,7 @@ extern "C" { */ int ndb_mgm_set_loglevel_clusterlog(NdbMgmHandle handle, int nodeId, - /*enum ndb_mgm_event_category category*/ - char * category, + enum ndb_mgm_event_category category, int level, struct ndb_mgm_reply* reply); @@ -587,8 +617,7 @@ extern "C" { */ int ndb_mgm_set_loglevel_node(NdbMgmHandle handle, int nodeId, - /*enum ndb_mgm_event_category category*/ - char * category, + enum ndb_mgm_event_category category, int level, struct ndb_mgm_reply* reply); @@ -660,14 +689,24 @@ extern "C" { struct ndb_mgm_reply* reply); /** + * Listen event + * + * @param filter pairs of { level, category } that will be + * pushed to fd, level=0 ends lists + * @return fd which events will be pushed to + */ + int ndb_mgm_listen_event(NdbMgmHandle handle, int filter[]); + + /** * Get configuration * @param handle NDB management handle. * @param version Version of configuration, 0 means latest * @see MAKE_VERSION - * @Note the caller must free the pointer returned. + * @Note the caller must call ndb_mgm_detroy_configuration */ struct ndb_mgm_configuration * ndb_mgm_get_configuration(NdbMgmHandle handle, unsigned version); + void ndb_mgm_destroy_configuration(struct ndb_mgm_configuration *); int ndb_mgm_alloc_nodeid(NdbMgmHandle handle, unsigned version, diff --git a/ndb/include/mgmapi/mgmapi_config_parameters.h b/ndb/include/mgmapi/mgmapi_config_parameters.h index 3eca49055fe..6a0cd376355 100644 --- a/ndb/include/mgmapi/mgmapi_config_parameters.h +++ b/ndb/include/mgmapi/mgmapi_config_parameters.h @@ -1,7 +1,6 @@ #ifndef MGMAPI_CONFIG_PARAMTERS_H #define MGMAPI_CONFIG_PARAMTERS_H - #define CFG_SYS_NAME 3 #define CFG_SYS_PRIMARY_MGM_NODE 1 #define CFG_SYS_CONFIG_GENERATION 2 @@ -12,6 +11,7 @@ #define CFG_NODE_BYTE_ORDER 4 #define CFG_NODE_HOST 5 #define CFG_NODE_SYSTEM 6 +#define CFG_NODE_DATADIR 7 /** * DB config parameters @@ -63,23 +63,42 @@ #define CFG_DB_BACKUP_LOG_BUFFER_MEM 135 #define CFG_DB_BACKUP_WRITE_SIZE 136 -#define CFG_LOGLEVEL_STARTUP 137 -#define CFG_LOGLEVEL_SHUTDOWN 138 -#define CFG_LOGLEVEL_STATISTICS 139 -#define CFG_LOGLEVEL_CHECKPOINT 140 -#define CFG_LOGLEVEL_NODERESTART 141 -#define CFG_LOGLEVEL_CONNECTION 142 -#define CFG_LOGLEVEL_INFO 143 -#define CFG_LOGLEVEL_WARNING 144 -#define CFG_LOGLEVEL_ERROR 145 -#define CFG_LOGLEVEL_GREP 146 #define CFG_LOG_DESTINATION 147 #define CFG_DB_DISCLESS 148 +#define CFG_DB_NO_ORDERED_INDEXES 149 +#define CFG_DB_NO_UNIQUE_HASH_INDEXES 150 +#define CFG_DB_NO_LOCAL_OPS 151 +#define CFG_DB_NO_LOCAL_SCANS 152 +#define CFG_DB_BATCH_SIZE 153 + +#define CFG_DB_UNDO_INDEX_BUFFER 154 +#define CFG_DB_UNDO_DATA_BUFFER 155 +#define CFG_DB_REDO_BUFFER 156 + +#define CFG_DB_LONG_SIGNAL_BUFFER 157 + +#define CFG_DB_BACKUP_DATADIR 158 + #define CFG_NODE_ARBIT_RANK 200 #define CFG_NODE_ARBIT_DELAY 201 +#define CFG_MIN_LOGLEVEL 250 +#define CFG_LOGLEVEL_STARTUP 250 +#define CFG_LOGLEVEL_SHUTDOWN 251 +#define CFG_LOGLEVEL_STATISTICS 252 +#define CFG_LOGLEVEL_CHECKPOINT 253 +#define CFG_LOGLEVEL_NODERESTART 254 +#define CFG_LOGLEVEL_CONNECTION 255 +#define CFG_LOGLEVEL_INFO 256 +#define CFG_LOGLEVEL_WARNING 257 +#define CFG_LOGLEVEL_ERROR 258 +#define CFG_LOGLEVEL_GREP 259 +#define CFG_LOGLEVEL_DEBUG 260 +#define CFG_LOGLEVEL_BACKUP 261 +#define CFG_MAX_LOGLEVEL 261 + #define CFG_MGM_PORT 300 #define CFG_CONNECTION_NODE_1 400 @@ -89,9 +108,9 @@ #define CFG_CONNECTION_NODE_1_SYSTEM 404 #define CFG_CONNECTION_NODE_2_SYSTEM 405 #define CFG_CONNECTION_SERVER_PORT 406 +#define CFG_CONNECTION_HOSTNAME_1 407 +#define CFG_CONNECTION_HOSTNAME_2 408 -#define CFG_TCP_HOSTNAME_1 450 -#define CFG_TCP_HOSTNAME_2 451 #define CFG_TCP_SERVER 452 #define CFG_TCP_SEND_BUFFER_SIZE 454 #define CFG_TCP_RECEIVE_BUFFER_SIZE 455 @@ -102,19 +121,13 @@ #define CFG_SHM_KEY 502 #define CFG_SHM_BUFFER_MEM 503 -#define CFG_SCI_ID_0 550 -#define CFG_SCI_ID_1 551 -#define CFG_SCI_SEND_LIMIT 552 -#define CFG_SCI_BUFFER_MEM 553 -#define CFG_SCI_NODE1_ADAPTERS 554 -#define CFG_SCI_NODE1_ADAPTER0 555 -#define CFG_SCI_NODE1_ADAPTER1 556 -#define CFG_SCI_NODE2_ADAPTERS 554 -#define CFG_SCI_NODE2_ADAPTER0 555 -#define CFG_SCI_NODE2_ADAPTER1 556 - -#define CFG_OSE_HOSTNAME_1 600 -#define CFG_OSE_HOSTNAME_2 601 +#define CFG_SCI_HOST1_ID_0 550 +#define CFG_SCI_HOST1_ID_1 551 +#define CFG_SCI_HOST2_ID_0 552 +#define CFG_SCI_HOST2_ID_1 553 +#define CFG_SCI_SEND_LIMIT 554 +#define CFG_SCI_BUFFER_MEM 555 + #define CFG_OSE_PRIO_A_SIZE 602 #define CFG_OSE_PRIO_B_SIZE 603 #define CFG_OSE_RECEIVE_ARRAY_SIZE 604 @@ -122,6 +135,14 @@ #define CFG_REP_HEARTBEAT_INTERVAL 700 /** + * API Config variables + * + */ +#define CFG_MAX_SCAN_BATCH_SIZE 800 +#define CFG_BATCH_BYTE_SIZE 801 +#define CFG_BATCH_SIZE 802 + +/** * Internal */ #define CFG_DB_STOP_ON_ERROR_INSERT 1 diff --git a/ndb/include/mgmcommon/ConfigRetriever.hpp b/ndb/include/mgmcommon/ConfigRetriever.hpp index 396ce24308c..6c32255e921 100644 --- a/ndb/include/mgmcommon/ConfigRetriever.hpp +++ b/ndb/include/mgmcommon/ConfigRetriever.hpp @@ -28,19 +28,13 @@ */ class ConfigRetriever { public: - ConfigRetriever(Uint32 version, Uint32 nodeType); + ConfigRetriever(LocalConfig &local_config, Uint32 version, Uint32 nodeType); ~ConfigRetriever(); - /** - * Read local config - * @return Own node id, -1 means fail - */ - int init(); - - int do_connect(); + int do_connect(int exit_on_connect_failure= false); /** - * Get configuration for current (nodeId given in local config file) node. + * Get configuration for current node. * * Configuration is fetched from one MGM server configured in local config * file. The method loops over all the configured MGM servers and tries @@ -55,16 +49,6 @@ public: const char * getErrorString(); /** - * Sets connectstring which can be used instead of local config file - */ - void setConnectString(const char * connectString); - - /** - * Sets name of local config file (usually not needed) - */ - void setLocalConfigFileName(const char * connectString); - - /** * @return Node id of this node (as stated in local config or connectString) */ Uint32 allocNodeId(); @@ -78,6 +62,14 @@ public: * Get config from file */ struct ndb_mgm_configuration * getConfig(const char * file); + + /** + * Verify config + */ + bool verifyConfig(const struct ndb_mgm_configuration *, Uint32 nodeid); + + Uint32 get_mgmd_port() const {return m_mgmd_port;}; + const char *get_mgmd_host() const {return m_mgmd_host;}; private: BaseString errorString; enum ErrorType { @@ -88,20 +80,14 @@ private: void setError(ErrorType, const char * errorMsg); - BaseString _localConfigFileName; - struct LocalConfig _localConfig; - int _ownNodeId; - - BaseString m_connectString; - + struct LocalConfig& _localConfig; + Uint32 _ownNodeId; + Uint32 m_mgmd_port; + const char *m_mgmd_host; + Uint32 m_version; Uint32 m_node_type; NdbMgmHandle m_handle; - - /** - * Verify config - */ - bool verifyConfig(const struct ndb_mgm_configuration *); }; #endif diff --git a/ndb/include/mgmcommon/LocalConfig.hpp b/ndb/include/mgmcommon/LocalConfig.hpp index c741b35f482..9ceeffdba36 100644 --- a/ndb/include/mgmcommon/LocalConfig.hpp +++ b/ndb/include/mgmcommon/LocalConfig.hpp @@ -53,14 +53,14 @@ struct LocalConfig { void printUsage() const; void setError(int lineNumber, const char * _msg); - bool readConnectString(const char *); + bool readConnectString(const char *, const char *info); bool readFile(const char * file, bool &fopenError); bool parseLine(char * line, int lineNumber); bool parseNodeId(const char *buf); bool parseHostName(const char *buf); bool parseFileName(const char *buf); - bool parseString(const char *buf, char *line); + bool parseString(const char *buf, BaseString &err); }; #endif // LocalConfig_H diff --git a/ndb/include/mgmcommon/NdbConfig.h b/ndb/include/mgmcommon/NdbConfig.h index 5c83a348df2..1bca825ab8d 100644 --- a/ndb/include/mgmcommon/NdbConfig.h +++ b/ndb/include/mgmcommon/NdbConfig.h @@ -21,6 +21,8 @@ extern "C" { #endif +const char* NdbConfig_get_path(int *len); +void NdbConfig_SetPath(const char *path); char* NdbConfig_NdbCfgName(int with_ndb_home); char* NdbConfig_ErrorFileName(int node_id); char* NdbConfig_ClusterLogFileName(int node_id); diff --git a/ndb/include/ndb_global.h b/ndb/include/ndb_global.h index b8fcca6dbb1..09559f6ddff 100644 --- a/ndb/include/ndb_global.h +++ b/ndb/include/ndb_global.h @@ -3,7 +3,6 @@ #define NDBGLOBAL_H #include <my_global.h> -#define NDB_BASE_PORT 2200 /** signal & SIG_PIPE */ #include <my_alarm.h> @@ -14,6 +13,9 @@ #undef NDB_WIN32 #endif +#ifdef _AIX +#undef _H_STRINGS +#endif #include <m_string.h> #include <m_ctype.h> #include <ndb_types.h> @@ -61,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 @@ -77,6 +79,10 @@ extern "C" { #include <assert.h> +/* call in main() - does not return on error */ +extern int ndb_init(void); +extern void ndb_end(int); + #ifndef HAVE_STRDUP extern char * strdup(const char *s); #endif diff --git a/ndb/include/ndb_types.h b/ndb/include/ndb_types.h index 87ebd3d6c6b..a2988dbae78 100644 --- a/ndb/include/ndb_types.h +++ b/ndb/include/ndb_types.h @@ -33,7 +33,7 @@ typedef unsigned int UintR; #ifdef __SIZE_TYPE__ typedef __SIZE_TYPE__ UintPtr; #else -#include <my_global.h> +#include <ndb_global.h> #ifdef HAVE_STDINT_H #include <stdint.h> #endif diff --git a/ndb/include/ndbapi/Ndb.hpp b/ndb/include/ndbapi/Ndb.hpp index 7904ecef305..5ec09269695 100644 --- a/ndb/include/ndbapi/Ndb.hpp +++ b/ndb/include/ndbapi/Ndb.hpp @@ -860,6 +860,7 @@ #include <ndb_types.h> #include <ndbapi_limits.h> +#include <ndb_cluster_connection.hpp> #include <NdbError.hpp> #include <NdbDictionary.hpp> @@ -880,6 +881,7 @@ class Table; class BaseString; class NdbEventOperation; class NdbBlob; +class NdbReceiver; typedef void (* NdbEventCallback)(NdbEventOperation*, Ndb*, void*); @@ -992,6 +994,8 @@ public: * deprecated. */ Ndb(const char* aCatalogName = "", const char* aSchemaName = "def"); + Ndb(Ndb_cluster_connection *ndb_cluster_connection, + const char* aCatalogName = "", const char* aSchemaName = "def"); ~Ndb(); @@ -1081,8 +1085,9 @@ public: * @return 0: Ndb is ready and timeout has not occurred.<br> * -1: Timeout has expired */ + int waitUntilReady(int timeout = 60); - + /** @} *********************************************************************/ /** @@ -1357,15 +1362,6 @@ public: */ static void setConnectString(const char * connectString); - /** - * useFullyQualifiedNames - * Enables unique name space for different databases and schemas - * by defining table names as DATABASENAME/SCHEMANAME/TABLENAME and - * index names as DATABASENAME/SCHEMANAME/TABLENAME/INDEXNAME - * @param turnNamingOn bool true - turn naming on, false - turn naming off - */ - void useFullyQualifiedNames(bool turnNamingOn = true); - bool usingFullyQualifiedNames(); /** @} *********************************************************************/ @@ -1416,13 +1412,13 @@ public: */ Uint64 getAutoIncrementValue(const char* aTableName, Uint32 cacheSize = 1); - Uint64 getAutoIncrementValue(NdbDictionary::Table * aTable, + Uint64 getAutoIncrementValue(const NdbDictionary::Table * aTable, Uint32 cacheSize = 1); Uint64 readAutoIncrementValue(const char* aTableName); - Uint64 readAutoIncrementValue(NdbDictionary::Table * aTable); + Uint64 readAutoIncrementValue(const NdbDictionary::Table * aTable); bool setAutoIncrementValue(const char* aTableName, Uint64 val, bool increase = false); - bool setAutoIncrementValue(NdbDictionary::Table * aTable, Uint64 val, + bool setAutoIncrementValue(const NdbDictionary::Table * aTable, Uint64 val, bool increase = false); Uint64 getTupleIdFromNdb(const char* aTableName, Uint32 cacheSize = 1000); @@ -1447,6 +1443,12 @@ public: ****************************************************************************/ private: + void setup(Ndb_cluster_connection *ndb_cluster_connection, + const char* aCatalogName, const char* aSchemaName); + + void connected(Uint32 block_reference); + + NdbConnection* startTransactionLocal(Uint32 aPrio, Uint32 aFragmentId); // Connect the connection object to the Database. @@ -1585,6 +1587,7 @@ private: * These are the private variables in this class. *****************************************************************************/ NdbObjectIdMap* theNdbObjectIdMap; + Ndb_cluster_connection *m_ndb_cluster_connection; NdbConnection** thePreparedTransactionsArray; NdbConnection** theSentTransactionsArray; @@ -1610,7 +1613,6 @@ private: char prefixName[NDB_MAX_INTERNAL_TABLE_LENGTH]; char * prefixEnd; - //Table* theTable; // The table object class NdbImpl * theImpl; class NdbDictionaryImpl* theDictionary; class NdbGlobalEventBufferHandle* theGlobalEventBufferHandle; @@ -1696,14 +1698,17 @@ private: NdbApiSignal* theCommitAckSignal; + +#ifdef POORMANSPURIFY int cfreeSignals; int cnewSignals; int cgetSignals; int creleaseSignals; +#endif static void executeMessage(void*, NdbApiSignal *, struct LinearSectionPtr ptr[3]); - static void statusMessage(void*, Uint16, bool, bool); + static void statusMessage(void*, Uint32, bool, bool); #ifdef VM_TRACE void printState(const char* fmt, ...); #endif diff --git a/ndb/include/ndbapi/NdbBlob.hpp b/ndb/include/ndbapi/NdbBlob.hpp index dc47115d16f..5df61a0806c 100644 --- a/ndb/include/ndbapi/NdbBlob.hpp +++ b/ndb/include/ndbapi/NdbBlob.hpp @@ -192,7 +192,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 @@ -200,19 +200,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. */ @@ -238,9 +238,9 @@ private: Ndb* theNdb; NdbConnection* theNdbCon; NdbOperation* theNdbOp; - NdbTableImpl* theTable; - NdbTableImpl* theAccessTable; - NdbTableImpl* theBlobTable; + const NdbTableImpl* theTable; + const NdbTableImpl* theAccessTable; + const NdbTableImpl* theBlobTable; const NdbColumnImpl* theColumn; char theFillChar; // sizes diff --git a/ndb/include/ndbapi/NdbConnection.hpp b/ndb/include/ndbapi/NdbConnection.hpp index c268f9aab04..92b940e96f7 100644 --- a/ndb/include/ndbapi/NdbConnection.hpp +++ b/ndb/include/ndbapi/NdbConnection.hpp @@ -442,13 +442,13 @@ public: int executePendingBlobOps(Uint8 flags = 0xFF); // Fast path calls for MySQL ha_ndbcluster - NdbOperation* getNdbOperation(NdbDictionary::Table * table); - NdbIndexOperation* getNdbIndexOperation(NdbDictionary::Index * index, - NdbDictionary::Table * table); - NdbScanOperation* getNdbScanOperation(NdbDictionary::Table * table); - NdbIndexScanOperation* getNdbIndexScanOperation(NdbDictionary::Index * index, - NdbDictionary::Table * table); - + NdbOperation* getNdbOperation(const NdbDictionary::Table * table); + NdbIndexOperation* getNdbIndexOperation(const NdbDictionary::Index *, + const NdbDictionary::Table * table); + NdbScanOperation* getNdbScanOperation(const NdbDictionary::Table * table); + NdbIndexScanOperation* getNdbIndexScanOperation(const NdbDictionary::Index * index, + const NdbDictionary::Table * table); + private: /** * Release completed operations @@ -526,9 +526,8 @@ private: int sendCOMMIT(); // Send a TC_COMMITREQ signal; void setGCI(int GCI); // Set the global checkpoint identity - int OpCompleteFailure(); // Operation Completed with success - int OpCompleteSuccess(); // Operation Completed with success - + int OpCompleteFailure(Uint8 abortoption); + int OpCompleteSuccess(); void CompletedOperations(); // Move active ops to list of completed void OpSent(); // Operation Sent with success @@ -556,14 +555,14 @@ private: void setOperationErrorCodeAbort(int anErrorCode); int checkMagicNumber(); // Verify correct object - NdbOperation* getNdbOperation(class NdbTableImpl* aTable, + NdbOperation* getNdbOperation(const class NdbTableImpl* aTable, NdbOperation* aNextOp = 0); - NdbIndexScanOperation* getNdbScanOperation(class NdbTableImpl* aTable); - NdbIndexOperation* getNdbIndexOperation(class NdbIndexImpl* anIndex, - class NdbTableImpl* aTable, + NdbIndexScanOperation* getNdbScanOperation(const class NdbTableImpl* aTable); + NdbIndexOperation* getNdbIndexOperation(const class NdbIndexImpl* anIndex, + const class NdbTableImpl* aTable, NdbOperation* aNextOp = 0); - NdbIndexScanOperation* getNdbIndexScanOperation(NdbIndexImpl* index, - NdbTableImpl* table); + NdbIndexScanOperation* getNdbIndexScanOperation(const NdbIndexImpl* index, + const NdbTableImpl* table); void handleExecuteCompletion(); @@ -649,6 +648,18 @@ private: Uint32 theNodeSequence; // The sequence no of the db node bool theReleaseOnClose; + /** + * handle transaction spanning + * multiple TC/db nodes + * + * 1) Bitmask with used nodes + * 2) Bitmask with nodes failed during op + */ + Uint32 m_db_nodes[2]; + Uint32 m_failed_db_nodes[2]; + + int report_node_failure(Uint32 id); + // Scan operations bool m_waitForReply; NdbIndexScanOperation* m_theFirstScanOperation; @@ -673,6 +684,9 @@ private: void printState(); #endif bool checkState_TransId(const Uint32 * transId) const; + + void remove_list(NdbOperation*& head, NdbOperation*); + void define_scan_op(NdbIndexScanOperation*); }; inline diff --git a/ndb/include/ndbapi/NdbDictionary.hpp b/ndb/include/ndbapi/NdbDictionary.hpp index b5c3985c6cb..51a6895648f 100644 --- a/ndb/include/ndbapi/NdbDictionary.hpp +++ b/ndb/include/ndbapi/NdbDictionary.hpp @@ -32,6 +32,8 @@ #include <ndb_types.h> class Ndb; +struct charset_info_st; +typedef struct charset_info_st CHARSET_INFO; /** * @class NdbDictionary @@ -257,6 +259,10 @@ public: /** * Set type of column * @param type Type of column + * + * @note setType resets <em>all</em> column attributes + * to (type dependent) defaults and should be the first + * method to call. Default type is Unsigned. */ void setType(Type type); @@ -302,27 +308,35 @@ public: int getLength() const; /** + * For Char or Varchar or Text, set or get MySQL CHARSET_INFO. This + * specifies both character set and collation. See get_charset() + * etc in MySQL. (The cs is not "const" in MySQL). + */ + void setCharset(CHARSET_INFO* cs); + CHARSET_INFO* getCharset() const; + + /** * For blob, set or get "inline size" i.e. number of initial bytes * to store in table's blob attribute. This part is normally in * main memory and can be indexed and interpreted. */ - void setInlineSize(int size) { setPrecision(size); } - int getInlineSize() const { return getPrecision(); } + void setInlineSize(int size); + int getInlineSize() const; /** * For blob, set or get "part size" i.e. number of bytes to store in * each tuple of the "blob table". Can be set to zero to omit parts * and to allow only inline bytes ("tinyblob"). */ - void setPartSize(int size) { setScale(size); } - int getPartSize() const { return getScale(); } + void setPartSize(int size); + int getPartSize() const; /** * For blob, set or get "stripe size" i.e. number of consecutive * <em>parts</em> to store in each node group. */ - void setStripeSize(int size) { setLength(size); } - int getStripeSize() const { return getLength(); } + void setStripeSize(int size); + int getStripeSize() const; /** * Get size of element @@ -379,6 +393,10 @@ public: void setDefaultValue(const char*); const char* getDefaultValue() const; /** @} *******************************************************************/ + + static const Column * FRAGMENT; + static const Column * ROW_COUNT; + static const Column * COMMIT_COUNT; #endif private: @@ -1062,6 +1080,9 @@ public: Dictionary(NdbDictionaryImpl&); const Table * getIndexTable(const char * indexName, const char * tableName); + public: + const Table * getTable(const char * name, void **data); + void set_local_table_data_size(unsigned sz); }; }; diff --git a/ndb/include/ndbapi/NdbIndexOperation.hpp b/ndb/include/ndbapi/NdbIndexOperation.hpp index 2d873c52e56..7612fe54d1b 100644 --- a/ndb/include/ndbapi/NdbIndexOperation.hpp +++ b/ndb/include/ndbapi/NdbIndexOperation.hpp @@ -56,6 +56,15 @@ public: * * @return 0 if successful otherwise -1. */ + int readTuple(LockMode); + + /** + * Define the NdbIndexOperation to be a standard operation of type readTuple. + * When calling NdbConnection::execute, this operation + * reads a tuple. + * + * @return 0 if successful otherwise -1. + */ int readTuple(); /** @@ -175,15 +184,15 @@ private: int executeCursor(int ProcessorId); // Overloaded methods from NdbCursorOperation - int indxInit(class NdbIndexImpl* anIndex, - class NdbTableImpl* aTable, + int indxInit(const class NdbIndexImpl* anIndex, + const class NdbTableImpl* aTable, NdbConnection* myConnection); int equal_impl(const class NdbColumnImpl*, const char* aValue, Uint32 len); int prepareSend(Uint32 TC_ConnectPtr, Uint64 TransactionId); // Private attributes - NdbIndexImpl* m_theIndex; + const NdbIndexImpl* m_theIndex; Uint32 m_theIndexDefined[NDB_MAX_ATTRIBUTES_IN_INDEX][3]; Uint32 m_theIndexLen; // Length of the index in words Uint32 m_theNoOfIndexDefined; // The number of index attributes diff --git a/ndb/include/ndbapi/NdbIndexScanOperation.hpp b/ndb/include/ndbapi/NdbIndexScanOperation.hpp index 82aed04a9fc..66b3fc9d43b 100644 --- a/ndb/include/ndbapi/NdbIndexScanOperation.hpp +++ b/ndb/include/ndbapi/NdbIndexScanOperation.hpp @@ -56,27 +56,11 @@ public: } /** - * @name Define Range Scan - * - * A range scan is a scan on an ordered index. The operation is on - * the index table but tuples are returned from the primary table. - * The index contains all tuples where at least one index key has not - * null value. - * - * A range scan is currently opened via a normal open scan method. - * Bounds can be defined for each index key. After setting bounds, - * usual scan methods can be used (get value, interpreter, take over). - * These operate on the primary table. - * - * @{ - */ - - /** * Type of ordered index key bound. The values (0-4) will not change * and can be used explicitly (e.g. they could be computed). */ enum BoundType { - BoundLE = 0, ///< lower bound, + BoundLE = 0, ///< lower bound BoundLT = 1, ///< lower bound, strict BoundGE = 2, ///< upper bound BoundGT = 3, ///< upper bound, strict @@ -86,20 +70,28 @@ public: /** * Define bound on index key in range scan. * - * 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. + * Each index key can have lower and/or upper bound. Setting the key + * equal to a value defines both upper and lower bounds. The bounds + * can be defined in any order. Conflicting definitions is an error. + * + * For equality, it is better to use BoundEQ instead of the equivalent + * pair of BoundLE and BoundGE. This is especially true when table + * distribution key is an initial part of the index key. + * + * The sets of lower and upper bounds must be on initial sequences of + * index keys. All but possibly the last bound must be non-strict. + * So "a >= 2 and b > 3" is ok but "a > 2 and b >= 3" is not. * - * 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. + * The scan may currently return tuples for which the bounds are not + * satisfied. For example, "a <= 2 and b <= 3" scans the index up to + * (a=2, b=3) but also returns any (a=1, b=4). * * 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 + * value and equal to another NULL value. To compare against NULL use * setBound with null pointer (0). * - * An index stores also all-NULL keys (this may become optional). - * Doing index scan with empty bound set returns all table tuples. + * An index stores also all-NULL keys. Doing index scan with empty + * bound set returns all table tuples. * * @param attrName Attribute name, alternatively: * @param anAttrId Index column id (starting from 0) @@ -117,14 +109,19 @@ public: */ int setBound(Uint32 anAttrId, int type, const void* aValue, Uint32 len = 0); - /** @} *********************************************************************/ + /** + * Reset bounds and put operation in list that will be + * sent on next execute + */ + int reset_bounds(); + bool getSorted() const { return m_ordered; } private: NdbIndexScanOperation(Ndb* aNdb); virtual ~NdbIndexScanOperation(); int setBound(const NdbColumnImpl*, int type, const void* aValue, Uint32 len); - int saveBoundATTRINFO(); + int insertBOUNDS(Uint32 * data, Uint32 sz); virtual int equal_impl(const NdbColumnImpl*, const char*, Uint32); virtual NdbRecAttr* getValue_impl(const NdbColumnImpl*, char*); diff --git a/ndb/include/ndbapi/NdbOperation.hpp b/ndb/include/ndbapi/NdbOperation.hpp index c48dccd4864..8e0294e41e6 100644 --- a/ndb/include/ndbapi/NdbOperation.hpp +++ b/ndb/include/ndbapi/NdbOperation.hpp @@ -21,6 +21,7 @@ #include "ndbapi_limits.h" #include "NdbError.hpp" #include "NdbReceiver.hpp" +#include "NdbDictionary.hpp" class Ndb; class NdbApiSignal; @@ -51,6 +52,19 @@ public: */ /** + * Lock when performing read + */ + + enum LockMode { + LM_Read = 0, + LM_Exclusive = 1, + LM_CommittedRead = 2, +#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL + LM_Dirty = 2 +#endif + }; + + /** * Define the NdbOperation to be a standard operation of type insertTuple. * When calling NdbConnection::execute, this operation * adds a new tuple to the table. @@ -93,6 +107,15 @@ public: * reads a tuple. * * @return 0 if successful otherwise -1. + */ + virtual int readTuple(LockMode); + + /** + * Define the NdbOperation to be a standard operation of type readTuple. + * When calling NdbConnection::execute, this operation + * reads a tuple. + * + * @return 0 if successful otherwise -1. */ virtual int readTuple(); @@ -289,8 +312,9 @@ public: * the attribute, or a NULL pointer * (indicating error). */ - NdbRecAttr* getValue(const char* anAttrName, char* aValue = 0); - NdbRecAttr* getValue(Uint32 anAttrId, char* aValue = 0); + NdbRecAttr* getValue(const char* anAttrName, char* aValue = 0); + NdbRecAttr* getValue(Uint32 anAttrId, char* aValue = 0); + NdbRecAttr* getValue(const NdbDictionary::Column*, char* val = 0); /** * Define an attribute to set or update in query. @@ -609,6 +633,20 @@ public: int interpret_exit_nok(Uint32 ErrorCode); int interpret_exit_nok(); + + /** + * Interpreted program instruction: + * + * For scanning transactions, + * return this row, but no more from this fragment + * + * For non-scanning transactions, + * abort the whole transaction. + * + * @return -1 if unsuccessful. + */ + int interpret_exit_last_row(); + /** * Interpreted program instruction: * Define a subroutine in an interpreted operation. @@ -679,6 +717,8 @@ public: NotDefined ///< Internal for debugging }; + LockMode getLockMode() const { return theLockMode; } + protected: /****************************************************************************** * These are the methods used to create and delete the NdbOperation objects. @@ -693,7 +733,7 @@ protected: //-------------------------------------------------------------- // Initialise after allocating operation to a transaction //-------------------------------------------------------------- - int init(class NdbTableImpl*, NdbConnection* aCon); + int init(const class NdbTableImpl*, NdbConnection* aCon); void initInterpreter(); void next(NdbOperation*); // Set next pointer @@ -711,7 +751,6 @@ protected: FinalGetValue, SubroutineExec, SubroutineEnd, - SetBound, WaitResponse, WaitCommitResponse, Finished, @@ -748,11 +787,6 @@ protected: int receiveTCKEYREF(NdbApiSignal*); - - int receiveTRANSID_AI(const Uint32* aDataPtr, Uint32 aDataLength); - int receiveREAD_CONF(const Uint32* aDataPtr, Uint32 aDataLength); - - int checkMagicNumber(bool b = true); // Verify correct object int checkState_TransId(NdbApiSignal* aSignal); @@ -776,8 +810,6 @@ protected: int branch_col_null(Uint32 type, Uint32 col, Uint32 Label); // Handle ATTRINFO signals - int receiveREAD_AI(Uint32* aDataPtr, Uint32 aLength); - int insertATTRINFO(Uint32 aData); int insertATTRINFOloop(const Uint32* aDataPtr, Uint32 aLength); @@ -842,8 +874,8 @@ protected: Uint32* theKEYINFOptr; // Pointer to where to write KEYINFO Uint32* theATTRINFOptr; // Pointer to where to write ATTRINFO - class NdbTableImpl* m_currentTable; // The current table - class NdbTableImpl* m_accessTable; + const class NdbTableImpl* m_currentTable; // The current table + const class NdbTableImpl* m_accessTable; // Set to TRUE when a tuple key attribute has been defined. Uint32 theTupleKeyDefined[NDB_MAX_NO_OF_ATTRIBUTES_IN_KEY][3]; @@ -856,7 +888,7 @@ protected: // currently defined OperationType theOperationType; // Read Request, Update Req...... - Uint8 theLockMode; // Can be set to WRITE if read operation + LockMode theLockMode; // Can be set to WRITE if read operation OperationStatus theStatus; // The status of the operation. Uint32 theMagicNumber; // Magic number to verify that object // is correct @@ -883,9 +915,6 @@ protected: Uint16 m_keyInfoGSN; Uint16 m_attrInfoGSN; - // saveBoundATTRINFO() moves ATTRINFO here when setBound() is ready - NdbApiSignal* theBoundATTRINFO; - Uint32 theTotalBoundAI_Len; // Blobs in this operation NdbBlob* theBlobList; diff --git a/ndb/include/ndbapi/NdbReceiver.hpp b/ndb/include/ndbapi/NdbReceiver.hpp index 13898fc8e5f..b95313db274 100644 --- a/ndb/include/ndbapi/NdbReceiver.hpp +++ b/ndb/include/ndbapi/NdbReceiver.hpp @@ -19,8 +19,11 @@ #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL // Not part of public interface #include <ndb_types.h> +#include <ndb_global.h> class Ndb; +class NdbConnection; + class NdbReceiver { friend class Ndb; @@ -59,6 +62,7 @@ public: inline void next(NdbReceiver* next) { m_next = next;} inline NdbReceiver* next() { return m_next; } + void setErrorCode(int); private: Uint32 theMagicNumber; Ndb* m_ndb; @@ -75,6 +79,7 @@ private: class NdbRecAttr * getValue(const class NdbColumnImpl*, char * user_dst_ptr); void do_get_value(NdbReceiver*, Uint32 rows, Uint32 key_size); void prepareSend(); + void calculate_batch_size(Uint32, Uint32, Uint32&, Uint32&, Uint32&); int execKEYINFO20(Uint32 info, const Uint32* ptr, Uint32 len); int execTRANSID_AI(const Uint32* ptr, Uint32 len); @@ -126,7 +131,8 @@ int NdbReceiver::execTCOPCONF(Uint32 len){ Uint32 tmp = m_received_result_length; m_expected_result_length = len; - return (tmp == len ? 1 : 0); + assert(!(tmp && !len)); + return ((bool)len ^ (bool)tmp ? 0 : 1); } inline diff --git a/ndb/include/ndbapi/NdbResultSet.hpp b/ndb/include/ndbapi/NdbResultSet.hpp index 483e08179c0..478daf8aad2 100644 --- a/ndb/include/ndbapi/NdbResultSet.hpp +++ b/ndb/include/ndbapi/NdbResultSet.hpp @@ -138,7 +138,11 @@ public: */ int deleteTuple(); int deleteTuple(NdbConnection* takeOverTransaction); - + + /** + * Get underlying operation + */ + NdbOperation* getOperation(); private: NdbResultSet(NdbScanOperation*); @@ -149,4 +153,10 @@ private: NdbScanOperation* m_operation; }; +inline +NdbOperation* +NdbResultSet::getOperation(){ + return m_operation; +} + #endif diff --git a/ndb/include/ndbapi/NdbScanOperation.hpp b/ndb/include/ndbapi/NdbScanOperation.hpp index c7ae029e742..2e4d173ac75 100644 --- a/ndb/include/ndbapi/NdbScanOperation.hpp +++ b/ndb/include/ndbapi/NdbScanOperation.hpp @@ -32,6 +32,7 @@ #include <NdbOperation.hpp> class NdbBlob; +class NdbResultSet; /** * @class NdbScanOperation @@ -54,18 +55,6 @@ public: }; /** - * Lock when performing scan - */ - enum LockMode { - LM_Read = 0, - LM_Exclusive = 1, - LM_CommittedRead = 2, -#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL - LM_Dirty = 2 -#endif - }; - - /** * Type of cursor */ CursorType get_cursor_type() const; @@ -99,18 +88,19 @@ protected: CursorType m_cursor_type; NdbScanOperation(Ndb* aNdb); - ~NdbScanOperation(); + virtual ~NdbScanOperation(); int nextResult(bool fetchAllowed = true); virtual void release(); void closeScan(); + int close_impl(class TransporterFacade*); // Overloaded methods from NdbCursorOperation int executeCursor(int ProcessorId); // Overloaded private methods from NdbOperation - int init(NdbTableImpl* tab, NdbConnection* myConnection); + int init(const NdbTableImpl* tab, NdbConnection* myConnection); int prepareSend(Uint32 TC_ConnectPtr, Uint64 TransactionId); int doSend(int ProcessorId); @@ -122,7 +112,6 @@ protected: NdbConnection *m_transConnection; // Scan related variables - Uint32 theBatchSize; Uint32 theParallelism; Uint32 m_keyInfo; NdbApiSignal* theSCAN_TABREQ; @@ -132,6 +121,7 @@ protected: int prepareSendScan(Uint32 TC_ConnectPtr, Uint64 TransactionId); int fix_receivers(Uint32 parallel); + void reset_receivers(Uint32 parallel, Uint32 ordered); Uint32* m_array; // containing all arrays below Uint32 m_allocated_receivers; NdbReceiver** m_receivers; // All receivers diff --git a/ndb/include/ndbapi/ndb_cluster_connection.hpp b/ndb/include/ndbapi/ndb_cluster_connection.hpp new file mode 100644 index 00000000000..f8e6f25ce73 --- /dev/null +++ b/ndb/include/ndbapi/ndb_cluster_connection.hpp @@ -0,0 +1,47 @@ +/* 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 CLUSTER_CONNECTION_HPP +#define CLUSTER_CONNECTION_HPP + +class TransporterFacade; +class LocalConfig; +class ConfigRetriever; +class NdbThread; + +extern "C" { + void* run_ndb_cluster_connection_connect_thread(void*); +} + +class Ndb_cluster_connection { +public: + Ndb_cluster_connection(const char * connect_string = 0); + ~Ndb_cluster_connection(); + int connect(int reconnect= 0); + int start_connect_thread(int (*connect_callback)(void)= 0); +private: + friend void* run_ndb_cluster_connection_connect_thread(void*); + void connect_thread(); + char *m_connect_string; + TransporterFacade *m_facade; + LocalConfig *m_local_config; + ConfigRetriever *m_config_retriever; + NdbThread *m_connect_thread; + int (*m_connect_callback)(void); +}; + +#endif diff --git a/ndb/include/portlib/NdbCondition.h b/ndb/include/portlib/NdbCondition.h index fb1f2fcd69e..3d959a0db41 100644 --- a/ndb/include/portlib/NdbCondition.h +++ b/ndb/include/portlib/NdbCondition.h @@ -26,21 +26,21 @@ extern "C" { struct NdbCondition; -/* -// Create a condition -// -// * returnvalue: pointer to the condition structure -*/ +/** + * Create a condition + * + * returnvalue: pointer to the condition structure + */ struct NdbCondition* NdbCondition_Create(void); -/* -// Wait for a condition, allows a thread to wait for -// a condition and atomically releases the associated mutex. -// -// * p_cond: pointer to the condition structure -// * p_mutex: pointer to the mutex structure -// * returnvalue: 0 = succeeded, 1 = failed -*/ +/** + * Wait for a condition, allows a thread to wait for + * a condition and atomically releases the associated mutex. + * + * p_cond: pointer to the condition structure + * p_mutex: pointer to the mutex structure + * returnvalue: 0 = succeeded, 1 = failed + */ int NdbCondition_Wait(struct NdbCondition* p_cond, NdbMutex* p_mutex); @@ -60,29 +60,29 @@ NdbCondition_WaitTimeout(struct NdbCondition* p_cond, int msec); -/* -// Signal a condition -// -// * p_cond: pointer to the condition structure -// * returnvalue: 0 = succeeded, 1 = failed -*/ +/** + * Signal a condition + * + * p_cond: pointer to the condition structure + * returnvalue: 0 = succeeded, 1 = failed + */ int NdbCondition_Signal(struct NdbCondition* p_cond); -/* -// Broadcast a condition -// -// * p_cond: pointer to the condition structure -// * returnvalue: 0 = succeeded, 1 = failed -*/ +/** + * Broadcast a condition + * + * p_cond: pointer to the condition structure + * returnvalue: 0 = succeeded, 1 = failed + */ int NdbCondition_Broadcast(struct NdbCondition* p_cond); -/* -// Destroy a condition -// -// * p_cond: pointer to the condition structure -// * returnvalue: 0 = succeeded, 1 = failed -*/ +/** + * Destroy a condition + * + * p_cond: pointer to the condition structure + * returnvalue: 0 = succeeded, 1 = failed + */ int NdbCondition_Destroy(struct NdbCondition* p_cond); #ifdef __cplusplus diff --git a/ndb/include/portlib/NdbMutex.h b/ndb/include/portlib/NdbMutex.h index 28adaacb8c4..b0b985ecef5 100644 --- a/ndb/include/portlib/NdbMutex.h +++ b/ndb/include/portlib/NdbMutex.h @@ -31,13 +31,11 @@ extern "C" { #if defined NDB_OSE || defined NDB_SOFTOSE #include <ose.h> typedef SEMAPHORE NdbMutex; -#define NDB_MUTEX_INITIALIZER { 1, 0, 0 } #elif defined NDB_WIN32 typedef CRITICAL_SECTION NdbMutex; #else #include <pthread.h> typedef pthread_mutex_t NdbMutex; -#define NDB_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER #endif /** diff --git a/ndb/include/portlib/PortDefs.h b/ndb/include/portlib/PortDefs.h index 5e24e08ec61..b61bb627e65 100644 --- a/ndb/include/portlib/PortDefs.h +++ b/ndb/include/portlib/PortDefs.h @@ -28,35 +28,35 @@ struct tms { - time_t tms_utime; // user time - time_t tms_stime; // system time - time_t tms_cutime; // user time of children - time_t tms_cstime; // system time of children + time_t tms_utime; /* user time */ + time_t tms_stime; /* system time */ + time_t tms_cutime; /* user time of children */ + time_t tms_cstime; /* system time of children */ }; struct timespec { - long tv_sec; // Seconds - long tv_nsec; // Nanoseconds + long tv_sec; /* Seconds */ + long tv_nsec; /* Nanoseconds */ }; #define strcasecmp(a,b) _strcmpi(a,b) - // Exports a WIN32 getopt function +/* Exports a WIN32 getopt function */ extern int optind; extern char *optarg; int getopt(int, char **, char *opts); -#endif // NDB_WIN32 +#endif /* NDB_WIN32 */ #ifdef NDB_ALPHA -#ifdef NDB_GCC // only for NDB_ALPHA +#ifdef NDB_GCC /* only for NDB_ALPHA */ extern int gnuShouldNotUseRPCC(); #define RPCC() gnuShouldNotUseRPCC(); #else #ifdef NDB_WIN32 #ifdef __cplusplus extern "C" { -#endif //__cplusplus +#endif /* __cplusplus */ u_int64 __asm(char *, ...); double __dasm(char *, ...); float __fasm(char *, ...); @@ -65,32 +65,32 @@ extern "C" { int __ADD_ATOMIC_LONG2(void *, int); #ifdef __cplusplus }; -#endif //__cplusplus +#endif /* __cplusplus */ #pragma intrinsic (__asm, __dasm, __fasm) #pragma intrinsic(_ReleaseSpinLock, _AcquireSpinLock) #pragma intrinsic(__ADD_ATOMIC_LONG2) -#endif // NDB_WIN32 +#endif /* NDB_WIN32 */ #define RPCC() ((int)__asm(" rpcc v0;")) #define MB() __asm(" mb;"); #define WMB() __asm(" wmb;"); #ifdef USE_INITIALSP #define IS_IP() (__asm(" mov sp,v0;") < IPinitialSP) -#else // USE_INITIALSP +#else /* USE_INITIALSP */ #define IS_IP() (((__asm(" rpcc v0;") >> 32) & 0x7) == IP_CPU) #endif -#endif //NDB_GCC -#else // NDB_ALPHA +#endif /* NDB_GCC */ +#else /* NDB_ALPHA */ #if defined NDB_SPARC -#define MB() asm ("membar 0x0;"); // LoadLoad -#define WMB() asm ("membar 0x3;"); // StoreStore -#else // NDB_SPARC +#define MB() asm ("membar 0x0;"); /* LoadLoad */ +#define WMB() asm ("membar 0x3;"); /* StoreStore */ +#else /* NDB_SPARC */ #define MB() #define WMB() -#endif // NDB_SPARC +#endif /* NDB_SPARC */ #define IS_IP() (1==1) extern int shouldNotUseRPCC(); #define RPCC() shouldNotUseRPCC(); -#endif // NDB_ALPHA +#endif /* NDB_ALPHA */ #endif diff --git a/ndb/include/portlib/prefetch.h b/ndb/include/portlib/prefetch.h index d663dd4c40d..729c80bd93e 100644 --- a/ndb/include/portlib/prefetch.h +++ b/ndb/include/portlib/prefetch.h @@ -42,7 +42,7 @@ inline void prefetch(void* p) { #ifdef NDB_ALPHA __asm(" ldl r31,0(a0);", p); -#endif // NDB_ALPHA +#endif /* NDB_ALPHA */ #ifdef NDB_FORTE6 sparc_prefetch_read_once(p); #else @@ -54,7 +54,7 @@ inline void writehint(void* p) { #ifdef NDB_ALPHA __asm(" wh64 (a0);", p); -#endif // NDB_ALPHA +#endif /* NDB_ALPHA */ #ifdef NDB_FORTE6 sparc_prefetch_write_once(p); #else diff --git a/ndb/include/transporter/TransporterDefinitions.hpp b/ndb/include/transporter/TransporterDefinitions.hpp index 0301d12348f..a8da8068552 100644 --- a/ndb/include/transporter/TransporterDefinitions.hpp +++ b/ndb/include/transporter/TransporterDefinitions.hpp @@ -59,8 +59,6 @@ struct TCP_TransporterConfiguration { NodeId localNodeId; Uint32 sendBufferSize; // Size of SendBuffer of priority B Uint32 maxReceiveSize; // Maximum no of bytes to receive - Uint32 byteOrder; - bool compression; bool checksum; bool signalId; }; @@ -72,10 +70,8 @@ struct SHM_TransporterConfiguration { Uint32 port; NodeId remoteNodeId; NodeId localNodeId; - bool compression; bool checksum; bool signalId; - int byteOrder; Uint32 shmKey; Uint32 shmSize; @@ -89,10 +85,8 @@ struct OSE_TransporterConfiguration { const char *localHostName; NodeId remoteNodeId; NodeId localNodeId; - bool compression; bool checksum; bool signalId; - int byteOrder; Uint32 prioASignalSize; Uint32 prioBSignalSize; @@ -103,20 +97,20 @@ struct OSE_TransporterConfiguration { * SCI Transporter Configuration */ struct SCI_TransporterConfiguration { + const char *remoteHostName; + const char *localHostName; + Uint32 port; Uint32 sendLimit; // Packet size Uint32 bufferSize; // Buffer size Uint32 nLocalAdapters; // 1 or 2, the number of adapters on local host - Uint32 nRemoteAdapters; Uint32 remoteSciNodeId0; // SCInodeId for adapter 1 Uint32 remoteSciNodeId1; // SCInodeId for adapter 2 NodeId localNodeId; // Local node Id NodeId remoteNodeId; // Remote node Id - Uint32 byteOrder; - bool compression; bool checksum; bool signalId; @@ -132,7 +126,7 @@ struct SignalHeader { Uint16 theTrace; Uint8 m_noOfSections; Uint8 m_fragmentInfo; -}; /** 7x4 = 32 Bytes */ +}; /** 7x4 = 28 Bytes */ struct LinearSectionPtr { Uint32 sz; diff --git a/ndb/include/transporter/TransporterRegistry.hpp b/ndb/include/transporter/TransporterRegistry.hpp index 3c6c307406c..ac6291f9e57 100644 --- a/ndb/include/transporter/TransporterRegistry.hpp +++ b/ndb/include/transporter/TransporterRegistry.hpp @@ -218,15 +218,18 @@ public: void printState(); #endif - unsigned short m_service_port; - + class Transporter_interface { + public: + unsigned short m_service_port; + const char *m_interface; + }; + Vector<Transporter_interface> m_transporter_interface; + void add_transporter_interface(const char *interface, unsigned short port); protected: private: void * callbackObj; - TransporterService *m_transporter_service; - char *m_interface_name; struct NdbThread *m_start_clients_thread; bool m_run_start_clients_thread; diff --git a/ndb/include/util/BaseString.hpp b/ndb/include/util/BaseString.hpp index a1bb91ea9c5..066a24f294e 100644 --- a/ndb/include/util/BaseString.hpp +++ b/ndb/include/util/BaseString.hpp @@ -177,6 +177,12 @@ public: * Trim string from <i>delim</i> */ static char* trim(char * src, const char * delim); + + /** + * snprintf on some platforms need special treatment + */ + static int snprintf(char *str, size_t size, const char *format, ...); + static int vsnprintf(char *str, size_t size, const char *format, va_list ap); private: char* m_chr; unsigned m_len; diff --git a/ndb/include/util/NdbAutoPtr.hpp b/ndb/include/util/NdbAutoPtr.hpp index c01650ffc7e..ff747e3de68 100644 --- a/ndb/include/util/NdbAutoPtr.hpp +++ b/ndb/include/util/NdbAutoPtr.hpp @@ -18,6 +18,7 @@ #define __NDB_AUTO_PTR_HPP #include <ndb_global.h> +#include <my_sys.h> template<typename T> class NdbAutoPtr { @@ -46,4 +47,13 @@ public: ~NdbAutoObjArrayPtr() { if (m_obj) delete[] m_obj;} }; +template<typename T> +class My_auto_ptr { + T * m_obj; +public: + My_auto_ptr(T * obj = 0){ m_obj = obj;} + void reset(T * obj = 0) { if (m_obj) my_free(m_obj,MYF(0)); m_obj = obj; } + ~My_auto_ptr() { if (m_obj) my_free(m_obj,MYF(0));} +}; + #endif diff --git a/ndb/include/util/NdbSqlUtil.hpp b/ndb/include/util/NdbSqlUtil.hpp index a79245868e0..3062d1e4e1b 100644 --- a/ndb/include/util/NdbSqlUtil.hpp +++ b/ndb/include/util/NdbSqlUtil.hpp @@ -40,21 +40,25 @@ public: * Compare kernel attribute values. Returns -1, 0, +1 for less, * equal, greater, respectively. Parameters are pointers to values, * full attribute size in words, and size of available data in words. - * There are 2 special return values to check first. All values fit - * into a signed char. + * There is also pointer to type specific extra info. Char types + * receive CHARSET_INFO in it. + * + * If available size is less than full size, CmpUnknown may be + * returned. If a value cannot be parsed, it compares like NULL i.e. + * less than any valid value. */ - typedef int Cmp(const Uint32* p1, const Uint32* p2, Uint32 full, Uint32 size); + typedef int Cmp(const void* info, const Uint32* p1, const Uint32* p2, Uint32 full, Uint32 size); enum CmpResult { CmpLess = -1, CmpEqual = 0, CmpGreater = 1, - CmpUnknown = 126, // insufficient partial data - CmpError = 127 // bad data format or unimplemented comparison + CmpUnknown = 2 // insufficient partial data }; /** * Kernel data types. Must match m_typeList in NdbSqlUtil.cpp. + * Now also must match types in NdbDictionary. */ struct Type { enum Enum { @@ -82,19 +86,25 @@ public: Text // Text blob }; Enum m_typeId; - Cmp* m_cmp; // set to NULL if cmp not implemented + Cmp* m_cmp; // comparison method }; /** * Get type by id. Can return the Undefined type. */ - static const Type& type(Uint32 typeId); + static const Type& getType(Uint32 typeId); /** - * Inline comparison method. Most or all real methods Type::m_cmp are - * implemented via this (trusting dead code elimination). + * Get type by id but replace char type by corresponding binary type. */ - static int cmp(Uint32 typeId, const Uint32* p1, const Uint32* p2, Uint32 full, Uint32 size); + static const Type& getTypeBinary(Uint32 typeId); + + /** + * Check character set. + */ + static bool usable_in_pk(Uint32 typeId, const void* cs); + static bool usable_in_hash_index(Uint32 typeId, const void* cs); + static bool usable_in_ordered_index(Uint32 typeId, const void* cs); private: /** @@ -127,323 +137,4 @@ private: static Cmp cmpText; }; -inline int -NdbSqlUtil::cmp(Uint32 typeId, const Uint32* p1, const Uint32* p2, Uint32 full, Uint32 size) -{ - // XXX require size >= 1 - if (size > full) - return CmpError; - switch ((Type::Enum)typeId) { - case Type::Undefined: - break; - case Type::Tinyint: - { - if (size >= 1) { - union { Uint32 p[1]; Int8 v; } u1, u2; - u1.p[0] = p1[0]; - u2.p[0] = p2[0]; - if (u1.v < u2.v) - return -1; - if (u1.v > u2.v) - return +1; - return 0; - } - return CmpUnknown; - } - case Type::Tinyunsigned: - { - if (size >= 1) { - union { Uint32 p[1]; Uint8 v; } u1, u2; - u1.p[0] = p1[0]; - u2.p[0] = p2[0]; - if (u1.v < u2.v) - return -1; - if (u1.v > u2.v) - return +1; - return 0; - } - return CmpUnknown; - } - case Type::Smallint: - { - if (size >= 1) { - union { Uint32 p[1]; Int16 v; } u1, u2; - u1.p[0] = p1[0]; - u2.p[0] = p2[0]; - if (u1.v < u2.v) - return -1; - if (u1.v > u2.v) - return +1; - return 0; - } - return CmpUnknown; - } - case Type::Smallunsigned: - { - if (size >= 1) { - union { Uint32 p[1]; Uint16 v; } u1, u2; - u1.p[0] = p1[0]; - u2.p[0] = p2[0]; - if (u1.v < u2.v) - return -1; - if (u1.v > u2.v) - return +1; - return 0; - } - return CmpUnknown; - } - case Type::Mediumint: - { - if (size >= 1) { - union { const Uint32* p; const unsigned char* v; } u1, u2; - u1.p = p1; - u2.p = p2; - Int32 v1 = sint3korr(u1.v); - Int32 v2 = sint3korr(u2.v); - if (v1 < v2) - return -1; - if (v1 > v2) - return +1; - return 0; - } - return CmpUnknown; - } - case Type::Mediumunsigned: - { - if (size >= 1) { - union { const Uint32* p; const unsigned char* v; } u1, u2; - u1.p = p1; - u2.p = p2; - Uint32 v1 = uint3korr(u1.v); - Uint32 v2 = uint3korr(u2.v); - if (v1 < v2) - return -1; - if (v1 > v2) - return +1; - return 0; - } - return CmpUnknown; - } - case Type::Int: - { - if (size >= 1) { - union { Uint32 p[1]; Int32 v; } u1, u2; - u1.p[0] = p1[0]; - u2.p[0] = p2[0]; - if (u1.v < u2.v) - return -1; - if (u1.v > u2.v) - return +1; - return 0; - } - return CmpUnknown; - } - case Type::Unsigned: - { - if (size >= 1) { - union { Uint32 p[1]; Uint32 v; } u1, u2; - u1.v = p1[0]; - u2.v = p2[0]; - if (u1.v < u2.v) - return -1; - if (u1.v > u2.v) - return +1; - return 0; - } - return CmpUnknown; - } - case Type::Bigint: - { - if (size >= 2) { - union { Uint32 p[2]; Int64 v; } u1, u2; - u1.p[0] = p1[0]; - u1.p[1] = p1[1]; - u2.p[0] = p2[0]; - u2.p[1] = p2[1]; - if (u1.v < u2.v) - return -1; - if (u1.v > u2.v) - return +1; - return 0; - } - return CmpUnknown; - } - case Type::Bigunsigned: - { - if (size >= 2) { - union { Uint32 p[2]; Uint64 v; } u1, u2; - u1.p[0] = p1[0]; - u1.p[1] = p1[1]; - u2.p[0] = p2[0]; - u2.p[1] = p2[1]; - if (u1.v < u2.v) - return -1; - if (u1.v > u2.v) - return +1; - return 0; - } - return CmpUnknown; - } - case Type::Float: - { - if (size >= 1) { - union { Uint32 p[1]; float v; } u1, u2; - u1.p[0] = p1[0]; - u2.p[0] = p2[0]; - if (u1.v < u2.v) - return -1; - if (u1.v > u2.v) - return +1; - return 0; - } - return CmpUnknown; - } - case Type::Double: - { - if (size >= 2) { - union { Uint32 p[2]; double v; } u1, u2; - u1.p[0] = p1[0]; - u1.p[1] = p1[1]; - u2.p[0] = p2[0]; - u2.p[1] = p2[1]; - if (u1.v < u2.v) - return -1; - if (u1.v > u2.v) - return +1; - return 0; - } - return CmpUnknown; - } - case Type::Decimal: - // XXX not used by MySQL or NDB - break; - case Type::Char: - { - /* - * Char is blank-padded to length and null-padded to word size. - * There is no terminator so we must compare the full values. - */ - union { const Uint32* p; const char* v; } u1, u2; - u1.p = p1; - u2.p = p2; - int k = memcmp(u1.v, u2.v, size << 2); - return k < 0 ? -1 : k > 0 ? +1 : full == size ? 0 : CmpUnknown; - } - case Type::Varchar: - { - /* - * Varchar is not allowed to contain a null byte and the stored - * value is null-padded. Therefore comparison does not need to - * use the length. - */ - if (size >= 1) { - union { const Uint32* p; const char* v; } u1, u2; - u1.p = p1; - u2.p = p2; - // length in first 2 bytes - int k = strncmp(u1.v + 2, u2.v + 2, (size << 2) - 2); - return k < 0 ? -1 : k > 0 ? +1 : full == size ? 0 : CmpUnknown; - } - return CmpUnknown; - } - case Type::Binary: - { - // compare byte wise - union { const Uint32* p; const char* v; } u1, u2; - u1.p = p1; - u2.p = p2; - int k = memcmp(u1.v, u2.v, size << 2); - return k < 0 ? -1 : k > 0 ? +1 : full == size ? 0 : CmpUnknown; - } - case Type::Varbinary: - { - // assume correctly padded and compare byte wise - if (size >= 1) { - union { const Uint32* p; const char* v; } u1, u2; - u1.p = p1; - u2.p = p2; - // length in first 2 bytes - int k = memcmp(u1.v + 2, u2.v + 2, (size << 2) - 2); - return k < 0 ? -1 : k > 0 ? +1 : full == size ? 0 : CmpUnknown; - } - return CmpUnknown; - } - case Type::Datetime: - { - /* - * Datetime is CC YY MM DD hh mm ss \0 - */ - if (size >= 1) { - union { const Uint32* p; const char* v; } u1, u2; - u1.p = p1; - u2.p = p2; - // skip format check - int k = memcmp(u1.v, u2.v, 4); - if (k != 0) - return k < 0 ? -1 : +1; - if (size >= 2) { - k = memcmp(u1.v + 4, u2.v + 4, 4); - return k < 0 ? -1 : k > 0 ? +1 : 0; - } - } - return CmpUnknown; - } - case Type::Timespec: - { - /* - * Timespec is CC YY MM DD hh mm ss \0 NN NN NN NN - */ - if (size >= 1) { - union { const Uint32* p; const char* v; } u1, u2; - u1.p = p1; - u2.p = p2; - // skip format check - int k = memcmp(u1.v, u2.v, 4); - if (k != 0) - return k < 0 ? -1 : +1; - if (size >= 2) { - k = memcmp(u1.v + 4, u2.v + 4, 4); - if (k != 0) - return k < 0 ? -1 : +1; - Uint32 n1 = *(const Uint32*)(u1.v + 8); - Uint32 n2 = *(const Uint32*)(u2.v + 8); - if (n1 < n2) - return -1; - if (n2 > n1) - return +1; - return 0; - } - } - return CmpUnknown; - } - case Type::Blob: - { - // skip blob head, the rest is binary - const unsigned skip = NDB_BLOB_HEAD_SIZE; - if (size >= skip + 1) { - union { const Uint32* p; const char* v; } u1, u2; - u1.p = p1 + skip; - u2.p = p2 + skip; - int k = memcmp(u1.v, u2.v, (size - 1) << 2); - return k < 0 ? -1 : k > 0 ? +1 : full == size ? 0 : CmpUnknown; - } - return CmpUnknown; - } - case Type::Text: - { - // skip blob head, the rest is char - const unsigned skip = NDB_BLOB_HEAD_SIZE; - if (size >= skip + 1) { - union { const Uint32* p; const char* v; } u1, u2; - u1.p = p1 + skip; - u2.p = p2 + skip; - int k = memcmp(u1.v, u2.v, (size - 1) << 2); - return k < 0 ? -1 : k > 0 ? +1 : full == size ? 0 : CmpUnknown; - } - return CmpUnknown; - } - } - return CmpError; -} - #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/include/util/SocketServer.hpp b/ndb/include/util/SocketServer.hpp index 334fa575e47..3860b9ca84b 100644 --- a/ndb/include/util/SocketServer.hpp +++ b/ndb/include/util/SocketServer.hpp @@ -76,7 +76,7 @@ public: * then close the socket * Returns true if succeding in binding */ - bool tryBind(unsigned short port, const char * intface = 0) const; + static bool tryBind(unsigned short port, const char * intface = 0); /** * Setup socket diff --git a/ndb/include/util/basestring_vsnprintf.h b/ndb/include/util/basestring_vsnprintf.h new file mode 100644 index 00000000000..7c804f22841 --- /dev/null +++ b/ndb/include/util/basestring_vsnprintf.h @@ -0,0 +1,29 @@ +/* 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 BASESTRING_VSNPRINTF_H +#define BASESTRING_VSNPRINTF_H +#include <stdarg.h> +#if defined(__cplusplus) +extern "C" +{ +#endif +int basestring_snprintf(char*, size_t, const char*, ...); +int basestring_vsnprintf(char*,size_t, const char*,va_list); +#if defined(__cplusplus) +} +#endif +#endif diff --git a/ndb/include/util/version.h b/ndb/include/util/version.h index a82ae4b8b52..5459e44b818 100644 --- a/ndb/include/util/version.h +++ b/ndb/include/util/version.h @@ -30,7 +30,7 @@ extern "C" { Uint32 makeVersion(Uint32 major, Uint32 minor, Uint32 build); - char* getVersionString(Uint32 version, char * status); + const char* getVersionString(Uint32 version, const char * status); void ndbPrintVersion(); Uint32 ndbGetOwnVersion(); |