mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-33475: --gtid-ignore-duplicate can double-apply event in case of parallel replication retry
When rolling back and retrying a transaction in parallel replication, don't release the domain ownership (for --gtid-ignore-duplicates) as part of the rollback. Otherwise another master connection could grab the ownership and double-apply the transaction in parallel with the retry. Reviewed-by: Brandon Nesterenko <brandon.nesterenko@mariadb.com> Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
This commit is contained in:
@ -211,6 +211,13 @@ finish_event_group(rpl_parallel_thread *rpt, uint64 sub_id,
|
||||
signal_error_to_sql_driver_thread(thd, rgi, err);
|
||||
thd->wait_for_commit_ptr= NULL;
|
||||
|
||||
/*
|
||||
Calls to check_duplicate_gtid() must match up with
|
||||
record_and_update_gtid() (or release_domain_owner() in error case). This
|
||||
assertion tries to catch any missing release of the domain.
|
||||
*/
|
||||
DBUG_ASSERT(rgi->gtid_ignore_duplicate_state != rpl_group_info::GTID_DUPLICATE_OWNER);
|
||||
|
||||
mysql_mutex_lock(&entry->LOCK_parallel_entry);
|
||||
/*
|
||||
We need to mark that this event group started its commit phase, in case we
|
||||
@ -868,7 +875,13 @@ do_retry:
|
||||
});
|
||||
#endif
|
||||
|
||||
rgi->cleanup_context(thd, 1);
|
||||
/*
|
||||
We are still applying the event group, even though we will roll it back
|
||||
and retry it. So for --gtid-ignore-duplicates, keep ownership of the
|
||||
domain during the retry so another master connection will not try to take
|
||||
over and duplicate apply the same event group (MDEV-33475).
|
||||
*/
|
||||
rgi->cleanup_context(thd, 1, 1 /* keep_domain_owner */);
|
||||
wait_for_pending_deadlock_kill(thd, rgi);
|
||||
thd->reset_killed();
|
||||
thd->clear_error();
|
||||
|
Reference in New Issue
Block a user