Bug #64511 binlog_ignore_db and binlog_do_db at the same time
Submitted: 1 Mar 2012 10:47 Modified: 6 Mar 2012 13:06
Reporter: Peter Laursen (Basic Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:any OS:Any
Assigned to: CPU Architecture:Any
Tags: qc

[1 Mar 2012 10:47] Peter Laursen
Description:
Options binlog_ignore_db and binlog_do_db may be used in the same options file (and also replicate_ignore_db and replciate_do_db may).

This raises the problem in two cases

1) one database is mistakenly specified in both.  Which one will have effect?  

2) db1 is used with binlog_ignore_db and db2 is used with binlog_do_db.  I now "CREATE DATABSE db3;", create tables and insert data . Will it be binlogged or not? 

Does one option have higher value/strength than the other or is it the option specified latest (in commandline or options file) that has effect?

 

How to repeat:
create db1 and db2

Restart server with:
binlog_format=mixed  // or whatever binlog format
binlog-do-db=db1
binlog-ignore-db=db2

Now create db3

Suggested fix:
Even though you may find it silly and/or a mistake to specify both options the docs does not specify (as far as I can see) how the server will resolve such conflict.  It should be specified/described. Or better it should not be allowed.
[1 Mar 2012 11:58] Valeriy Kravchuk
IMHO our manual, http://dev.mysql.com/doc/refman/5.5/en/binary-log.html, clearly says:

"The server evaluates the --binlog-do-db and --binlog-ignore-db options in the same way as it does the --replicate-do-db and --replicate-ignore-db options. For information about how this is done, see Section 15.2.3.1, “Evaluation of Database-Level Replication and Binary Logging Options”."

What is NOT clear at http://dev.mysql.com/doc/refman/5.5/en/replication-rules-db-options.html I wonder?
[6 Mar 2012 13:06] Peter Laursen
OK .. it will be binlogged