1
include/master-slave.inc
3
call mtr.add_suppression("Slave: Can\'t find record in \'t1\' Error_code: .*");
5
SET @old_slave_exec_mode= @@global.slave_exec_mode;
6
######## Run with slave_exec_mode=STRICT ########
7
SET @@global.slave_exec_mode = 'STRICT';
10
CREATE TABLE t1(a INT PRIMARY KEY);
12
==== Test: SQL thread sees 'INSERT' of existing key ====
13
---- Prepare slave so that it will get duplicate key error ----
14
INSERT INTO t1 VALUES (1);
15
---- Insert rows on master ----
17
INSERT INTO t1 VALUES (1);
22
---- Wait until slave stops with an error ----
23
include/wait_for_slave_sql_error.inc [errno=1062]
24
Last_SQL_Error (expected "duplicate key" error)
25
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 END_LOG_POS
26
call mtr.add_suppression("Slave SQL.*Duplicate entry .1. for key .PRIMARY.* Error_code: 1062");
30
---- Resolve the conflict on the slave and restart SQL thread ----
31
DELETE FROM t1 WHERE a = 1;
32
START SLAVE SQL_THREAD;
33
include/wait_for_slave_sql_to_start.inc
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
call mtr.add_suppression("Slave SQL.*Can.t find record in .t1., Error_code: 1032");
54
include/wait_for_slave_sql_error.inc [errno=1032]
55
Last_SQL_Error (expected "duplicate key" error)
56
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 END_LOG_POS
59
---- Resolve the conflict on the slave and restart SQL thread ----
60
INSERT INTO t1 VALUES (1);
61
START SLAVE SQL_THREAD;
62
include/wait_for_slave_sql_to_start.inc
63
---- Sync slave and verify that there is no error ----
64
Last_SQL_Error = (expected no error)
72
######## Run with slave_exec_mode=IDEMPOTENT ########
73
set @@global.slave_exec_mode= 'IDEMPOTENT';
76
CREATE TABLE t1(a INT PRIMARY KEY);
78
==== Test: SQL thread sees 'INSERT' of existing key ====
79
---- Prepare slave so that it will get duplicate key error ----
80
INSERT INTO t1 VALUES (1);
81
---- Insert rows on master ----
83
INSERT INTO t1 VALUES (1);
88
---- Sync slave and verify that there is no error ----
89
Last_SQL_Error = '' (expected no error)
93
==== Test: SQL thread sees 'DELETE' of non-existing row ====
94
---- On master, insert two rows, the second with binlogging off ----
97
INSERT INTO t1 VALUES (1);
99
DELETE FROM t1 WHERE a = 1;
100
---- On master, remove the row that does not exist on slave ----
102
DELETE FROM t1 WHERE a = 1;
106
---- Sync slave and verify that there is no error ----
107
Last_SQL_Error = (expected no error)
114
SET @@global.slave_exec_mode= @old_slave_exec_mode;