| 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). |
| 5 |
|
| 6 |
call mtr.add_suppression("Unsafe statement written to the binary log using statement format"); |
| 7 |
|
| 8 |
source include/have_debug.inc; |
| 9 |
# because of pretend_version_50034_in_binlog the test can't run with checksum |
| 10 |
source include/have_binlog_checksum_off.inc; |
| 11 |
|
| 12 |
# Currently only statement-based-specific bugs are here |
| 13 |
-- source include/have_binlog_format_statement.inc |
| 14 |
|
| 15 |
source include/master-slave.inc; |
| 16 |
|
| 17 |
# testcase with INSERT SELECT |
| 18 |
connection master; |
| 19 |
CREATE TABLE t1 ( |
| 20 |
id bigint(20) unsigned NOT NULL auto_increment, |
| 21 |
field_1 int(10) unsigned NOT NULL, |
| 22 |
field_2 varchar(255) NOT NULL, |
| 23 |
field_3 varchar(255) NOT NULL, |
| 24 |
PRIMARY KEY (id), |
| 25 |
UNIQUE KEY field_1 (field_1, field_2) |
| 26 |
); |
| 27 |
CREATE TABLE t2 ( |
| 28 |
field_a int(10) unsigned NOT NULL, |
| 29 |
field_b varchar(255) NOT NULL, |
| 30 |
field_c varchar(255) NOT NULL |
| 31 |
); |
| 32 |
INSERT INTO t2 (field_a, field_b, field_c) VALUES (1, 'a', '1a'); |
| 33 |
INSERT INTO t2 (field_a, field_b, field_c) VALUES (2, 'b', '2b'); |
| 34 |
INSERT INTO t2 (field_a, field_b, field_c) VALUES (3, 'c', '3c'); |
| 35 |
INSERT INTO t2 (field_a, field_b, field_c) VALUES (4, 'd', '4d'); |
| 36 |
INSERT INTO t2 (field_a, field_b, field_c) VALUES (5, 'e', '5e'); |
| 37 |
sync_slave_with_master; |
| 38 |
connection master; |
| 39 |
# Updating table t1 based on values from table t2 |
| 40 |
INSERT INTO t1 (field_1, field_2, field_3) |
| 41 |
SELECT t2.field_a, t2.field_b, t2.field_c |
| 42 |
FROM t2 |
| 43 |
ON DUPLICATE KEY UPDATE |
| 44 |
t1.field_3 = t2.field_c; |
| 45 |
# Inserting new record into t2 |
| 46 |
INSERT INTO t2 (field_a, field_b, field_c) VALUES (6, 'f', '6f'); |
| 47 |
# Updating t1 again |
| 48 |
INSERT INTO t1 (field_1, field_2, field_3) |
| 49 |
SELECT t2.field_a, t2.field_b, t2.field_c |
| 50 |
FROM t2 |
| 51 |
ON DUPLICATE KEY UPDATE |
| 52 |
t1.field_3 = t2.field_c; |
| 53 |
SELECT * FROM t1; |
| 54 |
connection slave; |
| 55 |
|
| 56 |
# show the error message |
| 57 |
#1105 = ER_UNKNOWN_ERROR |
| 58 |
--let $slave_sql_errno= 1105 |
| 59 |
--let $show_slave_sql_error= 1 |
| 60 |
--source include/wait_for_slave_sql_error.inc |
| 61 |
|
| 62 |
# show that it was not replicated |
| 63 |
SELECT * FROM t1; |
| 64 |
connection master; |
| 65 |
|
| 66 |
# clean up |
| 67 |
drop table t1, t2; |
| 68 |
connection slave; |
| 69 |
drop table t1, t2; |
| 70 |
# clear error message in sql thread |
| 71 |
--source include/stop_slave_io.inc |
| 72 |
RESET SLAVE; |
| 73 |
|
| 74 |
# End of 5.0 tests |
| 75 |
--let $rpl_only_running_threads= 1 |
| 76 |
--source include/rpl_end.inc |