orchestrator: Keep relay logs, when MasterFailoverDetachReplicaMasterHost: true

When MasterFailoverDetachReplicaMasterHost: true, the stop slave and change master are sent to promoted server and all relay logs are removed. It also happens even if, ApplyMySQLPromotionAfterMasterFailover": false. From mysql docs:

Prior to MySQL 5.7.4, CHANGE MASTER TO deletes all relay log files and starts a new one, unless you specify RELAY_LOG_FILE or RELAY_LOG_POS. In that case, relay log files are kept; the relay_log_purge global variable is set silently to 0. In MySQL 5.7.4 and later, relay logs are preserved if at least one of the slave SQL thread and the slave I/O thread is running; if both threads are stopped, all relay log files are deleted unless at least one of RELAY_LOG_FILE or RELAY_LOG_POS is specified.

Does it make sense to add “RELAY_LOG_FILE=current_relay_log_file”, which will do nothing, but keep the relay logs after change master?

Also in case of GTID, MASTER_AUTO_POSITION=0 should be added otherwise:

ERROR 1776 (HY000): Parameters MASTER_LOG_FILE, MASTER_LOG_POS, RELAY_LOG_FILE and RELAY_LOG_POS cannot be set when MASTER_AUTO_POSITION is active.

The full statement may look like this: change master to master_host='\\dbserver', master_port=3306, relay_log_file='relay-bin.000002', master_auto_position=0;

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Comments: 16 (3 by maintainers)

Most upvoted comments

So I am looking for possibilities to have only “detach” and keep relay logs with running sql thread.

Got it.

I happen to know of a contributor who has made a patch they intend to push upstream: upon failover, the newly promoted master will first consume all of the relay logs, before making the final promotion (setting read-only=0 etc.)

So I will wait for their contribution (which I hope will surface in the next few weeks).