2
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
5
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
7
call mtr.add_suppression("Slave: Can\'t find record in \'t1\' Error_code: .*");
9
SET @old_slave_exec_mode= @@global.slave_exec_mode;
10
######## Run with slave_exec_mode=STRICT ########
11
SET @@global.slave_exec_mode = 'STRICT';
14
CREATE TABLE t1(a INT PRIMARY KEY);
16
==== Test: SQL thread sees 'INSERT' of existing key ====
17
---- Prepare slave so that it will get duplicate key error ----
18
INSERT INTO t1 VALUES (1);
19
---- Insert rows on master ----
21
INSERT INTO t1 VALUES (1);
26
---- Wait until slave stops with an error ----
27
Last_SQL_Error = Could not execute Write_rows event on table test.t1; Duplicate entry '1' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log master-bin.000001, end_log_pos 346 (expected "duplicate key" error)
31
---- Resolve the conflict on the slave and restart SQL thread ----
32
DELETE FROM t1 WHERE a = 1;
33
START SLAVE SQL_THREAD;
34
---- Sync slave and verify that there is no error ----
35
Last_SQL_Error = '' (expected no error)
39
==== Test: SQL thread sees 'DELETE' of non-existing row ====
40
---- On master, insert two rows, the second with binlogging off ----
43
INSERT INTO t1 VALUES (1);
45
DELETE FROM t1 WHERE a = 1;
46
---- On master, remove the row that does not exist on slave ----
48
DELETE FROM t1 WHERE a = 1;
52
---- Wait until slave stops with an error ----
53
Last_SQL_Error = Could not execute Delete_rows event on table test.t1; Can't find record in 't1', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log master-bin.000001, end_log_pos 982 (expected "can't find record" error)
56
---- Resolve the conflict on the slave and restart SQL thread ----
57
INSERT INTO t1 VALUES (1);
58
START SLAVE SQL_THREAD;
59
---- Sync slave and verify that there is no error ----
60
Last_SQL_Error = (expected no error)
67
######## Run with slave_exec_mode=IDEMPOTENT ########
68
set @@global.slave_exec_mode= 'IDEMPOTENT';
71
CREATE TABLE t1(a INT PRIMARY KEY);
73
==== Test: SQL thread sees 'INSERT' of existing key ====
74
---- Prepare slave so that it will get duplicate key error ----
75
INSERT INTO t1 VALUES (1);
76
---- Insert rows on master ----
78
INSERT INTO t1 VALUES (1);
83
---- Sync slave and verify that there is no error ----
84
Last_SQL_Error = '' (expected no error)
88
==== Test: SQL thread sees 'DELETE' of non-existing row ====
89
---- On master, insert two rows, the second with binlogging off ----
92
INSERT INTO t1 VALUES (1);
94
DELETE FROM t1 WHERE a = 1;
95
---- On master, remove the row that does not exist on slave ----
97
DELETE FROM t1 WHERE a = 1;
101
---- Sync slave and verify that there is no error ----
102
Last_SQL_Error = (expected no error)
109
SET @@global.slave_exec_mode= @old_slave_exec_mode;