We have the following scenario:
Set of slaves replicate from the master, separate standby master (a.k.a slave with binlogs) replicates from the same master; lag slave, powered by
pt-slave-delay, replicates from the same source.
We also utilise mha4mysql to switch slaves from one master to another in case of need.
All would be dandy, if not for lag slaves.
Let's say lag slave is running 12 hours behind master.
Switch lag slave from Master to Standby Master in such a way that failover occurs immediately (i.e.
CHANGE MASTER is executed on lag slave the same time as on regular slaves) and that lag slave keeps lagging 12 hours.
While I know that slave keeps track of master binlog position in its own relay log, I can calculate master position to 12 hours in the past, however, as far as I understand it Standby Master (aka slave with binlogs) has no relation between own relay logs and own binlogs.
Is there a reliable way to calculate position of the Standby Master we need to switch to (discarding the rest of relay logs on lag slave, obviously) and restart replication from 12 hours behind, but on the new master?
NOTE we are running MySQL 5.1, so 5.5 (or 5.6 with GTIDs) aren't a solution for now unfortunately.