1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

WL#2472: Refactoring of replication and binlog filtering.

Needed to be able to have multiple masters connected 
to same slave server with different filters.
This commit is contained in:
lars@mysql.com
2005-03-08 21:12:35 +01:00
parent b6a2b5f734
commit 26787260b7
15 changed files with 744 additions and 502 deletions

View File

@ -16,11 +16,14 @@
#include "mysql_priv.h"
#include "sql_repl.h"
#include "table_filter.h"
#include "repl_failsafe.h"
#include <m_ctype.h>
#include <myisam.h>
#include <my_dir.h>
extern Table_filter *rpl_filter;
#ifdef HAVE_INNOBASE_DB
#include "ha_innodb.h"
#endif
@ -137,10 +140,12 @@ static bool end_active_trans(THD *thd)
#ifdef HAVE_REPLICATION
inline bool all_tables_not_ok(THD *thd, TABLE_LIST *tables)
{
return (table_rules_on && tables && !tables_ok(thd,tables) &&
return (rpl_filter->is_on() && tables &&
!rpl_filter->tables_ok(thd->db, tables) &&
((thd->lex->sql_command != SQLCOM_DELETE_MULTI) ||
!tables_ok(thd,
(TABLE_LIST *)thd->lex->auxilliary_table_list.first)));
!rpl_filter->tables_ok(thd->db,
(TABLE_LIST *)
thd->lex->auxilliary_table_list.first)));
}
#endif
@ -3283,9 +3288,9 @@ unsent_create_error:
above was not called. So we have to check rules again here.
*/
#ifdef HAVE_REPLICATION
if (thd->slave_thread &&
(!db_ok(lex->name, replicate_do_db, replicate_ignore_db) ||
!db_ok_with_wild_table(lex->name)))
if (thd->slave_thread &&
(!rpl_filter->db_ok(lex->name) ||
!rpl_filter->db_ok_with_wild_table(lex->name)))
{
my_message(ER_SLAVE_IGNORED_TABLE, ER(ER_SLAVE_IGNORED_TABLE), MYF(0));
break;
@ -3314,8 +3319,8 @@ unsent_create_error:
*/
#ifdef HAVE_REPLICATION
if (thd->slave_thread &&
(!db_ok(lex->name, replicate_do_db, replicate_ignore_db) ||
!db_ok_with_wild_table(lex->name)))
(!rpl_filter->db_ok(lex->name) ||
!rpl_filter->db_ok_with_wild_table(lex->name)))
{
my_message(ER_SLAVE_IGNORED_TABLE, ER(ER_SLAVE_IGNORED_TABLE), MYF(0));
break;
@ -3355,8 +3360,8 @@ unsent_create_error:
*/
#ifdef HAVE_REPLICATION
if (thd->slave_thread &&
(!db_ok(db, replicate_do_db, replicate_ignore_db) ||
!db_ok_with_wild_table(db)))
(!rpl_filter->db_ok(lex->name) ||
!rpl_filter->db_ok_with_wild_table(lex->name)))
{
my_message(ER_SLAVE_IGNORED_TABLE, ER(ER_SLAVE_IGNORED_TABLE), MYF(0));
break;