summaryrefslogtreecommitdiff
path: root/ndb/include/kernel/signaldata/EventReport.hpp
blob: 1ad6e1bf7ac0cc3297790d50102e2adfe2f4eed1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
/* Copyright (C) 2003 MySQL AB

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */

#ifndef SD_EVENT_REPORT_H
#define SD_EVENT_REPORT_H

#include "SignalData.hpp"

/**
 * Send by different block to report that a event has taken place
 *
 * SENDER:  *Block*
 * RECIVER: SimBlockCMCtrBlck
 */
class EventReport {
  friend class SimulatedBlock;
  friend class Cmvmi;
  friend class SimblockMissra;
  friend class Dbacc;
  friend class Dblqh;
  friend class Dbtup;
  friend class Dbtc;
  friend class Ndbcntr;
  friend class Qmgr;
  friend class Dbdih;
  friend class Dbdict;
  friend class MgmtSrvr;
  friend class Grep;
public:
  /* 
     EventType defines what event reports to send. 

     The ORDER is NOT important anymore. //ejonore 2003-07-24 15:03
     
     HOW TO ADD A NEW EVENT
     --------------------
     1) Add SentHeartbeat EventType in the category where it belongs.
        ...
        // INFO
        SentHeartbeat,
        InfoEvent
        ...

     2) remeber to update # of events below. Just to keep count...
        Number of event types = 53

     3) Add a new SentHeartBeat entry to EventLogger::matrix[]. 
       ...
       // INFO
       { EventReport::SentHeartbeat, LogLevel::llInfo, 11, INFO },
       { EventReport::InfoEvent,     LogLevel::llInfo,  2, INFO }      
       ...

     4) Add SentHeartbeat in EventLogger::getText()

   */
  enum EventType {
    // CONNECTION
    Connected = 0,
    Disconnected = 1,
    CommunicationClosed = 2,
    CommunicationOpened = 3,
    ConnectedApiVersion = 51,
    // CHECKPOINT
    GlobalCheckpointStarted = 4,
    GlobalCheckpointCompleted = 5,
    LocalCheckpointStarted = 6,
    LocalCheckpointCompleted = 7,
    LCPStoppedInCalcKeepGci = 8,
    LCPFragmentCompleted = 9,
    // STARTUP
    NDBStartStarted = 10,
    NDBStartCompleted = 11,
    STTORRYRecieved = 12,
    StartPhaseCompleted = 13,
    CM_REGCONF = 14,
    CM_REGREF = 15,
    FIND_NEIGHBOURS = 16,
    NDBStopStarted = 17,
    NDBStopAborted = 18,
    StartREDOLog = 19,
    StartLog = 20,
    UNDORecordsExecuted = 21,

    // NODERESTART
    NR_CopyDict = 22,
    NR_CopyDistr = 23,
    NR_CopyFragsStarted = 24,
    NR_CopyFragDone = 25,
    NR_CopyFragsCompleted = 26,
    
    // NODEFAIL
    NodeFailCompleted = 27,
    NODE_FAILREP = 28,
    ArbitState = 29,
    ArbitResult = 30,
    GCP_TakeoverStarted = 31,
    GCP_TakeoverCompleted = 32,
    LCP_TakeoverStarted = 33,
    LCP_TakeoverCompleted = 34,
    
    // STATISTIC
    TransReportCounters = 35,
    OperationReportCounters = 36,
    TableCreated = 37,
    UndoLogBlocked = 38,
    JobStatistic = 39,
    SendBytesStatistic = 40,
    ReceiveBytesStatistic = 41,
    MemoryUsage = 50,

    // ERROR
    TransporterError = 42,
    TransporterWarning = 43,
    MissedHeartbeat = 44,
    DeadDueToHeartbeat = 45,
    WarningEvent = 46,
    // INFO
    SentHeartbeat = 47,
    CreateLogBytes = 48,
    InfoEvent = 49,

    //GREP
    GrepSubscriptionInfo = 52,
    GrepSubscriptionAlert = 53,

    //BACKUP
    BackupStarted = 54,
    BackupFailedToStart = 55,
    BackupCompleted = 56,
    BackupAborted = 57
  };
  
  void setEventType(EventType type);
  EventType getEventType() const;
  UintR eventType;    // DATA 0
};

inline
void
EventReport::setEventType(EventType type){
  eventType = (UintR) type;
}

inline
EventReport::EventType
EventReport::getEventType() const {
  return (EventType)eventType;
}

#endif