Bug #74324 Make keeping relay logs (relay_log_purge=0) crash safe.
Submitted: 10 Oct 2014 13:41
Reporter: Jean-François Gagné Email Updates:
Status: Open Impact on me:
Category:MySQL Server: Replication Severity:S4 (Feature request)
Version:5.6.21 OS:Any
Assigned to:
Tags: Crash-safe replication, relay_log_purge, relay-log-recovery, replication

[10 Oct 2014 13:41] Jean-François Gagné
In Bug # 73038, I pointed out that keeping relay logs (relay_log_purge=0) is not crash safe in MySQL 5.6.  Effectively, after a crash, events can be in double (or missing) in the relay-logs.

Please make those two options working together.  Thanks.

How to repeat:
Setup a master/slave replication.
Stop the SQL_THREAD on the slave.
Execute some transactions on the master.
Stop/crash mysqld on the slave.
Restart the slave with relay-log-recovery=1 and relay_log_purge=0.
The transactions executed on the master while the SQL_THREAD was stopped are in double in the relay-logs.

Setup a master/slave replication.
On the slave
-disable binlogs, set innodb_flush_log_at_trx_commit=1 and sync_relay_log=0,
-set relay_log_info_repository=TABLE, relay-log-recovery=1 and relay_log_purge=0.
Execute a flow of transactions on the master (seq -f "INSERT into test_jfg.t1 VALUES (%.0f, NULL);" 1 20000 | sudo mysql).
Crash the operating system of the slave (stop a VM) during execution of the master (relay logs must not be synced).
Restart the slave with relay_log_info_repository=TABLE, relay-log-recovery=1 and relay_log_purge=0.
There should be a gap in the relay-logs (timing and sync_relay_log dependent).