mirror of
https://github.com/MariaDB/server.git
synced 2025-08-30 11:22:14 +03:00
MDEV-5363: Make parallel replication waits killable
Add another test case. This one for killing a worker while its transaction is waiting to start until the previous transaction has committed. Fix setting reading_or_writing to 0 in worker threads so SHOW SLAVE STATUS can show something more useful than "Reading from net".
This commit is contained in:
@@ -295,6 +295,7 @@ a b
|
||||
SET sql_log_bin=0;
|
||||
CALL mtr.add_suppression("Query execution was interrupted");
|
||||
CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends");
|
||||
CALL mtr.add_suppression("Slave: Connection was killed");
|
||||
SET sql_log_bin=1;
|
||||
SET debug_sync='now WAIT_FOR t2_query';
|
||||
SET debug_sync='now SIGNAL t2_cont';
|
||||
@@ -513,6 +514,120 @@ include/start_slave.inc
|
||||
include/stop_slave.inc
|
||||
SET GLOBAL binlog_format=@old_format;
|
||||
SET GLOBAL slave_parallel_threads=0;
|
||||
SET GLOBAL slave_parallel_threads=3;
|
||||
include/start_slave.inc
|
||||
*** 4. Test killing thread that is waiting to start transaction until previous transaction commits ***
|
||||
SET binlog_format=statement;
|
||||
SET gtid_domain_id=2;
|
||||
INSERT INTO t3 VALUES (60, foo(60,
|
||||
'ha_write_row_end SIGNAL d2_query WAIT_FOR d2_cont2',
|
||||
'rpl_parallel_end_of_group SIGNAL d2_done WAIT_FOR d2_cont'));
|
||||
SET gtid_domain_id=0;
|
||||
SET debug_sync='now WAIT_FOR d2_query';
|
||||
SET gtid_domain_id=1;
|
||||
BEGIN;
|
||||
INSERT INTO t3 VALUES (61, foo(61,
|
||||
'rpl_parallel_start_waiting_for_prior SIGNAL t3_waiting',
|
||||
'rpl_parallel_start_waiting_for_prior_killed SIGNAL t3_killed'));
|
||||
INSERT INTO t3 VALUES (62, foo(62,
|
||||
'ha_write_row_end SIGNAL d1_query WAIT_FOR d1_cont2',
|
||||
'rpl_parallel_end_of_group SIGNAL d1_done WAIT_FOR d1_cont'));
|
||||
COMMIT;
|
||||
SET gtid_domain_id=0;
|
||||
SET debug_sync='now WAIT_FOR d1_query';
|
||||
SET gtid_domain_id=0;
|
||||
INSERT INTO t3 VALUES (63, foo(63,
|
||||
'ha_write_row_end SIGNAL d0_query WAIT_FOR d0_cont2',
|
||||
'rpl_parallel_end_of_group SIGNAL d0_done WAIT_FOR d0_cont'));
|
||||
SET debug_sync='now WAIT_FOR d0_query';
|
||||
SET debug_sync='now SIGNAL d2_cont2';
|
||||
SET debug_sync='now WAIT_FOR d2_done';
|
||||
SET debug_sync='now SIGNAL d1_cont2';
|
||||
SET debug_sync='now WAIT_FOR d1_done';
|
||||
SET debug_sync='now SIGNAL d0_cont2';
|
||||
SET debug_sync='now WAIT_FOR d0_done';
|
||||
SET binlog_format=statement;
|
||||
INSERT INTO t3 VALUES (64, foo(64,
|
||||
'commit_before_prepare_ordered SIGNAL t1_waiting WAIT_FOR t1_cont', ''));
|
||||
SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2 WAIT_FOR master_cont2';
|
||||
INSERT INTO t3 VALUES (65, foo(65, '', ''));
|
||||
SET debug_sync='now WAIT_FOR master_queued2';
|
||||
SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued3';
|
||||
INSERT INTO t3 VALUES (66, foo(66, '', ''));
|
||||
SET debug_sync='now WAIT_FOR master_queued3';
|
||||
SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued4';
|
||||
INSERT INTO t3 VALUES (67, foo(67, '', ''));
|
||||
SET debug_sync='now WAIT_FOR master_queued4';
|
||||
SET debug_sync='now SIGNAL master_cont2';
|
||||
SELECT * FROM t3 WHERE a >= 60 ORDER BY a;
|
||||
a b
|
||||
60 60
|
||||
61 61
|
||||
62 62
|
||||
63 63
|
||||
64 64
|
||||
65 65
|
||||
66 66
|
||||
67 67
|
||||
SET debug_sync='now SIGNAL d0_cont';
|
||||
SET debug_sync='now WAIT_FOR t1_waiting';
|
||||
SET debug_sync='now SIGNAL d1_cont';
|
||||
SET debug_sync='now WAIT_FOR t3_waiting';
|
||||
SET debug_sync='now SIGNAL d2_cont';
|
||||
KILL THD_ID;
|
||||
SET debug_sync='now WAIT_FOR t3_killed';
|
||||
SET debug_sync='now SIGNAL t1_cont';
|
||||
include/wait_for_slave_sql_error.inc [errno=1317,1927,1963]
|
||||
STOP SLAVE IO_THREAD;
|
||||
SELECT * FROM t3 WHERE a >= 60 ORDER BY a;
|
||||
a b
|
||||
60 60
|
||||
61 61
|
||||
62 62
|
||||
63 63
|
||||
64 64
|
||||
SET GLOBAL slave_parallel_threads=0;
|
||||
SET GLOBAL slave_parallel_threads=10;
|
||||
SET sql_log_bin=0;
|
||||
DROP FUNCTION foo;
|
||||
CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500))
|
||||
RETURNS INT DETERMINISTIC
|
||||
BEGIN
|
||||
RETURN x;
|
||||
END
|
||||
||
|
||||
SET sql_log_bin=1;
|
||||
INSERT INTO t3 VALUES (69,0);
|
||||
include/start_slave.inc
|
||||
SELECT * FROM t3 WHERE a >= 60 ORDER BY a;
|
||||
a b
|
||||
60 60
|
||||
61 61
|
||||
62 62
|
||||
63 63
|
||||
64 64
|
||||
65 65
|
||||
66 66
|
||||
67 67
|
||||
69 0
|
||||
SET sql_log_bin=0;
|
||||
DROP FUNCTION foo;
|
||||
CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500))
|
||||
RETURNS INT DETERMINISTIC
|
||||
BEGIN
|
||||
IF d1 != '' THEN
|
||||
SET debug_sync = d1;
|
||||
END IF;
|
||||
IF d2 != '' THEN
|
||||
SET debug_sync = d2;
|
||||
END IF;
|
||||
RETURN x;
|
||||
END
|
||||
||
|
||||
SET sql_log_bin=1;
|
||||
include/stop_slave.inc
|
||||
SET GLOBAL binlog_format=@old_format;
|
||||
SET GLOBAL slave_parallel_threads=0;
|
||||
SET GLOBAL slave_parallel_threads=10;
|
||||
include/start_slave.inc
|
||||
include/stop_slave.inc
|
||||
|
Reference in New Issue
Block a user