| 1 |
SET @old_isolation_level= @@session.transaction_isolation; |
| 2 |
SET @@session.transaction_isolation= 'READ-COMMITTED'; |
| 3 |
CREATE DATABASE b42829; |
| 4 |
use b42829; |
| 5 |
CREATE TABLE t1 (x int, y int) engine=InnoDB; |
| 6 |
CREATE TABLE t2 (x int, y int) engine=InnoDB; |
| 7 |
CREATE DATABASE b42829_filtered; |
| 8 |
use b42829_filtered; |
| 9 |
CREATE TABLE t1 (x int, y int) engine=InnoDB; |
| 10 |
CREATE TABLE t2 (x int, y int) engine=InnoDB; |
| 11 |
SET @@session.sql_log_bin= 0; |
| 12 |
INSERT INTO b42829_filtered.t1 VALUES (100,100); |
| 13 |
INSERT INTO b42829.t1 VALUES (100,100); |
| 14 |
SET @@session.sql_log_bin= 1; |
| 15 |
### assertion: the inserts will not raise log error because |
| 16 |
### binlog-do-db is filtering used database |
| 17 |
INSERT INTO t2 VALUES (1,2), (1,3), (1,4); |
| 18 |
INSERT INTO t1 SELECT * FROM t2; |
| 19 |
### assertion: assert that despite updating a not filtered |
| 20 |
### database this wont trigger an error as the |
| 21 |
### used database is the filtered one. |
| 22 |
UPDATE b42829_filtered.t1 ft1, b42829.t1 nft1 SET ft1.x=1, nft1.x=2; |
| 23 |
use b42829; |
| 24 |
### assertion: the statements *will* raise log error because |
| 25 |
### binlog-do-db is not filtering used database |
| 26 |
BEGIN; |
| 27 |
INSERT INTO t2 VALUES (1,2), (1,3), (1,4); |
| 28 |
ERROR HY000: Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED. |
| 29 |
UPDATE b42829_filtered.t1 ft1, b42829.t1 nft1 SET ft1.x=1, nft1.x=2; |
| 30 |
ERROR HY000: Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED. |
| 31 |
INSERT INTO t1 SELECT * FROM t2; |
| 32 |
ERROR HY000: Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED. |
| 33 |
COMMIT; |
| 34 |
### assertion: filtered events did not make into the binlog |
| 35 |
include/show_binlog_events.inc |
| 36 |
Log_name Pos Event_type Server_id End_log_pos Info |
| 37 |
binlog.000001 # Query # # CREATE DATABASE b42829 |
| 38 |
binlog.000001 # Query # # use `b42829`; CREATE TABLE t1 (x int, y int) engine=InnoDB |
| 39 |
binlog.000001 # Query # # use `b42829`; CREATE TABLE t2 (x int, y int) engine=InnoDB |
| 40 |
DROP DATABASE b42829; |
| 41 |
DROP DATABASE b42829_filtered; |
| 42 |
SET @@session.transaction_isolation= @old_isolation_level; |