Commit f53bc339 authored by unknown's avatar unknown

Added EventReport for backup


ndb/src/mgmsrv/MgmtSrvr.cpp:
  removed useless code
ndb/src/mgmsrv/MgmtSrvr.hpp:
  removed useless code
parent 08ffa298
......@@ -57,7 +57,8 @@ public:
llWarning = CFG_LOGLEVEL_WARNING - CFG_MIN_LOGLEVEL,
llError = CFG_LOGLEVEL_ERROR - CFG_MIN_LOGLEVEL,
llGrep = CFG_LOGLEVEL_GREP - CFG_MIN_LOGLEVEL,
llDebug = CFG_LOGLEVEL_DEBUG - CFG_MIN_LOGLEVEL,
llDebug = CFG_LOGLEVEL_DEBUG - CFG_MIN_LOGLEVEL
,llBackup = CFG_LOGLEVEL_BACKUP - CFG_MIN_LOGLEVEL
};
/**
......
......@@ -135,12 +135,17 @@ public:
//GREP
GrepSubscriptionInfo = 52,
GrepSubscriptionAlert = 53
GrepSubscriptionAlert = 53,
//BACKUP
BackupStarted = 54,
BackupFailedToStart = 55,
BackupCompleted = 56,
BackupAborted = 57
};
void setEventType(EventType type);
EventType getEventType() const;
private:
UintR eventType; // DATA 0
};
......
......@@ -277,6 +277,7 @@ extern "C" {
NDB_MGM_EVENT_CATEGORY_WARNING = CFG_LOGLEVEL_WARNING,
NDB_MGM_EVENT_CATEGORY_ERROR = CFG_LOGLEVEL_ERROR,
NDB_MGM_EVENT_CATEGORY_GREP = CFG_LOGLEVEL_GREP,
NDB_MGM_EVENT_CATEGORY_BACKUP = CFG_LOGLEVEL_BACKUP,
NDB_MGM_MIN_EVENT_CATEGORY = CFG_MIN_LOGLEVEL,
NDB_MGM_MAX_EVENT_CATEGORY = CFG_MAX_LOGLEVEL
......
......@@ -96,7 +96,8 @@
#define CFG_LOGLEVEL_ERROR 258
#define CFG_LOGLEVEL_GREP 259
#define CFG_LOGLEVEL_DEBUG 260
#define CFG_MAX_LOGLEVEL 260
#define CFG_LOGLEVEL_BACKUP 261
#define CFG_MAX_LOGLEVEL 261
#define CFG_MGM_PORT 300
......
......@@ -107,7 +107,13 @@ const EventLoggerBase::EventRepLogLevelMatrix EventLoggerBase::matrix[] = {
//Global replication
{ EventReport::GrepSubscriptionInfo, LogLevel::llGrep, 7, Logger::LL_INFO},
{ EventReport::GrepSubscriptionAlert, LogLevel::llGrep, 7, Logger::LL_ALERT}
{ EventReport::GrepSubscriptionAlert, LogLevel::llGrep, 7, Logger::LL_ALERT},
// Backup
{ EventReport::BackupStarted, LogLevel::llBackup, 7, Logger::LL_INFO },
{ EventReport::BackupCompleted, LogLevel::llBackup, 7, Logger::LL_INFO },
{ EventReport::BackupFailedToStart, LogLevel::llBackup, 7, Logger::LL_ALERT},
{ EventReport::BackupAborted, LogLevel::llBackup, 7, Logger::LL_ALERT }
};
const Uint32 EventLoggerBase::matrixSize = sizeof(EventLoggerBase::matrix)/
......@@ -1256,6 +1262,38 @@ EventLogger::getText(char * m_text, size_t m_text_len,
break;
}
case EventReport::BackupStarted:
::snprintf(m_text,
m_text_len,
"%sBackup %d started from node %d",
theNodeId, theData[2], refToNode(theData[1]));
break;
case EventReport::BackupFailedToStart:
::snprintf(m_text,
m_text_len,
"%sBackup request from %d failed to start. Error: %d",
theNodeId, refToNode(theData[1]), theData[2]);
break;
case EventReport::BackupCompleted:
::snprintf(m_text,
m_text_len,
"%sBackup %d started from node %d completed\n"
" StartGCP: %d StopGCP: %d\n"
" #Records: %d #LogRecords: %d\n"
" Data: %d bytes Log: %d bytes",
theNodeId, theData[2], refToNode(theData[1]),
theData[3], theData[4], theData[6], theData[8],
theData[5], theData[7]);
break;
case EventReport::BackupAborted:
::snprintf(m_text,
m_text_len,
"%sBackup %d started from %d has been aborted. Error: %d",
theNodeId,
theData[2],
refToNode(theData[1]),
theData[3]);
break;
default:
::snprintf(m_text,
m_text_len,
......
......@@ -40,6 +40,7 @@
#include <signaldata/BackupImpl.hpp>
#include <signaldata/BackupSignalData.hpp>
#include <signaldata/BackupContinueB.hpp>
#include <signaldata/EventReport.hpp>
#include <signaldata/UtilSequence.hpp>
......@@ -944,6 +945,11 @@ Backup::sendBackupRef(BlockReference senderRef, Signal *signal,
ref->errorCode = errorCode;
ref->masterRef = numberToRef(BACKUP, getMasterNodeId());
sendSignal(senderRef, GSN_BACKUP_REF, signal, BackupRef::SignalLength, JBB);
signal->theData[0] = EventReport::BackupFailedToStart;
signal->theData[1] = senderRef;
signal->theData[2] = errorCode;
sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 3, JBB);
}
void
......@@ -1227,6 +1233,12 @@ Backup::defineBackupReply(Signal* signal, BackupRecordPtr ptr, Uint32 nodeId)
sendSignal(ptr.p->clientRef, GSN_BACKUP_CONF, signal,
BackupConf::SignalLength, JBB);
signal->theData[0] = EventReport::BackupStarted;
signal->theData[1] = ptr.p->clientRef;
signal->theData[2] = ptr.p->backupId;
ptr.p->nodes.copyto(NdbNodeBitmask::Size, signal->theData+3);
sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 3+NdbNodeBitmask::Size, JBB);
ptr.p->masterData.state.setState(DEFINED);
/**
* Prepare Trig
......@@ -2069,6 +2081,18 @@ Backup::stopBackupReply(Signal* signal, BackupRecordPtr ptr, Uint32 nodeId)
rep->nodes = ptr.p->nodes;
sendSignal(ptr.p->clientRef, GSN_BACKUP_COMPLETE_REP, signal,
BackupCompleteRep::SignalLength, JBB);
signal->theData[0] = EventReport::BackupCompleted;
signal->theData[1] = ptr.p->clientRef;
signal->theData[2] = ptr.p->backupId;
signal->theData[3] = ptr.p->startGCP;
signal->theData[4] = ptr.p->stopGCP;
signal->theData[5] = ptr.p->noOfBytes;
signal->theData[6] = ptr.p->noOfRecords;
signal->theData[7] = ptr.p->noOfLogBytes;
signal->theData[8] = ptr.p->noOfLogRecords;
ptr.p->nodes.copyto(NdbNodeBitmask::Size, signal->theData+9);
sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 9+NdbNodeBitmask::Size, JBB);
}
/*****************************************************************************
......@@ -2259,6 +2283,12 @@ Backup::masterSendAbortBackup(Signal* signal, BackupRecordPtr ptr)
rep->reason = ptr.p->errorCode;
sendSignal(ptr.p->clientRef, GSN_BACKUP_ABORT_REP, signal,
BackupAbortRep::SignalLength, JBB);
signal->theData[0] = EventReport::BackupAborted;
signal->theData[1] = ptr.p->clientRef;
signal->theData[2] = ptr.p->backupId;
signal->theData[3] = ptr.p->errorCode;
sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 4, JBB);
}//if
// ptr.p->masterData.state.setState(INITIAL);
......
......@@ -965,6 +965,7 @@ struct ndb_mgm_event_categories
{ "INFO", NDB_MGM_EVENT_CATEGORY_INFO },
{ "ERROR", NDB_MGM_EVENT_CATEGORY_ERROR },
{ "GREP", NDB_MGM_EVENT_CATEGORY_GREP },
{ "BACKUP", NDB_MGM_EVENT_CATEGORY_BACKUP },
{ 0, NDB_MGM_ILLEGAL_EVENT_CATEGORY }
};
......
......@@ -63,63 +63,6 @@
extern int global_flag_send_heartbeat_now;
extern int g_no_nodeid_checks;
static
void
CmdBackupCallback(const MgmtSrvr::BackupEvent & event)
{
char str[255];
ndbout << endl;
bool ok = false;
switch(event.Event){
case MgmtSrvr::BackupEvent::BackupStarted:
ok = true;
snprintf(str, sizeof(str),
"Backup %d started", event.Started.BackupId);
break;
case MgmtSrvr::BackupEvent::BackupFailedToStart:
ok = true;
snprintf(str, sizeof(str),
"Backup failed to start (Error %d)",
event.FailedToStart.ErrorCode);
break;
case MgmtSrvr::BackupEvent::BackupCompleted:
ok = true;
snprintf(str, sizeof(str),
"Backup %d completed",
event.Completed.BackupId);
ndbout << str << endl;
snprintf(str, sizeof(str),
" StartGCP: %d StopGCP: %d",
event.Completed.startGCP, event.Completed.stopGCP);
ndbout << str << endl;
snprintf(str, sizeof(str),
" #Records: %d #LogRecords: %d",
event.Completed.NoOfRecords, event.Completed.NoOfLogRecords);
ndbout << str << endl;
snprintf(str, sizeof(str),
" Data: %d bytes Log: %d bytes",
event.Completed.NoOfBytes, event.Completed.NoOfLogBytes);
break;
case MgmtSrvr::BackupEvent::BackupAborted:
ok = true;
snprintf(str, sizeof(str),
"Backup %d has been aborted reason %d",
event.Aborted.BackupId,
event.Aborted.Reason);
break;
}
if(!ok){
snprintf(str, sizeof(str), "Unknown backup event: %d", event.Event);
}
ndbout << str << endl;
}
void *
MgmtSrvr::logLevelThread_C(void* m)
{
......@@ -519,7 +462,6 @@ MgmtSrvr::MgmtSrvr(NodeId nodeId,
m_newConfig = NULL;
m_configFilename = configFilename;
setCallback(CmdBackupCallback);
m_localNdbConfigFilename = ndb_config_filename;
m_nextConfigGenerationNumber = 0;
......@@ -2398,15 +2340,6 @@ MgmtSrvr::eventReport(NodeId nodeId, const Uint32 * theData)
/***************************************************************************
* Backup
***************************************************************************/
MgmtSrvr::BackupCallback
MgmtSrvr::setCallback(BackupCallback aCall)
{
BackupCallback ret = m_backupCallback;
m_backupCallback = aCall;
return ret;
}
int
MgmtSrvr::startBackup(Uint32& backupId, bool waitCompleted)
{
......@@ -2605,10 +2538,6 @@ MgmtSrvr::backupCallback(BackupEvent & event)
return;
}
if(m_backupCallback != 0){
(* m_backupCallback)(event);
}
}
......
......@@ -353,8 +353,6 @@ public:
/**
* Backup functionallity
*/
typedef void (* BackupCallback)(const BackupEvent& Event);
BackupCallback setCallback(BackupCallback);
int startBackup(Uint32& backupId, bool waitCompleted = false);
int abortBackup(Uint32 backupId);
int performBackup(Uint32* backupId);
......@@ -743,7 +741,6 @@ private:
void signalRecvThreadRun();
void backupCallback(BackupEvent &);
BackupCallback m_backupCallback;
BackupEvent m_lastBackupEvent;
Config *_props;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment