mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 13:32:33 +01:00
parent
9d0c4e8e89
commit
c2c618332e
11 changed files with 129 additions and 88 deletions
|
@ -67,8 +67,7 @@ while test $# -gt 0; do
|
||||||
initial_ndb=1
|
initial_ndb=1
|
||||||
;;
|
;;
|
||||||
--debug*)
|
--debug*)
|
||||||
f=`echo "$1" | sed -e "s;--debug=;;"`
|
flags_ndb="$flags_ndb $1"
|
||||||
flags_ndb="$flags_ndb $f"
|
|
||||||
;;
|
;;
|
||||||
--status)
|
--status)
|
||||||
status_ndb=1
|
status_ndb=1
|
||||||
|
|
|
@ -48,6 +48,11 @@ public:
|
||||||
|
|
||||||
static const EventRepLogLevelMatrix matrix[];
|
static const EventRepLogLevelMatrix matrix[];
|
||||||
static const Uint32 matrixSize;
|
static const Uint32 matrixSize;
|
||||||
|
static int
|
||||||
|
EventLoggerBase::event_lookup(int eventType,
|
||||||
|
LogLevel::EventCategory &cat,
|
||||||
|
Uint32 &threshold,
|
||||||
|
Logger::LoggerLevel &severity);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -73,7 +73,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Note level is valid as 0-15
|
* 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
|
* Get the loglevel (0-15) for a category
|
||||||
|
@ -119,10 +119,14 @@ LogLevel::clear(){
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
void
|
int
|
||||||
LogLevel::setLogLevel(EventCategory ec, Uint32 level){
|
LogLevel::setLogLevel(EventCategory ec, Uint32 level){
|
||||||
assert(ec >= 0 && (Uint32) ec < LOGLEVEL_CATEGORIES);
|
if (ec >= 0 && (Uint32) ec < LOGLEVEL_CATEGORIES)
|
||||||
|
{
|
||||||
logLevelData[ec] = (Uint8)level;
|
logLevelData[ec] = (Uint8)level;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
|
|
|
@ -1342,6 +1342,23 @@ operator<<(NdbOut& out, const LogLevel & ll)
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
EventLoggerBase::event_lookup(int eventType,
|
||||||
|
LogLevel::EventCategory &cat,
|
||||||
|
Uint32 &threshold,
|
||||||
|
Logger::LoggerLevel &severity)
|
||||||
|
{
|
||||||
|
for(unsigned i = 0; i<EventLoggerBase::matrixSize; i++){
|
||||||
|
if(EventLoggerBase::matrix[i].eventType == eventType){
|
||||||
|
cat = EventLoggerBase::matrix[i].eventCategory;
|
||||||
|
threshold = EventLoggerBase::matrix[i].threshold;
|
||||||
|
severity = EventLoggerBase::matrix[i].severity;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
EventLogger::log(int eventType, const Uint32* theData, NodeId nodeId,
|
EventLogger::log(int eventType, const Uint32* theData, NodeId nodeId,
|
||||||
const LogLevel* ll)
|
const LogLevel* ll)
|
||||||
|
@ -1350,19 +1367,16 @@ EventLogger::log(int eventType, const Uint32* theData, NodeId nodeId,
|
||||||
Logger::LoggerLevel severity = Logger::LL_WARNING;
|
Logger::LoggerLevel severity = Logger::LL_WARNING;
|
||||||
LogLevel::EventCategory cat= LogLevel::llInvalid;
|
LogLevel::EventCategory cat= LogLevel::llInvalid;
|
||||||
|
|
||||||
for(unsigned i = 0; i<EventLoggerBase::matrixSize; i++){
|
DBUG_ENTER("EventLogger::log");
|
||||||
if(EventLoggerBase::matrix[i].eventType == eventType){
|
DBUG_PRINT("enter",("eventType=%d, nodeid=%d", eventType, nodeId));
|
||||||
cat = EventLoggerBase::matrix[i].eventCategory;
|
|
||||||
threshold = EventLoggerBase::matrix[i].threshold;
|
|
||||||
severity = EventLoggerBase::matrix[i].severity;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cat == LogLevel::llInvalid)
|
if (EventLoggerBase::event_lookup(eventType,cat,threshold,severity))
|
||||||
return;
|
DBUG_VOID_RETURN;
|
||||||
|
|
||||||
Uint32 set = ll?ll->getLogLevel(cat) : m_logLevel.getLogLevel(cat);
|
Uint32 set = ll?ll->getLogLevel(cat) : m_logLevel.getLogLevel(cat);
|
||||||
|
DBUG_PRINT("info",("threshold=%d, set=%d", threshold, set));
|
||||||
|
if (ll)
|
||||||
|
DBUG_PRINT("info",("m_logLevel.getLogLevel=%d", m_logLevel.getLogLevel(cat)));
|
||||||
if (threshold <= set){
|
if (threshold <= set){
|
||||||
switch (severity){
|
switch (severity){
|
||||||
case Logger::LL_ALERT:
|
case Logger::LL_ALERT:
|
||||||
|
@ -1401,6 +1415,7 @@ EventLogger::log(int eventType, const Uint32* theData, NodeId nodeId,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} // if (..
|
} // if (..
|
||||||
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
extern "C"
|
extern "C"
|
||||||
int
|
int
|
||||||
Ndb_getInAddr(struct in_addr * dst, const char *address) {
|
Ndb_getInAddr(struct in_addr * dst, const char *address) {
|
||||||
DBUG_ENTER("Ndb_getInAddr");
|
// DBUG_ENTER("Ndb_getInAddr");
|
||||||
{
|
{
|
||||||
int tmp_errno;
|
int tmp_errno;
|
||||||
struct hostent tmp_hostent, *hp;
|
struct hostent tmp_hostent, *hp;
|
||||||
|
@ -33,7 +33,7 @@ Ndb_getInAddr(struct in_addr * dst, const char *address) {
|
||||||
{
|
{
|
||||||
memcpy(dst, hp->h_addr, min(sizeof(*dst), (size_t) hp->h_length));
|
memcpy(dst, hp->h_addr, min(sizeof(*dst), (size_t) hp->h_length));
|
||||||
my_gethostbyname_r_free();
|
my_gethostbyname_r_free();
|
||||||
DBUG_RETURN(0);
|
return 0; //DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
my_gethostbyname_r_free();
|
my_gethostbyname_r_free();
|
||||||
}
|
}
|
||||||
|
@ -47,11 +47,11 @@ Ndb_getInAddr(struct in_addr * dst, const char *address) {
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
DBUG_RETURN(0);
|
return 0; //DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
DBUG_PRINT("error",("inet_addr(%s) - %d - %s",
|
// DBUG_PRINT("error",("inet_addr(%s) - %d - %s",
|
||||||
address, errno, strerror(errno)));
|
// address, errno, strerror(errno)));
|
||||||
DBUG_RETURN(-1);
|
return -1; //DBUG_RETURN(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
|
@ -193,21 +193,11 @@ void Cmvmi::execEVENT_REP(Signal* signal)
|
||||||
/**
|
/**
|
||||||
* If entry is not found
|
* If entry is not found
|
||||||
*/
|
*/
|
||||||
Uint32 threshold = 16;
|
Uint32 threshold;
|
||||||
LogLevel::EventCategory eventCategory = (LogLevel::EventCategory)0;
|
LogLevel::EventCategory eventCategory;
|
||||||
|
Logger::LoggerLevel severity;
|
||||||
for(unsigned int i = 0; i< EventLoggerBase::matrixSize; i++){
|
if (EventLoggerBase::event_lookup(eventType,eventCategory,threshold,severity))
|
||||||
if(EventLoggerBase::matrix[i].eventType == eventType){
|
|
||||||
eventCategory = EventLoggerBase::matrix[i].eventCategory;
|
|
||||||
threshold = EventLoggerBase::matrix[i].threshold;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(threshold > 15){
|
|
||||||
// No entry found in matrix (or event that should never be printed)
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
SubscriberPtr ptr;
|
SubscriberPtr ptr;
|
||||||
for(subscribers.first(ptr); ptr.i != RNIL; subscribers.next(ptr)){
|
for(subscribers.first(ptr); ptr.i != RNIL; subscribers.next(ptr)){
|
||||||
|
@ -225,14 +215,15 @@ void Cmvmi::execEVENT_REP(Signal* signal)
|
||||||
// Print the event info
|
// Print the event info
|
||||||
g_eventLogger.log(eventReport->getEventType(), signal->theData);
|
g_eventLogger.log(eventReport->getEventType(), signal->theData);
|
||||||
|
|
||||||
|
return;
|
||||||
}//execEVENT_REP()
|
}//execEVENT_REP()
|
||||||
|
|
||||||
void
|
void
|
||||||
Cmvmi::execEVENT_SUBSCRIBE_REQ(Signal * signal){
|
Cmvmi::execEVENT_SUBSCRIBE_REQ(Signal * signal){
|
||||||
EventSubscribeReq * subReq = (EventSubscribeReq *)&signal->theData[0];
|
EventSubscribeReq * subReq = (EventSubscribeReq *)&signal->theData[0];
|
||||||
SubscriberPtr ptr;
|
SubscriberPtr ptr;
|
||||||
|
|
||||||
jamEntry();
|
jamEntry();
|
||||||
|
DBUG_ENTER("Cmvmi::execEVENT_SUBSCRIBE_REQ");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search for subcription
|
* Search for subcription
|
||||||
|
@ -269,11 +260,13 @@ Cmvmi::execEVENT_SUBSCRIBE_REQ(Signal * signal){
|
||||||
category = (LogLevel::EventCategory)(subReq->theData[i] >> 16);
|
category = (LogLevel::EventCategory)(subReq->theData[i] >> 16);
|
||||||
level = subReq->theData[i] & 0xFFFF;
|
level = subReq->theData[i] & 0xFFFF;
|
||||||
ptr.p->logLevel.setLogLevel(category, level);
|
ptr.p->logLevel.setLogLevel(category, level);
|
||||||
|
DBUG_PRINT("info",("entry %d: level=%d, category= %d", i, level, category));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
signal->theData[0] = ptr.i;
|
signal->theData[0] = ptr.i;
|
||||||
sendSignal(ptr.p->blockRef, GSN_EVENT_SUBSCRIBE_CONF, signal, 1, JBB);
|
sendSignal(ptr.p->blockRef, GSN_EVENT_SUBSCRIBE_CONF, signal, 1, JBB);
|
||||||
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -1102,15 +1102,18 @@ ndb_mgm_set_loglevel_clusterlog(NdbMgmHandle handle, int nodeId,
|
||||||
"set cluster loglevel", &args);
|
"set cluster loglevel", &args);
|
||||||
CHECK_REPLY(reply, -1);
|
CHECK_REPLY(reply, -1);
|
||||||
|
|
||||||
|
DBUG_ENTER("ndb_mgm_set_loglevel_clusterlog");
|
||||||
|
DBUG_PRINT("enter",("node=%d, category=%d, level=%d", nodeId, cat, level));
|
||||||
|
|
||||||
BaseString result;
|
BaseString result;
|
||||||
reply->get("result", result);
|
reply->get("result", result);
|
||||||
if(strcmp(result.c_str(), "Ok") != 0) {
|
if(strcmp(result.c_str(), "Ok") != 0) {
|
||||||
SET_ERROR(handle, EINVAL, result.c_str());
|
SET_ERROR(handle, EINVAL, result.c_str());
|
||||||
delete reply;
|
delete reply;
|
||||||
return -1;
|
DBUG_RETURN(-1);
|
||||||
}
|
}
|
||||||
delete reply;
|
delete reply;
|
||||||
return 0;
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
|
|
|
@ -153,7 +153,7 @@ MgmtSrvr::logLevelThreadRun()
|
||||||
* Handle started nodes
|
* Handle started nodes
|
||||||
*/
|
*/
|
||||||
EventSubscribeReq req;
|
EventSubscribeReq req;
|
||||||
req = m_statisticsListner.m_clients[0].m_logLevel;
|
req = m_event_listner[0].m_logLevel;
|
||||||
req.blockRef = _ownReference;
|
req.blockRef = _ownReference;
|
||||||
|
|
||||||
SetLogLevelOrd ord;
|
SetLogLevelOrd ord;
|
||||||
|
@ -409,7 +409,7 @@ MgmtSrvr::MgmtSrvr(SocketServer *socket_server,
|
||||||
_ownReference(0),
|
_ownReference(0),
|
||||||
theSignalIdleList(NULL),
|
theSignalIdleList(NULL),
|
||||||
theWaitState(WAIT_SUBSCRIBE_CONF),
|
theWaitState(WAIT_SUBSCRIBE_CONF),
|
||||||
m_statisticsListner(this)
|
m_event_listner(this)
|
||||||
{
|
{
|
||||||
|
|
||||||
DBUG_ENTER("MgmtSrvr::MgmtSrvr");
|
DBUG_ENTER("MgmtSrvr::MgmtSrvr");
|
||||||
|
@ -547,16 +547,18 @@ MgmtSrvr::MgmtSrvr(SocketServer *socket_server,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Setup clusterlog as client[0] in m_event_listner
|
||||||
{
|
{
|
||||||
MgmStatService::StatListener se;
|
Ndb_mgmd_event_service::Event_listener se;
|
||||||
se.m_socket = -1;
|
se.m_socket = -1;
|
||||||
for(size_t t = 0; t<LogLevel::LOGLEVEL_CATEGORIES; t++){
|
for(size_t t = 0; t<LogLevel::LOGLEVEL_CATEGORIES; t++){
|
||||||
se.m_logLevel.setLogLevel((LogLevel::EventCategory)t, 7);
|
se.m_logLevel.setLogLevel((LogLevel::EventCategory)t, 7);
|
||||||
}
|
}
|
||||||
se.m_logLevel.setLogLevel(LogLevel::llError, 15);
|
se.m_logLevel.setLogLevel(LogLevel::llError, 15);
|
||||||
|
se.m_logLevel.setLogLevel(LogLevel::llConnection, 8);
|
||||||
se.m_logLevel.setLogLevel(LogLevel::llBackup, 15);
|
se.m_logLevel.setLogLevel(LogLevel::llBackup, 15);
|
||||||
m_statisticsListner.m_clients.push_back(se);
|
m_event_listner.m_clients.push_back(se);
|
||||||
m_statisticsListner.m_logLevel = se.m_logLevel;
|
m_event_listner.m_logLevel = se.m_logLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
|
@ -2071,21 +2073,18 @@ MgmtSrvr::handleStopReply(NodeId nodeId, Uint32 errCode)
|
||||||
void
|
void
|
||||||
MgmtSrvr::handleStatus(NodeId nodeId, bool alive)
|
MgmtSrvr::handleStatus(NodeId nodeId, bool alive)
|
||||||
{
|
{
|
||||||
|
DBUG_ENTER("MgmtSrvr::handleStatus");
|
||||||
|
Uint32 theData[25];
|
||||||
|
theData[1] = nodeId;
|
||||||
if (alive) {
|
if (alive) {
|
||||||
m_started_nodes.push_back(nodeId);
|
m_started_nodes.push_back(nodeId);
|
||||||
Uint32 theData[25];
|
|
||||||
theData[0] = EventReport::Connected;
|
theData[0] = EventReport::Connected;
|
||||||
theData[1] = nodeId;
|
|
||||||
eventReport(_ownNodeId, theData);
|
|
||||||
} else {
|
} else {
|
||||||
handleStopReply(nodeId, 0);
|
handleStopReply(nodeId, 0);
|
||||||
|
|
||||||
Uint32 theData[25];
|
|
||||||
theData[0] = EventReport::Disconnected;
|
theData[0] = EventReport::Disconnected;
|
||||||
theData[1] = nodeId;
|
|
||||||
|
|
||||||
eventReport(_ownNodeId, theData);
|
|
||||||
}
|
}
|
||||||
|
eventReport(_ownNodeId, theData);
|
||||||
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
//****************************************************************************
|
//****************************************************************************
|
||||||
|
@ -2106,8 +2105,11 @@ void
|
||||||
MgmtSrvr::nodeStatusNotification(void* mgmSrv, Uint32 nodeId,
|
MgmtSrvr::nodeStatusNotification(void* mgmSrv, Uint32 nodeId,
|
||||||
bool alive, bool nfComplete)
|
bool alive, bool nfComplete)
|
||||||
{
|
{
|
||||||
|
DBUG_ENTER("MgmtSrvr::nodeStatusNotification");
|
||||||
|
DBUG_PRINT("enter",("nodeid= %d, alive= %d, nfComplete= %d", nodeId, alive, nfComplete));
|
||||||
if(!(!alive && nfComplete))
|
if(!(!alive && nfComplete))
|
||||||
((MgmtSrvr*)mgmSrv)->handleStatus(nodeId, alive);
|
((MgmtSrvr*)mgmSrv)->handleStatus(nodeId, alive);
|
||||||
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ndb_mgm_node_type
|
enum ndb_mgm_node_type
|
||||||
|
@ -2386,8 +2388,8 @@ MgmtSrvr::eventReport(NodeId nodeId, const Uint32 * theData)
|
||||||
EventReport::EventType type = eventReport->getEventType();
|
EventReport::EventType type = eventReport->getEventType();
|
||||||
// Log event
|
// Log event
|
||||||
g_EventLogger.log(type, theData, nodeId,
|
g_EventLogger.log(type, theData, nodeId,
|
||||||
&m_statisticsListner.m_clients[0].m_logLevel);
|
&m_event_listner[0].m_logLevel);
|
||||||
m_statisticsListner.log(type, theData, nodeId);
|
m_event_listner.log(type, theData, nodeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
|
@ -2740,5 +2742,5 @@ template bool SignalQueue::waitFor<SigMatch>(Vector<SigMatch>&, SigMatch*&, NdbA
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template class MutexVector<unsigned short>;
|
template class MutexVector<unsigned short>;
|
||||||
template class MutexVector<MgmStatService::StatListener>;
|
template class MutexVector<Ndb_mgmd_event_service::Event_listener>;
|
||||||
template class MutexVector<EventSubscribeReq>;
|
template class MutexVector<EventSubscribeReq>;
|
||||||
|
|
|
@ -43,27 +43,30 @@ class Config;
|
||||||
class SetLogLevelOrd;
|
class SetLogLevelOrd;
|
||||||
class SocketServer;
|
class SocketServer;
|
||||||
|
|
||||||
class MgmStatService : public EventLoggerBase
|
class Ndb_mgmd_event_service : public EventLoggerBase
|
||||||
{
|
{
|
||||||
friend class MgmtSrvr;
|
friend class MgmtSrvr;
|
||||||
public:
|
public:
|
||||||
struct StatListener : public EventLoggerBase {
|
struct Event_listener : public EventLoggerBase {
|
||||||
NDB_SOCKET_TYPE m_socket;
|
NDB_SOCKET_TYPE m_socket;
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class MgmtSrvr * m_mgmsrv;
|
class MgmtSrvr * m_mgmsrv;
|
||||||
MutexVector<StatListener> m_clients;
|
MutexVector<Event_listener> m_clients;
|
||||||
public:
|
public:
|
||||||
MgmStatService(class MgmtSrvr * m) : m_clients(5) {
|
Ndb_mgmd_event_service(class MgmtSrvr * m) : m_clients(5) {
|
||||||
m_mgmsrv = m;
|
m_mgmsrv = m;
|
||||||
}
|
}
|
||||||
|
|
||||||
void add_listener(const StatListener&);
|
void add_listener(const Event_listener&);
|
||||||
|
|
||||||
void log(int eventType, const Uint32* theData, NodeId nodeId);
|
void log(int eventType, const Uint32* theData, NodeId nodeId);
|
||||||
|
|
||||||
void stopSessions();
|
void stop_sessions();
|
||||||
|
|
||||||
|
Event_listener& operator[](unsigned i) { return m_clients[i]; }
|
||||||
|
const Event_listener& operator[](unsigned i) const { return m_clients[i]; }
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -732,8 +735,8 @@ private:
|
||||||
LogLevel m_nodeLogLevel[MAX_NODES];
|
LogLevel m_nodeLogLevel[MAX_NODES];
|
||||||
enum ndb_mgm_node_type nodeTypes[MAX_NODES];
|
enum ndb_mgm_node_type nodeTypes[MAX_NODES];
|
||||||
friend class MgmApiSession;
|
friend class MgmApiSession;
|
||||||
friend class MgmStatService;
|
friend class Ndb_mgmd_event_service;
|
||||||
MgmStatService m_statisticsListner;
|
Ndb_mgmd_event_service m_event_listner;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the thread wich upon a 'Node is started' event will
|
* Handles the thread wich upon a 'Node is started' event will
|
||||||
|
|
|
@ -208,12 +208,12 @@ ParserRow<MgmApiSession> commands[] = {
|
||||||
|
|
||||||
MGM_CMD("set loglevel", &MgmApiSession::setLogLevel, ""),
|
MGM_CMD("set loglevel", &MgmApiSession::setLogLevel, ""),
|
||||||
MGM_ARG("node", Int, Mandatory, "Node"),
|
MGM_ARG("node", Int, Mandatory, "Node"),
|
||||||
MGM_ARG("category", String, Mandatory, "Event category"),
|
MGM_ARG("category", Int, Mandatory, "Event category"),
|
||||||
MGM_ARG("level", Int, Mandatory, "Log level (0-15)"),
|
MGM_ARG("level", Int, Mandatory, "Log level (0-15)"),
|
||||||
|
|
||||||
MGM_CMD("set cluster loglevel", &MgmApiSession::setClusterLogLevel, ""),
|
MGM_CMD("set cluster loglevel", &MgmApiSession::setClusterLogLevel, ""),
|
||||||
MGM_ARG("node", Int, Mandatory, "Node"),
|
MGM_ARG("node", Int, Mandatory, "Node"),
|
||||||
MGM_ARG("category", String, Mandatory, "Event category"),
|
MGM_ARG("category", Int, Mandatory, "Event category"),
|
||||||
MGM_ARG("level", Int, Mandatory, "Log level (0-15)"),
|
MGM_ARG("level", Int, Mandatory, "Log level (0-15)"),
|
||||||
|
|
||||||
MGM_CMD("set logfilter", &MgmApiSession::setLogFilter, ""),
|
MGM_CMD("set logfilter", &MgmApiSession::setLogFilter, ""),
|
||||||
|
@ -781,20 +781,35 @@ MgmApiSession::bye(Parser<MgmApiSession>::Context &,
|
||||||
void
|
void
|
||||||
MgmApiSession::setClusterLogLevel(Parser<MgmApiSession>::Context &,
|
MgmApiSession::setClusterLogLevel(Parser<MgmApiSession>::Context &,
|
||||||
Properties const &args) {
|
Properties const &args) {
|
||||||
Uint32 node, level, category;
|
const char *reply= "set cluster loglevel reply";
|
||||||
|
Uint32 node, level, cat;
|
||||||
BaseString errorString;
|
BaseString errorString;
|
||||||
SetLogLevelOrd logLevel;
|
SetLogLevelOrd logLevel;
|
||||||
int result;
|
int result;
|
||||||
|
DBUG_ENTER("MgmApiSession::setClusterLogLevel");
|
||||||
args.get("node", &node);
|
args.get("node", &node);
|
||||||
args.get("category", &category);
|
args.get("category", &cat);
|
||||||
args.get("level", &level);
|
args.get("level", &level);
|
||||||
|
|
||||||
|
DBUG_PRINT("enter",("node=%d, category=%d, level=%d", node, cat, level));
|
||||||
|
|
||||||
/* XXX should use constants for this value */
|
/* XXX should use constants for this value */
|
||||||
if(level > 15) {
|
if(level > 15) {
|
||||||
m_output->println("set cluster loglevel reply");
|
m_output->println(reply);
|
||||||
m_output->println("result: Invalid loglevel");
|
m_output->println("result: Invalid loglevel %d", level);
|
||||||
m_output->println("");
|
m_output->println("");
|
||||||
return;
|
DBUG_VOID_RETURN;
|
||||||
|
}
|
||||||
|
|
||||||
|
LogLevel::EventCategory category=
|
||||||
|
(LogLevel::EventCategory)(cat-(int)CFG_MIN_LOGLEVEL);
|
||||||
|
|
||||||
|
if (m_mgmsrv.m_event_listner[0].m_logLevel.setLogLevel(category,level))
|
||||||
|
{
|
||||||
|
m_output->println(reply);
|
||||||
|
m_output->println("result: Invalid category %d", category);
|
||||||
|
m_output->println("");
|
||||||
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
EventSubscribeReq req;
|
EventSubscribeReq req;
|
||||||
|
@ -803,9 +818,10 @@ MgmApiSession::setClusterLogLevel(Parser<MgmApiSession>::Context &,
|
||||||
req.theData[0] = (category << 16) | level;
|
req.theData[0] = (category << 16) | level;
|
||||||
m_mgmsrv.m_log_level_requests.push_back(req);
|
m_mgmsrv.m_log_level_requests.push_back(req);
|
||||||
|
|
||||||
m_output->println("set cluster loglevel reply");
|
m_output->println(reply);
|
||||||
m_output->println("result: Ok");
|
m_output->println("result: Ok");
|
||||||
m_output->println("");
|
m_output->println("");
|
||||||
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1263,21 +1279,17 @@ operator<<(NdbOut& out, const LogLevel & ll)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MgmStatService::log(int eventType, const Uint32* theData, NodeId nodeId){
|
Ndb_mgmd_event_service::log(int eventType, const Uint32* theData, NodeId nodeId){
|
||||||
|
|
||||||
Uint32 threshold = 0;
|
Uint32 threshold;
|
||||||
LogLevel::EventCategory cat= LogLevel::llInvalid;
|
LogLevel::EventCategory cat;
|
||||||
|
Logger::LoggerLevel severity;
|
||||||
int i;
|
int i;
|
||||||
|
DBUG_ENTER("Ndb_mgmd_event_service::log");
|
||||||
|
DBUG_PRINT("enter",("eventType=%d, nodeid=%d", eventType, nodeId));
|
||||||
|
|
||||||
for(i = 0; (unsigned)i<EventLogger::matrixSize; i++){
|
if (EventLoggerBase::event_lookup(eventType,cat,threshold,severity))
|
||||||
if(EventLogger::matrix[i].eventType == eventType){
|
DBUG_VOID_RETURN;
|
||||||
cat = EventLogger::matrix[i].eventCategory;
|
|
||||||
threshold = EventLogger::matrix[i].threshold;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (cat == LogLevel::llInvalid)
|
|
||||||
return;
|
|
||||||
|
|
||||||
char m_text[256];
|
char m_text[256];
|
||||||
EventLogger::getText(m_text, sizeof(m_text), eventType, theData, nodeId);
|
EventLogger::getText(m_text, sizeof(m_text), eventType, theData, nodeId);
|
||||||
|
@ -1316,10 +1328,11 @@ MgmStatService::log(int eventType, const Uint32* theData, NodeId nodeId){
|
||||||
m_mgmsrv->m_log_level_requests.push_back(req);
|
m_mgmsrv->m_log_level_requests.push_back(req);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MgmStatService::add_listener(const StatListener& client){
|
Ndb_mgmd_event_service::add_listener(const Event_listener& client){
|
||||||
m_clients.push_back(client);
|
m_clients.push_back(client);
|
||||||
LogLevel tmp = m_logLevel;
|
LogLevel tmp = m_logLevel;
|
||||||
tmp.set_max(client.m_logLevel);
|
tmp.set_max(client.m_logLevel);
|
||||||
|
@ -1334,7 +1347,7 @@ MgmStatService::add_listener(const StatListener& client){
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MgmStatService::stopSessions(){
|
Ndb_mgmd_event_service::stop_sessions(){
|
||||||
for(int i = m_clients.size() - 1; i >= 0; i--){
|
for(int i = m_clients.size() - 1; i >= 0; i--){
|
||||||
if(m_clients[i].m_socket >= 0){
|
if(m_clients[i].m_socket >= 0){
|
||||||
NDB_CLOSE_SOCKET(m_clients[i].m_socket);
|
NDB_CLOSE_SOCKET(m_clients[i].m_socket);
|
||||||
|
@ -1374,7 +1387,7 @@ MgmApiSession::listen_event(Parser<MgmApiSession>::Context & ctx,
|
||||||
int result = 0;
|
int result = 0;
|
||||||
BaseString msg;
|
BaseString msg;
|
||||||
|
|
||||||
MgmStatService::StatListener le;
|
Ndb_mgmd_event_service::Event_listener le;
|
||||||
le.m_socket = m_socket;
|
le.m_socket = m_socket;
|
||||||
|
|
||||||
Vector<BaseString> list;
|
Vector<BaseString> list;
|
||||||
|
@ -1419,7 +1432,7 @@ MgmApiSession::listen_event(Parser<MgmApiSession>::Context & ctx,
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_mgmsrv.m_statisticsListner.add_listener(le);
|
m_mgmsrv.m_event_listner.add_listener(le);
|
||||||
|
|
||||||
m_stop = true;
|
m_stop = true;
|
||||||
m_socket = -1;
|
m_socket = -1;
|
||||||
|
|
|
@ -626,6 +626,9 @@ TransporterFacade::ReportNodeFailureComplete(NodeId tNodeId)
|
||||||
* After the restart the node is up again and the Ndb object
|
* After the restart the node is up again and the Ndb object
|
||||||
* might not have noticed the failure.
|
* might not have noticed the failure.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
DBUG_ENTER("TransporterFacade::ReportNodeFailureComplete");
|
||||||
|
DBUG_PRINT("enter",("nodeid= %d", tNodeId));
|
||||||
Uint32 sz = m_threads.m_statusNext.size();
|
Uint32 sz = m_threads.m_statusNext.size();
|
||||||
for (Uint32 i = 0; i < sz ; i ++) {
|
for (Uint32 i = 0; i < sz ; i ++) {
|
||||||
if (m_threads.getInUse(i)){
|
if (m_threads.getInUse(i)){
|
||||||
|
@ -634,6 +637,7 @@ TransporterFacade::ReportNodeFailureComplete(NodeId tNodeId)
|
||||||
(*RegPC) (obj, tNodeId, false, true);
|
(*RegPC) (obj, tNodeId, false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in a new issue