mirror of
https://github.com/MariaDB/server.git
synced 2026-05-10 17:14:30 +02:00
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
This commit is contained in:
commit
a562315e3f
18 changed files with 651 additions and 1271 deletions
|
|
@ -24,128 +24,15 @@
|
|||
#include <kernel/LogLevel.hpp>
|
||||
#include <signaldata/EventReport.hpp>
|
||||
|
||||
/**
|
||||
* The EventLogger is primarily used for logging NDB events
|
||||
* in the Management Server. It inherits all logging functionality of Logger.
|
||||
*
|
||||
* HOW TO USE
|
||||
*
|
||||
* 1) Create an EventLogger
|
||||
*
|
||||
* EventLogger myEventLogger = new EventLogger();
|
||||
*
|
||||
* 2) Log NDB events and other log messages.
|
||||
*
|
||||
* myEventLogger->info("Changing log levels.");
|
||||
*
|
||||
* EventReport* report = (EventReport*)&theSignalData[0];
|
||||
* myEventLogger->log(eventReport->getEventType(), theSignalData, aNodeId);
|
||||
*
|
||||
*
|
||||
* The following NDB event categories and log levels are enabled as default:
|
||||
*
|
||||
* EVENT-CATEGORY LOG-LEVEL
|
||||
*
|
||||
* Startup 4
|
||||
* Shutdown 1
|
||||
* Statistic 2
|
||||
* Checkpoint 5
|
||||
* NodeRestart 8
|
||||
* Connection 2
|
||||
* Error 15
|
||||
* Info 10
|
||||
*
|
||||
* @see Logger
|
||||
* @version #@ $Id: EventLogger.hpp,v 1.3 2003/09/01 10:15:52 innpeno Exp $
|
||||
*/
|
||||
class EventLogger : public Logger
|
||||
{
|
||||
class EventLoggerBase {
|
||||
public:
|
||||
/**
|
||||
* Default constructor. Enables default log levels and
|
||||
* sets the log category to 'EventLogger'.
|
||||
*/
|
||||
EventLogger();
|
||||
virtual ~EventLoggerBase();
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
* LogLevel settings
|
||||
*/
|
||||
~EventLogger();
|
||||
|
||||
/**
|
||||
* Opens/creates the eventlog with the specified filename.
|
||||
*
|
||||
* @param aFileName the eventlog filename.
|
||||
* @param maxNoFiles the maximum no of archived eventlog files.
|
||||
* @param maxFileSize the maximum eventlog file size.
|
||||
* @param maxLogEntries the maximum number of log entries before
|
||||
* checking time to archive.
|
||||
* @return true if successful.
|
||||
*/
|
||||
bool open(const char* logFileName,
|
||||
int maxNoFiles = FileLogHandler::MAX_NO_FILES,
|
||||
long int maxFileSize = FileLogHandler::MAX_FILE_SIZE,
|
||||
unsigned int maxLogEntries = FileLogHandler::MAX_LOG_ENTRIES);
|
||||
|
||||
/**
|
||||
* Closes the eventlog.
|
||||
*/
|
||||
void close();
|
||||
|
||||
/**
|
||||
* 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();
|
||||
LogLevel m_logLevel;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* @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
|
||||
*
|
||||
|
|
@ -193,22 +80,113 @@ public:
|
|||
};
|
||||
|
||||
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.
|
||||
*
|
||||
* HOW TO USE
|
||||
*
|
||||
* 1) Create an EventLogger
|
||||
*
|
||||
* EventLogger myEventLogger = new EventLogger();
|
||||
*
|
||||
* 2) Log NDB events and other log messages.
|
||||
*
|
||||
* myEventLogger->info("Changing log levels.");
|
||||
*
|
||||
* EventReport* report = (EventReport*)&theSignalData[0];
|
||||
* myEventLogger->log(eventReport->getEventType(), theSignalData, aNodeId);
|
||||
*
|
||||
*
|
||||
* The following NDB event categories and log levels are enabled as default:
|
||||
*
|
||||
* EVENT-CATEGORY LOG-LEVEL
|
||||
*
|
||||
* Startup 4
|
||||
* Shutdown 1
|
||||
* Statistic 2
|
||||
* Checkpoint 5
|
||||
* NodeRestart 8
|
||||
* Connection 2
|
||||
* Error 15
|
||||
* Info 10
|
||||
*
|
||||
* @see Logger
|
||||
* @version #@ $Id: EventLogger.hpp,v 1.3 2003/09/01 10:15:52 innpeno Exp $
|
||||
*/
|
||||
class EventLogger : public EventLoggerBase, public Logger
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Default constructor. Enables default log levels and
|
||||
* sets the log category to 'EventLogger'.
|
||||
*/
|
||||
EventLogger();
|
||||
|
||||
/**
|
||||
* Default log levels for management nodes.
|
||||
*
|
||||
* threshold - is in range [0-15]
|
||||
* Destructor.
|
||||
*/
|
||||
struct EventLogMatrix {
|
||||
LogLevel::EventCategory eventCategory;
|
||||
Uint32 threshold;
|
||||
};
|
||||
virtual ~EventLogger();
|
||||
|
||||
static const EventLogMatrix defEventLogMatrix[];
|
||||
/**
|
||||
* Opens/creates the eventlog with the specified filename.
|
||||
*
|
||||
* @param aFileName the eventlog filename.
|
||||
* @param maxNoFiles the maximum no of archived eventlog files.
|
||||
* @param maxFileSize the maximum eventlog file size.
|
||||
* @param maxLogEntries the maximum number of log entries before
|
||||
* checking time to archive.
|
||||
* @return true if successful.
|
||||
*/
|
||||
bool open(const char* logFileName,
|
||||
int maxNoFiles = FileLogHandler::MAX_NO_FILES,
|
||||
long int maxFileSize = FileLogHandler::MAX_FILE_SIZE,
|
||||
unsigned int maxLogEntries = FileLogHandler::MAX_LOG_ENTRIES);
|
||||
|
||||
/**
|
||||
* Closes the eventlog.
|
||||
*/
|
||||
void close();
|
||||
|
||||
/**
|
||||
* Logs the NDB event.
|
||||
*
|
||||
* @param eventType the type of event.
|
||||
* @param theData the event data.
|
||||
* @param nodeId the node id of event origin.
|
||||
*/
|
||||
virtual void log(int eventType, const Uint32* theData, NodeId nodeId = 0);
|
||||
|
||||
/**
|
||||
* 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(char * dst, size_t dst_len,
|
||||
int type,
|
||||
const Uint32* theData, NodeId nodeId = 0);
|
||||
|
||||
static const Uint32 matrixSize;
|
||||
static const Uint32 defEventLogMatrixSize;
|
||||
/**
|
||||
* 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);
|
||||
|
||||
private:
|
||||
/** Prohibit */
|
||||
|
|
@ -216,11 +194,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];
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -55,24 +55,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.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue