Internally, the server uses C++ classes to represent binary log
events. Prototypes are in log_event.h
. Code for
methods of these classes is in log_event.cc
.
Log_event
is the base class. Other more
specific event subclasses are derived from it. Type codes are
associated with subclasses because class instance contents are
written to binary or relay logs or are sent over the network from
master to slave. In those contexts, an event is just a sequence of
bytes, not a class structure, so a type code is needed to allow
recognition of the event type from the byte sequence.
An event byte sequence has a header part and a data part. The type code appears in the header part of each event.
The possible type codes for events are listed in the
Log_event_type
enumeration:
enum Log_event_type {
UNKNOWN_EVENT= 0,
START_EVENT_V3= 1,
QUERY_EVENT= 2,
STOP_EVENT= 3,
ROTATE_EVENT= 4,
INTVAR_EVENT= 5,
LOAD_EVENT= 6,
SLAVE_EVENT= 7,
CREATE_FILE_EVENT= 8,
APPEND_BLOCK_EVENT= 9,
EXEC_LOAD_EVENT= 10,
DELETE_FILE_EVENT= 11,
NEW_LOAD_EVENT= 12,
RAND_EVENT= 13,
USER_VAR_EVENT= 14,
FORMAT_DESCRIPTION_EVENT= 15,
XID_EVENT= 16,
BEGIN_LOAD_QUERY_EVENT= 17,
EXECUTE_LOAD_QUERY_EVENT= 18,
TABLE_MAP_EVENT = 19,
PRE_GA_WRITE_ROWS_EVENT = 20,
PRE_GA_UPDATE_ROWS_EVENT = 21,
PRE_GA_DELETE_ROWS_EVENT = 22,
WRITE_ROWS_EVENT = 23,
UPDATE_ROWS_EVENT = 24,
DELETE_ROWS_EVENT = 25,
INCIDENT_EVENT= 26,
HEARTBEAT_LOG_EVENT= 27,
IGNORABLE_LOG_EVENT= 28,
ROWS_QUERY_LOG_EVENT= 29,
WRITE_ROWS_EVENT = 30,
UPDATE_ROWS_EVENT = 31,
DELETE_ROWS_EVENT = 32,
GTID_LOG_EVENT= 33,
ANONYMOUS_GTID_LOG_EVENT= 34,
PREVIOUS_GTIDS_LOG_EVENT= 35,
ENUM_END_EVENT
/* end marker */
};
The INTVAR_EVENT
type has "subtypes," listed in
the Int_event_type
enumeration:
enum Int_event_type {
INVALID_INT_EVENT = LAST_INSERT_ID_EVENT = INSERT_ID_EVENT = 2
};
The following table summarizes the relationship between event
classes and type codes. Each class is derived from
Log_event
unless otherwise indicated. As can be
seen, an event class is associated with a single type code in most
cases, although there are some exceptions:
Some classes are not associated with any type code because they are used only as a base class for which to derive subclasses or because they are never written to binary or relay logs or sent from master to slave. For example,
Log_event
has no type code because it is used only as a base class.A class may be associated with multiple type codes:
Load_log_event
may contain a type code of eitherLOAD_EVENT
orNEW_LOAD_EVENT
.
Value |
Type Code |
Class |
|
||
|
||
|
||
|
||
0 |
|
|
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 |
|
|