Debian Codegraph @

mysql-test/suite/binlog/t/binlog_innodb_row.test

raw
1 #
2 # Tests of innodb/binlog with the row binlog format
3 #
4 source include/have_log_bin.inc;
5 source include/have_binlog_format_row.inc;
6
7 #
8 # Bug #40221 Replication failure on RBR + UPDATE the primary key
9 #
10
11 CREATE TABLE t1 (i int unique) ENGINE=innodb;
12 reset master;
13
14 # part 1: update can cause the dup key
15
16 begin;
17 insert into t1 values (1),(2);
18 --echo *** the following UPDATE query wont generate any updates for the binlog ***
19 --error ER_DUP_ENTRY
20 update t1 set i = 3 where i < 3;
21 commit;
22
23 --echo *** Results of the test: the binlog must have only Write_rows events not any Update_rows ***
24 source include/show_binlog_events.inc;
25
26 # part 2: insert can cause the dup key
27
28 delete from t1;
29 reset master;
30
31 begin;
32 insert into t1 values (1),(2);
33 --echo *** the following UPDATE query wont generate any updates for the binlog ***
34 --error ER_DUP_ENTRY
35 insert into t1 values (3),(4),(1),(2);
36 commit;
37
38 --echo *** Results of the test: the binlog must have only one Write_rows event not two ***
39 source include/show_binlog_events.inc;
40
41 drop table t1;
42
43 #
44 # BUG#51251
45 #
46 # The test case checks if truncating a temporary table created with
47 # engine InnoDB will not cause the truncate statement to be binlogged.
48
49 # Before patch for BUG#51251, the TRUNCATE statements below would be
50 # binlogged, which would cause the slave to fail with "table does not
51 # exist".
52
53 RESET MASTER;
54
55 CREATE TABLE t1 ( c1 int , primary key (c1)) ENGINE=InnoDB;
56 INSERT INTO t1 VALUES (1), (2), (3);
57 CREATE TEMPORARY TABLE IF NOT EXISTS t2 LIKE t1;
58 TRUNCATE TABLE t2;
59 DROP TABLE t1;
60
61 -- echo ###############################################
62 -- echo ### assertion: No event for 'TRUNCATE TABLE t2'
63 -- echo ###############################################
64 -- source include/show_binlog_events.inc
65 -- echo ###############################################
66
67 RESET MASTER;
68
69 CREATE TEMPORARY TABLE t1 (c1 int) Engine=InnoDB;
70 INSERT INTO t1 VALUES (1), (2), (3);
71 TRUNCATE t1;
72 DROP TEMPORARY TABLE t1;
73
74 -- echo ###############################################
75 -- echo ### assertion: No event for 'TRUNCATE TABLE t1'
76 -- echo ###############################################
77 -- source include/show_binlog_events.inc
78 -- echo ###############################################
79