MySQL replication problem: Impossible replication position

Topics: MySQL replication

A MySQL replica can report an impossible replication position when it requests an offset beyond the source’s binary-log file, for example after a source crash. This note records recovery commands for MySQL 8.x and 5.x.

Subtopics

MySQL 8.x

When a leader node crashes, it sometimes loses binary log data that hadn’t been written to disk in time. In that case, follower nodes will fail with ` Last_IO_Error: Got fatal error 1236 from source when reading data from binary log: ‘Client requested source to start replication from position > file size’`.

Replication can be resumed with the following commands:

STOP REPLICA;
CHANGE REPLICATION SOURCE TO
  SOURCE_LOG_FILE="<next_binlog_file>",
  SOURCE_LOG_POS=4;
START REPLICA;

MySQL 5.x

In MySQL versions 5.x, the equivalent error message is Client requested master to start replication from impossible position. To repair replication, issue the following statements:

STOP SLAVE;
CHANGE MASTER TO 
  MASTER_LOG_FILE="<next_binlog_file>",
  MASTER_LOG_POS=4;
START SLAVE;

Bookmarks

Questions