Bug #15942 RBR ignores --binlog_ignore_db and tries to map to table on slave for writes
Submitted: 22 Dec 2005 20:46 Modified: 5 Jan 2006 17:08
Reporter: Jonathan Miller Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Replication Severity:S2 (Serious)
Version:5.1.3 OS:Linux (Linux)
Assigned to: Mats Kindahl

[22 Dec 2005 20:46] Jonathan Miller
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.
[4 Jan 2006 21:17] Mike Hillyer
I see no fix, should not be in documenting status.
[5 Jan 2006 12:05] Lars Thalmann
I don't know why the change set was not forwarded to bugs.mysql.com:

ChangeSet
  1.1985 05/12/27 12:06:48 mats@mysql.com +4 -0
  Bug#15942 (RBR ignored --binlog_ignore_db and tries to map table on slave for writes):
    Added code to do the filtering (seems to have gone away).

It has been reviewed and pushed.
Since this was not part of any official release, I don't think we need 
any further documentation.
[5 Jan 2006 17:08] Mike Hillyer
Closing this then.