Bug #73196 | Allow ALTER TABLE to run concurrently on master and slave | ||
---|---|---|---|
Submitted: | 4 Jul 2014 11:37 | Modified: | 6 Jul 2015 9:22 |
Reporter: | Andrew Morgan | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: Replication | Severity: | S4 (Feature request) |
Version: | 5.7 | OS: | Any |
Assigned to: | Luis Soares | CPU Architecture: | Any |
[4 Jul 2014 11:37]
Andrew Morgan
[1 May 2015 12:30]
Daniƫl van Eeden
It could be something like this: Run "ALTER t1 ... , BACKGROUND=1" on a master, which then returns directly and writes this statement to the binlog (and thus send it to the slave). Then the slave will start to build the index in the background also and presumably end in the same state. I would then expect to find a thread which handles the ALTER in the processlist and/or p_s.threads. And then killing the background thread should cancel the alter. Another alternative: Run "ALTER TABLE t1 ... , NOLOCAL=1" on the master which will validate the statement and put it in the binlogs, but without applying it locally. Then the slaves can do the alter and then on the master a SET SESSION sql_log_bin=0; ALTER TABLE... ; SET SESSION sql_log_bin=1; can be done. This however will still block the SQL thread on the slave for some time, but maybe the slave can detect this and run this in parallel.
[7 May 2015 12:20]
Simon Mudd
I think the BACKGROUND=1 type answer is quite a nice thing to do. One thing that concerns me is how much I/O such a command might trigger, so pushing out a background task to N downstream slaves could potentially be rather damaging. - As such perhaps some sort of I/O throttling mechanism might be useful to prevent the I/O generated from such a command saturating the server.
[6 Jul 2015 9:22]
MySQL Verification Team
Hello Andrew, Thank you for the feature request! Thanks, Umesh
[19 Jul 2016 12:59]
Joseph Smackerty
Can we *please* get an update on the "triaging" of this major issue? Online ALTER TABLE is effectively useless for a tremendous amount of use cases until this is fixed.