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;
29 # show the error message
30 #1105 = ER_UNKNOWN_ERROR
31 --let $slave_sql_errno= 1105
32 --let $show_slave_sql_error= 1
33 call mtr.add_suppression("Slave SQL.*suffer.*http:..bugs.mysql.com.bug.php.id=24432");
34 --source include/wait_for_slave_sql_error.inc
35 # show that it was not replicated
38 # restart replication for the next testcase
47 # testcase with INSERT SELECT
50 id bigint(20) unsigned NOT NULL auto_increment,
51 field_1 int(10) unsigned NOT NULL,
52 field_2 varchar(255) NOT NULL,
53 field_3 varchar(255) NOT NULL,
55 UNIQUE KEY field_1 (field_1, field_2)
58 field_a int(10) unsigned NOT NULL,
59 field_b varchar(255) NOT NULL,
60 field_c varchar(255) NOT NULL
62 INSERT INTO t2 (field_a, field_b, field_c) VALUES (1, 'a', '1a');
63 INSERT INTO t2 (field_a, field_b, field_c) VALUES (2, 'b', '2b');
64 INSERT INTO t2 (field_a, field_b, field_c) VALUES (3, 'c', '3c');
65 INSERT INTO t2 (field_a, field_b, field_c) VALUES (4, 'd', '4d');
66 INSERT INTO t2 (field_a, field_b, field_c) VALUES (5, 'e', '5e');
67 sync_slave_with_master;
69 # Updating table t1 based on values from table t2
70 INSERT INTO t1 (field_1, field_2, field_3)
71 SELECT t2.field_a, t2.field_b, t2.field_c
73 ON DUPLICATE KEY UPDATE
74 t1.field_3 = t2.field_c;
75 # Inserting new record into t2
76 INSERT INTO t2 (field_a, field_b, field_c) VALUES (6, 'f', '6f');
78 INSERT INTO t1 (field_1, field_2, field_3)
79 SELECT t2.field_a, t2.field_b, t2.field_c
81 ON DUPLICATE KEY UPDATE
82 t1.field_3 = t2.field_c;
86 # show the error message
87 #1105 = ER_UNKNOWN_ERROR
88 --let $slave_sql_errno= 1105
89 --let $show_slave_sql_error= 1
90 --source include/wait_for_slave_sql_error.inc
92 # show that it was not replicated
100 # clear error message in sql thread
101 --source include/stop_slave_io.inc
105 --let $rpl_only_running_threads= 1
106 --source include/rpl_end.inc