1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-30423 Deadlock on Replica during BACKUP STAGE BLOCK_COMMIT on XA transactions

The user XA commit execution branch was caught not have been covered
with MDEV-21953 fixes.

The XA involved deadlock is resolved now to apply the former fixes
pattern.
Along the fixes the following changes have been implemented.
- MDL lock attribute correction
- dissociation of the externally completed XA from the current
  thread's xid_state in the error branches
- cleanup_context() preseves the prepared XA
- wait_for_prior_commit() is relocated to satisfy both
  the binlog ON (log-slave-updates and skip-log-bin)
  and OFF slave execution branches.
This commit is contained in:
Andrei
2023-01-19 19:42:24 +02:00
parent 647a7232ff
commit dc646c2389
17 changed files with 786 additions and 37 deletions

View File

@@ -12,6 +12,9 @@
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE = innodb;
--sync_slave_with_master
call mtr.add_suppression("Deadlock found when trying to get lock");
call mtr.add_suppression("Commit failed due to failure of an earlier commit");
--source include/stop_slave.inc
SET @old_parallel_threads= @@GLOBAL.slave_parallel_threads;
SET @old_parallel_mode = @@GLOBAL.slave_parallel_mode;
@@ -61,6 +64,32 @@ BACKUP STAGE END;
--let $diff_tables= master:t1,slave:t1
--source include/diff_tables.inc
#
--echo # MDEV-30423: dealock XA COMMIT vs BACKUP
# Prove XA "COMPLETE" 'xid' does not dealock similary to the normal trx case.
# The slave binlog group commit leader is blocked by a local trx like in
# the above normal trx case.
# [Notice a reuse of t1,aux_conn from above.]
#
--let $complete = COMMIT
--source parallel_backup_xa.inc
--let $complete = ROLLBACK
--source parallel_backup_xa.inc
--let $slave_ooo_error = 1
--let $complete = COMMIT
--source parallel_backup_xa.inc
--connection slave
--source include/start_slave.inc
--source include/sync_with_master_gtid.inc
--let $slave_ooo_error = 1
--let $complete = ROLLBACK
--source parallel_backup_xa.inc
--connection slave
--source include/start_slave.inc
--source include/sync_with_master_gtid.inc
# Clean up.
--connection slave