1
# Test to see if slave can detect certain known bugs present
2
# on the master, and appropriately decides to stop
3
# (assuming the bug is fixed in the slave, slave cannot of course
4
# imitate the bug, so it has to stop).
6
source include/have_debug.inc;
7
source include/master-slave.inc;
9
# Currently only statement-based-specific bugs are here
10
-- source include/have_binlog_format_mixed_or_statement.inc
13
# This is to test that slave properly detects if
14
# master may suffer from:
15
# BUG#24432 "INSERT... ON DUPLICATE KEY UPDATE skips auto_increment values"
16
# (i.e. on master, INSERT ON DUPLICATE KEY UPDATE is used and manipulates
17
# an auto_increment column, and is binlogged statement-based).
20
# testcase with INSERT VALUES
21
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b INT,
23
sync_slave_with_master;
25
INSERT INTO t1(b) VALUES(1),(1),(2) ON DUPLICATE KEY UPDATE t1.b=10;
28
--source include/wait_for_slave_sql_to_stop.inc
29
# show the error message
30
--replace_column 1 # 4 # 7 # 8 # 9 # 23 # 33 #
31
--query_vertical show slave status;
32
# show that it was not replicated
35
# restart replication for the next testcase
44
# testcase with INSERT SELECT
47
id bigint(20) unsigned NOT NULL auto_increment,
48
field_1 int(10) unsigned NOT NULL,
49
field_2 varchar(255) NOT NULL,
50
field_3 varchar(255) NOT NULL,
52
UNIQUE KEY field_1 (field_1, field_2)
55
field_a int(10) unsigned NOT NULL,
56
field_b varchar(255) NOT NULL,
57
field_c varchar(255) NOT NULL
59
INSERT INTO t2 (field_a, field_b, field_c) VALUES (1, 'a', '1a');
60
INSERT INTO t2 (field_a, field_b, field_c) VALUES (2, 'b', '2b');
61
INSERT INTO t2 (field_a, field_b, field_c) VALUES (3, 'c', '3c');
62
INSERT INTO t2 (field_a, field_b, field_c) VALUES (4, 'd', '4d');
63
INSERT INTO t2 (field_a, field_b, field_c) VALUES (5, 'e', '5e');
64
sync_slave_with_master;
66
# Updating table t1 based on values from table t2
67
INSERT INTO t1 (field_1, field_2, field_3)
68
SELECT t2.field_a, t2.field_b, t2.field_c
70
ON DUPLICATE KEY UPDATE
71
t1.field_3 = t2.field_c;
72
# Inserting new record into t2
73
INSERT INTO t2 (field_a, field_b, field_c) VALUES (6, 'f', '6f');
75
INSERT INTO t1 (field_1, field_2, field_3)
76
SELECT t2.field_a, t2.field_b, t2.field_c
78
ON DUPLICATE KEY UPDATE
79
t1.field_3 = t2.field_c;
82
--source include/wait_for_slave_sql_to_stop.inc
83
# show the error message
84
--replace_column 1 # 4 # 7 # 8 # 9 # 23 # 33 #
85
--query_vertical show slave status;
86
# show that it was not replicated