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

Fix sporadic failure of rpl.rpl_parallel_innodb_lock_conflict

Make sure the table mysql.gtid_slave_pos is altered to InnoDB before
starting parallel replication. The parallel replication of the suppression
insertion in the test case was trying to update the GTID position in
parallel with the ALTER TABLE, which could occasionally deadlock on the MDL
lock.

Reviewed-by: Monty <monty@mariadb.org>
Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
This commit is contained in:
Kristian Nielsen
2025-02-19 10:43:36 +00:00
parent f1d7e0c17e
commit a20c8fabe7
3 changed files with 11 additions and 15 deletions

View File

@@ -1,16 +1,15 @@
***MDEV-5914: Parallel replication deadlock due to InnoDB lock conflicts *** ***MDEV-5914: Parallel replication deadlock due to InnoDB lock conflicts ***
include/master-slave.inc include/master-slave.inc
[connection master] [connection master]
connection server_2; ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
SET sql_log_bin=0; CALL mtr.add_suppression("InnoDB: Transaction was aborted due to ");
CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends"); CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends");
SET sql_log_bin=1; connection server_2;
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
include/stop_slave.inc include/stop_slave.inc
SET GLOBAL slave_parallel_threads=10; SET GLOBAL slave_parallel_threads=10;
CHANGE MASTER TO master_use_gtid=slave_pos; CHANGE MASTER TO master_use_gtid=slave_pos;
connection server_1; connection server_1;
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
CREATE TABLE t4 (a INT PRIMARY KEY, b INT, KEY b_idx(b)) ENGINE=InnoDB; CREATE TABLE t4 (a INT PRIMARY KEY, b INT, KEY b_idx(b)) ENGINE=InnoDB;
INSERT INTO t4 VALUES (1,NULL), (2,2), (3,NULL), (4,4), (5, NULL), (6, 6); INSERT INTO t4 VALUES (1,NULL), (2,2), (3,NULL), (4,4), (5, NULL), (6, 6);
connect con1,127.0.0.1,root,,test,$SERVER_MYPORT_1,; connect con1,127.0.0.1,root,,test,$SERVER_MYPORT_1,;

View File

@@ -1,16 +1,15 @@
***MDEV-5914: Parallel replication deadlock due to InnoDB lock conflicts *** ***MDEV-5914: Parallel replication deadlock due to InnoDB lock conflicts ***
include/master-slave.inc include/master-slave.inc
[connection master] [connection master]
connection server_2; ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
SET sql_log_bin=0; CALL mtr.add_suppression("InnoDB: Transaction was aborted due to ");
CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends"); CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends");
SET sql_log_bin=1; connection server_2;
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
include/stop_slave.inc include/stop_slave.inc
SET GLOBAL slave_parallel_threads=10; SET GLOBAL slave_parallel_threads=10;
CHANGE MASTER TO master_use_gtid=slave_pos; CHANGE MASTER TO master_use_gtid=slave_pos;
connection server_1; connection server_1;
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
CREATE TABLE t4 (a INT PRIMARY KEY, b INT, KEY b_idx(b)) ENGINE=InnoDB; CREATE TABLE t4 (a INT PRIMARY KEY, b INT, KEY b_idx(b)) ENGINE=InnoDB;
INSERT INTO t4 VALUES (1,NULL), (2,2), (3,NULL), (4,4), (5, NULL), (6, 6); INSERT INTO t4 VALUES (1,NULL), (2,2), (3,NULL), (4,4), (5, NULL), (6, 6);
connect con1,127.0.0.1,root,,test,$SERVER_MYPORT_1,; connect con1,127.0.0.1,root,,test,$SERVER_MYPORT_1,;

View File

@@ -5,21 +5,19 @@
--source include/have_debug_sync.inc --source include/have_debug_sync.inc
--source include/master-slave.inc --source include/master-slave.inc
--disable_query_log ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
call mtr.add_suppression("InnoDB: Transaction was aborted due to "); CALL mtr.add_suppression("InnoDB: Transaction was aborted due to ");
--enable_query_log CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends");
--save_master_pos
--connection server_2 --connection server_2
SET sql_log_bin=0; --sync_with_master
CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends");
SET sql_log_bin=1;
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
--source include/stop_slave.inc --source include/stop_slave.inc
SET GLOBAL slave_parallel_threads=10; SET GLOBAL slave_parallel_threads=10;
CHANGE MASTER TO master_use_gtid=slave_pos; CHANGE MASTER TO master_use_gtid=slave_pos;
--connection server_1 --connection server_1
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
CREATE TABLE t4 (a INT PRIMARY KEY, b INT, KEY b_idx(b)) ENGINE=InnoDB; CREATE TABLE t4 (a INT PRIMARY KEY, b INT, KEY b_idx(b)) ENGINE=InnoDB;
INSERT INTO t4 VALUES (1,NULL), (2,2), (3,NULL), (4,4), (5, NULL), (6, 6); INSERT INTO t4 VALUES (1,NULL), (2,2), (3,NULL), (4,4), (5, NULL), (6, 6);
--connect (con1,127.0.0.1,root,,test,$SERVER_MYPORT_1,) --connect (con1,127.0.0.1,root,,test,$SERVER_MYPORT_1,)