impossible position in Replication

suggest change

Usually this means the source crashed while sync_binlog was OFF. On the replica, point at the next binary log on the source. The first event in a log is at position 4, not 0:

CHANGE REPLICATION SOURCE TO
  SOURCE_LOG_FILE = 'mysql-bin.000123',
  SOURCE_LOG_POS = 4;

Before MySQL 8.0.23 the statement was CHANGE MASTER TO MASTER_LOG_FILE=..., MASTER_LOG_POS=4. There is no POS=0.

The cause: The Master sends replication items to the Slave before flushing to its binlog (when sync_binlog=OFF). If the Master crashes before the flush, the Slave has already logically moved past the end of file on the binlog. When the Master starts up again, it starts a new binlog, so CHANGEing to the beginning of that binlog is the best available solution.

A longer term solution is sync_binlog=ON, if you can afford the extra I/O that it causes.

With GTID, do not invent a file position. Use the source’s Executed_Gtid_Set and CHANGE REPLICATION SOURCE TO SOURCE_AUTO_POSITION = 1 after the replica’s GTID state matches what the source still has.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents