IO_AFTER_GTIDS is an UNTIL condition that can be added to START REPLICA (or START SLAVE in MySQL 5.7 and earlier). It is used only in environments where GTID-based replication (GTID_MODE = ON) is enabled. When specified, the replica’s IO thread keeps pulling events from the source binary log until it has retrieved every transaction whose GTID appears in the given set. As soon as the last matching transaction has been written to the relay log, the IO thread stops. The SQL thread continues to execute events already stored in the relay log unless it is also stopped explicitly.IO_AFTER_GTIDS is the IO-thread counterpart to SQL_AFTER_GTIDS. Use the IO variant when you care about pulling transactions into the relay log but do not yet need them executed. This is useful for coordinated switchover operations, point-in-time recovery, cloning, and reducing replication lag before a controlled stop.Caveats and behavior:- Works only with GTID-enabled replication.- The supplied GTID set must be a subset of the source’s Executed_Gtid_Set; otherwise START REPLICA fails.- IO_AFTER_GTIDS does not wait for the SQL thread. If you need both threads to stop, combine IO_AFTER_GTIDS with SQL_AFTER_GTIDS or STOP REPLICA SQL_THREAD.- SHOW REPLICA STATUS (or SHOW SLAVE STATUS) reports a non-running IO thread and the Retrieved_Gtid_Set equal to or superset of the provided set when the condition is met.
gtid_set
(string) - One or more GTID intervals in standard MySQL format, e.g., '41e8b0e4-cd7f-11ed-bd6c-080027e3d8b2|||1-150'.SQL_AFTER_GTIDS, SQL_BEFORE_GTIDS, IO_BEFORE_GTIDS, START REPLICA, GTID replication, WAIT_FOR_EXECUTED_GTID_SET
MySQL 5.7.6
IO_AFTER_GTIDS controls the replica IO thread. It stops the thread once all transactions belonging to the specified GTID set have been fetched from the source.
No. The option is recognized only when GTID_MODE is ON on both the source and the replica.
Combine IO_AFTER_GTIDS with SQL_AFTER_GTIDS in a single START REPLICA statement, or stop the other thread separately after IO_AFTER_GTIDS triggers.
Issue START REPLICA IO_THREAD to restart the IO thread, or START REPLICA to start both threads together.