mirror of
https://github.com/MariaDB/server.git
synced 2025-11-28 17:36:30 +03:00
Follow-up patch, fixing a possible deadlock issue. If the master crashes in the middle of an event group, there can be an active transaction in a worker thread when we encounter the following master restart format description event. In this case, we need to notify that worker thread to abort and roll back the partial event group. Otherwise a deadlock occurs: the worker thread waits for the commit that never arrives, and the SQL driver thread waits for the worker thread to complete its event group, which it never does.
124 lines
3.5 KiB
Plaintext
124 lines
3.5 KiB
Plaintext
include/rpl_init.inc [topology=1->2]
|
|
*** MDEV-6321: close_temporary_tables() in format description event not serialised correctly ***
|
|
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
|
|
include/stop_slave.inc
|
|
SET GLOBAL slave_parallel_threads=5;
|
|
CHANGE MASTER TO master_use_gtid= current_pos;
|
|
include/start_slave.inc
|
|
CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(100) CHARACTER SET utf8);
|
|
include/stop_slave.inc
|
|
SET gtid_domain_id= 1;
|
|
INSERT INTO t1 VALUES (1, 0);
|
|
CREATE TEMPORARY TABLE t2 (a int);
|
|
SET gtid_domain_id= 2;
|
|
CREATE TEMPORARY TABLE t3 (a INT PRIMARY KEY);
|
|
CREATE TEMPORARY TABLE t4 (a int);
|
|
INSERT INTO t3 VALUES (100);
|
|
INSERT INTO t4 SELECT a+1 FROM t3;
|
|
INSERT INTO t2 VALUES (2), (4), (6), (8), (10), (12), (14), (16), (18), (20);
|
|
INSERT INTO t2 VALUES (3), (6), (9), (12), (15), (18);
|
|
INSERT INTO t2 VALUES (4), (8), (12), (16), (20);
|
|
INSERT INTO t3 SELECT a+2 FROM t4;
|
|
INSERT INTO t4 SELECT a+4 FROM t3;
|
|
INSERT INTO t2 VALUES (5), (10), (15), (20);
|
|
INSERT INTO t2 VALUES (6), (12), (18);
|
|
INSERT INTO t2 VALUES (7), (14);
|
|
INSERT INTO t2 VALUES (8), (16);
|
|
INSERT INTO t2 VALUES (9), (18);
|
|
INSERT INTO t2 VALUES (10), (20);
|
|
INSERT INTO t3 SELECT a+8 FROM t4;
|
|
INSERT INTO t4 SELECT a+16 FROM t3;
|
|
INSERT INTO t2 VALUES (11);
|
|
INSERT INTO t2 VALUES (12);
|
|
INSERT INTO t2 VALUES (13);
|
|
INSERT INTO t3 SELECT a+32 FROM t4;
|
|
INSERT INTO t2 VALUES (14);
|
|
INSERT INTO t2 VALUES (15);
|
|
INSERT INTO t2 VALUES (16);
|
|
INSERT INTO t4 SELECT a+64 FROM t3;
|
|
INSERT INTO t2 VALUES (17);
|
|
INSERT INTO t2 VALUES (18);
|
|
INSERT INTO t2 VALUES (19);
|
|
INSERT INTO t3 SELECT a+128 FROM t4;
|
|
INSERT INTO t2 VALUES (20);
|
|
INSERT INTO t1 SELECT a, a MOD 7 FROM t3;
|
|
INSERT INTO t1 SELECT a, a MOD 7 FROM t4;
|
|
INSERT INTO t1 SELECT a, COUNT(*) FROM t2 GROUP BY a;
|
|
FLUSH TABLES;
|
|
SET SESSION debug_dbug="+d,crash_dispatch_command_before";
|
|
SELECT 1;
|
|
Got one of the listed errors
|
|
INSERT INTO t1 VALUES (0, 1);
|
|
include/start_slave.inc
|
|
SELECT * FROM t1 WHERE a <= 20 ORDER BY a;
|
|
a b
|
|
0 1
|
|
1 0
|
|
2 1
|
|
3 1
|
|
4 2
|
|
5 1
|
|
6 3
|
|
7 1
|
|
8 3
|
|
9 2
|
|
10 3
|
|
11 1
|
|
12 5
|
|
13 1
|
|
14 3
|
|
15 3
|
|
16 4
|
|
17 1
|
|
18 5
|
|
19 1
|
|
20 5
|
|
SELECT COUNT(*) FROM t1 WHERE a BETWEEN 100+0 AND 100+256;
|
|
COUNT(*)
|
|
55
|
|
SHOW STATUS LIKE 'Slave_open_temp_tables';
|
|
Variable_name Value
|
|
Slave_open_temp_tables 0
|
|
*** Test that if master logged partial event group before crash, we finish that group correctly before executing format description event ***
|
|
include/stop_slave.inc
|
|
CALL mtr.add_suppression("Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them");
|
|
SET gtid_domain_id= 1;
|
|
DELETE FROM t1;
|
|
ALTER TABLE t1 ENGINE=InnoDB;
|
|
CREATE TEMPORARY TABLE t2 (a INT PRIMARY KEY);
|
|
INSERT INTO t2 VALUES (1);
|
|
INSERT INTO t2 VALUES (2);
|
|
SET gtid_domain_id= 2;
|
|
CREATE TEMPORARY TABLE t3 (a INT PRIMARY KEY);
|
|
INSERT INTO t3 VALUES (10);
|
|
INSERT INTO t3 VALUES (20);
|
|
INSERT INTO t1 SELECT a, 'server_1' FROM t2;
|
|
INSERT INTO t1 SELECT a, 'default' FROM t3;
|
|
INSERT INTO t1 SELECT a+2, '+server_1' FROM t2;
|
|
FLUSH TABLES;
|
|
SET SESSION debug_dbug="+d,crash_before_writing_xid";
|
|
INSERT INTO t1 SELECT a+4, '++server_1' FROM t2;
|
|
Got one of the listed errors
|
|
INSERT INTO t1 VALUES (0, 1);
|
|
include/save_master_gtid.inc
|
|
include/start_slave.inc
|
|
include/sync_with_master_gtid.inc
|
|
SELECT * FROM t1 ORDER BY a;
|
|
a b
|
|
0 1
|
|
1 server_1
|
|
2 server_1
|
|
3 +server_1
|
|
4 +server_1
|
|
10 default
|
|
20 default
|
|
SHOW STATUS LIKE 'Slave_open_temp_tables';
|
|
Variable_name Value
|
|
Slave_open_temp_tables 0
|
|
FLUSH LOGS;
|
|
include/stop_slave.inc
|
|
SET GLOBAL slave_parallel_threads=@old_parallel_threads;
|
|
include/start_slave.inc
|
|
DROP TABLE t1;
|
|
include/rpl_end.inc
|