18 #include <ndb_global.h>
20 #include <EventLogger.hpp>
21 #include <TransporterCallback.hpp>
23 #include <NdbConfig.h>
24 #include <kernel/BlockNumbers.h>
25 #include <signaldata/ArbitSignalData.hpp>
26 #include <signaldata/FailRep.hpp>
27 #include <NodeState.hpp>
29 #include <ndb_version.h>
31 #include <ndbd_exit_codes.h>
33 #define make_uint64(a,b) (((Uint64)(a)) + (((Uint64)(b)) << 32))
38 EventLoggerBase::~EventLoggerBase()
43 #define QQQQ char *m_text, size_t m_text_len, const Uint32* theData, Uint32 len
45 void getTextConnected(QQQQ) {
50 void getTextConnectedApiVersion(QQQQ) {
52 Uint32 mysql_version = theData[3];
53 if (theData[2] < NDBD_SPLIT_VERSION)
58 ndbGetVersionString(theData[2], mysql_version, 0,
62 void getTextDisconnected(QQQQ) {
64 "Node %u Disconnected",
67 void getTextCommunicationClosed(QQQQ) {
72 "Communication to Node %u closed",
75 void getTextCommunicationOpened(QQQQ) {
80 "Communication to Node %u opened",
83 void getTextNDBStartStarted(QQQQ) {
89 Uint32 mysql_version = theData[2];
90 if (theData[1] < NDBD_SPLIT_VERSION)
93 "Start initiated (%s)",
94 ndbGetVersionString(theData[1], mysql_version, 0,
97 void getTextNDBStopStarted(QQQQ) {
99 "%s shutdown initiated",
100 (theData[1] == 1 ?
"Cluster" :
"Node"));
102 void getRestartAction(Uint32 action,
BaseString &str)
106 str.
appfmt(
", restarting");
112 void getTextNDBStopCompleted(QQQQ) {
115 getRestartAction(theData[1], action_str);
117 signum_str.appfmt(
" Initiated by signal %d.", theData[2]);
119 "Node shutdown completed%s.%s",
123 void getTextNDBStopForced(QQQQ) {
127 int signum = theData[2];
128 int error = theData[3];
129 int sphase = theData[4];
130 int extra = theData[5];
132 getRestartAction(theData[1],action_str);
134 reason_str.appfmt(
" Initiated by signal %d.", signum);
137 ndbd_exit_classification cl;
139 const char *
msg = ndbd_exit_message(error, &cl);
140 const char *cl_msg = ndbd_exit_classification_message(cl, &st);
141 const char *st_msg = ndbd_exit_status_message(st);
142 reason_str.appfmt(
" Caused by error %d: \'%s(%s). %s\'.",
143 error, msg, cl_msg, st_msg);
145 reason_str.appfmt(
" (extra info %d)", extra);
148 sphase_str.appfmt(
" Occured during startphase %u.", sphase);
150 "Forced node shutdown completed%s.%s%s",
151 action_str.c_str(), sphase_str.c_str(),
154 void getTextNDBStopAborted(QQQQ) {
156 "Node shutdown aborted");
158 void getTextNDBStartCompleted(QQQQ) {
164 Uint32 mysql_version = theData[2];
165 if (theData[1] < NDBD_SPLIT_VERSION)
169 ndbGetVersionString(theData[1], mysql_version, 0,
173 void getTextSTTORRYRecieved(QQQQ) {
178 "STTORRY received after restart finished");
180 void getTextStartPhaseCompleted(QQQQ) {
184 const char *
type =
"<Unknown>";
185 switch((NodeState::StartType)theData[2]){
186 case NodeState::ST_INITIAL_START:
187 type =
"(initial start)";
189 case NodeState::ST_SYSTEM_RESTART:
190 type =
"(system restart)";
192 case NodeState::ST_NODE_RESTART:
193 type =
"(node restart)";
195 case NodeState::ST_INITIAL_NODE_RESTART:
196 type =
"(initial node restart)";
198 case NodeState::ST_ILLEGAL_TYPE:
203 "Start phase %u completed (unknown = %d)",
209 "Start phase %u completed %s",
213 void getTextCM_REGCONF(QQQQ) {
215 "CM_REGCONF president = %u, own Node = %u, our dynamic id = %u/%u",
218 (theData[3] >> 16), (theData[3] & 0xFFFF));
220 void getTextCM_REGREF(QQQQ) {
221 const char* line =
"";
222 switch (theData[3]) {
227 line =
"Election with wait = false";
230 line =
"Election with wait = false";
233 line =
"Not president";
236 line =
"Election without selecting new candidate";
239 line =
"No such cause";
244 "CM_REGREF from Node %u to our Node %u. Cause = %s",
249 void getTextFIND_NEIGHBOURS(QQQQ) {
254 "We are Node %u with dynamic ID %u, our left neighbour "
255 "is Node %u, our right is Node %u",
261 void getTextNodeFailCompleted(QQQQ) {
267 if (theData[3] != 0) {
269 "Node %u completed failure of Node %u",
274 "All nodes completed failure of Node %u",
278 const char* line =
"";
279 if (theData[1] == DBTC){
281 }
else if (theData[1] == DBDICT){
283 }
else if (theData[1] == DBDIH){
285 }
else if (theData[1] == DBLQH){
289 "Node failure of %u %s completed",
294 void getTextNODE_FAILREP(QQQQ) {
296 "Node %u has failed. The Node state at failure "
301 void getTextArbitState(QQQQ) {
307 char ticketText[ArbitTicket::TextLength + 1];
308 char errText[ArbitCode::ErrTextLength + 1];
309 const unsigned code = sd->code & 0xFFFF;
310 const unsigned state = sd->code >> 16;
312 case ArbitCode::ThreadStart:
314 "President restarts arbitration thread [state=%u]",
317 case ArbitCode::PrepPart2:
318 sd->ticket.getText(ticketText,
sizeof(ticketText));
320 "Prepare arbitrator node %u [ticket=%s]",
321 sd->node, ticketText);
323 case ArbitCode::PrepAtrun:
324 sd->ticket.getText(ticketText,
sizeof(ticketText));
326 "Receive arbitrator node %u [ticket=%s]",
327 sd->node, ticketText);
329 case ArbitCode::ApiStart:
330 sd->ticket.getText(ticketText,
sizeof(ticketText));
332 "Started arbitrator node %u [ticket=%s]",
333 sd->node, ticketText);
335 case ArbitCode::ApiFail:
337 "Lost arbitrator node %u - process failure [state=%u]",
340 case ArbitCode::ApiExit:
342 "Lost arbitrator node %u - process exit [state=%u]",
346 ArbitCode::getErrText(code, errText,
sizeof(errText));
348 "Lost arbitrator node %u - %s [state=%u]",
349 sd->node, errText, state);
355 void getTextArbitResult(QQQQ) {
361 char errText[ArbitCode::ErrTextLength + 1];
362 const unsigned code = sd->code & 0xFFFF;
363 const unsigned state = sd->code >> 16;
365 case ArbitCode::LoseNodes:
367 "Arbitration check lost - less than 1/2 nodes left");
369 case ArbitCode::WinNodes:
371 "Arbitration check won - all node groups and more than 1/2 nodes left");
373 case ArbitCode::WinGroups:
375 "Arbitration check won - node group majority");
377 case ArbitCode::LoseGroups:
379 "Arbitration check lost - missing node group");
381 case ArbitCode::Partitioning:
383 "Network partitioning - arbitration required");
385 case ArbitCode::WinChoose:
387 "Arbitration won - positive reply from node %u",
390 case ArbitCode::LoseChoose:
392 "Arbitration lost - negative reply from node %u",
395 case ArbitCode::LoseNorun:
397 "Network partitioning - no arbitrator available");
399 case ArbitCode::LoseNocfg:
401 "Network partitioning - no arbitrator configured");
403 case ArbitCode::WinWaitExternal:{
407 "Continuing after wait for external arbitration, "
412 ArbitCode::getErrText(code, errText,
sizeof(errText));
414 "Arbitration failure - %s [state=%u]",
420 void getTextGlobalCheckpointStarted(QQQQ) {
426 "Global checkpoint %u started",
429 void getTextGlobalCheckpointCompleted(QQQQ) {
435 "Global checkpoint %u completed",
438 void getTextLocalCheckpointStarted(QQQQ) {
444 "Local checkpoint %u started. "
445 "Keep GCI = %u oldest restorable GCI = %u",
450 void getTextLocalCheckpointCompleted(QQQQ) {
456 "Local checkpoint %u completed",
459 void getTextTableCreated(QQQQ) {
464 "Table with ID = %u created",
468 void getTextLCPStoppedInCalcKeepGci(QQQQ) {
471 "Local Checkpoint stopped in CALCULATED_KEEP_GCI");
473 void getTextNR_CopyDict(QQQQ) {
478 "Node restart completed copy of dictionary information");
480 void getTextNR_CopyDistr(QQQQ) {
485 "Node restart completed copy of distribution information");
487 void getTextNR_CopyFragsStarted(QQQQ) {
492 "Node restart starting to copy the fragments "
496 void getTextNR_CopyFragDone(QQQQ) {
500 Uint64 rows = theData[4] + (Uint64(theData[5]) << 32);
501 Uint64 bytes = theData[6] + (Uint64(theData[7]) << 32);
503 "Table ID = %u, fragment ID = %u have been synced "
504 "to Node %u rows: %llu bytes: %llu ",
510 void getTextNR_CopyFragsCompleted(QQQQ) {
512 "Node restart completed copying the fragments "
516 void getTextLCPFragmentCompleted(QQQQ) {
518 "Table ID = %u, fragment ID = %u has completed LCP "
519 "on Node %u maxGciStarted: %d maxGciCompleted: %d",
526 void getTextTransReportCounters(QQQQ) {
531 "Trans. Count = %u, Commit Count = %u, "
532 "Read Count = %u, Simple Read Count = %u, "
533 "Write Count = %u, AttrInfo Count = %u, "
534 "Concurrent Operations = %u, Abort Count = %u"
535 " Scans = %u Range scans = %u",
547 void getTextOperationReportCounters(QQQQ) {
552 void getTextUndoLogBlocked(QQQQ) {
557 "ACC Blocked %u and TUP Blocked %u times last second",
562 void getTextTransporterError(QQQQ) {
563 struct myTransporterError{
565 char errorString[256];
569 static const struct myTransporterError TransporterErrorString[]=
572 {TE_NO_ERROR,
"No error"},
574 {TE_ERROR_CLOSING_SOCKET,
"Error found during closing of socket"},
576 {TE_ERROR_IN_SELECT_BEFORE_ACCEPT,
"Error found before accept. The transporter will retry"},
578 {TE_INVALID_MESSAGE_LENGTH,
"Error found in message (invalid message length)"},
580 {TE_INVALID_CHECKSUM,
"Error found in message (checksum)"},
582 {TE_COULD_NOT_CREATE_SOCKET,
"Error found while creating socket(can't create socket)"},
584 {TE_COULD_NOT_BIND_SOCKET,
"Error found while binding server socket"},
586 {TE_LISTEN_FAILED,
"Error found while listening to server socket"},
588 {TE_ACCEPT_RETURN_ERROR,
"Error found during accept(accept return error)"},
590 {TE_SHM_DISCONNECT,
"The remote node has disconnected"},
592 {TE_SHM_IPC_STAT,
"Unable to check shm segment"},
594 {TE_SHM_UNABLE_TO_CREATE_SEGMENT,
"Unable to create shm segment"},
596 {TE_SHM_UNABLE_TO_ATTACH_SEGMENT,
"Unable to attach shm segment"},
598 {TE_SHM_UNABLE_TO_REMOVE_SEGMENT,
"Unable to remove shm segment"},
600 {TE_TOO_SMALL_SIGID,
"Sig ID too small"},
602 {TE_TOO_LARGE_SIGID,
"Sig ID too large"},
604 {TE_WAIT_STACK_FULL,
"Wait stack was full"},
606 {TE_RECEIVE_BUFFER_FULL,
"Receive buffer was full"},
608 {TE_SIGNAL_LOST_SEND_BUFFER_FULL,
"Send buffer was full,and trying to force send fails"},
610 {TE_SIGNAL_LOST,
"Send failed for unknown reason(signal lost)"},
612 {TE_SEND_BUFFER_FULL,
"The send buffer was full, but sleeping for a while solved"},
614 {TE_SCI_LINK_ERROR,
"There is no link from this node to the switch"},
616 {TE_SCI_UNABLE_TO_START_SEQUENCE,
"Could not start a sequence, because system resources are exumed or no sequence has been created"},
618 {TE_SCI_UNABLE_TO_REMOVE_SEQUENCE,
"Could not remove a sequence"},
620 {TE_SCI_UNABLE_TO_CREATE_SEQUENCE,
"Could not create a sequence, because system resources are exempted. Must reboot"},
622 {TE_SCI_UNRECOVERABLE_DATA_TFX_ERROR,
"Tried to send data on redundant link but failed"},
624 {TE_SCI_CANNOT_INIT_LOCALSEGMENT,
"Cannot initialize local segment"},
626 {TE_SCI_CANNOT_MAP_REMOTESEGMENT,
"Cannot map remote segment"},
628 {TE_SCI_UNABLE_TO_UNMAP_SEGMENT,
"Cannot free the resources used by this segment (step 1)"},
630 {TE_SCI_UNABLE_TO_REMOVE_SEGMENT,
"Cannot free the resources used by this segment (step 2)"},
632 {TE_SCI_UNABLE_TO_DISCONNECT_SEGMENT,
"Cannot disconnect from a remote segment"},
634 {TE_SHM_IPC_PERMANENT,
"Shm ipc Permanent error"},
636 {TE_SCI_UNABLE_TO_CLOSE_CHANNEL,
"Unable to close the sci channel and the resources allocated"}
639 lenth =
sizeof(TransporterErrorString)/
sizeof(
struct myTransporterError);
640 for(i=0; i<lenth; i++)
642 if(theData[2] == (Uint32) TransporterErrorString[
i].errorNum)
645 "Transporter to node %d reported error 0x%x: %s",
648 TransporterErrorString[i].errorString);
654 "Transporter to node %d reported error 0x%x: unknown error",
658 void getTextTransporterWarning(QQQQ) {
659 getTextTransporterError(m_text, m_text_len, theData, len);
661 void getTextMissedHeartbeat(QQQQ) {
663 "Node %d missed heartbeat %d",
667 void getTextDeadDueToHeartbeat(QQQQ) {
669 "Node %d declared dead due to missed heartbeat",
672 void getTextJobStatistic(QQQQ) {
674 "Mean loop Counter in doJob last 8192 times = %u",
677 void getTextThreadConfigLoop(QQQQ) {
679 "8192 loops,tot %u usec,exec %u extra:loops = %u,time %u,const %u",
680 theData[1], theData[3], theData[4], theData[5],
683 void getTextSendBytesStatistic(QQQQ) {
685 "Mean send size to Node = %d last 4096 sends = %u bytes",
689 void getTextReceiveBytesStatistic(QQQQ) {
691 "Mean receive size to Node = %d last 4096 sends = %u bytes",
695 void getTextSentHeartbeat(QQQQ) {
697 "Node Sent Heartbeat to node = %d",
700 void getTextCreateLogBytes(QQQQ) {
702 "Log part %u, log file %u, MB %u",
707 void getTextStartLog(QQQQ) {
709 "Log part %u, start MB %u, stop MB %u, last GCI, log exec %u",
715 void getTextStartREDOLog(QQQQ) {
717 "Node: %d StartLog: [GCI Keep: %d LastCompleted: %d NewestRestorable: %d]",
723 void getTextRedoStatus(QQQQ) {
724 Uint64 total = (Uint64(theData[6]) << 32) + theData[7];
725 Uint64 free = (Uint64(theData[8]) << 32) + theData[9];
728 "Logpart: %u head=[ file: %u mbyte: %u ] tail=[ file: %u mbyte: %u ] total mb: %llu free mb: %llu free%%: %u",
736 Uint32((100 * free) / total));
738 void getTextUNDORecordsExecuted(QQQQ) {
739 const char* line =
"";
740 if (theData[1] == DBTUP){
742 }
else if (theData[1] == DBACC){
747 " UNDO %s %d [%d %d %d %d %d %d %d %d %d]",
760 void getTextInfoEvent(QQQQ) {
763 const char bytes_unit[]=
"B";
764 const char kbytes_unit[]=
"KB";
765 const char mbytes_unit[]=
"MB";
766 static void convert_unit(
unsigned &data,
const char *&unit)
773 if (data < 16*1024*1024)
775 data= (data+1023)/1024;
779 data= (data+1024*1024-1)/(1024*1024);
783 void getTextEventBufferStatus(QQQQ) {
784 unsigned used= theData[1], alloc= theData[2], max_= theData[3];
785 const char *used_unit, *alloc_unit, *max_unit;
786 convert_unit(used, used_unit);
787 convert_unit(alloc, alloc_unit);
788 convert_unit(max_, max_unit);
790 "Event buffer status: used=%d%s(%d%%) alloc=%d%s(%d%%) "
791 "max=%d%s apply_epoch=%u/%u latest_epoch=%u/%u",
793 theData[2] ? (Uint32)((((Uint64)theData[1])*100)/theData[2]) : 0,
795 theData[3] ? (Uint32)((((Uint64)theData[2])*100)/theData[3]) : 0,
797 theData[5], theData[4],
798 theData[7], theData[6]);
800 void getTextWarningEvent(QQQQ) {
803 void getTextGCP_TakeoverStarted(QQQQ) {
806 void getTextGCP_TakeoverCompleted(QQQQ) {
809 void getTextLCP_TakeoverStarted(QQQQ) {
812 void getTextLCP_TakeoverCompleted(QQQQ) {
814 "LCP Take over completed (state = %d)",
817 void getTextMemoryUsage(QQQQ) {
818 const int gth = theData[1];
819 const int size = theData[2];
820 const int used = theData[3];
821 const int total = theData[4];
822 const int block = theData[5];
823 const int percent = total ? (used*100)/total : 0;
826 "%s usage %s %d%s(%d %dK pages of total %d)",
827 (block==DBACC ?
"Index" : (block == DBTUP ?
"Data":
"<unknown>")),
828 (gth == 0 ?
"is" : (gth > 0 ?
"increased to" :
"decreased to")),
830 used, size/1024, total
834 void getTextBackupStarted(QQQQ) {
836 "Backup %u started from node %d",
837 theData[2], refToNode(theData[1]));
839 void getTextBackupFailedToStart(QQQQ) {
841 "Backup request from %d failed to start. Error: %d",
842 refToNode(theData[1]), theData[2]);
844 void getTextBackupCompleted(QQQQ) {
846 "Backup %u started from node %u completed."
847 " StartGCP: %u StopGCP: %u"
848 " #Records: %u #LogRecords: %u"
849 " Data: %u bytes Log: %u bytes",
850 theData[2], refToNode(theData[1]),
851 theData[3], theData[4], theData[6], theData[8],
852 theData[5], theData[7]);
854 void getTextBackupStatus(QQQQ) {
857 "Local backup status: backup %u started from node %u\n"
858 " #Records: %llu #LogRecords: %llu\n"
859 " Data: %llu bytes Log: %llu bytes",
860 theData[2], refToNode(theData[1]),
861 make_uint64(theData[5], theData[6]),
862 make_uint64(theData[9], theData[10]),
863 make_uint64(theData[3], theData[4]),
864 make_uint64(theData[7], theData[8]));
867 "Backup not started");
869 void getTextBackupAborted(QQQQ) {
871 "Backup %u started from %d has been aborted. Error: %d",
873 refToNode(theData[1]),
876 void getTextRestoreStarted(QQQQ)
879 "Restore started: backup %u from node %u",
880 theData[1], theData[2]);
882 void getTextRestoreMetaData(QQQQ)
885 "Restore meta data: backup %u from node %u "
887 " #Tablespaces: %u #Logfilegroups: %u "
888 "#datafiles: %u #undofiles: %u",
889 theData[1], theData[2], theData[3],
890 theData[4], theData[5], theData[6], theData[7]);
892 void getTextRestoreData(QQQQ)
895 "Restore data: backup %u from node %u "
896 "#Records: %llu Data: %llu bytes",
897 theData[1], theData[2],
898 make_uint64(theData[3], theData[4]),
899 make_uint64(theData[5], theData[6]));
901 void getTextRestoreLog(QQQQ)
904 "Restore log: backup %u from node %u "
905 "#Records: %llu Data: %llu bytes",
906 theData[1], theData[2],
907 make_uint64(theData[3], theData[4]),
908 make_uint64(theData[5], theData[6]));
910 void getTextRestoreCompleted(QQQQ)
913 "Restore completed: backup %u from node %u",
914 theData[1], theData[2]);
916 void getTextLogFileInitStatus(QQQQ) {
919 "Local redo log file initialization status:\n"
920 "#Total files: %u, Completed: %u\n"
921 "#Total MBytes: %u, Completed: %u",
923 theData[2], theData[3],
924 theData[4], theData[5]);
927 "Node %u: Log file initializtion completed",
928 refToNode(theData[1]));
930 void getTextLogFileInitCompStatus(QQQQ) {
932 "Local redo log file initialization completed:\n"
933 "#Total files: %u, Completed: %u\n"
934 "#Total MBytes: %u, Completed: %u",
936 theData[2], theData[3],
937 theData[4], theData[5]);
939 void getTextSingleUser(QQQQ) {
947 "Entered single user mode "
948 "Node %d has exclusive access", theData[2]);
955 "Unknown single user report %d", theData[1]);
960 void getTextStartReport(QQQQ) {
961 Uint32 time = theData[2];
962 Uint32 sz = theData[3];
964 bstr0 = BaseString::getPrettyText(sz, theData + 4 + (0 * sz)),
965 bstr1 = BaseString::getPrettyText(sz, theData + 4 + (1 * sz)),
966 bstr2 = BaseString::getPrettyText(sz, theData + 4 + (2 * sz)),
967 bstr3 = BaseString::getPrettyText(sz, theData + 4 + (3 * sz)),
968 bstr4 = BaseString::getPrettyText(sz, theData + 4 + (4 * sz));
970 if (len < 4 + 5 * sz)
972 bstr4.assign(
"<unknown>");
979 "Initial start, waiting for %s to connect, "
980 " nodes [ all: %s connected: %s no-wait: %s ]",
981 bstr3.c_str(), bstr0.
c_str(), bstr1.c_str(), bstr2.c_str());
986 "Waiting until nodes: %s connects, "
987 "nodes [ all: %s connected: %s no-wait: %s ]",
988 bstr3.c_str(), bstr0.
c_str(), bstr1.c_str(), bstr2.c_str());
993 "Waiting %u sec for nodes %s to connect, "
994 "nodes [ all: %s connected: %s no-wait: %s ]",
995 time, bstr3.c_str(), bstr0.
c_str(), bstr1.c_str(), bstr2.c_str());
1000 "Waiting for non partitioned start, "
1001 "nodes [ all: %s connected: %s missing: %s no-wait: %s ]",
1002 bstr0.
c_str(), bstr1.c_str(), bstr3.c_str(), bstr2.c_str());
1006 (m_text, m_text_len,
1007 "Waiting %u sec for non partitioned start, "
1008 "nodes [ all: %s connected: %s missing: %s no-wait: %s ]",
1009 time, bstr0.
c_str(), bstr1.c_str(), bstr3.c_str(), bstr2.c_str());
1013 (m_text, m_text_len,
1014 "Initial start, waiting %u for %s to connect, "
1015 "nodes [ all: %s connected: %s missing: %s no-wait: %s no-nodegroup: %s ]",
1016 time, bstr4.c_str(),
1017 bstr0.
c_str(), bstr1.c_str(), bstr3.c_str(), bstr2.c_str(),
1022 (m_text, m_text_len,
1023 "Waiting %u sec for nodes %s to connect, "
1024 "nodes [ all: %s connected: %s no-wait: %s no-nodegroup: %s ]",
1025 time, bstr3.c_str(), bstr0.
c_str(), bstr1.c_str(), bstr2.c_str(),
1031 (m_text, m_text_len,
1032 "Initial start with nodes %s [ missing: %s no-wait: %s ]",
1033 bstr1.c_str(), bstr3.c_str(), bstr2.c_str());
1037 (m_text, m_text_len,
1038 "Start with all nodes %s",
1043 (m_text, m_text_len,
1044 "Start with nodes %s [ missing: %s no-wait: %s ]",
1045 bstr1.c_str(), bstr3.c_str(), bstr2.c_str());
1049 (m_text, m_text_len,
1050 "Start potentially partitioned with nodes %s "
1051 " [ missing: %s no-wait: %s ]",
1052 bstr1.c_str(), bstr3.c_str(), bstr2.c_str());
1056 (m_text, m_text_len,
1057 "Unknown startreport: 0x%x [ %s %s %s %s ]",
1059 bstr0.
c_str(), bstr1.c_str(), bstr2.c_str(), bstr3.c_str());
1062 void getTextMTSignalStatistics(QQQQ) {
1064 "Signals delivered from thread %u: "
1065 "prio A %u (%u bytes) prio B %u (%u bytes)",
1067 theData[2], theData[3], theData[4], theData[5]);
1070 void getTextSubscriptionStatus(QQQQ)
1072 switch(theData[1]) {
1075 "Disconnecting node %u because it has "
1076 "exceeded MaxBufferedEpochs (%u > %u), epoch %u/%u",
1080 theData[4], theData[3]);
1084 "Nodefailure while out of event buffer: "
1085 "informing subscribers of possibly missing event data"
1087 theData[4], theData[3]);
1093 getTextStartReadLCP(QQQQ)
1096 "Start reading LCP for table %u fragment: %u",
1102 getTextReadLCPComplete(QQQQ)
1105 "Restored LCP for table %u fragment: %u rows: %llu",
1108 (Uint64(theData[3]) << 32) + Uint64(theData[4]));
1112 getTextRunRedo(QQQQ)
1115 if (ev->currgci == ev->startgci)
1118 "Log part: %u phase: %u run redo from "
1119 " gci: %u (file: %u mb: %u) to "
1120 " gci: %u (file: %u mb: %u)",
1130 else if (ev->currgci == ev->stopgci)
1133 "Log part: %u phase: %u found stop "
1134 " gci: %u (file: %u mb: %u)",
1144 "Log part: %u phase: %u at "
1145 " gci: %u (file: %u mb: %u)",
1155 getTextRebuildIndex(QQQQ)
1158 "instace: %u rebuild index: %u",
1165 getObjectTypeName(Uint32 type)
1171 getTextCreateSchemaObject(QQQQ)
1174 "create %s id: %u version: %u (from %u)",
1175 getObjectTypeName(theData[3]),
1182 getTextAlterSchemaObject(QQQQ)
1185 "alter %s id: %u version: %u (from %u)",
1186 getObjectTypeName(theData[3]),
1193 getTextDropSchemaObject(QQQQ)
1196 "drop %s id: %u version: %u (from %u)",
1197 getObjectTypeName(theData[3]),
1203 void getTextSavedEvent(QQQQ)
1208 void getTextConnectCheckStarted(QQQQ)
1217 Uint32 other_node_count = theData[1];
1218 Uint32 reason = theData[2];
1219 Uint32 causing_node = theData[3];
1220 Uint32 bitmaskSz = theData[4];
1221 char otherNodeMask[100];
1222 char suspectNodeMask[100];
1230 const char * reasonText = NULL;
1233 case FailRep::ZHEARTBEAT_FAILURE:
1234 reasonText =
"Heartbeat failure";
1236 case FailRep::ZCONNECT_CHECK_FAILURE:
1237 reasonText =
"Connectivity check request";
1240 reasonText =
"UNKNOWN";
1245 "Connectivity Check of %u other nodes (%s) started due to %s from node %u.",
1255 "Connectivity Check of %u nodes (%s) restarting due to %u suspect nodes (%s).",
1263 void getTextConnectCheckCompleted(QQQQ)
1271 Uint32 nodes_checked = theData[1];
1272 Uint32 suspect_nodes = theData[2];
1273 Uint32 failed_nodes = theData[3];
1275 if ((failed_nodes + suspect_nodes) == 0)
1279 "Connectivity Check completed on %u nodes, connectivity ok",
1284 if (failed_nodes > 0)
1286 if (suspect_nodes > 0)
1289 "Connectivity Check completed on %u nodes. %u nodes failed. "
1290 "%u nodes still suspect, repeating check.",
1298 "Connectivity Check completed on %u nodes. %u nodes failed. "
1299 "Connectivity now OK",
1308 "Connectivity Check completed on %u nodes. %u nodes still suspect, "
1316 void getTextNodeFailRejected(QQQQ)
1318 Uint32 reason = theData[1];
1319 Uint32 failed_node = theData[2];
1320 Uint32 source_node = theData[3];
1322 const char* reasonText =
"Unknown";
1325 case FailRep::ZCONNECT_CHECK_FAILURE:
1326 reasonText =
"Connect Check Failure";
1328 case FailRep::ZLINK_FAILURE:
1329 reasonText =
"Link Failure";
1334 "Received FAIL_REP (%s (%u)) for node %u sourced by suspect node %u. "
1335 "Rejecting as failure of node %u.",
1346 "Unknown event: %d",
1357 #define ROW(a,b,c,d) \
1358 { NDB_LE_ ## a, b, c, d, getText ## a}
1362 ROW(Connected, LogLevel::llConnection, 8, Logger::LL_INFO ),
1363 ROW(Disconnected, LogLevel::llConnection, 8, Logger::LL_ALERT ),
1364 ROW(CommunicationClosed, LogLevel::llConnection, 8, Logger::LL_INFO ),
1365 ROW(CommunicationOpened, LogLevel::llConnection, 8, Logger::LL_INFO ),
1366 ROW(ConnectedApiVersion, LogLevel::llConnection, 8, Logger::LL_INFO ),
1368 ROW(GlobalCheckpointStarted, LogLevel::llCheckpoint, 9, Logger::LL_INFO ),
1369 ROW(GlobalCheckpointCompleted,LogLevel::llCheckpoint,10, Logger::LL_INFO ),
1370 ROW(LocalCheckpointStarted, LogLevel::llCheckpoint, 7, Logger::LL_INFO ),
1371 ROW(LocalCheckpointCompleted,LogLevel::llCheckpoint, 7, Logger::LL_INFO ),
1372 ROW(LCPStoppedInCalcKeepGci, LogLevel::llCheckpoint, 0, Logger::LL_ALERT ),
1373 ROW(LCPFragmentCompleted, LogLevel::llCheckpoint, 11, Logger::LL_INFO ),
1374 ROW(UndoLogBlocked, LogLevel::llCheckpoint, 7, Logger::LL_INFO ),
1375 ROW(RedoStatus, LogLevel::llCheckpoint, 7, Logger::LL_INFO ),
1378 ROW(NDBStartStarted, LogLevel::llStartUp, 1, Logger::LL_INFO ),
1379 ROW(NDBStartCompleted, LogLevel::llStartUp, 1, Logger::LL_INFO ),
1380 ROW(STTORRYRecieved, LogLevel::llStartUp, 15, Logger::LL_INFO ),
1381 ROW(StartPhaseCompleted, LogLevel::llStartUp, 4, Logger::LL_INFO ),
1382 ROW(CM_REGCONF, LogLevel::llStartUp, 3, Logger::LL_INFO ),
1383 ROW(CM_REGREF, LogLevel::llStartUp, 8, Logger::LL_INFO ),
1384 ROW(FIND_NEIGHBOURS, LogLevel::llStartUp, 8, Logger::LL_INFO ),
1385 ROW(NDBStopStarted, LogLevel::llStartUp, 1, Logger::LL_INFO ),
1386 ROW(NDBStopCompleted, LogLevel::llStartUp, 1, Logger::LL_INFO ),
1387 ROW(NDBStopForced, LogLevel::llStartUp, 1, Logger::LL_ALERT ),
1388 ROW(NDBStopAborted, LogLevel::llStartUp, 1, Logger::LL_INFO ),
1389 ROW(StartREDOLog, LogLevel::llStartUp, 4, Logger::LL_INFO ),
1390 ROW(StartLog, LogLevel::llStartUp, 10, Logger::LL_INFO ),
1391 ROW(UNDORecordsExecuted, LogLevel::llStartUp, 15, Logger::LL_INFO ),
1392 ROW(StartReport, LogLevel::llStartUp, 4, Logger::LL_INFO ),
1393 ROW(LogFileInitStatus, LogLevel::llStartUp, 7, Logger::LL_INFO),
1394 ROW(LogFileInitCompStatus, LogLevel::llStartUp, 7, Logger::LL_INFO),
1395 ROW(StartReadLCP, LogLevel::llStartUp, 10, Logger::LL_INFO),
1396 ROW(ReadLCPComplete, LogLevel::llStartUp, 10, Logger::LL_INFO),
1397 ROW(RunRedo, LogLevel::llStartUp, 8, Logger::LL_INFO),
1398 ROW(RebuildIndex, LogLevel::llStartUp, 10, Logger::LL_INFO),
1401 ROW(NR_CopyDict, LogLevel::llNodeRestart, 7, Logger::LL_INFO ),
1402 ROW(NR_CopyDistr, LogLevel::llNodeRestart, 7, Logger::LL_INFO ),
1403 ROW(NR_CopyFragsStarted, LogLevel::llNodeRestart, 7, Logger::LL_INFO ),
1404 ROW(NR_CopyFragDone, LogLevel::llNodeRestart,10, Logger::LL_INFO ),
1405 ROW(NR_CopyFragsCompleted, LogLevel::llNodeRestart, 7, Logger::LL_INFO ),
1407 ROW(NodeFailCompleted, LogLevel::llNodeRestart, 8, Logger::LL_ALERT),
1408 ROW(NODE_FAILREP, LogLevel::llNodeRestart, 8, Logger::LL_ALERT),
1409 ROW(ArbitState, LogLevel::llNodeRestart, 6, Logger::LL_INFO ),
1410 ROW(ArbitResult, LogLevel::llNodeRestart, 2, Logger::LL_ALERT),
1411 ROW(GCP_TakeoverStarted, LogLevel::llNodeRestart, 7, Logger::LL_INFO ),
1412 ROW(GCP_TakeoverCompleted, LogLevel::llNodeRestart, 7, Logger::LL_INFO ),
1413 ROW(LCP_TakeoverStarted, LogLevel::llNodeRestart, 7, Logger::LL_INFO ),
1414 ROW(LCP_TakeoverCompleted, LogLevel::llNodeRestart, 7, Logger::LL_INFO ),
1416 ROW(ConnectCheckStarted, LogLevel::llNodeRestart, 6, Logger::LL_INFO ),
1417 ROW(ConnectCheckCompleted, LogLevel::llNodeRestart, 6, Logger::LL_INFO ),
1418 ROW(NodeFailRejected, LogLevel::llNodeRestart, 6, Logger::LL_ALERT ),
1421 ROW(TransReportCounters, LogLevel::llStatistic, 8, Logger::LL_INFO ),
1422 ROW(OperationReportCounters, LogLevel::llStatistic, 8, Logger::LL_INFO ),
1423 ROW(TableCreated, LogLevel::llStatistic, 7, Logger::LL_INFO ),
1424 ROW(JobStatistic, LogLevel::llStatistic, 9, Logger::LL_INFO ),
1425 ROW(ThreadConfigLoop, LogLevel::llStatistic, 9, Logger::LL_INFO ),
1426 ROW(SendBytesStatistic, LogLevel::llStatistic, 9, Logger::LL_INFO ),
1427 ROW(ReceiveBytesStatistic, LogLevel::llStatistic, 9, Logger::LL_INFO ),
1428 ROW(MemoryUsage, LogLevel::llStatistic, 5, Logger::LL_INFO ),
1429 ROW(MTSignalStatistics, LogLevel::llStatistic, 9, Logger::LL_INFO ),
1432 ROW(CreateSchemaObject, LogLevel::llSchema, 8, Logger::LL_INFO ),
1433 ROW(AlterSchemaObject, LogLevel::llSchema, 8, Logger::LL_INFO ),
1434 ROW(DropSchemaObject, LogLevel::llSchema, 8, Logger::LL_INFO ),
1437 ROW(TransporterError, LogLevel::llError, 2, Logger::LL_ERROR ),
1438 ROW(TransporterWarning, LogLevel::llError, 8, Logger::LL_WARNING ),
1439 ROW(MissedHeartbeat, LogLevel::llError, 8, Logger::LL_WARNING ),
1440 ROW(DeadDueToHeartbeat, LogLevel::llError, 8, Logger::LL_ALERT ),
1441 ROW(WarningEvent, LogLevel::llError, 2, Logger::LL_WARNING ),
1442 ROW(SubscriptionStatus, LogLevel::llError, 4, Logger::LL_WARNING ),
1444 ROW(SentHeartbeat, LogLevel::llInfo, 12, Logger::LL_INFO ),
1445 ROW(CreateLogBytes, LogLevel::llInfo, 11, Logger::LL_INFO ),
1446 ROW(InfoEvent, LogLevel::llInfo, 2, Logger::LL_INFO ),
1447 ROW(EventBufferStatus, LogLevel::llInfo, 7, Logger::LL_INFO ),
1450 ROW(SingleUser, LogLevel::llInfo, 7, Logger::LL_INFO ),
1453 ROW(BackupStarted, LogLevel::llBackup, 7, Logger::LL_INFO ),
1454 ROW(BackupStatus, LogLevel::llBackup, 7, Logger::LL_INFO ),
1455 ROW(BackupCompleted, LogLevel::llBackup, 7, Logger::LL_INFO ),
1456 ROW(BackupFailedToStart, LogLevel::llBackup, 7, Logger::LL_ALERT),
1457 ROW(BackupAborted, LogLevel::llBackup, 7, Logger::LL_ALERT),
1458 ROW(RestoreStarted, LogLevel::llBackup, 7, Logger::LL_INFO ),
1460 ROW(RestoreData, LogLevel::llBackup, 7, Logger::LL_INFO ),
1461 ROW(RestoreLog, LogLevel::llBackup, 7, Logger::LL_INFO ),
1462 ROW(RestoreCompleted, LogLevel::llBackup, 7, Logger::LL_INFO ),
1464 ROW(
SavedEvent, LogLevel::llInfo, 7, Logger::LL_INFO)
1467 const Uint32 EventLoggerBase::matrixSize=
1468 sizeof(EventLoggerBase::matrix)/
sizeof(EventRepLogLevelMatrix);
1473 enable(Logger::LL_INFO, Logger::LL_ALERT);
1489 operator<<(NdbOut& out,
const LogLevel & ll)
1491 out <<
"[LogLevel: ";
1492 for(
size_t i = 0; i<LogLevel::LOGLEVEL_CATEGORIES; i++)
1493 out << ll.
getLogLevel((LogLevel::EventCategory)i) <<
" ";
1500 EventLoggerBase::event_lookup(
int eventType,
1501 LogLevel::EventCategory &cat,
1504 EventTextFunction &textF)
1506 for(
unsigned i = 0; i<EventLoggerBase::matrixSize; i++){
1507 if(EventLoggerBase::matrix[i].eventType == eventType){
1508 cat = EventLoggerBase::matrix[
i].eventCategory;
1509 threshold = EventLoggerBase::matrix[
i].threshold;
1510 severity = EventLoggerBase::matrix[
i].severity;
1511 textF= EventLoggerBase::matrix[
i].textF;
1520 EventTextFunction textF,
1521 const Uint32* theData, Uint32 len, NodeId nodeId )
1529 if (dst_len-pos > 0)
1530 textF(dst+pos, dst_len-pos, theData, len);
1538 Uint32 threshold = 0;
1540 LogLevel::EventCategory cat= LogLevel::llInvalid;
1542 char log_text[MAX_TEXT_LENGTH];
1544 DBUG_ENTER(
"EventLogger::log");
1545 DBUG_PRINT(
"enter",(
"eventType=%d, nodeid=%d", eventType, nodeId));
1547 if (EventLoggerBase::event_lookup(eventType,cat,threshold,severity,textF))
1551 DBUG_PRINT(
"info",(
"threshold=%d, set=%d", threshold,
set));
1555 if (threshold <=
set){
1556 getText(log_text,
sizeof(log_text), textF, theData, len, nodeId);
1559 case Logger::LL_ALERT:
1560 alert(
"%s", log_text);
1562 case Logger::LL_CRITICAL:
1565 case Logger::LL_WARNING:
1568 case Logger::LL_ERROR:
1569 error(
"%s", log_text);
1571 case Logger::LL_INFO:
1572 info(
"%s", log_text);
1574 case Logger::LL_DEBUG:
1575 debug(
"%s", log_text);
1578 info(
"%s", log_text);
1586 create_event_logger()
1592 destroy_event_logger(
class EventLogger ** g_eventLogger)
1594 delete *g_eventLogger;