[MDEV-32356] Setting gtid_slave_pos is not atomic Created: 2023-10-05 Updated: 2023-11-22 |
|
| Status: | Stalled |
| Project: | MariaDB Server |
| Component/s: | Galera, Replication |
| Affects Version/s: | 10.4 |
| Fix Version/s: | 10.4 |
| Type: | Bug | Priority: | Major |
| Reporter: | Jan Lindström | Assignee: | Kristian Nielsen |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
Consider first normal master-slave topology with gtid_strict_mode=0 where user stops slave and sets:
Yes, this could be totally incorrect i.e. there could not even be any node with domain_id with 1 or 2. This command is executed like this:
Anyway, this is not atomic because rpl_slave_state::load contains a loop i.e. it takes one gtid and calls rpl_slave_state::record_gtid where we have
The fact that storing these gtids is not atomic might have problems in following cases:
|
| Comments |
| Comment by Kristian Nielsen [ 2023-10-05 ] |
|
I think even without considering Galera, it would be preferred that SET GLOBAL gtid_slave_pos=<...> is a single transaction. Looking at the code, it seems this should be simple to achive:
Hope this helps, - Kristian. |
| Comment by Jan Lindström [ 2023-11-22 ] |
|
knielsen I think above is not enough. rpl_slave_state::record_gtid does open_and_lock_tables, we do not want to do so for every gtid we store on set. For Galera case transaction is needed naturally for only gtid_slave_pos table having InnoDB storage engine (I thought there could be more than one of them). I think we need a new function for SET or bigger refactoring. |