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
9source include/master-slave.inc;
10
11# see if DROP DATABASE is binlogged even if no effect
12connection slave;
13create database mysqltest;
14connection master;
15drop database if exists mysqltest;
16sync_slave_with_master;
17# can't read dir
18--replace_result "Errcode: 1" "Errcode: X" "Errcode: 2" "Errcode: X" \\ /
19--error 1049
20show tables from mysqltest;
21
22# see if DROP TABLE is binlogged even if no effect
23connection slave;
24create table t1 (a int);
25connection master;
26drop table if exists t1;
27sync_slave_with_master;
28# table does not exist
29--error 1146
30select * from t1;
31
32# see if single-table DELETE is binlogged even if no effect
33connection master;
34create table t1 (a int, b int);
35sync_slave_with_master;
36insert into t1 values(1,1);
37connection master;
38delete from t1;
39sync_slave_with_master;
40select * from t1;
41
42# see if single-table UPDATE is binlogged even if no effect
43insert into t1 values(1,1);
44connection master;
45insert into t1 values(2,1);
46update t1 set a=2;
47sync_slave_with_master;
48select * 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
54connection master;
55create table t2 (a int, b int);
56delete from t1;
57insert into t1 values(1,1);
58insert into t2 values(1,1);
59
60sync_slave_with_master;
61# force a difference to see if master's multi-UPDATE will correct it
62update t1 set a=2;
63
64connection master;
65UPDATE t1, t2 SET t1.a = t2.a;
66
67sync_slave_with_master;
68select * from t1;
69select * from t2;
70
71# See if multi-table DELETE is binlogged even if no effect
72
73connection master;
74delete from t1;
75delete from t2;
76
77sync_slave_with_master;
78# force a difference to see if master's multi-DELETE will correct it
79insert into t1 values(1,1);
80insert into t2 values(1,1);
81
82connection master;
83DELETE t1.*, t2.* from t1, t2;
84
85sync_slave_with_master;
86select * from t1;
87select * from t2;
88
89
90# cleanup
91connection master;
92drop table t1, t2;
93sync_slave_with_master;
94--source include/rpl_end.inc
95