This is port of Google's patches
There is modified the slave IO thread to maintain a copy of the master's binlog as it writes the relay log. The copy means the file has the same name and same contents. When this is done, slave can transparently failover between master and slaves with mirror the binlog.
When this is first enabled, the slave must download all of the current binlog. This can take some time. New events are not appended to the relay log until this has finished.
Parameters:
New commands:
These commands allow fast promotion of a slave to a master. It is fast because it can be done without restarting the slave.
Discussion
Can you provide a more detailed description of how the mirrored binlogs works? the position on the slave will be different as soon as I “stop slave” and “start slave”.
this is a master: mysql> show master status; +——————–+———-+————–+——————+
+——————–+———-+————–+——————+
+——————–+———-+————–+——————+ 1 row in set (0.00 sec)
this is a slave: mysql> show master status; +——————–+———-+————–+——————+
+——————–+———-+————–+——————+
+——————–+———-+————–+——————+ 1 row in set (0.00 sec) mysql> slave stop;slave start; Query OK, 0 rows affected (0.00 sec) mysql> show master status; +——————–+———-+————–+——————+
+——————–+———-+————–+——————+
+——————–+———-+————–+——————+ 1 row in set (0.00 sec)
binlog at this slave is recorded two times. ########################################### #091212 15:50:03 server id 44690 end_log_pos 98 Start: binlog v 4, server v 5.0.37-log created 091212 15:50:03 at startup ROLLBACK/*!*/; # at 98 #091212 15:51:18 server id 44690 end_log_pos 181 Query thread_id=3 exec_time=0 error_code=0 SET TIMESTAMP=1260604278/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; /*!\C latin1 **!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; create database f111/*!*/; # at 181 #091212 15:51:25 server id 44690 end_log_pos 264 Query thread_id=3 exec_time=0 error_code=0 SET TIMESTAMP=1260604285/*!*/; create database g111/*!*/; # at 264 #091212 15:50:03 server id 44690 end_log_pos 98 Start: binlog v 4, server v 5.0.37-log created 091212 15:50:03 at startup ROLLBACK/*!*/; # at 358 #091212 15:51:18 server id 44690 end_log_pos 181 Query thread_id=3 exec_time=0 error_code=0 SET TIMESTAMP=1260604278/*!*/; create database f111/*!*/; # at 441 #091212 15:51:25 server id 44690 end_log_pos 264 Query thread_id=3 exec_time=0 error_code=0 SET TIMESTAMP=1260604285/*!*/; create database g111/*!*/; DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; ###############################################