Replication and Binary Logging Options and Variables • relay_log_purge • relay_log_recovery If enabled, this variable enables automatic relay log recovery immediately following server startup. The recovery process creates a new relay log file, initializes the SQL thread position to this new relay log, and initializes the I/O thread to the SQL thread position. Reading of the relay log from the source then continues. This global variable is read-only at runtime. Its value can be set with the  --relay-log-recovery option at replica server startup, which should be used following an unexpected halt of a replica to ensure that no possibly corrupted relay logs are processed, and must be used in order to guarantee a crash- safe replica. The default value is 0 (disabled). For information on the combination of settings on a replica that is most resilient to unexpected halts, see Section 17.4.2, “Handling an Unexpected Halt of a Replica” . For a multithreaded replica (where  slave_parallel_workers  is greater than 0), setting  --relay- log-recovery  at startup automatically handles any inconsistencies and gaps in the sequence of transactions that have been executed from the relay log. These gaps can occur when file position based replication is in use. (For more details, see Section 17.5.1.34, “Replication and Transaction Inconsistencies” .) The relay log recovery process deals with gaps using the same method as the  START REPLICA | SLAVE UNTIL SQL_AFTER_MTS_GAPS  statement would. When the replica reaches a consistent gap-free state, the relay log recovery process goes on to fetch further transactions from the source beginning at the SQL (applier) thread position. When GTID-based replication is in use, from MySQL 8.0.18 a multithreaded replica checks first whether  MASTER_AUTO_POSITION  is set to  ON , and 3522 Disables or enables automatic purging of relay log files as soon as they are not needed any more. The default value is 1 ( ON ). Command-Line Format --relay-log-purge[={OFF|ON}] System Variable relay_log_purge Scope Global Dynamic Yes SET_VAR  Hint Applies No Type Boolean Default Value ON Command-Line Format --relay-log-recovery[={OFF|ON}] System Variable relay_log_recovery Scope Global Dynamic No SET_VAR  Hint Applies No Type Boolean Default Value OFF