Diagnostic step 1
Do not attempt ad-hoc GTID manipulations (like changing GTID_EXECUTED sets) unless you have a tested rollback plan and a recent backup. Those operations are high risk for silent data corruption.
Generated Oct 3, 2026, 12:35:03 AM
Do not attempt ad-hoc GTID manipulations (like changing GTID_EXECUTED sets) unless you have a tested rollback plan and a recent backup. Those operations are high risk for silent data corruption.
If the replication divergence is small and you can identify the exact missing GTIDs on the replica, you can use mysqlbinlog on the primary to extract the missing transactions and apply them manually in a transaction on the replica. This requires careful verification that those statements are deterministic and safe to replay. Keep full backups first.
The most reliable remediation is to provision a fresh replica: take a new backup from the primary (mysqldump --single-transaction --master-data=2 or a physical backup with Percona XtraBackup preserving GTIDs), restore it to the replica, and configure replication afresh. This avoids manual GTID surgery and guarantees consistency.
If full re-cloning is not possible immediately, capture the current state (file system snapshot or logical export) as a backup, and then use mysqlbinlog/SHOW BINLOG EVENTS to find and confirm the offending GTID(s). Get DBA assistance before applying manual fixes.
To prevent recurrence: ensure replicas are set read_only, monitor replication status and network health, and consider semi-synchronous replication for critical setups. If using GTIDs, avoid manual skips and prepare automated procedures for controlled failover. If you are not comfortable performing a fresh restore or manual GTID repair, escalate to a DBA with experience in GTID-based recovery—these steps can cause irreversible data divergence if done incorrectly.