Bug #93761 | optimize table cause the slave MTS deadlock! | ||
---|---|---|---|
Submitted: | 29 Dec 2018 2:45 | Modified: | 9 Mar 2019 23:35 |
Reporter: | yayun zhou | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: Replication | Severity: | S2 (Serious) |
Version: | 5.7.22 | OS: | Red Hat (6.5) |
Assigned to: | CPU Architecture: | Any | |
Tags: | MTS, optimize table |
[29 Dec 2018 2:45]
yayun zhou
[21 Jan 2019 6:58]
Jean-François Gagné
I suggest the following workaround: replace your optimize table with an ALTER TABLE ENGINE INNODB. Another work-arount could be to disable slave_preserve_commit_order, but you might not want to do that. It is not actually the optimize table that cause the deadlock, it is a combinasion of enabling slave_preserve_commit_order and of the optimize not being considered as a barrier when generating the logical clocks (last_committed and sequence_number), but I think an ALTER TABLE is. Long story made short, DDL should not be run in parallel on slaves. When written to the binlogs, a DDL (including an ALTER TABLE or a CREATE TABLE) should force all following last_committed to be greater or equal to the sequence_number of this DDL. Think of it this way: you cannot run an INSER in a TABLE before the CREATE TABLE is run.
[7 Mar 2019 4:14]
MySQL Verification Team
Hi, Not a bug, a design limitation maybe but a bug - no. Jean-François already explained why (Thanks!!). Thanks Bogdan p.s. this type of issues are handled differently (more safely) in 8.x due to DDL's being transactional
[9 Mar 2019 23:35]
MySQL Verification Team
Hi, I discussed this a little bit with colleagues and I change my mind, I think this actually is a bug. Probbly only that's not going to be fixed since 8.x fixes it and to fix in 5.7 we'd need a change too big to allow to enter into 5.7 but still I'll verify it. all best Bogdan