[MDEV-17515] GTID Replication in optimistic mode deadlock Created: 2018-10-22 Updated: 2023-05-12 Resolved: 2021-05-17 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Replication |
| Affects Version/s: | 10.1, 10.1.36, 10.2, 10.3, 10.4, 10.5 |
| Fix Version/s: | 10.2.39, 10.3.30, 10.4.20, 10.5.11 |
| Type: | Bug | Priority: | Critical |
| Reporter: | VAROQUI Stephane | Assignee: | Sujatha Sivakumar (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | affects-tests, mdl, parallelreplication | ||
| Description |
|
Hi, Setup is like this
The scenario that trigger such deadlock was some optimize tables on the first relay and mysql restart after optimize
The deadlock:
|
| Comments |
| Comment by Kristian Nielsen [ 2019-07-19 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
From the process list, it looks like we have two transactions T1 (OPTIMIZE TABLE requetes) and T2 (DML on table requetes). And T2 was somehow allowed to start before T1 was complete; this should not have been allowed. OPTIMIZE TABLE should have been marked as DDL, which would prevent T2 from starting until T1 completed. Check the binlog on the master of the deadlocked slave (or alternatively the relaylog on the deadlocked slave) that the OPTIMIZE TABLE GTID event is marked as DDL. I can see this is an old bug, so probably the original logs are not available, but it might be enough to check the binlogging in a similar setup. The deadlock will be very dependent on timing between different transactions, but the marking of OPTIMIZE TABLE as DDL is hoefully not. Hope this helps,
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Andrei Elkin [ 2019-08-13 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
knielsen, thanks for the guidence! That must be the case. The width of the pasted show processlist window did not help me in particular to identify OPTIMIZE as an actor | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sachin Setiya (Inactive) [ 2019-12-05 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi knielsen
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sachin Setiya (Inactive) [ 2019-12-05 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Test Case
Debug build it fails with assert
In RelWithDebInfo build
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Alice Sherepa [ 2020-06-17 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Current 10.4,10.5-debug hangs with the test case from the above. but assertion is still appearing:
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Kristian Nielsen [ 2020-07-16 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
A better testcase would be to grep the binlog from OPTIMIZE TABLE to check that it is marked as DDL.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sujatha Sivakumar (Inactive) [ 2020-12-17 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hello Elkin Can you please review the changes for Patch: https://github.com/MariaDB/server/commit/70377dc9be5205286806e01365f33cbfd32e1d27 BuildBot: http://buildbot.askmonty.org/buildbot/grid?category=main&branch=bb-10.2-sujatha Thank you. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sujatha Sivakumar (Inactive) [ 2020-12-21 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hello Elkin I made some minor changes on top of the above mentioned commit. Please find the following commit Please review top two commits: 1. commit 44eb746c226d3eabe93d476790bb0c6bb30106b2 2. commit 502a6b9b3ce119f507cb8ccc9ec034a9953ad3cc | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sachin Setiya (Inactive) [ 2021-05-06 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Okay to push , one comment needs to addressed | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sujatha Sivakumar (Inactive) [ 2021-05-17 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hence both are tested and pushed together. 10.3: http://buildbot.askmonty.org/buildbot/grid?category=main&branch=bb-10.3-sujatha 10.3 cherry-pick testing. commit e683e8c010bd2ffa9415857828e89f94b9ac0550 10.3 cherry-pick testing. 10.4: http://buildbot.askmonty.org/buildbot/grid?category=main&branch=bb-10.4-sujatha 10.4 cherry-pick testing. commit 4169e6571c342b57a3ce89e7ae45328c06beb788 10.4 cherry-pick testing. Merge conflicts addressed. 10.5: http://buildbot.askmonty.org/buildbot/grid?category=main&branch=bb-10.5-sujatha 10.5 cherry-pick testing. No Merge conflicts commit f0c220898fbe8f58393d386aa0cb6da6b7cedf9f 10.5 cherry-pick testing. Moved changes to log_event_server.cc |