IO_BEFORE_GTIDS is used with START REPLICA (or legacy START SLAVE) and STOP REPLICA to control how far the replica I/O thread should read from the source’s binary log. When IO_BEFORE_GTIDS is supplied, the I/O thread continues requesting events until it encounters an event whose GTID is equal to or exceeds the first GTID in the supplied set. It then stops, leaving the SQL thread free to apply everything already queued. This mechanism lets administrators bring a replica to an exact point in the transaction history without executing the GTIDs listed in the set. It is frequently paired with SQL_BEFORE_GTIDS or SQL_AFTER_GTIDS to achieve precise point-in-time cloning, delayed replication, or controlled failover. Important caveats: - The replica must be configured for GTID-based replication (GTID_MODE = ON on both source and replica). - IO_BEFORE_GTIDS only affects the I/O thread. The SQL thread may still apply events already downloaded unless separately controlled. - If the specified GTID set is not present on the source, the I/O thread waits indefinitely unless a timeout is configured.
IO_BEFORE_GTIDS
(string) - One or more GTID ranges in the canonical GTID set format 'uuid:low-high' separated by commas.SQL_BEFORE_GTIDS, SQL_AFTER_GTIDS, START REPLICA, STOP REPLICA, GTID_MODE, MASTER_AUTO_POSITION
MySQL 5.7.6
IO_BEFORE_GTIDS targets the I/O thread so only the download phase stops, while SQL_BEFORE_GTIDS targets the SQL thread to pause event execution.
No. The clause is only valid when GTID_MODE is ON. Without GTIDs the server raises a syntax error.
Simply issue `START REPLICA IO_THREAD;` (or `START SLAVE IO_THREAD;` on older versions) to restart downloading events.
The I/O thread waits indefinitely, so administrators often set `SOURCE_CONNECT_RETRY` or manually monitor and intervene if necessary.