diff options
author | unknown <tomas@poseidon.(none)> | 2004-09-16 23:36:48 +0000 |
---|---|---|
committer | unknown <tomas@poseidon.(none)> | 2004-09-16 23:36:48 +0000 |
commit | 1c24e579220a251f8279d822d2d59728592108e5 (patch) | |
tree | 82705fe674f54eb642e58d273d2ecc498181c9ec /ndb/include | |
parent | 9956b20790d88db6639096ef823b5950643b176c (diff) | |
parent | 1de03e7b54374b151ac254e30ad592d808044285 (diff) | |
download | mariadb-git-1c24e579220a251f8279d822d2d59728592108e5.tar.gz |
Merge tulin@bk-internal.mysql.com:/home/bk/mysql-4.1-ndb
into poseidon.(none):/home/tomas/mysql-4.1-ndb-merge
ndb/src/mgmsrv/MgmtSrvr.cpp:
Auto merged
ndb/src/mgmsrv/Services.cpp:
Auto merged
ndb/src/mgmsrv/main.cpp:
Auto merged
ndb/src/ndbapi/NdbDictionary.cpp:
Auto merged
ndb/src/ndbapi/NdbDictionaryImpl.cpp:
Auto merged
ndb/src/ndbapi/Ndbinit.cpp:
Auto merged
sql/ha_ndbcluster.cc:
Auto merged
Diffstat (limited to 'ndb/include')
-rw-r--r-- | ndb/include/debugger/EventLogger.hpp | 167 | ||||
-rw-r--r-- | ndb/include/kernel/LogLevel.hpp | 24 | ||||
-rw-r--r-- | ndb/include/kernel/signaldata/DictTabInfo.hpp | 4 | ||||
-rw-r--r-- | ndb/include/kernel/signaldata/EventSubscribeReq.hpp | 14 | ||||
-rw-r--r-- | ndb/include/kernel/signaldata/SetLogLevelOrd.hpp | 19 | ||||
-rw-r--r-- | ndb/include/mgmapi/mgmapi.h | 18 | ||||
-rw-r--r-- | ndb/include/ndb_global.h | 3 | ||||
-rw-r--r-- | ndb/include/ndbapi/NdbDictionary.hpp | 26 | ||||
-rw-r--r-- | ndb/include/util/NdbSqlUtil.hpp | 7 |
9 files changed, 154 insertions, 128 deletions
diff --git a/ndb/include/debugger/EventLogger.hpp b/ndb/include/debugger/EventLogger.hpp index 6cd6a83e68d..36cece6f22a 100644 --- a/ndb/include/debugger/EventLogger.hpp +++ b/ndb/include/debugger/EventLogger.hpp @@ -24,6 +24,65 @@ #include <kernel/LogLevel.hpp> #include <signaldata/EventReport.hpp> +class EventLoggerBase { +public: + virtual ~EventLoggerBase(); + + /** + * LogLevel settings + */ + LogLevel m_logLevel; + + /** + * 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. + * + * @param cat the event category. + * @return category name. + */ + static const char * getEventCategoryName(LogLevel::EventCategory cat); + + /** + * Specifies allowed event categories/log levels. + */ + 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[]; + 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 +117,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 +129,7 @@ public: /** * Destructor. */ - ~EventLogger(); + virtual ~EventLogger(); /** * Opens/creates the eventlog with the specified filename. @@ -95,30 +154,23 @@ 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); + virtual 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. + * Returns the event text for the specified event report type. * - * @return the log level. + * @param type the event type. + * @param theData the event data. + * @param nodeId a node id. + * @return the event report text. */ - LogLevel& getLoglevel(); + static const char* getText(char * dst, size_t dst_len, + int type, + const Uint32* theData, NodeId nodeId = 0); /** * Returns the log level that is used to filter an event. The event will not @@ -127,6 +179,7 @@ public: * @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'. @@ -135,92 +188,16 @@ public: */ void setFilterLevel(int filterLevel); - /** - * Returns the event text for the specified event report type. - * - * @param type the event type. - * @param theData the event data. - * @param nodeId a node id. - * @return the event report text. - */ - static const char* getText(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. - * - * @param cat the event category. - * @return category name. - */ - static const char * getEventCategoryName(LogLevel::EventCategory cat); - - /** - * Specifies allowed event categories/log levels. - */ - 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[]; - - /** - * Default log levels for management nodes. - * - * threshold - is in range [0-15] - */ - struct EventLogMatrix { - LogLevel::EventCategory eventCategory; - Uint32 threshold; - }; - - static const EventLogMatrix defEventLogMatrix[]; - - - static const Uint32 matrixSize; - static const Uint32 defEventLogMatrixSize; - private: /** Prohibit */ EventLogger(const EventLogger&); 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/LogLevel.hpp b/ndb/include/kernel/LogLevel.hpp index 10cd0d43bee..e3a81263dcb 100644 --- a/ndb/include/kernel/LogLevel.hpp +++ b/ndb/include/kernel/LogLevel.hpp @@ -130,18 +130,25 @@ 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; + } + private: /** * The actual data */ - Uint32 logLevelData[LOGLEVEL_CATEGORIES]; - - LogLevel(const LogLevel &); + Uint8 logLevelData[LOGLEVEL_CATEGORIES]; }; inline LogLevel::LogLevel(){ - clear(); + clear(); } inline @@ -176,5 +183,14 @@ LogLevel::getLogLevel(EventCategory ec) const{ return 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; +} #endif diff --git a/ndb/include/kernel/signaldata/DictTabInfo.hpp b/ndb/include/kernel/signaldata/DictTabInfo.hpp index dec7145c897..a9a50f19fbc 100644 --- a/ndb/include/kernel/signaldata/DictTabInfo.hpp +++ b/ndb/include/kernel/signaldata/DictTabInfo.hpp @@ -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/EventSubscribeReq.hpp b/ndb/include/kernel/signaldata/EventSubscribeReq.hpp index fd2821ea31d..522f8d9b8d3 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: + /** * Note: If you use the same blockRef as you have used earlier, * you update your ongoing subscription @@ -55,6 +54,15 @@ private: Uint32 theCategories[10]; Uint32 theLevels[10]; + + EventSubscribeReq& operator= (const LogLevel& ll){ + noOfEntries = _LOGLEVEL_CATEGORIES; + for(size_t i = 0; i<noOfEntries; i++){ + theCategories[i] = i; + theLevels[i] = ll.getLogLevel((LogLevel::EventCategory)i); + } + return * this; + } }; #endif diff --git a/ndb/include/kernel/signaldata/SetLogLevelOrd.hpp b/ndb/include/kernel/signaldata/SetLogLevelOrd.hpp index c3be808cc41..8e1a8add966 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" /** @@ -51,6 +52,24 @@ private: * Note level is valid as 0-15 */ void setLogLevel(LogLevel::EventCategory ec, int level = 7); + + SetLogLevelOrd& operator= (const LogLevel& ll){ + noOfEntries = _LOGLEVEL_CATEGORIES; + for(size_t i = 0; i<noOfEntries; i++){ + theCategories[i] = i; + theLevels[i] = ll.getLogLevel((LogLevel::EventCategory)i); + } + return * this; + } + + SetLogLevelOrd& operator= (const EventSubscribeReq& ll){ + noOfEntries = ll.noOfEntries; + for(size_t i = 0; i<noOfEntries; i++){ + theCategories[i] = ll.theCategories[i]; + theLevels[i] = ll.theLevels[i]; + } + return * this; + } }; inline diff --git a/ndb/include/mgmapi/mgmapi.h b/ndb/include/mgmapi/mgmapi.h index 929f4b0833b..9caf1c86c4d 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; diff --git a/ndb/include/ndb_global.h b/ndb/include/ndb_global.h index 0ae781ba5c2..19bd387c457 100644 --- a/ndb/include/ndb_global.h +++ b/ndb/include/ndb_global.h @@ -76,6 +76,9 @@ extern "C" { #include <assert.h> +/* call in main() - does not return on error */ +extern int ndb_init(void); + #ifndef HAVE_STRDUP extern char * strdup(const char *s); #endif diff --git a/ndb/include/ndbapi/NdbDictionary.hpp b/ndb/include/ndbapi/NdbDictionary.hpp index 5c470c1d25f..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 diff --git a/ndb/include/util/NdbSqlUtil.hpp b/ndb/include/util/NdbSqlUtil.hpp index 1d3e96d5c7e..df1cb716f93 100644 --- a/ndb/include/util/NdbSqlUtil.hpp +++ b/ndb/include/util/NdbSqlUtil.hpp @@ -90,6 +90,13 @@ public: */ static const Type& getType(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: /** * List of all types. Must match Type::Enum. |