Bug #84249 | CHANGE MASTER TO MASTER_DELAY can lead a slave to skip transactions | ||
---|---|---|---|
Submitted: | 18 Dec 2016 18:08 | Modified: | 24 May 2017 12:34 |
Reporter: | Sergio Roysen | Email Updates: | |
Status: | Duplicate | Impact on me: | |
Category: | MySQL Server: Replication | Severity: | S2 (Serious) |
Version: | 5.7 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | replication |
[18 Dec 2016 18:08]
Sergio Roysen
[20 Dec 2016 11:22]
MySQL Verification Team
Hi, Thanks for your report, verified as described.
[2 Mar 2017 15:24]
Saverio Miroddi
Duplicate of https://bugs.mysql.com/bug.php?id=84375 (Changing MASTER_DELAY to 0 purges the relay log, causing corruption). It's not an issue, but something that's it's not very obviously pointed out in the documentation - the I/O thread must not be stopped, in this context, when changing the master. This is the reply from support: > In your case, after step 4 - new relay log is generated(i.e slave server creates a new relay log file each time the I/O thread starts). So instead of > > STOP SLAVE; > CHANGE MASTER TO MASTER_DELAY=<value>; > START SLAVE; > > it is enough to do the following with this feature. > > STOP SLAVE SQL_THREAD; > CHANGE MASTER TO MASTER_DELAY=<value>; > START SLAVE SQL_THREAD; > > Please see more details on this here http://mysqlserverteam.com/mysql-5-7-4-change-master-without-stopping-slave-altogether/
[4 Mar 2017 14:58]
Sergio Roysen
I consider this a dangerous bug. According to the official documentation, relay logs are going to be deleted every time that a `CHANGE MASTER ....` command is issued while both slave threads are stopped. There are other `CHANGE MASTER...` commands where that deletion is done in a safe way, and the values of `MASTER_LOG_FILE` and `MASTER_LOG_FILE` are changed accordingly to guaranteed that any transactions that had not yet been applied by the sql_thread are going to be retrieved from the master again. You can verify that quite easily: Follow the step described above to reproduce the bug, but this time, instead of running `CHANGE MASTER TO MASTER_DELAY = 0;` run `CHANGE MASTER TO MASTER_RETRY_COUNT=20;`. You will see that the relay logs are purged, but you will also see that the master bin log positions have been modified so that there are not going to be any missing transactions when you start the slave threads again. Regarding the documentation that you were refereed to: I don't consider http://mysqlserverteam.com/mysql-5-7-4-change-master-without-stopping-slave-altogether/ as official documentation of the behavior of MySQL. It is a very informative and interesting blog article about a new feature (been able to stop only one of the two slave threads for some operations), but not documentation. When that article refers to stopping the slave thread when changing MASTER_DELAY, it says: > it is enough to do the following with this feature. That is clearly misleading and should say instead: `You MUST do the following with this feature`. The same article says at the bottom: > SIDE-EFFECTS? > > While implementing this, we have taken special care to make sure we dont > break anything for a user switching masters like: > > STOP SLAVE; > CHANGE MASTER to <master_def>; > START SLAVE. > There are absolutely NO side-effects to worry you. As it was shown here and in the other bug report, that is clearly not the case. Things can and will break.
[24 May 2017 12:34]
Erlend Dahl
Duplicate of Bug#81232 Changing master_delay after stop slave results in loss of events.
[24 Jul 2017 19:18]
Shlomi Noach
Affected by same bug.