summaryrefslogtreecommitdiff
path: root/ndb/include
diff options
context:
space:
mode:
authorunknown <mysql@mc04.(none)>2004-09-16 21:53:46 +0200
committerunknown <mysql@mc04.(none)>2004-09-16 21:53:46 +0200
commita562315e3fc1fb84ac1352960b79fb21e39ca48d (patch)
tree3c04c998f09f8f8359a4047beca759da020fd07b /ndb/include
parentd159d111da398b1b1ed59a56f2357692bf2a8ab1 (diff)
parent1da0c31b840911c58fa82f61c2efcabfbf80020a (diff)
downloadmariadb-git-a562315e3fc1fb84ac1352960b79fb21e39ca48d.tar.gz
Merge mronstrom@bk-internal.mysql.com:/home/bk/mysql-4.1-ndb
into mc04.(none):/space/mysql/mysql-4.1-ndb ndb/src/mgmsrv/Makefile.am: Auto merged
Diffstat (limited to 'ndb/include')
-rw-r--r--ndb/include/debugger/EventLogger.hpp167
-rw-r--r--ndb/include/kernel/LogLevel.hpp24
-rw-r--r--ndb/include/kernel/signaldata/EventSubscribeReq.hpp14
-rw-r--r--ndb/include/kernel/signaldata/SetLogLevelOrd.hpp19
-rw-r--r--ndb/include/mgmapi/mgmapi.h18
5 files changed, 122 insertions, 120 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/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;