mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
MDEV-8113: Parallel slave: slave hangs on ALTER TABLE (or other DDL) as the first event after slave start
In optimistic parallel replication, it is not safe to try to run a following transaction in parallel with a DDL statement, and there is code to prevent this. However, the code was missing the case where the DDL is the very first event after slave start. In this case, following transactions could run in parallel with the DDL, which can cause the slave to hang or even corrupt slave in unlucky cases.
This commit is contained in:
@ -429,6 +429,33 @@ SET GLOBAL debug_dbug= @old_debug;
|
||||
--source include/start_slave.inc
|
||||
|
||||
|
||||
--echo *** MDEV-8113: ALTER TABLE causes slave hang in optimistic parallel replication ***
|
||||
|
||||
--connection server_2
|
||||
--source include/stop_slave.inc
|
||||
|
||||
--connection server_1
|
||||
ALTER TABLE t2 ADD c INT;
|
||||
INSERT INTO t2 (a,b) VALUES (50, 0);
|
||||
INSERT INTO t2 (a,b) VALUES (51, 1);
|
||||
INSERT INTO t2 (a,b) VALUES (52, 2);
|
||||
INSERT INTO t2 (a,b) VALUES (53, 3);
|
||||
INSERT INTO t2 (a,b) VALUES (54, 4);
|
||||
INSERT INTO t2 (a,b) VALUES (55, 5);
|
||||
INSERT INTO t2 (a,b) VALUES (56, 6);
|
||||
INSERT INTO t2 (a,b) VALUES (57, 7);
|
||||
INSERT INTO t2 (a,b) VALUES (58, 8);
|
||||
INSERT INTO t2 (a,b) VALUES (59, 9);
|
||||
ALTER TABLE t2 DROP COLUMN c;
|
||||
SELECT * FROM t2 WHERE a >= 50 ORDER BY a;
|
||||
--source include/save_master_gtid.inc
|
||||
|
||||
--connection server_2
|
||||
--source include/start_slave.inc
|
||||
--source include/sync_with_master_gtid.inc
|
||||
SELECT * FROM t2 WHERE a >= 50 ORDER BY a;
|
||||
|
||||
|
||||
# Clean up.
|
||||
|
||||
--connection server_2
|
||||
|
Reference in New Issue
Block a user