diff options
author | unknown <joreland@mysql.com> | 2004-12-31 06:14:18 +0100 |
---|---|---|
committer | unknown <joreland@mysql.com> | 2004-12-31 06:14:18 +0100 |
commit | 5df5f5c174299fc76e65e8273570f09090b41df5 (patch) | |
tree | 5116ea21b23500f78f5ae5b33e504266f590fc0d /ndb/include | |
parent | 5bd46150a0d51bc38611796541ee5de8c347a3f9 (diff) | |
parent | ee4c910422236fd376df0d9688ce0ca39f61fdfc (diff) | |
download | mariadb-git-5df5f5c174299fc76e65e8273570f09090b41df5.tar.gz |
Merge joreland@bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/home/jonas/src/mysql-5.0
BitKeeper/etc/logging_ok:
auto-union
ndb/include/ndbapi/NdbDictionary.hpp:
Auto merged
ndb/src/common/util/Makefile.am:
Auto merged
ndb/src/kernel/blocks/backup/Backup.cpp:
Auto merged
ndb/src/kernel/blocks/backup/Backup.hpp:
Auto merged
ndb/src/kernel/blocks/backup/BackupInit.cpp:
Auto merged
ndb/src/kernel/blocks/dbdict/Dbdict.cpp:
Auto merged
ndb/src/ndbapi/NdbDictionary.cpp:
Auto merged
ndb/src/ndbapi/NdbDictionaryImpl.cpp:
Auto merged
ndb/src/ndbapi/TransporterFacade.cpp:
Auto merged
ndb/src/ndbapi/TransporterFacade.hpp:
Auto merged
ndb/src/ndbapi/ndberror.c:
Auto merged
ndb/test/ndbapi/Makefile.am:
Auto merged
ndb/test/tools/Makefile.am:
Auto merged
ndb/tools/restore/restore_main.cpp:
Auto merged
Diffstat (limited to 'ndb/include')
30 files changed, 213 insertions, 277 deletions
diff --git a/ndb/include/Makefile.am b/ndb/include/Makefile.am index 61f55cf9d61..b29433a59b7 100644 --- a/ndb/include/Makefile.am +++ b/ndb/include/Makefile.am @@ -42,3 +42,5 @@ portlib transporter util dist-hook: -rm -rf `find $(distdir) -type d -name SCCS` + +windoze-dsp: diff --git a/ndb/include/debugger/EventLogger.hpp b/ndb/include/debugger/EventLogger.hpp index 686989089ae..ddf21b79f5f 100644 --- a/ndb/include/debugger/EventLogger.hpp +++ b/ndb/include/debugger/EventLogger.hpp @@ -48,6 +48,10 @@ public: static const EventRepLogLevelMatrix matrix[]; static const Uint32 matrixSize; + static int event_lookup(int eventType, + LogLevel::EventCategory &cat, + Uint32 &threshold, + Logger::LoggerLevel &severity); }; /** diff --git a/ndb/include/debugger/GrepError.hpp b/ndb/include/debugger/GrepError.hpp index ab6a7b272a5..beedbd95c80 100644 --- a/ndb/include/debugger/GrepError.hpp +++ b/ndb/include/debugger/GrepError.hpp @@ -24,8 +24,8 @@ */ class GrepError { public: - enum Code { - NO_ERROR = 0, + enum GE_Code { + GE_NO_ERROR = 0, SUBSCRIPTION_ID_NOMEM = 1, SUBSCRIPTION_ID_NOT_FOUND = 2, SUBSCRIPTION_ID_NOT_UNIQUE = 3, @@ -82,12 +82,12 @@ public: }; struct ErrorDescription { - Code errCode; + GE_Code errCode; const char * name; }; static const ErrorDescription errorDescriptions[]; static const Uint32 noOfErrorDescs; - static const char * getErrorDesc(GrepError::Code err); + static const char * getErrorDesc(GrepError::GE_Code err); }; diff --git a/ndb/include/kernel/LogLevel.hpp b/ndb/include/kernel/LogLevel.hpp index 467f0604edd..3c2f349e0e1 100644 --- a/ndb/include/kernel/LogLevel.hpp +++ b/ndb/include/kernel/LogLevel.hpp @@ -73,7 +73,7 @@ public: /** * Note level is valid as 0-15 */ - void setLogLevel(EventCategory ec, Uint32 level = 7); + int setLogLevel(EventCategory ec, Uint32 level = 7); /** * Get the loglevel (0-15) for a category @@ -89,7 +89,7 @@ public: return memcmp(this, &l, sizeof(* this)) == 0; } - LogLevel& operator=(const class EventSubscribeReq & req); + LogLevel& operator=(const struct EventSubscribeReq & req); private: /** @@ -119,10 +119,14 @@ LogLevel::clear(){ } inline -void +int LogLevel::setLogLevel(EventCategory ec, Uint32 level){ - assert(ec >= 0 && (Uint32) ec < LOGLEVEL_CATEGORIES); - logLevelData[ec] = (Uint8)level; + if (ec >= 0 && (Uint32) ec < LOGLEVEL_CATEGORIES) + { + logLevelData[ec] = (Uint8)level; + return 0; + } + return 1; } inline diff --git a/ndb/include/kernel/signaldata/CreateEvnt.hpp b/ndb/include/kernel/signaldata/CreateEvnt.hpp index 65a07c122a2..e911fa36ce6 100644 --- a/ndb/include/kernel/signaldata/CreateEvnt.hpp +++ b/ndb/include/kernel/signaldata/CreateEvnt.hpp @@ -475,14 +475,14 @@ struct CreateEvntRef { } }; inline bool CreateEvntRef::isTemporary() const -{ return (errorCode & CreateEvntRef::Temporary) > 0; }; +{ return (errorCode & CreateEvntRef::Temporary) > 0; } inline void CreateEvntRef::setTemporary() -{ errorCode |= CreateEvntRef::Temporary; }; +{ errorCode |= CreateEvntRef::Temporary; } inline CreateEvntRef::ErrorCode CreateEvntRef::setTemporary(ErrorCode ec) { return (CreateEvntRef::ErrorCode) - (errorCode = ((Uint32) ec | (Uint32)CreateEvntRef::Temporary)); }; + (errorCode = ((Uint32) ec | (Uint32)CreateEvntRef::Temporary)); } inline CreateEvntRef::ErrorCode CreateEvntRef::makeTemporary(ErrorCode ec) { return (CreateEvntRef::ErrorCode) - ( (Uint32) ec | (Uint32)CreateEvntRef::Temporary ); }; + ( (Uint32) ec | (Uint32)CreateEvntRef::Temporary ); } #endif diff --git a/ndb/include/kernel/signaldata/FsCloseReq.hpp b/ndb/include/kernel/signaldata/FsCloseReq.hpp index c42afa143e6..10d094fb30b 100644 --- a/ndb/include/kernel/signaldata/FsCloseReq.hpp +++ b/ndb/include/kernel/signaldata/FsCloseReq.hpp @@ -75,7 +75,7 @@ inline void FsCloseReq::setRemoveFileFlag(UintR & fileflag, bool removefile){ // ASSERT_BOOL(removefile, "FsCloseReq::setRemoveFileFlag"); - if (removefile == true) + if (removefile) fileflag = 1; else fileflag = 0; diff --git a/ndb/include/kernel/signaldata/PackedSignal.hpp b/ndb/include/kernel/signaldata/PackedSignal.hpp index 057bb39b25a..ea0ff6db526 100644 --- a/ndb/include/kernel/signaldata/PackedSignal.hpp +++ b/ndb/include/kernel/signaldata/PackedSignal.hpp @@ -38,6 +38,6 @@ class PackedSignal { }; inline -Uint32 PackedSignal::getSignalType(Uint32 data) { return data >> 28; }; +Uint32 PackedSignal::getSignalType(Uint32 data) { return data >> 28; } #endif diff --git a/ndb/include/kernel/signaldata/RepImpl.hpp b/ndb/include/kernel/signaldata/RepImpl.hpp index affffe46f9c..0de1389a4a9 100644 --- a/ndb/include/kernel/signaldata/RepImpl.hpp +++ b/ndb/include/kernel/signaldata/RepImpl.hpp @@ -93,7 +93,7 @@ public: Uint32 subscriptionId; Uint32 subscriptionKey; Uint32 senderNodeId; - GrepError::Code err; + GrepError::GE_Code err; }; class RepGetGciReq @@ -151,7 +151,7 @@ public: Uint32 lastPSGCI; Uint32 firstSSGCI; Uint32 lastSSGCI; - GrepError::Code err; + GrepError::GE_Code err; }; class RepGetGciBufferReq { @@ -213,7 +213,7 @@ public: Uint32 lastSSGCI; Uint32 currentGCIBuffer; Uint32 nodeGrp; - GrepError::Code err; + GrepError::GE_Code err; }; class RepInsertGciBufferReq @@ -252,7 +252,7 @@ public: Uint32 nodeGrp; Uint32 tableId; Uint32 force; - GrepError::Code err; + GrepError::GE_Code err; }; class RepInsertGciBufferConf @@ -310,7 +310,7 @@ public: Uint32 lastGCI; Uint32 currentGCI; Uint32 nodeGrp; - GrepError::Code err; + GrepError::GE_Code err; }; class RepClearPSGciBufferConf @@ -367,7 +367,7 @@ public: Uint32 lastGCI; Uint32 currentGCI; Uint32 nodeGrp; - GrepError::Code err; + GrepError::GE_Code err; }; class RepClearSSGciBufferConf diff --git a/ndb/include/kernel/signaldata/SumaImpl.hpp b/ndb/include/kernel/signaldata/SumaImpl.hpp index 089132cd9aa..89ade067dcd 100644 --- a/ndb/include/kernel/signaldata/SumaImpl.hpp +++ b/ndb/include/kernel/signaldata/SumaImpl.hpp @@ -159,12 +159,12 @@ public: Uint32 subscriberRef; }; inline bool SubStartRef::isTemporary() const -{ return (errorCode & SubStartRef::Temporary) > 0; }; +{ return (errorCode & SubStartRef::Temporary) > 0; } inline void SubStartRef::setTemporary() -{ errorCode |= SubStartRef::Temporary; }; +{ errorCode |= SubStartRef::Temporary; } inline SubStartRef::ErrorCode SubStartRef::setTemporary(ErrorCode ec) { return (SubStartRef::ErrorCode) - (errorCode = ((Uint32) ec | (Uint32)SubStartRef::Temporary)); }; + (errorCode = ((Uint32) ec | (Uint32)SubStartRef::Temporary)); } class SubStartConf { /** @@ -239,12 +239,12 @@ public: }; }; inline bool SubStopRef::isTemporary() const -{ return (errorCode & SubStopRef::Temporary) > 0; }; +{ return (errorCode & SubStopRef::Temporary) > 0; } inline void SubStopRef::setTemporary() -{ errorCode |= SubStopRef::Temporary; }; +{ errorCode |= SubStopRef::Temporary; } inline SubStopRef::ErrorCode SubStopRef::setTemporary(ErrorCode ec) { return (SubStopRef::ErrorCode) - (errorCode = ((Uint32) ec | (Uint32)SubStopRef::Temporary)); }; + (errorCode = ((Uint32) ec | (Uint32)SubStopRef::Temporary)); } class SubStopConf { /** @@ -515,12 +515,12 @@ public: }; }; inline bool SubRemoveRef::isTemporary() const -{ return (err & SubRemoveRef::Temporary) > 0; }; +{ return (err & SubRemoveRef::Temporary) > 0; } inline void SubRemoveRef::setTemporary() -{ err |= SubRemoveRef::Temporary; }; +{ err |= SubRemoveRef::Temporary; } inline SubRemoveRef::ErrorCode SubRemoveRef::setTemporary(ErrorCode ec) { return (SubRemoveRef::ErrorCode) - (errorCode = ((Uint32) ec | (Uint32)SubRemoveRef::Temporary)); }; + (errorCode = ((Uint32) ec | (Uint32)SubRemoveRef::Temporary)); } class SubRemoveConf { /** diff --git a/ndb/include/kernel/signaldata/UtilLock.hpp b/ndb/include/kernel/signaldata/UtilLock.hpp index 1cac467daa0..318024fd706 100644 --- a/ndb/include/kernel/signaldata/UtilLock.hpp +++ b/ndb/include/kernel/signaldata/UtilLock.hpp @@ -39,7 +39,7 @@ public: enum RequestInfo { TryLock = 1 }; -private: +public: Uint32 senderData; Uint32 senderRef; Uint32 lockId; @@ -63,7 +63,7 @@ class UtilLockConf { public: STATIC_CONST( SignalLength = 4 ); -private: +public: Uint32 senderData; Uint32 senderRef; Uint32 lockId; @@ -95,7 +95,7 @@ public: LockAlreadyHeld = 4 }; -private: +public: Uint32 senderData; Uint32 senderRef; Uint32 lockId; @@ -119,7 +119,7 @@ class UtilUnlockReq { public: STATIC_CONST( SignalLength = 4 ); -private: +public: Uint32 senderData; Uint32 senderRef; Uint32 lockId; @@ -143,7 +143,7 @@ class UtilUnlockConf { public: STATIC_CONST( SignalLength = 3 ); -private: +public: Uint32 senderData; Uint32 senderRef; Uint32 lockId; @@ -171,7 +171,7 @@ public: NoSuchLock = 1, NotLockOwner = 2 }; -private: +public: Uint32 senderData; Uint32 senderRef; Uint32 lockId; @@ -200,7 +200,7 @@ public: STATIC_CONST( SignalLength = 4 ); -private: +public: Uint32 senderData; Uint32 senderRef; Uint32 lockId; @@ -229,7 +229,7 @@ public: STATIC_CONST( SignalLength = 4 ); -private: +public: Uint32 senderData; Uint32 senderRef; Uint32 lockId; @@ -251,7 +251,7 @@ class UtilCreateLockConf { public: STATIC_CONST( SignalLength = 3 ); -private: +public: Uint32 senderData; Uint32 senderRef; Uint32 lockId; @@ -275,7 +275,7 @@ class UtilDestroyLockReq { public: STATIC_CONST( SignalLength = 4 ); -private: +public: Uint32 senderData; Uint32 senderRef; Uint32 lockId; @@ -303,7 +303,7 @@ public: STATIC_CONST( SignalLength = 4 ); -private: +public: Uint32 senderData; Uint32 senderRef; Uint32 lockId; @@ -325,7 +325,7 @@ class UtilDestroyLockConf { public: STATIC_CONST( SignalLength = 3 ); -private: +public: Uint32 senderData; Uint32 senderRef; Uint32 lockId; diff --git a/ndb/include/logger/Logger.hpp b/ndb/include/logger/Logger.hpp index c6145f2091a..f12297023b7 100644 --- a/ndb/include/logger/Logger.hpp +++ b/ndb/include/logger/Logger.hpp @@ -101,7 +101,7 @@ public: /** The log levels. NOTE: Could not use the name LogLevel since * it caused conflicts with another class. */ - enum LoggerLevel {LL_OFF, LL_DEBUG, LL_INFO, LL_WARNING, LL_ERROR, + enum LoggerLevel {LL_ON, LL_DEBUG, LL_INFO, LL_WARNING, LL_ERROR, LL_CRITICAL, LL_ALERT, LL_ALL}; /** diff --git a/ndb/include/logger/SysLogHandler.hpp b/ndb/include/logger/SysLogHandler.hpp index 4f13308d61b..0dfc1cb2d43 100644 --- a/ndb/include/logger/SysLogHandler.hpp +++ b/ndb/include/logger/SysLogHandler.hpp @@ -18,7 +18,9 @@ #define SYSLOGHANDLER_H #include "LogHandler.hpp" +#ifndef NDB_WIN32 #include <syslog.h> +#endif /** * Logs messages to syslog. The default identity is 'NDB'. @@ -62,7 +64,7 @@ public: * @param pIdentity a syslog identity. * @param facility syslog facility, defaults to LOG_USER */ - SysLogHandler(const char* pIdentity, int facility = LOG_USER); + SysLogHandler(const char* pIdentity, int facility); /** * Destructor. diff --git a/ndb/include/mgmapi/mgmapi.h b/ndb/include/mgmapi/mgmapi.h index dc4f745adb2..3d4a34d6488 100644 --- a/ndb/include/mgmapi/mgmapi.h +++ b/ndb/include/mgmapi/mgmapi.h @@ -49,6 +49,7 @@ * @{ */ +#include <ndb_types.h> #include "mgmapi_config_parameters.h" #ifdef __cplusplus @@ -244,7 +245,9 @@ extern "C" { * Log severities (used to filter the cluster log) */ enum ndb_mgm_clusterlog_level { - NDB_MGM_CLUSTERLOG_OFF = 0, /*< Cluster log off*/ + NDB_MGM_ILLEGAL_CLUSTERLOG_LEVEL = -1, + /* must range from 0 and up, indexes into an array */ + NDB_MGM_CLUSTERLOG_ON = 0, /*< Cluster log on*/ NDB_MGM_CLUSTERLOG_DEBUG = 1, /*< Used in NDB Cluster *< developement */ @@ -264,7 +267,8 @@ extern "C" { *< corrected immediately, *< such as a corrupted system */ - NDB_MGM_CLUSTERLOG_ALL = 7 /*< All severities on*/ + /* must be next number, works as bound in loop */ + NDB_MGM_CLUSTERLOG_ALL = 7 /*< All severities */ }; /** @@ -580,11 +584,13 @@ extern "C" { * * @param handle NDB management handle. * @param level A cluster log level to filter. + * @param enable set 1=enable 0=disable * @param reply Reply message. * @return -1 on error. */ int ndb_mgm_filter_clusterlog(NdbMgmHandle handle, enum ndb_mgm_clusterlog_level level, + int enable, struct ndb_mgm_reply* reply); /** @@ -620,6 +626,11 @@ extern "C" { int level, struct ndb_mgm_reply* reply); + ndb_mgm_clusterlog_level + ndb_mgm_match_clusterlog_level(const char * name); + const char * + ndb_mgm_get_clusterlog_level_string(enum ndb_mgm_clusterlog_level level); + /** * Set log category and levels for the Node * @@ -656,11 +667,15 @@ extern "C" { * Start backup * * @param handle NDB management handle. + * @param wait_completed 0=don't wait for confirmation + 1=wait for backup started + 2=wait for backup completed * @param backup_id Backup id is returned from function. * @param reply Reply message. * @return -1 on error. */ - int ndb_mgm_start_backup(NdbMgmHandle handle, unsigned int* backup_id, + int ndb_mgm_start_backup(NdbMgmHandle handle, int wait_completed, + unsigned int* backup_id, struct ndb_mgm_reply* reply); /** @@ -743,7 +758,7 @@ extern "C" { int ndb_mgm_get_int_parameter(const ndb_mgm_configuration_iterator*, int param, unsigned * value); int ndb_mgm_get_int64_parameter(const ndb_mgm_configuration_iterator*, - int param, unsigned long long * value); + int param, Uint64 * value); int ndb_mgm_get_string_parameter(const ndb_mgm_configuration_iterator*, int param, const char ** value); int ndb_mgm_purge_stale_sessions(NdbMgmHandle handle, char **); diff --git a/ndb/include/mgmapi/mgmapi_config_parameters.h b/ndb/include/mgmapi/mgmapi_config_parameters.h index 6a0cd376355..406bdb1a110 100644 --- a/ndb/include/mgmapi/mgmapi_config_parameters.h +++ b/ndb/include/mgmapi/mgmapi_config_parameters.h @@ -110,6 +110,7 @@ #define CFG_CONNECTION_SERVER_PORT 406 #define CFG_CONNECTION_HOSTNAME_1 407 #define CFG_CONNECTION_HOSTNAME_2 408 +#define CFG_CONNECTION_GROUP 409 #define CFG_TCP_SERVER 452 #define CFG_TCP_SEND_BUFFER_SIZE 454 diff --git a/ndb/include/mgmcommon/IPCConfig.hpp b/ndb/include/mgmcommon/IPCConfig.hpp index ebe65b53b59..1e23cdf9807 100644 --- a/ndb/include/mgmcommon/IPCConfig.hpp +++ b/ndb/include/mgmcommon/IPCConfig.hpp @@ -59,7 +59,7 @@ public: void print() const { props->print(); } static Uint32 configureTransporters(Uint32 nodeId, - const class ndb_mgm_configuration &, + const struct ndb_mgm_configuration &, class TransporterRegistry &); private: diff --git a/ndb/include/ndb_global.h b/ndb/include/ndb_global.h.in index bdd4e503cc5..aefb319730c 100644 --- a/ndb/include/ndb_global.h +++ b/ndb/include/ndb_global.h.in @@ -2,34 +2,51 @@ #ifndef NDBGLOBAL_H #define NDBGLOBAL_H -#include <my_global.h> +#include <ndb_types.h> -/** signal & SIG_PIPE */ -#include <my_alarm.h> +#define NDB_PORT "@ndb_port@" +#define NDB_TCP_BASE_PORT "@ndb_port_base@" #if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32) #define NDB_WIN32 +#include <winsock2.h> +#define PATH_MAX 256 +#define DIR_SEPARATOR "\\" +#define MYSQLCLUSTERDIR "c:\\mysql\\mysql-cluster" +#define HAVE_STRCASECMP +#define strcasecmp _strcmpi +#pragma warning(disable: 4503 4786) #else #undef NDB_WIN32 +#define DIR_SEPARATOR "/" #endif +#include <my_global.h> +#include <my_alarm.h> + #ifdef _AIX #undef _H_STRINGS #endif #include <m_string.h> #include <m_ctype.h> -#include <ndb_types.h> #include <ctype.h> + #ifdef HAVE_STDARG_H #include <stdarg.h> #endif + #ifdef TIME_WITH_SYS_TIME #include <time.h> #endif + #ifdef HAVE_FCNTL_H #include <fcntl.h> #endif + +#ifdef HAVE_SYS_PARAM_H #include <sys/param.h> +#endif + #ifdef HAVE_SYS_STAT_H #if defined(__cplusplus) && defined(_APP32_64BIT_OFF_T) && defined(_INCLUDE_AES_SOURCE) #undef _INCLUDE_AES_SOURCE @@ -39,31 +56,31 @@ #include <sys/stat.h> #endif #endif + +#ifdef HAVE_SYS_RESOURCE_H #include <sys/resource.h> +#endif + #ifdef HAVE_SYS_WAIT_H #include <sys/wait.h> #endif + #ifdef HAVE_SYS_MMAN_H #include <sys/mman.h> #endif -#ifdef NDB_WIN32 -#include <winsock2.h> -#include <ws2tcpip.h> - -#define DIR_SEPARATOR "\\" -#define PATH_MAX 256 - -#pragma warning(disable: 4503 4786) -#else - -#define DIR_SEPARATOR "/" +#ifndef HAVE_STRDUP +extern char * strdup(const char *s); +#endif +#ifndef HAVE_STRCASECMP +extern int strcasecmp(const char *s1, const char *s2); +extern int strncasecmp(const char *s1, const char *s2, size_t n); #endif static const char table_name_separator = '/'; -#if defined(_AIX) || defined(NDB_VC98) +#if defined(_AIX) || defined(WIN32) || defined(NDB_VC98) #define STATIC_CONST(x) enum { x } #else #define STATIC_CONST(x) static const Uint32 x @@ -84,13 +101,8 @@ extern int ndb_init(void); extern void ndb_end(int); #define NDB_INIT(prog_name) {my_progname=(prog_name); ndb_init();} -#ifndef HAVE_STRDUP -extern char * strdup(const char *s); -#endif - -#ifndef HAVE_STRCASECMP -extern int strcasecmp(const char *s1, const char *s2); -extern int strncasecmp(const char *s1, const char *s2, size_t n); +#ifdef __cplusplus +} #endif #ifdef SCO @@ -101,8 +113,4 @@ extern int strncasecmp(const char *s1, const char *s2, size_t n); #endif /* SCO */ -#ifdef __cplusplus -} -#endif - #endif diff --git a/ndb/include/ndb_types.h b/ndb/include/ndb_types.h index 64b3f517934..0d603cc2ab3 100644 --- a/ndb/include/ndb_types.h +++ b/ndb/include/ndb_types.h @@ -40,15 +40,21 @@ typedef __SIZE_TYPE__ UintPtr; #ifdef HAVE_INTTYPES_H #include <inttypes.h> #endif +#if defined(WIN32) || defined(NDB_WIN32) +typedef Uint32 UintPtr; +#else typedef uintptr_t UintPtr; #endif +#endif #if defined(WIN32) || defined(NDB_WIN32) typedef unsigned __int64 Uint64; typedef signed __int64 Int64; +typedef UintPtr ssize_t; #else typedef unsigned long long Uint64; typedef signed long long Int64; #endif + #endif diff --git a/ndb/include/ndb_version.h b/ndb/include/ndb_version.h.in index 56362020ebf..d7f43eae40a 100644 --- a/ndb/include/ndb_version.h +++ b/ndb/include/ndb_version.h.in @@ -20,14 +20,25 @@ #include <ndb_global.h> #include <version.h> +/* NDB build version */ +#define NDB_VERSION_BUILD @NDB_VERSION_BUILD@ + +/* NDB major version */ +#define NDB_VERSION_MAJOR @NDB_VERSION_MAJOR@ + +/* NDB minor version */ +#define NDB_VERSION_MINOR @NDB_VERSION_MINOR@ + +/* NDB status version */ +#define NDB_VERSION_STATUS "@NDB_VERSION_STATUS@" + + #define MAKE_VERSION(A,B,C) (((A) << 16) | ((B) << 8) | ((C) << 0)) #define NDB_VERSION_D MAKE_VERSION(NDB_VERSION_MAJOR, NDB_VERSION_MINOR, NDB_VERSION_BUILD) #define NDB_VERSION_STRING (getVersionString(NDB_VERSION, NDB_VERSION_STATUS)) -#define NDB_VERSION_TAG_STRING "$Name: $" - #define NDB_VERSION ndbGetOwnVersion() /** diff --git a/ndb/include/ndbapi/Ndb.hpp b/ndb/include/ndbapi/Ndb.hpp index 5ec09269695..766409d64e2 100644 --- a/ndb/include/ndbapi/Ndb.hpp +++ b/ndb/include/ndbapi/Ndb.hpp @@ -901,23 +901,6 @@ typedef void (* NdbEventCallback)(NdbEventOperation*, Ndb*, void*); NDB_MAX_SCHEMA_NAME_SIZE + \ NDB_MAX_TAB_NAME_SIZE*2 -#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL -class NdbWaiter { -public: - NdbWaiter(); - ~NdbWaiter(); - - void wait(int waitTime); - void nodeFail(Uint32 node); - void signal(Uint32 state); - - Uint32 m_node; - Uint32 m_state; - void * m_mutex; - struct NdbCondition * m_condition; -}; -#endif - /** * @class Ndb * @brief Represents the NDB kernel and is the main class of the NDB API. @@ -1199,39 +1182,6 @@ public: const char * keyData = 0, Uint32 keyLen = 0); -#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL - /** - * This method is a modification of Ndb::startTransaction, - * in which we use only the first two chars of keyData to - * select transaction coordinator. - * This is referred to as a distribution group. - * There are two ways to use the method: - * - In the first, the two characters are used directly as - * the distribution key, and - * - in the second the distribution is calculated as: - * (10 * (char[0] - 0x30) + (char[1] - 0x30)). - * Thus, in the second way, the two ASCII digits '78' - * will provide the distribution key = 78. - * - * @note Transaction priorities are not yet supported. - * - * @param aPrio Priority of the transaction.<br> - * Priority 0 is the highest priority and is used for short transactions - * with requirements on low delay.<br> - * Priority 1 is a medium priority for short transactions.<br> - * Priority 2 is a medium priority for long transactions.<br> - * Priority 3 is a low priority for long transactions. - * @param keyData is a string of which the two first characters - * is used to compute which fragement the data is stored in. - * @param type is the type of distribution group.<br> - * 0 means direct usage of the two characters, and<br> - * 1 means the ASCII digit variant. - * @return NdbConnection, or NULL if it failed. - */ - NdbConnection* startTransactionDGroup(Uint32 aPrio, - const char * keyData, int type); -#endif - /** * When a transactions is completed, the transaction has to be closed. * @@ -1586,9 +1536,6 @@ private: /****************************************************************************** * These are the private variables in this class. *****************************************************************************/ - NdbObjectIdMap* theNdbObjectIdMap; - Ndb_cluster_connection *m_ndb_cluster_connection; - NdbConnection** thePreparedTransactionsArray; NdbConnection** theSentTransactionsArray; NdbConnection** theCompletedTransactionsArray; @@ -1602,8 +1549,6 @@ private: Uint32 theNextConnectNode; - NdbWaiter theWaiter; - bool fullyQualifiedNames; // Ndb database name. @@ -1637,10 +1582,6 @@ private: Uint32 theMyRef; // My block reference Uint32 theNode; // The node number of our node - Uint32 theNoOfDBnodes; // The number of DB nodes - Uint32 * theDBnodes; // The node number of the DB nodes - Uint8 *the_release_ind;// 1 indicates to release all connections to node - Uint64 the_last_check_time; Uint64 theFirstTransId; @@ -1663,39 +1604,6 @@ private: InitConfigError } theInitState; - // Ensure good distribution of connects - Uint32 theCurrentConnectIndex; - Uint32 theCurrentConnectCounter; - - /** - * Computes fragement id for primary key - * - * Note that keydata has to be "shaped" as it is being sent in KEYINFO - */ - Uint32 computeFragmentId(const char * keyData, Uint32 keyLen); - Uint32 getFragmentId(Uint32 hashValue); - - /** - * Make a guess to which node is the primary for the fragment - */ - Uint32 guessPrimaryNode(Uint32 fragmentId); - - /** - * Structure containing values for guessing primary node - */ - struct StartTransactionNodeSelectionData { - StartTransactionNodeSelectionData(): - fragment2PrimaryNodeMap(0) {}; - Uint32 kValue; - Uint32 hashValueMask; - Uint32 hashpointerValue; - Uint32 noOfFragments; - Uint32 * fragment2PrimaryNodeMap; - - void init(Uint32 noOfNodes, Uint32 nodeIds[]); - void release(); - } startTransactionNodeSelectionData; - NdbApiSignal* theCommitAckSignal; diff --git a/ndb/include/ndbapi/NdbConnection.hpp b/ndb/include/ndbapi/NdbConnection.hpp index f0f44170ed7..3ae5690e104 100644 --- a/ndb/include/ndbapi/NdbConnection.hpp +++ b/ndb/include/ndbapi/NdbConnection.hpp @@ -50,7 +50,7 @@ enum AbortOption { TryCommit = 0, ///< <i>Missing explanation</i> #endif AbortOnError = 0, ///< Abort transaction on failed operation - IgnoreError = 2 ///< Transaction continues on failed operation + AO_IgnoreError = 2 ///< Transaction continues on failed operation }; typedef AbortOption CommitType; diff --git a/ndb/include/ndbapi/NdbDictionary.hpp b/ndb/include/ndbapi/NdbDictionary.hpp index 5f855ac06de..798aa20a937 100644 --- a/ndb/include/ndbapi/NdbDictionary.hpp +++ b/ndb/include/ndbapi/NdbDictionary.hpp @@ -702,7 +702,7 @@ public: /** * Get a specific column in the index */ - const NdbDictionary::Column * getColumn(unsigned no) const ; + const Column * getColumn(unsigned no) const ; /** * Get a specific column name in the index @@ -974,13 +974,6 @@ public: */ const Table * getTable(const char * name); - /** - * Get table with given name for alteration. - * @param name Name of table to alter - * @return table if successful. NULL if undefined - */ - Table getTableForAlteration(const char * name); - #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL /** * Invalidate cached table object diff --git a/ndb/include/ndbapi/ndb_cluster_connection.hpp b/ndb/include/ndbapi/ndb_cluster_connection.hpp index 6fa25caf5d0..1b1c8575656 100644 --- a/ndb/include/ndbapi/ndb_cluster_connection.hpp +++ b/ndb/include/ndbapi/ndb_cluster_connection.hpp @@ -18,13 +18,7 @@ #ifndef CLUSTER_CONNECTION_HPP #define CLUSTER_CONNECTION_HPP -class TransporterFacade; -class ConfigRetriever; -class NdbThread; - -extern "C" { - void* run_ndb_cluster_connection_connect_thread(void*); -} +struct Ndb_cluster_connection_node_iter; class Ndb_cluster_connection { public: @@ -32,16 +26,27 @@ public: ~Ndb_cluster_connection(); int connect(int no_retries, int retry_delay_in_seconds, int verbose); int start_connect_thread(int (*connect_callback)(void)= 0); + + // add check coupled to init state of cluster connection + // timeout_after_first_alive negative - ok only if all alive + // timeout_after_first_alive positive - ok if some alive + int wait_until_ready(int timeout_for_first_alive, + int timeout_after_first_alive); + const char *get_connectstring(char *buf, int buf_sz) const; int get_connected_port() const; const char *get_connected_host() const; + + void set_optimized_node_selection(int val); + + Uint32 no_db_nodes(); + private: - friend void* run_ndb_cluster_connection_connect_thread(void*); - void connect_thread(); - TransporterFacade *m_facade; - ConfigRetriever *m_config_retriever; - NdbThread *m_connect_thread; - int (*m_connect_callback)(void); + friend class Ndb; + friend class NdbImpl; + friend class Ndb_cluster_connection_impl; + class Ndb_cluster_connection_impl & m_impl; + Ndb_cluster_connection(Ndb_cluster_connection_impl&); }; #endif diff --git a/ndb/include/portlib/NdbTCP.h b/ndb/include/portlib/NdbTCP.h index 4dc8435eef1..8138a2ef354 100644 --- a/ndb/include/portlib/NdbTCP.h +++ b/ndb/include/portlib/NdbTCP.h @@ -40,7 +40,7 @@ typedef int socklen_t; #define InetErrno (* inet_errno()) -#elif NDB_WIN32 +#elif defined NDB_WIN32 /** * Include files needed diff --git a/ndb/include/portlib/PortDefs.h b/ndb/include/portlib/PortDefs.h index b61bb627e65..a115c60cfe1 100644 --- a/ndb/include/portlib/PortDefs.h +++ b/ndb/include/portlib/PortDefs.h @@ -22,55 +22,12 @@ $Id: PortDefs.h,v 1.5 2003/10/07 07:59:59 mikael Exp $ */ -#ifdef NDB_WIN32 -#include <time.h> - - -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 */ -}; - -struct timespec -{ - long tv_sec; /* Seconds */ - long tv_nsec; /* Nanoseconds */ -}; - -#define strcasecmp(a,b) _strcmpi(a,b) - -/* Exports a WIN32 getopt function */ -extern int optind; -extern char *optarg; -int getopt(int, char **, char *opts); -#endif /* NDB_WIN32 */ #ifdef 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 */ - u_int64 __asm(char *, ...); - double __dasm(char *, ...); - float __fasm(char *, ...); - void _AcquireSpinLock(long *); - void _ReleaseSpinLock(long *); - int __ADD_ATOMIC_LONG2(void *, int); -#ifdef __cplusplus -}; -#endif /* __cplusplus */ -#pragma intrinsic (__asm, __dasm, __fasm) -#pragma intrinsic(_ReleaseSpinLock, _AcquireSpinLock) -#pragma intrinsic(__ADD_ATOMIC_LONG2) -#endif /* NDB_WIN32 */ - #define RPCC() ((int)__asm(" rpcc v0;")) #define MB() __asm(" mb;"); #define WMB() __asm(" wmb;"); diff --git a/ndb/include/transporter/TransporterRegistry.hpp b/ndb/include/transporter/TransporterRegistry.hpp index ac6291f9e57..96da7eef2cb 100644 --- a/ndb/include/transporter/TransporterRegistry.hpp +++ b/ndb/include/transporter/TransporterRegistry.hpp @@ -87,6 +87,7 @@ public: */ class TransporterRegistry { friend class OSE_Receiver; + friend class SHM_Transporter; friend class Transporter; friend class TransporterService; public: @@ -224,7 +225,7 @@ public: const char *m_interface; }; Vector<Transporter_interface> m_transporter_interface; - void add_transporter_interface(const char *interface, unsigned short port); + void add_transporter_interface(const char *interf, unsigned short port); protected: private: @@ -312,6 +313,8 @@ private: Uint32 poll_TCP(Uint32 timeOutMillis); Uint32 poll_SCI(Uint32 timeOutMillis); Uint32 poll_SHM(Uint32 timeOutMillis); + + int m_shm_own_pid; }; #endif // Define of TransporterRegistry_H diff --git a/ndb/include/util/BaseString.hpp b/ndb/include/util/BaseString.hpp index 066a24f294e..02a6a3b3e66 100644 --- a/ndb/include/util/BaseString.hpp +++ b/ndb/include/util/BaseString.hpp @@ -48,10 +48,10 @@ public: bool empty() const; /** @brief Convert to uppercase */ - void ndb_toupper(); + BaseString& ndb_toupper(); /** @brief Convert to lowercase */ - void ndb_tolower(); + BaseString& ndb_tolower(); /** @brief Assigns from a char * */ BaseString& assign(const char* s); @@ -206,16 +206,18 @@ BaseString::empty() const return m_len == 0; } -inline void +inline BaseString& BaseString::ndb_toupper() { for(unsigned i = 0; i < length(); i++) m_chr[i] = toupper(m_chr[i]); + return *this; } -inline void +inline BaseString& BaseString::ndb_tolower() { for(unsigned i = 0; i < length(); i++) m_chr[i] = tolower(m_chr[i]); + return *this; } inline bool diff --git a/ndb/include/util/Parser.hpp b/ndb/include/util/Parser.hpp index 65cf24db633..c117498e1ba 100644 --- a/ndb/include/util/Parser.hpp +++ b/ndb/include/util/Parser.hpp @@ -23,7 +23,7 @@ #include "NdbOut.hpp" class ParserImpl; -template<class T> class ParserRow; +template<class T> struct ParserRow; //#define PARSER_DEBUG #ifdef PARSER_DEBUG @@ -130,11 +130,11 @@ public: * The void* equivalent implementation */ class ParserImpl { +public: class Dummy {}; typedef ParserRow<Dummy> DummyRow; typedef Parser<Dummy>::Context Context; - template<class T> friend class Parser; -private: + ParserImpl(const DummyRow rows[], class InputStream & in, bool b_cmd, bool b_empty, bool b_iarg); diff --git a/ndb/include/util/SimpleProperties.hpp b/ndb/include/util/SimpleProperties.hpp index d5ebb16bb09..356f3406f38 100644 --- a/ndb/include/util/SimpleProperties.hpp +++ b/ndb/include/util/SimpleProperties.hpp @@ -38,20 +38,20 @@ public: /** * Value types */ - enum ValueType { + enum ValueType { Uint32Value = 0, StringValue = 1, BinaryValue = 2, InvalidValue = 3 - }; - + }; + /** * Struct for defining mapping to be used with unpack */ struct SP2StructMapping { Uint16 Key; Uint32 Offset; - SimpleProperties::ValueType Type; + ValueType Type; Uint32 minValue; Uint32 maxValue; Uint32 Length_Offset; // Offset used for looking up length of @@ -233,7 +233,7 @@ private: */ class SimplePropertiesSectionReader : public SimpleProperties::Reader { public: - SimplePropertiesSectionReader(class SegmentedSectionPtr &, + SimplePropertiesSectionReader(struct SegmentedSectionPtr &, class SectionSegmentPool &); virtual void reset(); @@ -248,8 +248,8 @@ private: Uint32 m_pos; Uint32 m_len; class SectionSegmentPool & m_pool; - class SectionSegment * m_head; - class SectionSegment * m_currentSegment; + struct SectionSegment * m_head; + struct SectionSegment * m_currentSegment; }; inline @@ -275,15 +275,15 @@ public: /** * This "unlinks" the writer from the memory */ - void getPtr(class SegmentedSectionPtr & dst); + void getPtr(struct SegmentedSectionPtr & dst); private: Int32 m_pos; Uint32 m_sz; class SectionSegmentPool & m_pool; - class SectionSegment * m_head; + struct SectionSegment * m_head; Uint32 m_prevPtrI; // Prev to m_currentSegment - class SectionSegment * m_currentSegment; + struct SectionSegment * m_currentSegment; }; #endif diff --git a/ndb/include/util/SocketServer.hpp b/ndb/include/util/SocketServer.hpp index 2fad991e5f8..9d8af204391 100644 --- a/ndb/include/util/SocketServer.hpp +++ b/ndb/include/util/SocketServer.hpp @@ -98,7 +98,7 @@ public: */ void stopSessions(bool wait = false); - void foreachSession(void (*f)(SocketServer::Session*, void*), void *data); + void foreachSession(void (*f)(Session*, void*), void *data); private: struct SessionInstance { diff --git a/ndb/include/util/ndb_opts.h b/ndb/include/util/ndb_opts.h index f7ae3b5489e..4bac36f5e5e 100644 --- a/ndb/include/util/ndb_opts.h +++ b/ndb/include/util/ndb_opts.h @@ -17,47 +17,62 @@ #ifndef _NDB_OPTS_H #define _NDB_OPTS_H +#include <ndb_global.h> #include <my_sys.h> #include <my_getopt.h> #include <mysql_version.h> #include <ndb_version.h> -#ifndef DBUG_OFF -#define NDB_STD_OPTS(prog_name) \ - { "debug", '#', "Output debug log. Often this is 'd:t:o,filename'.", \ - 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0 }, \ - { "usage", '?', "Display this help and exit.", \ - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, \ - { "help", '?', "Display this help and exit.", \ - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, \ - { "version", 'V', "Output version information and exit.", 0, 0, 0, \ - GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, \ - { "ndb-connectstring", 'c', \ - "Set connect string for connecting to ndb_mgmd. " \ - "Syntax: \"[nodeid=<id>;][host=]<hostname>[:<port>]\". " \ - "Overides specifying entries in NDB_CONNECTSTRING and Ndb.cfg", \ - (gptr*) &opt_connect_str, (gptr*) &opt_connect_str, 0, \ - GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\ - { "connect-string", 'c', "same as --ndb-connectstring",\ - (gptr*) &opt_connect_str, (gptr*) &opt_connect_str, 0, \ - GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 } +#define NDB_STD_OPTS_VARS \ +const char *opt_connect_str= 0;\ +my_bool opt_ndb_shm;\ +my_bool opt_ndb_optimized_node_selection + +#define NDB_STD_OPTS_OPTIONS \ +OPT_NDB_SHM= 256,\ +OPT_NDB_OPTIMIZED_NODE_SELECTION + +#define OPT_NDB_CONNECTSTRING 'c' + +#ifdef NDB_SHM_TRANSPORTER +#define OPT_NDB_SHM_DEFAULT 1 #else -#define NDB_STD_OPTS(prog_name) \ +#define OPT_NDB_SHM_DEFAULT 0 +#endif + +#define NDB_STD_OPTS_COMMON \ { "usage", '?', "Display this help and exit.", \ 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, \ { "help", '?', "Display this help and exit.", \ 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, \ { "version", 'V', "Output version information and exit.", 0, 0, 0, \ GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, \ - { "ndb-connectstring", 'c', \ + { "ndb-connectstring", OPT_NDB_CONNECTSTRING, \ "Set connect string for connecting to ndb_mgmd. " \ "Syntax: \"[nodeid=<id>;][host=]<hostname>[:<port>]\". " \ "Overides specifying entries in NDB_CONNECTSTRING and Ndb.cfg", \ (gptr*) &opt_connect_str, (gptr*) &opt_connect_str, 0, \ GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\ - { "connect-string", 'c', "same as --ndb-connectstring",\ + { "ndb-shm", OPT_NDB_SHM,\ + "Allow optimizing using shared memory connections when available",\ + (gptr*) &opt_ndb_shm, (gptr*) &opt_ndb_shm, 0,\ + GET_BOOL, NO_ARG, OPT_NDB_SHM_DEFAULT, 0, 0, 0, 0, 0 },\ + {"ndb-optimized-node-selection", OPT_NDB_OPTIMIZED_NODE_SELECTION,\ + "Select nodes for transactions in a more optimal way",\ + (gptr*) &opt_ndb_optimized_node_selection,\ + (gptr*) &opt_ndb_optimized_node_selection, 0,\ + GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},\ + { "connect-string", OPT_NDB_CONNECTSTRING, "same as --ndb-connectstring",\ (gptr*) &opt_connect_str, (gptr*) &opt_connect_str, 0,\ GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 } + +#ifndef DBUG_OFF +#define NDB_STD_OPTS(prog_name) \ + { "debug", '#', "Output debug log. Often this is 'd:t:o,filename'.", \ + 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0 }, \ + NDB_STD_OPTS_COMMON +#else +#define NDB_STD_OPTS(prog_name) NDB_STD_OPTS_COMMON #endif #endif /*_NDB_OPTS_H */ |