1-Binlog Events

This section provides an overview of the various events recorded in the binary log, which are the core units of replication data transmission.

Binary log events, or binlog events, are information about data modification made to a MariaDB server instance stored in the binary log files.

Log File Structure

Each log file contains:

  • A 4-byte magic number, followed by a series of events describing data modifications: The magic number bytes are 0xfe 0x62 0x69 0x6e = 0xfe 'b''i''n' (this is the BINLOG_MAGIC constant).

  • A series of binlog events.

Event Content

Each event contains the 'header' followed by 'data bytes':

The header bytes provide information about:

  • The event type;

  • The creation time;

  • Which server created the event;

  • Flags and so forth.

The data bytes provide information specific to the type of event.

The first event, FORMAT_DESCRIPTION_EVENT at 'position' 4, is a descriptor event that describes the format used to write events in the file.

The remaining events are interpreted according to the version.

The final event is usually a log-rotation event ROTATE_EVENT that specifies the next binary log filename or a STOP_EVENT written during server shutdown.

Note: in case of a server crash there is no terminating event (no ROTATE nor STOP).

Example Binlog File (Hexdump -C $file_name)

Example From mysqlbinlog

This page is licensed: CC BY-SA / Gnu FDL

Last updated

Was this helpful?