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_innodb.inc;
5 source include/have_log_bin.inc;
6 source include/have_binlog_format_row.inc;
7
8 #
9 # Bug #40221 Replication failure on RBR + UPDATE the primary key
10 #
11
12 CREATE TABLE t1 (i int unique) ENGINE=innodb;
13 reset master;
14
15 # part 1: update can cause the dup key
16
17 begin;
18 insert into t1 values (1),(2);
19 --echo *** the following UPDATE query wont generate any updates for the binlog ***
20 --error ER_DUP_ENTRY
21 update t1 set i = 3 where i < 3;
22 commit;
23
24 --echo *** Results of the test: the binlog must have only Write_rows events not any Update_rows ***
25 source include/show_binlog_events.inc;
26
27 # part 2: insert can cause the dup key
28
29 delete from t1;
30 reset master;
31
32 begin;
33 insert into t1 values (1),(2);
34 --echo *** the following UPDATE query wont generate any updates for the binlog ***
35 --error ER_DUP_ENTRY
36 insert into t1 values (3),(4),(1),(2);
37 commit;
38
39 --echo *** Results of the test: the binlog must have only one Write_rows event not two ***
40 source include/show_binlog_events.inc;
41
42 drop table t1;
43
44 #
45 # BUG#51251
46 #
47 # The test case checks if truncating a temporary table created with
48 # engine InnoDB will not cause the truncate statement to be binlogged.
49
50 # Before patch for BUG#51251, the TRUNCATE statements below would be
51 # binlogged, which would cause the slave to fail with "table does not
52 # exist".
53
54 RESET MASTER;
55
56 CREATE TABLE t1 ( c1 int , primary key (c1)) ENGINE=InnoDB;
57 INSERT INTO t1 VALUES (1), (2), (3);
58 CREATE TEMPORARY TABLE IF NOT EXISTS t2 LIKE t1;
59 TRUNCATE TABLE t2;
60 DROP TABLE t1;
61
62 -- echo ###############################################
63 -- echo ### assertion: No event for 'TRUNCATE TABLE t2'
64 -- echo ###############################################
65 -- source include/show_binlog_events.inc
66 -- echo ###############################################
67
68 RESET MASTER;
69
70 CREATE TEMPORARY TABLE t1 (c1 int) Engine=InnoDB;
71 INSERT INTO t1 VALUES (1), (2), (3);
72 TRUNCATE t1;
73 DROP TEMPORARY TABLE t1;
74
75 -- echo ###############################################
76 -- echo ### assertion: No event for 'TRUNCATE TABLE t1'
77 -- echo ###############################################
78 -- source include/show_binlog_events.inc
79 -- echo ###############################################
80
81
82 --echo #
83 --echo # Bug#12346411 SQL/LOG.CC:6509: ASSERTION `PREPARED_XIDS > 0' FAILED
84 --echo #
85
86 --disable_warnings
87 DROP TABLE IF EXISTS t1, t2;
88 --enable_warnings
89
90 CREATE TABLE t1(a INT PRIMARY KEY) engine=innodb;
91 CREATE TABLE t2(a INT) engine=myisam;
92
93 INSERT INTO t1 VALUES (1);
94 START TRANSACTION;
95 INSERT INTO t2 VALUES (1);
96 INSERT IGNORE INTO t1 VALUES (1);
97 COMMIT;
98
99 INSERT INTO t1 VALUES (2);
100 START TRANSACTION;
101 INSERT INTO t2 VALUES (2);
102 UPDATE IGNORE t1 SET a=1 WHERE a=2;
103 COMMIT;
104
105 DROP TABLE t1, t2;