The following MySQL binlog
events are dispatched by the ChangeStreamEventListener
:
Used for row-based binary logging. This event precedes each row
operation event. It maps a table definition to a number, where the
table definition consists of database and table names and column
definitions. The purpose of this event is to enable replication when
a table has different definitions on the master and slave. Row
operation events that belong to the same transaction may be grouped
into sequences, in which case each such sequence of events begins
with a sequence of TABLE_MAP_EVENT
events: one per table used by
events in the sequence.
TABLE_MAP
events are used by the ChangeStreamEventDeserializer
to deserialize MutationEvent
s
that include database
and tableName
info.
Contains the SQL query that was executed to produce the row events immediately following this event.
ROWS_QUERY
events are used by the ChangeStreamEventDeserializer
to deserialize MutationEvent
s
that include the event's sql
query string.
*Note: In order to include sql with the mutation events, you must enable the
binlog_rows_query_log_events
setting in my.cnf
.
QUERY
events are converted into one of several objects:
AlterTableEvent
is delivered to theColumnInfoActor
(signaling that the table's cache should be expired and refreshed)BeginTransaction
is delivered to theTransactionActor
CommitTransaction
is delivered to theTransactionActor
RollbackTransaction
is delivered to theTransactionActor
####ROWS_EVENT (aka Mutations)
Mutations (i.e. Inserts, Updates and Deletes) can be represented by several binlog
events, together referred to as
ROWS_EVENT
:
WRITE_ROWS
andEXT_WRITE_ROWS
are converted toInsert
and delivered to theTransactionActor
.UPDATE_ROWS
andEXT_UPDATE_ROWS
are converted toUpdate
and delivered to theTransactionActor
.- Note: Update events are different from Insert and Delete in that they contain both the old and the new values for the record.
DELETE_ROWS
andEXT_DELETE_ROWS
are converted toDelete
and delivered to theTransactionActor
.
####XID
Generated for a commit of a transaction that modifies one or more tables of an XA-capable
storage engine. Normal transactions are implemented by sending a QUERY_EVENT
containing a
BEGIN
statement and a QUERY_EVENT
containing a COMMIT
statement (or a ROLLBACK
statement
if the transaction is rolled back).
XID_EVENT
events, indicative of the end of a transaction, are converted to
CommitTransaction
and delivered to the TransactionActor
.
####GTID
Written to the binlog prior to the mutations in it's transaction, GTID
event contains the gtid of the
transaction, and is added to each mutation event to allow consumers to group events by transaction (if desired).
GTID
events are converted to GtidEvent
and delivered to the TransactionActor
.