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