mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
MDEV-6549, failing to update gtid_slave_pos for a transaction that was retried.
The bug was that in some cases, if a replicated transaction was rolled back due to deadlock, during the subsequent retry of that transaction, the gtid_slave_pos would _not_ be updated with the new GTID, leaving the GTID position of the slave incorrect. Fix this by ensuring during the retry that we clear the flag that marks that the GTID has already been recorded in gtid_slave_pos, so that the update of gtid_slave_pos will be done again during the retry. In the original bug, the symptom was an assertion due to OPTION_GTID_BEGIN not being cleared during the retry of the transaction. The reason was some code in handling of a COMMIT query event, which would not clear the flag when not recording a GTID in gtid_slave_pos. This commit also fixes that code to always clear the OPTION_GTID_BEGIN flag for clarity, though it is actually not possible for OPTION_GTID_BEGIN to become set unless a GTID is pending for update (after fixing the bug described above).
This commit is contained in:
@ -4346,6 +4346,7 @@ thd_need_ordering_with(const MYSQL_THD thd, const MYSQL_THD other_thd)
|
||||
{
|
||||
rpl_group_info *rgi, *other_rgi;
|
||||
|
||||
DBUG_EXECUTE_IF("disable_thd_need_ordering_with", return 1;);
|
||||
if (!thd || !other_thd)
|
||||
return 1;
|
||||
rgi= thd->rgi_slave;
|
||||
@ -4361,7 +4362,7 @@ thd_need_ordering_with(const MYSQL_THD thd, const MYSQL_THD other_thd)
|
||||
if (!rgi->commit_id || rgi->commit_id != other_rgi->commit_id)
|
||||
return 1;
|
||||
/*
|
||||
These two threads are doing parallel replication within the same
|
||||
Otherwise, these two threads are doing parallel replication within the same
|
||||
replication domain. Their commit order is already fixed, so we do not need
|
||||
gap locks or similar to otherwise enforce ordering (and in fact such locks
|
||||
could lead to unnecessary deadlocks and transaction retry).
|
||||
|
Reference in New Issue
Block a user