Looking at an excerpt from the binary log, it can be seen that these 2 statements are written to the log out of order chronologically:
#160628 17:32:46 server id 2220 end_log_pos 64812204 Query thread_id=157061 exec_time=0 error_code=0
SET TIMESTAMP=1467153166/*!*/;
UPDATE `table` SET `field` = "a";
/*!*/;
# at 64812204
--
#160628 17:32:36 server id 2220 end_log_pos 64895850 Query thread_id=157062 exec_time=0 error_code=0
SET TIMESTAMP=1467153156/*!*/;
UPDATE `table` SET `field` = "b";
/*!*/;
# at 64895850
Can't figure out how to highlight inside the code block, but the important parts are:
first statement - end_log_pos 64812204, SET TIMESTAMP=1467153166
second statement - end_log_pos 64895850, SET TIMESTAMP=1467153156
So this has caused the master and slave to desync, as the master ran the first statement last, while the slave ran the second statement last.
Can anyone help me figure out the reason for this? I noticed that all the statements with the thread_id 157062 were executed first but written to the log after those with thread_id 157061.
Mysql version is 5.5.
Thanks for any help.