Inconsistent AUTO_INCREMENT in MySQL 5.7 Replication Caused by REPLACE INTO
In MySQL 5.7, using REPLACE INTO on a table that has an auto‑increment primary key and an extra unique index can cause the master and slave AUTO_INCREMENT counters to diverge, leading to duplicate‑key errors after failover, a bug mitigated by upgrading to MySQL 8.0, manual counter fixes, or avoiding REPLACE INTO.