| 1 |
# Test for |
| 2 |
# Bug #797: If a query is ignored on slave (replicate-ignore-table) the slave |
| 3 |
# still checks that it has the same error as on the master. |
| 4 |
########################################################################## |
| 5 |
|
| 6 |
-- source include/master-slave.inc |
| 7 |
|
| 8 |
-- disable_query_log |
| 9 |
CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT."); |
| 10 |
-- enable_query_log |
| 11 |
|
| 12 |
connection master; |
| 13 |
create table t1 (a int primary key); |
| 14 |
create table t4 (a int primary key); |
| 15 |
# generate an error that goes to the binlog |
| 16 |
--error 1022, ER_DUP_ENTRY |
| 17 |
insert into t1 values (1),(1); |
| 18 |
insert into t4 values (1),(2); |
| 19 |
# as the t1 table is ignored on the slave, the slave should be able to sync |
| 20 |
sync_slave_with_master; |
| 21 |
# check that the table has been ignored, because otherwise the test is nonsense |
| 22 |
show tables like 't1'; |
| 23 |
show tables like 't4'; |
| 24 |
SELECT * FROM test.t4 ORDER BY a; |
| 25 |
connection master; |
| 26 |
drop table t1; |
| 27 |
sync_slave_with_master; |
| 28 |
|
| 29 |
# Now test that even critical errors (connection killed) |
| 30 |
# are ignored if rules allow it. |
| 31 |
# The "kill" idea was copied from rpl000001.test. |
| 32 |
|
| 33 |
connection master1; |
| 34 |
select get_lock('crash_lock%20C', 10); |
| 35 |
|
| 36 |
connection master; |
| 37 |
create table t2 (a int primary key); |
| 38 |
insert into t2 values(1); |
| 39 |
create table t3 (id int); |
| 40 |
insert into t3 values(connection_id()); |
| 41 |
send update t2 set a = a + 1 + get_lock('crash_lock%20C', 10); |
| 42 |
|
| 43 |
connection master1; |
| 44 |
let $wait_condition= SELECT count(*) > 0 FROM information_schema.processlist WHERE info LIKE 'update%' AND state='User lock'; |
| 45 |
source include/wait_condition.inc; |
| 46 |
select (@id := id) - id from t3; |
| 47 |
kill @id; |
| 48 |
let $id= `SELECT @id`; |
| 49 |
let $wait_condition= SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE ID = $id; |
| 50 |
source include/wait_condition.inc; |
| 51 |
drop table t2,t3; |
| 52 |
insert into t4 values (3),(4); |
| 53 |
connection master; |
| 54 |
# The get_lock function causes warning for unsafe statement. |
| 55 |
--disable_warnings |
| 56 |
--error 0,1317,2013 |
| 57 |
reap; |
| 58 |
--enable_warnings |
| 59 |
connection master1; |
| 60 |
sync_slave_with_master; |
| 61 |
SELECT * FROM test.t4 ORDER BY a; |
| 62 |
|
| 63 |
connection master1; |
| 64 |
DROP TABLE test.t4; |
| 65 |
sync_slave_with_master; |
| 66 |
# End of 4.1 tests |
| 67 |
# Adding comment for force manual merge 5.0 -> wl1012. delete me if needed |
| 68 |
|
| 69 |
|
| 70 |
--source include/rpl_end.inc |