| 1 |
# It's true only in statement-based replication that a statement which |
| 2 |
# updates no rows (UPDATE/DELETE) is binlogged; in row-based |
| 3 |
# replication, as we log modified rows, nothing is binlogged in this |
| 4 |
# case. So this test is meaningul only in statement-based (and if it was |
| 5 |
# enabled in row-based, it would fail as expected). |
| 6 |
|
| 7 |
-- source include/have_binlog_format_mixed_or_statement.inc |
| 8 |
|
| 9 |
source include/master-slave.inc; |
| 10 |
|
| 11 |
# see if DROP DATABASE is binlogged even if no effect |
| 12 |
connection slave; |
| 13 |
create database mysqltest; |
| 14 |
connection master; |
| 15 |
drop database if exists mysqltest; |
| 16 |
--source include/sync_slave_sql_with_master.inc |
| 17 |
# can't read dir |
| 18 |
--replace_result "Errcode: 1" "Errcode: X" "Errcode: 2" "Errcode: X" \\ / |
| 19 |
--error 1049 |
| 20 |
show tables from mysqltest; |
| 21 |
|
| 22 |
# see if DROP TABLE is binlogged even if no effect |
| 23 |
connection slave; |
| 24 |
create table t1 (a int); |
| 25 |
connection master; |
| 26 |
drop table if exists t1; |
| 27 |
--source include/sync_slave_sql_with_master.inc |
| 28 |
# table does not exist |
| 29 |
--error 1146 |
| 30 |
select * from t1; |
| 31 |
|
| 32 |
# see if single-table DELETE is binlogged even if no effect |
| 33 |
connection master; |
| 34 |
create table t1 (a int, b int); |
| 35 |
--source include/sync_slave_sql_with_master.inc |
| 36 |
insert into t1 values(1,1); |
| 37 |
connection master; |
| 38 |
delete from t1; |
| 39 |
--source include/sync_slave_sql_with_master.inc |
| 40 |
select * from t1; |
| 41 |
|
| 42 |
# see if single-table UPDATE is binlogged even if no effect |
| 43 |
insert into t1 values(1,1); |
| 44 |
connection master; |
| 45 |
insert into t1 values(2,1); |
| 46 |
update t1 set a=2; |
| 47 |
--source include/sync_slave_sql_with_master.inc |
| 48 |
select * from t1; |
| 49 |
|
| 50 |
# End of 4.1 tests |
| 51 |
|
| 52 |
# see if multi-table UPDATE is binlogged even if no effect (BUG#13348) |
| 53 |
|
| 54 |
connection master; |
| 55 |
create table t2 (a int, b int); |
| 56 |
delete from t1; |
| 57 |
insert into t1 values(1,1); |
| 58 |
insert into t2 values(1,1); |
| 59 |
|
| 60 |
--source include/sync_slave_sql_with_master.inc |
| 61 |
# force a difference to see if master's multi-UPDATE will correct it |
| 62 |
update t1 set a=2; |
| 63 |
|
| 64 |
connection master; |
| 65 |
UPDATE t1, t2 SET t1.a = t2.a; |
| 66 |
|
| 67 |
--source include/sync_slave_sql_with_master.inc |
| 68 |
select * from t1; |
| 69 |
select * from t2; |
| 70 |
|
| 71 |
# See if multi-table DELETE is binlogged even if no effect |
| 72 |
|
| 73 |
connection master; |
| 74 |
delete from t1; |
| 75 |
delete from t2; |
| 76 |
|
| 77 |
--source include/sync_slave_sql_with_master.inc |
| 78 |
# force a difference to see if master's multi-DELETE will correct it |
| 79 |
insert into t1 values(1,1); |
| 80 |
insert into t2 values(1,1); |
| 81 |
|
| 82 |
connection master; |
| 83 |
DELETE t1.*, t2.* from t1, t2; |
| 84 |
|
| 85 |
--source include/sync_slave_sql_with_master.inc |
| 86 |
select * from t1; |
| 87 |
select * from t2; |
| 88 |
|
| 89 |
|
| 90 |
# cleanup |
| 91 |
connection master; |
| 92 |
drop table t1, t2; |
| 93 |
--source include/sync_slave_sql_with_master.inc |
| 94 |
--source include/rpl_end.inc |