| 1 |
include/rpl_init.inc [topology=1->2] |
| 2 |
*** Test killing transaction waiting in commit for previous transaction to commit, when not using 2-phase commit *** |
| 3 |
connection server_2; |
| 4 |
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; |
| 5 |
include/stop_slave.inc |
| 6 |
SET GLOBAL slave_parallel_threads=10; |
| 7 |
CHANGE MASTER TO master_use_gtid=slave_pos; |
| 8 |
include/start_slave.inc |
| 9 |
connection server_1; |
| 10 |
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; |
| 11 |
SET sql_log_bin=0; |
| 12 |
CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) |
| 13 |
RETURNS INT DETERMINISTIC |
| 14 |
BEGIN |
| 15 |
RETURN x; |
| 16 |
END |
| 17 |
|| |
| 18 |
SET sql_log_bin=1; |
| 19 |
CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; |
| 20 |
connection server_2; |
| 21 |
SET sql_log_bin=0; |
| 22 |
CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) |
| 23 |
RETURNS INT DETERMINISTIC |
| 24 |
BEGIN |
| 25 |
IF d1 != '' THEN |
| 26 |
SET debug_sync = d1; |
| 27 |
END IF; |
| 28 |
IF d2 != '' THEN |
| 29 |
SET debug_sync = d2; |
| 30 |
END IF; |
| 31 |
RETURN x; |
| 32 |
END |
| 33 |
|| |
| 34 |
SET sql_log_bin=1; |
| 35 |
connect con_temp3,127.0.0.1,root,,test,$SERVER_MYPORT_1,; |
| 36 |
SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; |
| 37 |
SET binlog_format=statement; |
| 38 |
SET debug_dbug='+d,row_ins_row_level'; |
| 39 |
INSERT INTO t3 VALUES (31, foo(31, |
| 40 |
'ha_commit_one_phase WAIT_FOR t2_waiting', |
| 41 |
'commit_one_phase_2 SIGNAL t1_ready WAIT_FOR t1_cont')); |
| 42 |
connection server_1; |
| 43 |
SET debug_sync='now WAIT_FOR master_queued1'; |
| 44 |
connect con_temp4,127.0.0.1,root,,test,$SERVER_MYPORT_1,; |
| 45 |
SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; |
| 46 |
SET binlog_format=statement; |
| 47 |
SET debug_dbug='+d,row_ins_row_level'; |
| 48 |
BEGIN; |
| 49 |
INSERT INTO t3 VALUES (32, foo(32, |
| 50 |
'ha_write_row_end SIGNAL t2_query WAIT_FOR t2_cont', |
| 51 |
'')); |
| 52 |
INSERT INTO t3 VALUES (33, foo(33, |
| 53 |
'wait_for_prior_commit_waiting SIGNAL t2_waiting', |
| 54 |
'wait_for_prior_commit_killed SIGNAL t2_killed')); |
| 55 |
COMMIT; |
| 56 |
connection server_1; |
| 57 |
SET debug_sync='now WAIT_FOR master_queued2'; |
| 58 |
connect con_temp5,127.0.0.1,root,,test,$SERVER_MYPORT_1,; |
| 59 |
SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued3'; |
| 60 |
SET binlog_format=statement; |
| 61 |
SET debug_dbug='+d,row_ins_row_level'; |
| 62 |
INSERT INTO t3 VALUES (34, foo(34, |
| 63 |
'', |
| 64 |
'')); |
| 65 |
connection server_1; |
| 66 |
SET debug_sync='now WAIT_FOR master_queued3'; |
| 67 |
SET debug_sync='now SIGNAL master_cont1'; |
| 68 |
connection con_temp3; |
| 69 |
connection con_temp4; |
| 70 |
connection con_temp5; |
| 71 |
connection server_1; |
| 72 |
SELECT * FROM t3 WHERE a >= 30 ORDER BY a; |
| 73 |
a b |
| 74 |
31 31 |
| 75 |
32 32 |
| 76 |
33 33 |
| 77 |
34 34 |
| 78 |
connection server_2; |
| 79 |
SET sql_log_bin=0; |
| 80 |
CALL mtr.add_suppression("Query execution was interrupted"); |
| 81 |
CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends"); |
| 82 |
CALL mtr.add_suppression("Slave: Connection was killed"); |
| 83 |
SET sql_log_bin=1; |
| 84 |
SET debug_sync='now WAIT_FOR t2_query'; |
| 85 |
SET debug_sync='now SIGNAL t2_cont'; |
| 86 |
SET debug_sync='now WAIT_FOR t1_ready'; |
| 87 |
KILL THD_ID; |
| 88 |
SET debug_sync='now WAIT_FOR t2_killed'; |
| 89 |
SET debug_sync='now SIGNAL t1_cont'; |
| 90 |
include/wait_for_slave_sql_error.inc [errno=1317,1927,1963] |
| 91 |
STOP SLAVE IO_THREAD; |
| 92 |
SELECT * FROM t3 WHERE a >= 30 ORDER BY a; |
| 93 |
a b |
| 94 |
31 31 |
| 95 |
SET GLOBAL slave_parallel_threads=0; |
| 96 |
SET GLOBAL slave_parallel_threads=10; |
| 97 |
SET sql_log_bin=0; |
| 98 |
DROP FUNCTION foo; |
| 99 |
CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) |
| 100 |
RETURNS INT DETERMINISTIC |
| 101 |
BEGIN |
| 102 |
RETURN x; |
| 103 |
END |
| 104 |
|| |
| 105 |
SET sql_log_bin=1; |
| 106 |
connection server_1; |
| 107 |
INSERT INTO t3 VALUES (39,0); |
| 108 |
connection server_2; |
| 109 |
include/start_slave.inc |
| 110 |
SELECT * FROM t3 WHERE a >= 30 ORDER BY a; |
| 111 |
a b |
| 112 |
31 31 |
| 113 |
32 32 |
| 114 |
33 33 |
| 115 |
34 34 |
| 116 |
39 0 |
| 117 |
SET sql_log_bin=0; |
| 118 |
DROP FUNCTION foo; |
| 119 |
CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) |
| 120 |
RETURNS INT DETERMINISTIC |
| 121 |
BEGIN |
| 122 |
IF d1 != '' THEN |
| 123 |
SET debug_sync = d1; |
| 124 |
END IF; |
| 125 |
IF d2 != '' THEN |
| 126 |
SET debug_sync = d2; |
| 127 |
END IF; |
| 128 |
RETURN x; |
| 129 |
END |
| 130 |
|| |
| 131 |
SET sql_log_bin=1; |
| 132 |
connection server_2; |
| 133 |
include/stop_slave.inc |
| 134 |
SET GLOBAL slave_parallel_threads=0; |
| 135 |
SET GLOBAL slave_parallel_threads=10; |
| 136 |
include/start_slave.inc |
| 137 |
connection server_2; |
| 138 |
include/stop_slave.inc |
| 139 |
SET GLOBAL slave_parallel_threads=@old_parallel_threads; |
| 140 |
SET debug_sync = 'reset'; |
| 141 |
include/start_slave.inc |
| 142 |
connection server_1; |
| 143 |
DROP function foo; |
| 144 |
DROP TABLE t3; |
| 145 |
SET debug_sync = 'reset'; |
| 146 |
include/rpl_end.inc |