mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
MDEV-34042: Deadlock kill of XA PREPARE can break replication / rpl.rpl_parallel_multi_domain_xa sporadic failure
Clear any pending deadlock kill after completing XA PREPARE, and before updating the mysql.gtid_slave_pos table in a separate transaction. Reviewed-by: Andrei Elkin <andrei.elkin@mariadb.com> Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
This commit is contained in:
@ -4209,6 +4209,19 @@ int XA_prepare_log_event::do_commit()
|
|||||||
else
|
else
|
||||||
res= trans_xa_commit(thd);
|
res= trans_xa_commit(thd);
|
||||||
|
|
||||||
|
if (thd->rgi_slave->is_parallel_exec)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
Since the transaction is prepared/committed without updating the GTID pos
|
||||||
|
(MDEV-32020...), we need here to clear any pending deadlock kill.
|
||||||
|
Otherwise if the kill happened after the prepare/commit completed, it
|
||||||
|
might end up killing the subsequent GTID position update, causing the
|
||||||
|
slave to fail with error.
|
||||||
|
*/
|
||||||
|
wait_for_pending_deadlock_kill(thd, thd->rgi_slave);
|
||||||
|
thd->reset_killed();
|
||||||
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
#endif // HAVE_REPLICATION
|
#endif // HAVE_REPLICATION
|
||||||
|
@ -131,7 +131,7 @@ handle_queued_pos_update(THD *thd, rpl_parallel_thread::queued_event *qev)
|
|||||||
asynchronously, we need to be sure they will be completed before starting a
|
asynchronously, we need to be sure they will be completed before starting a
|
||||||
new transaction. Otherwise the new transaction might suffer a spurious kill.
|
new transaction. Otherwise the new transaction might suffer a spurious kill.
|
||||||
*/
|
*/
|
||||||
static void
|
void
|
||||||
wait_for_pending_deadlock_kill(THD *thd, rpl_group_info *rgi)
|
wait_for_pending_deadlock_kill(THD *thd, rpl_group_info *rgi)
|
||||||
{
|
{
|
||||||
PSI_stage_info old_stage;
|
PSI_stage_info old_stage;
|
||||||
|
@ -494,6 +494,7 @@ struct rpl_parallel {
|
|||||||
extern struct rpl_parallel_thread_pool global_rpl_thread_pool;
|
extern struct rpl_parallel_thread_pool global_rpl_thread_pool;
|
||||||
|
|
||||||
|
|
||||||
|
extern void wait_for_pending_deadlock_kill(THD *thd, rpl_group_info *rgi);
|
||||||
extern int rpl_parallel_resize_pool_if_no_slaves(void);
|
extern int rpl_parallel_resize_pool_if_no_slaves(void);
|
||||||
extern int rpl_parallel_activate_pool(rpl_parallel_thread_pool *pool);
|
extern int rpl_parallel_activate_pool(rpl_parallel_thread_pool *pool);
|
||||||
extern int rpl_parallel_inactivate_pool(rpl_parallel_thread_pool *pool);
|
extern int rpl_parallel_inactivate_pool(rpl_parallel_thread_pool *pool);
|
||||||
|
Reference in New Issue
Block a user