1#
2# Tests of innodb/binlog with the row binlog format
3#
4source include/have_innodb.inc;
5source include/have_log_bin.inc;
6source include/have_binlog_format_row.inc;
7
8#
9# Bug #40221 Replication failure on RBR + UPDATE the primary key
10#
11
12CREATE TABLE t1 (i int unique) ENGINE=innodb;
13reset master;
14
15# part 1: update can cause the dup key
16
17begin;
18insert into t1 values (1),(2);
19--echo *** the following UPDATE query wont generate any updates for the binlog ***
20--error ER_DUP_ENTRY
21update t1 set i = 3 where i < 3;
22commit;
23
24--echo *** Results of the test: the binlog must have only Write_rows events not any Update_rows ***
25source include/show_binlog_events.inc;
26
27# part 2: insert can cause the dup key
28
29delete from t1;
30reset master;
31
32begin;
33insert into t1 values (1),(2);
34--echo *** the following UPDATE query wont generate any updates for the binlog ***
35--error ER_DUP_ENTRY
36insert into t1 values (3),(4),(1),(2);
37commit;
38
39--echo *** Results of the test: the binlog must have only one Write_rows event not two ***
40source include/show_binlog_events.inc;
41
42drop 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
54RESET MASTER;
55
56CREATE TABLE t1 ( c1 int , primary key (c1)) ENGINE=InnoDB;
57INSERT INTO t1 VALUES (1), (2), (3);
58CREATE TEMPORARY TABLE IF NOT EXISTS  t2 LIKE t1;
59TRUNCATE TABLE t2;
60DROP 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
68RESET MASTER;
69
70CREATE TEMPORARY TABLE t1 (c1 int) Engine=InnoDB;
71INSERT INTO t1 VALUES (1), (2), (3);
72TRUNCATE t1;
73DROP 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
87DROP TABLE IF EXISTS t1, t2;
88--enable_warnings
89
90CREATE TABLE t1(a INT PRIMARY KEY) engine=innodb;
91CREATE TABLE t2(a INT) engine=myisam;
92
93INSERT INTO t1 VALUES (1);
94START TRANSACTION;
95INSERT INTO t2 VALUES (1);
96INSERT IGNORE INTO t1 VALUES (1);
97COMMIT;
98
99INSERT INTO t1 VALUES (2);
100START TRANSACTION;
101INSERT INTO t2 VALUES (2);
102UPDATE IGNORE t1 SET a=1 WHERE a=2;
103COMMIT;
104
105DROP TABLE t1, t2;
106