Description:
I was rewritting the rpl_loaddata_m.test to work with SBR and RBR when I found this.
Test looks like:
-- source include/master-slave.inc
--disable_warnings
drop database if exists mysqltest;
--enable_warnings
connection master;
# 'test' database should be ignored by the slave
USE test;
CREATE TABLE t1(a INT, b INT, UNIQUE(b));
LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE test.t1;
SELECT COUNT(*) FROM test.t1;
# 'mysqltest' database should NOT be ignored by the slave
CREATE DATABASE mysqltest;
USE mysqltest;
CREATE TABLE t1(a INT, b INT, UNIQUE(b));
LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE mysqltest.t1;
SELECT COUNT(*) FROM mysqltest.t1;
# Now lets check the slave to see what we have :-)
save_master_pos;
connection slave;
sync_with_master;
SHOW DATABASES;
USE test;
SHOW TABLES;
USE mysqltest;
SHOW TABLES;
SELECT COUNT(*) FROM mysqltest.t1;
connection master;
DROP DATABASE mysqltest;
DROP TABLE test.t1;
# End of test
With "--binlog_ignore_db=test" in the master option file.
Test works fine using SBR, but RBR get the following in the slave error log:
[ERROR] Slave: Error 'Table 'test.t1' doesn't exist' on opening table `test`.`t1`,
Error_code: 1146
Looking at the bin log you can see that the bin log ignored the create of test.t1, but it
did not ignore the inserts into test.t1. In fact it tries to map and write to test.t1 when
it should not:
! show binlog events;
! Log_name Pos Event_type Server_id End_log_pos Info
! master-bin.000001 4 Format_desc 1 102 Server ver:
5.1.5-alpha-log, Binlog ver: 4
! master-bin.000001 102 Query 1 203 drop database if exists
mysqltest! master-bin.000001 203 Table_map 1 243 test.t1
! master-bin.000001 243 Write_rows 1 290
! master-bin.000001 290 Query 1 383 CREATE DATABASE mysqltest!
master-bin.000001 383 Query 1 491 use `mysqltest`; CREATE TABLE t1(a
INT, b INT, UNIQUE(b))
! master-bin.000001 491 Table_map 1 536 mysqltest.t1
! master-bin.000001 536 Write_rows 1 583
I will added test as is and place in disable.def file with the bug number from this
report.
How to repeat:
./mysql-test-run --force --skip-ndbcluster --mysqld=--binlog-format=row
--do-test=rpl_loaddata_m
Once I have it checked in :-)
Suggested fix:
binlog should ignore database "test" as instructed.