# Replication Protocol

- [1-Binlog Events](https://mariadb.com/docs/server/reference/clientserver-protocol/replication-protocol/1-binlog-events.md): This section provides an overview of the various events recorded in the binary log, which are the core units of replication data transmission.
- [2-Binlog Event Header](https://mariadb.com/docs/server/reference/clientserver-protocol/replication-protocol/2-binlog-event-header.md): Every binary log event starts with a standardized header containing metadata such as the timestamp, event type, server ID, and event size.
- [3-Binlog Network Stream](https://mariadb.com/docs/server/reference/clientserver-protocol/replication-protocol/3-binlog-network-stream.md): Describes the continuous packet stream format used to transmit binary log events from the primary server to the replica over the network.
- [4-Semi-Sync Replication](https://mariadb.com/docs/server/reference/clientserver-protocol/replication-protocol/4-semi-sync-replication.md): Explains the handshake and acknowledgement process for semi-synchronous replication, ensuring data is committed on at least one replica.
- [5-Replica Registration](https://mariadb.com/docs/server/reference/clientserver-protocol/replication-protocol/5-replica-registration.md): Details the initialization phase where a replica connects to the primary, authenticates, sends capabilities, and registers for updates.
- [ANNOTATE\_ROWS\_EVENT](https://mariadb.com/docs/server/reference/clientserver-protocol/replication-protocol/annotate_rows_event.md): This event accompanies row-based events to provide the original SQL query text, which is useful for auditing and debugging replication.
- [BEGIN\_LOAD\_QUERY\_EVENT](https://mariadb.com/docs/server/reference/clientserver-protocol/replication-protocol/begin_load_query_event.md): Used during LOAD DATA INFILE operations, this event marks the beginning of the data load and contains the initial query information.
- [BINLOG\_CHECKPOINT\_EVENT](https://mariadb.com/docs/server/reference/clientserver-protocol/replication-protocol/binlog_checkpoint_event.md): A marker event indicating a checkpoint in the binary log, used to ensure consistency and safe rotation of log files.
- [COM\_BINLOG\_DUMP](https://mariadb.com/docs/server/reference/clientserver-protocol/replication-protocol/com_binlog_dump.md): This command is sent by a replica to the primary server to request the start of the binary log event stream from a specific file and position.
- [COM\_REGISTER\_SLAVE](https://mariadb.com/docs/server/reference/clientserver-protocol/replication-protocol/com_register_slave.md): This command is used by a replica to register its details, such as server ID, hostname, and port, with the primary server.
- [EXECUTE\_LOAD\_QUERY\_EVENT](https://mariadb.com/docs/server/reference/clientserver-protocol/replication-protocol/execute_load_query_event.md): This event is used for LOAD DATA INFILE operations, managing the execution phase similar to a QUERY\_EVENT but with extra static fields for file handling.
- [Fake GTID\_LIST Event](https://mariadb.com/docs/server/reference/clientserver-protocol/replication-protocol/fake-gtid_list-event.md): A synthetic event sent by the master after the initial handshake to inform the replica of its current GTID state, it is not written to the binary log.
- [Fake ROTATE\_EVENT](https://mariadb.com/docs/server/reference/clientserver-protocol/replication-protocol/fake-rotate_event.md): An artificial event sent to the replica to indicate the name of the binary log file on the master, ensuring the replica knows which file is being read.
- [FORMAT\_DESCRIPTION\_EVENT](https://mariadb.com/docs/server/reference/clientserver-protocol/replication-protocol/format_description_event.md): This descriptor event appears at the start of every binary log file, defining the server version, binlog version, and header lengths for all event types.
- [GTID\_EVENT](https://mariadb.com/docs/server/reference/clientserver-protocol/replication-protocol/gtid_event.md): The GTID\_EVENT marks the start of a new transaction event group, associating it with a Global Transaction ID (GTID) and providing commit flags.
- [GTID\_LIST\_EVENT](https://mariadb.com/docs/server/reference/clientserver-protocol/replication-protocol/gtid_list_event.md): Logged during binlog rotation or checkpoints, this event lists the GTIDs present in the binary log to help replicas determine their replication state.
- [HEARTBEAT\_LOG\_EVENT](https://mariadb.com/docs/server/reference/clientserver-protocol/replication-protocol/heartbeat_log_event.md): A heartbeat event sent over the network by the master when there are no binlog events, ensuring the replica knows the connection is still active.
- [INTVAR\_EVENT](https://mariadb.com/docs/server/reference/clientserver-protocol/replication-protocol/intvar_event.md): This event records integer values for auto-increment columns or the LAST\_INSERT\_ID function, ensuring that these values are replicated deterministically.
- [QUERY\_EVENT](https://mariadb.com/docs/server/reference/clientserver-protocol/replication-protocol/query_event.md): The QUERY\_EVENT records text-based SQL statements for statement-based replication, capturing the query string and execution context like the default database.
- [RAND\_EVENT](https://mariadb.com/docs/server/reference/clientserver-protocol/replication-protocol/rand_event.md): The RAND\_EVENT records the two seed values used for the random number generator, ensuring that calls to the RAND() function produce identical results on replicas.
- [ROTATE\_EVENT](https://mariadb.com/docs/server/reference/clientserver-protocol/replication-protocol/rotate_event.md): The ROTATE\_EVENT indicates a log rotation, specifying the name of the next binary log file and the position where writing will continue.
- [ROWS\_EVENT\_V1/V2, ROWS\_COMPRESSED\_EVENT\_V1](https://mariadb.com/docs/server/reference/clientserver-protocol/replication-protocol/rows_event_v1v2-rows_compressed_event_v1.md): These events record row-level changes (WRITE, UPDATE, DELETE) for replication, with versions supporting different column counts and compression.
- [START\_ENCRYPTION\_EVENT](https://mariadb.com/docs/server/reference/clientserver-protocol/replication-protocol/start_encryption_event.md): This event marks the beginning of encrypted data in the binary log, defining the encryption scheme and key version for subsequent events.
- [STOP\_EVENT](https://mariadb.com/docs/server/reference/clientserver-protocol/replication-protocol/stop_event.md): The STOP\_EVENT is written to the binary log when the server shuts down, serving as a marker for a clean stop.
- [TABLE\_MAP\_EVENT](https://mariadb.com/docs/server/reference/clientserver-protocol/replication-protocol/table_map_event.md): This event provides a mapping between a table ID and its table definition, preceding row events to interpret the row data correctly.
- [USER\_VAR\_EVENT](https://mariadb.com/docs/server/reference/clientserver-protocol/replication-protocol/user_var_event.md): The USER\_VAR\_EVENT logs the value of a user-defined variable, ensuring that statements using variables replicate consistently.
- [XA\_PREPARE\_LOG\_EVENT](https://mariadb.com/docs/server/reference/clientserver-protocol/replication-protocol/xa_prepare_log_event.md): This event records the preparation phase of an XA transaction, storing the XID to support two-phase commit and recovery.
- [XID\_EVENT](https://mariadb.com/docs/server/reference/clientserver-protocol/replication-protocol/xid_event.md): The XID\_EVENT signifies the commit of a transaction, containing the transaction ID (XID) to ensure atomicity across replication.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mariadb.com/docs/server/reference/clientserver-protocol/replication-protocol.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
