1594 database data_error ai_generated true

ERROR: Relay log read failure: could not parse relay log event. The slave is stopped. Last_IO_Error: error reading relay log event: relay log read failure

ID: database/mysql-slow-replica-lag-bytes-behind

Also available as: JSON · Markdown · 中文
75%Fix Rate
85%Confidence
1Evidence
2024-03-15First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
MySQL 5.7 active
MySQL 8.0 active
MySQL 8.4 active

Root Cause

MySQL relay log is corrupted or truncated, often due to disk I/O errors or abrupt server shutdown during replication.

generic

中文

MySQL 中继日志损坏或被截断,通常是由于磁盘 I/O 错误或复制过程中服务器意外关闭。

Official Documentation

https://dev.mysql.com/doc/refman/8.0/en/replication-options-replica.html

Workarounds

  1. 85% success STOP SLAVE; RESET SLAVE; CHANGE MASTER TO ...; START SLAVE; (reinitialize replication from scratch using SHOW SLAVE STATUS to get the correct master log file and position, or use GTID if enabled)
    STOP SLAVE; RESET SLAVE; CHANGE MASTER TO ...; START SLAVE; (reinitialize replication from scratch using SHOW SLAVE STATUS to get the correct master log file and position, or use GTID if enabled)
  2. 70% success STOP SLAVE; SET GLOBAL relay_log_purge=0; START SLAVE; (if the error is transient, this may skip the bad event but risks data inconsistency)
    STOP SLAVE; SET GLOBAL relay_log_purge=0; START SLAVE; (if the error is transient, this may skip the bad event but risks data inconsistency)

中文步骤

  1. STOP SLAVE; RESET SLAVE; CHANGE MASTER TO ...; START SLAVE; (reinitialize replication from scratch using SHOW SLAVE STATUS to get the correct master log file and position, or use GTID if enabled)
  2. STOP SLAVE; SET GLOBAL relay_log_purge=0; START SLAVE; (if the error is transient, this may skip the bad event but risks data inconsistency)

Dead Ends

Common approaches that don't work:

  1. Restart the MySQL replica service without fixing the relay log 95% fail

    The corrupted relay log persists and will be re-read, causing the same error immediately.

  2. Manually delete relay log files and restart replication without resetting 80% fail

    MySQL still expects the relay log index to reference the deleted files, leading to further errors.