#At file:///home/lsoares/Workspace/bzr/work/bugfixing/46110/mysql-5.1-bugteam/ based on revid:sergey.glukhov@stripped
3513 Luis Soares 2010-09-17
B46110: Work-in-Progress
added:
mysql-test/suite/rpl/r/rpl_filter_bug.result
mysql-test/suite/rpl/t/rpl_filter_bug-slave.opt
mysql-test/suite/rpl/t/rpl_filter_bug.test
modified:
sql/sql_parse.cc
=== added file 'mysql-test/suite/rpl/r/rpl_filter_bug.result'
--- a/mysql-test/suite/rpl/r/rpl_filter_bug.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_filter_bug.result 2010-09-17 11:02:17 +0000
@@ -0,0 +1,6 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
=== added file 'mysql-test/suite/rpl/t/rpl_filter_bug-slave.opt'
--- a/mysql-test/suite/rpl/t/rpl_filter_bug-slave.opt 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_filter_bug-slave.opt 2010-09-17 11:02:17 +0000
@@ -0,0 +1 @@
+--replicate-do-db=dbx --replicate-wild-do-table=db%.t1
=== added file 'mysql-test/suite/rpl/t/rpl_filter_bug.test'
--- a/mysql-test/suite/rpl/t/rpl_filter_bug.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_filter_bug.test 2010-09-17 11:02:17 +0000
@@ -0,0 +1,76 @@
+#
+# BUG#46110: --replicate-wild-do-table invalidates --replicate-do-db matching rule
+#
+
+-- source include/master-slave.inc
+
+## Checking CREATE DATABASE
+
+-- disable_query_log
+CREATE DATABASE dbx DEFAULT CHARACTER SET=latin1;
+-- enable_query_log
+
+if (!`SELECT count(*) = 1 FROM information_schema.SCHEMATA WHERE schema_name = 'dbx'`)
+{
+ -- echo unexpected default character set for database: dbx
+ -- source include/show_rpl_debug_info.inc
+ -- die
+}
+
+-- sync_slave_with_master
+
+if (!`SELECT count(*) = 1 FROM information_schema.SCHEMATA WHERE schema_name = 'dbx'`)
+{
+ -- echo unexpected default character set for database: dbx
+ -- source include/show_rpl_debug_info.inc
+ -- die
+}
+
+## Checking ALTER DATABASE
+
+-- connection master
+
+-- disable_query_log
+ALTER DATABASE dbx DEFAULT CHARACTER SET=latin5;
+-- enable_query_log
+
+if (!`SELECT DEFAULT_CHARACTER_SET_NAME='latin5' FROM information_schema.SCHEMATA WHERE schema_name = 'dbx'`)
+{
+ -- echo unexpected default character set for database: dbx
+ -- source include/show_rpl_debug_info.inc
+ -- die
+}
+
+-- sync_slave_with_master
+
+if (!`SELECT DEFAULT_CHARACTER_SET_NAME='latin5' FROM information_schema.SCHEMATA WHERE schema_name = 'dbx'`)
+{
+ -- echo unexpected default character set for database: dbx
+ -- source include/show_rpl_debug_info.inc
+ -- die
+}
+
+## Checking DROP DATABASE
+
+-- connection master
+-- disable_query_log
+DROP DATABASE dbx;
+-- enable_query_log
+
+if (!`SELECT count(*) = 0 FROM information_schema.SCHEMATA WHERE schema_name = 'dbx'`)
+{
+ -- echo unexpected default character set for database: dbx
+ -- source include/show_rpl_debug_info.inc
+ -- die
+}
+
+-- sync_slave_with_master
+
+if (!`SELECT count(*) = 0 FROM information_schema.SCHEMATA WHERE schema_name = 'dbx'`)
+{
+ -- echo unexpected default character set for database: dbx
+ -- source include/show_rpl_debug_info.inc
+ -- die
+}
+
+-- source include/master-slave-end.inc
=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc 2010-08-18 04:56:06 +0000
+++ b/sql/sql_parse.cc 2010-09-17 11:02:17 +0000
@@ -217,6 +217,21 @@ inline bool all_tables_not_ok(THD *thd,
return rpl_filter->is_on() && tables && !thd->spcont &&
!rpl_filter->tables_ok(thd->db, tables);
}
+
+inline bool db_stmt_db_ok(THD *thd, char* db)
+{
+ DBUG_ENTER("db_stmt_db_ok");
+
+ if (!thd->slave_thread)
+ DBUG_RETURN(TRUE);
+
+ bool filtered= (!(rpl_filter->get_do_db()->is_empty() &&
+ rpl_filter->get_ignore_db()->is_empty())) ? /* filters exist in do_db ? */
+ !rpl_filter->db_ok(db) : /* then just check them */
+ !rpl_filter->db_ok_with_wild_table(db); /* if not, then check wild do table */
+
+ DBUG_RETURN(!filtered);
+}
#endif
@@ -3646,9 +3661,7 @@ end_with_restore_list:
above was not called. So we have to check rules again here.
*/
#ifdef HAVE_REPLICATION
- if (thd->slave_thread &&
- (!rpl_filter->db_ok(lex->name.str) ||
- !rpl_filter->db_ok_with_wild_table(lex->name.str)))
+ if (!db_stmt_db_ok(thd, lex->name.str))
{
my_message(ER_SLAVE_IGNORED_TABLE, ER(ER_SLAVE_IGNORED_TABLE), MYF(0));
break;
@@ -3681,9 +3694,7 @@ end_with_restore_list:
above was not called. So we have to check rules again here.
*/
#ifdef HAVE_REPLICATION
- if (thd->slave_thread &&
- (!rpl_filter->db_ok(lex->name.str) ||
- !rpl_filter->db_ok_with_wild_table(lex->name.str)))
+ if (!db_stmt_db_ok(thd, lex->name.str))
{
my_message(ER_SLAVE_IGNORED_TABLE, ER(ER_SLAVE_IGNORED_TABLE), MYF(0));
break;
@@ -3710,9 +3721,7 @@ end_with_restore_list:
break;
}
#ifdef HAVE_REPLICATION
- if (thd->slave_thread &&
- (!rpl_filter->db_ok(db->str) ||
- !rpl_filter->db_ok_with_wild_table(db->str)))
+ if (!db_stmt_db_ok(thd, lex->name.str))
{
res= 1;
my_message(ER_SLAVE_IGNORED_TABLE, ER(ER_SLAVE_IGNORED_TABLE), MYF(0));
@@ -3764,9 +3773,7 @@ end_with_restore_list:
above was not called. So we have to check rules again here.
*/
#ifdef HAVE_REPLICATION
- if (thd->slave_thread &&
- (!rpl_filter->db_ok(db->str) ||
- !rpl_filter->db_ok_with_wild_table(db->str)))
+ if (!db_stmt_db_ok(thd, lex->name.str))
{
my_message(ER_SLAVE_IGNORED_TABLE, ER(ER_SLAVE_IGNORED_TABLE), MYF(0));
break;
Attachment: [text/bzr-bundle] bzr/luis.soares@oracle.com-20100917110217-9xdyg3g0ca14egcs.bundle
| Thread |
|---|
| • bzr commit into mysql-5.1-bugteam branch (luis.soares:3513) | Luis Soares | 17 Sep |