summaryrefslogtreecommitdiff
path: root/sql/log_event.cc
diff options
context:
space:
mode:
authorLixun Peng <P.Linux@163.com>2013-04-16 19:43:28 +0800
committerLixun Peng <P.Linux@163.com>2013-04-16 19:43:28 +0800
commit82eedf4e9745aa570b88b225941120475f9f74c9 (patch)
treec88a6bcc7efd700de4e64af88edb7e3d02f9dd1b /sql/log_event.cc
parentaa052eeb1a020b8a198e892a7ca0d8f4a3bcd5f1 (diff)
downloadmariadb-git-82eedf4e9745aa570b88b225941120475f9f74c9.tar.gz
Makeing rpl_filter for each Master_info.
Users can set different repplication filter rules for each replication connection, in my.cnf or command line. But the rules set online will not record in master.info, it means if users restart MySQL, these rules will lose. So if users wantn't their replication filter rules lose, they should write the rules in my.cnf. Users can set rules by 2 ways: 1. Online SET command, "SET connection_name.replication_filter_settings = rules;". 2. In my.cnf, "connection_name.replication_filter_settings = rules". If no connection_name in my.cnf, this rule will apply for ALL replication connection. If no connetion_name in SET statement, this rull will apply for default_connection_name.
Diffstat (limited to 'sql/log_event.cc')
-rw-r--r--sql/log_event.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 104ea948cfc..f65d96eb9a8 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -3756,6 +3756,7 @@ int Query_log_event::do_apply_event(Relay_log_info const *rli,
HA_CREATE_INFO db_options;
uint64 sub_id= 0;
rpl_gtid gtid;
+ Rpl_filter *rpl_filter= rli->mi->rpl_filter;
DBUG_ENTER("Query_log_event::do_apply_event");
/*
@@ -5439,6 +5440,7 @@ int Load_log_event::do_apply_event(NET* net, Relay_log_info const *rli,
bool use_rli_only_for_errors)
{
LEX_STRING new_db;
+ Rpl_filter *rpl_filter= rli->mi->rpl_filter;
DBUG_ENTER("Load_log_event::do_apply_event");
new_db.length= db_len;
@@ -10044,8 +10046,8 @@ check_table_map(Relay_log_info const *rli, RPL_TABLE_LIST *table_list)
enum_tbl_map_status res= OK_TO_PROCESS;
if (rli->sql_thd->slave_thread /* filtering is for slave only */ &&
- (!rpl_filter->db_ok(table_list->db) ||
- (rpl_filter->is_on() && !rpl_filter->tables_ok("", table_list))))
+ (!rli->mi->rpl_filter->db_ok(table_list->db) ||
+ (rli->mi->rpl_filter->is_on() && !rli->mi->rpl_filter->tables_ok("", table_list))))
res= FILTERED_OUT;
else
{
@@ -10079,6 +10081,7 @@ int Table_map_log_event::do_apply_event(Relay_log_info const *rli)
char *db_mem, *tname_mem;
size_t dummy_len;
void *memory;
+ Rpl_filter *filter;
DBUG_ENTER("Table_map_log_event::do_apply_event(Relay_log_info*)");
DBUG_ASSERT(rli->sql_thd == thd);
@@ -10092,7 +10095,9 @@ int Table_map_log_event::do_apply_event(Relay_log_info const *rli)
NullS)))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- strmov(db_mem, rpl_filter->get_rewrite_db(m_dbnam, &dummy_len));
+ /* call from mysql_client_binlog_statement() will not set rli->mi */
+ filter= rli->sql_thd->slave_thread ? rli->mi->rpl_filter : global_rpl_filter;
+ strmov(db_mem, filter->get_rewrite_db(m_dbnam, &dummy_len));
strmov(tname_mem, m_tblnam);
table_list->init_one_table(db_mem, strlen(db_mem),