summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/log_event.cc6
-rw-r--r--sql/log_event.h2
-rw-r--r--sql/mysql_priv.h2
-rw-r--r--sql/mysqld.cc28
-rw-r--r--sql/set_var.cc6
-rw-r--r--sql/set_var.h11
-rw-r--r--sql/slave.cc5
-rw-r--r--sql/slave.h9
8 files changed, 49 insertions, 20 deletions
diff --git a/sql/log_event.cc b/sql/log_event.cc
index ffe4fb2a4fc..cf1e1229c91 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -828,8 +828,8 @@ Log_event::do_shall_skip(Relay_log_info *rli)
rli->slave_skip_counter));
if ((server_id == ::server_id && !rli->replicate_same_server_id) ||
(rli->slave_skip_counter == 1 && rli->is_in_group()) ||
- (flags & LOG_EVENT_SKIP_REPLICATION_F
- && !opt_replicate_events_marked_for_skip))
+ (flags & LOG_EVENT_SKIP_REPLICATION_F &&
+ opt_replicate_events_marked_for_skip != RPL_SKIP_REPLICATE))
return EVENT_SKIP_IGNORE;
if (rli->slave_skip_counter > 0)
return EVENT_SKIP_COUNT;
@@ -3492,7 +3492,7 @@ Query_log_event::do_shall_skip(Relay_log_info *rli)
number of events to be skipped due to @@sql_slave_skip_counter.
*/
if (flags & LOG_EVENT_SKIP_REPLICATION_F &&
- !opt_replicate_events_marked_for_skip)
+ opt_replicate_events_marked_for_skip != RPL_SKIP_REPLICATE)
DBUG_RETURN(Log_event::EVENT_SKIP_IGNORE);
if (rli->slave_skip_counter > 0)
diff --git a/sql/log_event.h b/sql/log_event.h
index 153c2999bf6..aeab4bc230c 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -495,7 +495,7 @@ struct sql_ex_info
Flag set by application creating the event (with @@skip_replication); the
slave will skip replication of such events if
- --replicate-events-marked-for-skip is false.
+ --replicate-events-marked-for-skip is not set to REPLICATE.
This is a MariaDB flag; we allocate it from the end of the available
values to reduce risk of conflict with new MySQL flags.
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index 295b913e623..784756f0061 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -2065,7 +2065,7 @@ extern my_bool opt_old_style_user_limits, trust_function_creators;
extern uint opt_crash_binlog_innodb;
extern char *shared_memory_base_name, *mysqld_unix_port;
extern my_bool opt_enable_shared_memory;
-extern my_bool opt_replicate_events_marked_for_skip;
+extern uint opt_replicate_events_marked_for_skip;
extern char *default_tz_name;
#endif /* MYSQL_SERVER */
#if defined MYSQL_SERVER || defined INNODB_COMPATIBILITY_HOOKS
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index a4477ba58e8..94882051dfa 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -389,6 +389,16 @@ TYPELIB plugin_maturity_values=
const int server_maturity= MariaDB_PLUGIN_MATURITY_UNKNOWN;
+/* These names must match RPL_SKIP_XXX #defines in slave.h. */
+static const char *replicate_events_marked_for_skip_names[]=
+{ "replicate", "filter_on_slave", "filter_on_master", 0 };
+
+TYPELIB replicate_events_marked_for_skip_typelib=
+{
+ array_elements(replicate_events_marked_for_skip_names) - 1, "",
+ replicate_events_marked_for_skip_names, 0
+};
+
const char *first_keyword= "first", *binary_keyword= "BINARY";
const char *my_localhost= "localhost", *delayed_user= "DELAYED";
#if SIZEOF_OFF_T > 4 && defined(BIG_TABLES)
@@ -553,7 +563,7 @@ uint opt_large_page_size= 0;
uint opt_debug_sync_timeout= 0;
#endif /* defined(ENABLED_DEBUG_SYNC) */
my_bool opt_old_style_user_limits= 0, trust_function_creators= 0;
-my_bool opt_replicate_events_marked_for_skip;
+uint opt_replicate_events_marked_for_skip;
/*
True if there is at least one per-hour limit for some user, so we should
@@ -6785,12 +6795,6 @@ each time the SQL thread starts.",
"cross database updates. If you need cross database updates to work, "
"make sure you have 3.23.28 or later, and use replicate-wild-ignore-"
"table=db_name.%. ", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"replicate-events-marked-for-skip", OPT_REPLICATE_EVENTS_MARKED_FOR_SKIP,
- "Tells the slave thread to replicate events that were created with"
- "@@skip_replication=1. Default true. If set to false, such events will not"
- "be replicated.", &opt_replicate_events_marked_for_skip,
- &opt_replicate_events_marked_for_skip, 0, GET_BOOL, NO_ARG,
- 1, 0, 0 ,0, 0, 0},
{"replicate-ignore-table", OPT_REPLICATE_IGNORE_TABLE,
"Tells the slave thread to not replicate to the specified table. To specify "
"more than one table to ignore, use the directive multiple times, once for "
@@ -6807,6 +6811,16 @@ each time the SQL thread starts.",
"Can't be set to 1 if --log-slave-updates is used.",
&replicate_same_server_id, &replicate_same_server_id,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"replicate-events-marked-for-skip", OPT_REPLICATE_EVENTS_MARKED_FOR_SKIP,
+ "Whether the slave should replicate events that were created with "
+ "@@skip_replication=1 on the master. Default REPLICATE (no events are "
+ "skipped). Other values are FILTER_ON_SLAVE (events will be sent by the "
+ "master but ignored by the slave) and FILTER_ON_MASTER (events marked with "
+ "@@skip_replication=1 will be filtered on the master and never be sent to "
+ "the slave).", &opt_replicate_events_marked_for_skip,
+ &opt_replicate_events_marked_for_skip,
+ &replicate_events_marked_for_skip_typelib, GET_ENUM, REQUIRED_ARG,
+ RPL_SKIP_REPLICATE, 0, 0 ,0, 0, 0},
#endif
{"replicate-wild-do-table", OPT_REPLICATE_WILD_DO_TABLE,
"Tells the slave thread to restrict replication to the tables that match "
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 04d57e50737..2150cd62359 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -925,7 +925,9 @@ static sys_var_thd_set sys_log_slow_verbosity(&vars,
static sys_var_replicate_events_marked_for_skip
sys_replicate_events_marked_for_skip(&vars,
"replicate_events_marked_for_skip",
- &opt_replicate_events_marked_for_skip);
+ &opt_replicate_events_marked_for_skip,
+ &replicate_events_marked_for_skip_typelib,
+ NULL);
#endif
/* Global read-only variable containing hostname */
@@ -4469,7 +4471,7 @@ bool sys_var_replicate_events_marked_for_skip::update(THD *thd, set_var *var)
result= TRUE;
}
else
- result= sys_var_bool_ptr::update(thd, var);
+ result= sys_var_enum::update(thd, var);
unlock_slave_threads(active_mi);
pthread_mutex_unlock(&LOCK_active_mi);
diff --git a/sql/set_var.h b/sql/set_var.h
index 25a9a054ce0..2f847ed6df9 100644
--- a/sql/set_var.h
+++ b/sql/set_var.h
@@ -31,7 +31,8 @@ typedef struct system_variables SV;
typedef struct my_locale_st MY_LOCALE;
extern TYPELIB bool_typelib, delay_key_write_typelib, sql_mode_typelib,
- optimizer_switch_typelib, slave_exec_mode_typelib;
+ optimizer_switch_typelib, slave_exec_mode_typelib,
+ replicate_events_marked_for_skip_typelib;
typedef int (*sys_check_func)(THD *, set_var *);
typedef bool (*sys_update_func)(THD *, set_var *);
@@ -1289,13 +1290,15 @@ public:
Handler for setting the system variable --replicate-events-marked-for-skip.
*/
-class sys_var_replicate_events_marked_for_skip :public sys_var_bool_ptr
+class sys_var_replicate_events_marked_for_skip :public sys_var_enum
{
public:
sys_var_replicate_events_marked_for_skip(sys_var_chain *chain,
const char *name_arg,
- my_bool *value_arg) :
- sys_var_bool_ptr(chain, name_arg, value_arg) {};
+ uint *value_arg,
+ TYPELIB *typelib,
+ sys_after_update_func func) :
+ sys_var_enum(chain, name_arg, value_arg, typelib, func) {};
~sys_var_replicate_events_marked_for_skip() {};
bool update(THD *thd, set_var *var);
};
diff --git a/sql/slave.cc b/sql/slave.cc
index 7e759eecb90..373661075bb 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -1178,9 +1178,10 @@ when it try to get the value of TIME_ZONE global variable from master.";
/*
Request the master to filter away events with the @@skip_replication flag
- set, if we are running with --replicate-events-marked-for-skip=0.
+ set, if we are running with
+ --replicate-events-marked-for-skip=FILTER_ON_MASTER.
*/
- if (!opt_replicate_events_marked_for_skip)
+ if (opt_replicate_events_marked_for_skip == RPL_SKIP_FILTER_ON_MASTER)
{
if (mysql_real_query(mysql, STRING_WITH_LEN("SET skip_replication=1")))
{
diff --git a/sql/slave.h b/sql/slave.h
index 1aa5b374e4b..802320446bf 100644
--- a/sql/slave.h
+++ b/sql/slave.h
@@ -134,6 +134,15 @@ extern ulonglong relay_log_space_limit;
*/
#define SLAVE_FORCE_ALL 4
+/*
+ Values for the option --replicate-events-marked-for-skip.
+ Must match the typelib replicate_events_marked_for_skip_typelib in mysqld.cc
+*/
+#define RPL_SKIP_REPLICATE 0
+#define RPL_SKIP_FILTER_ON_SLAVE 1
+#define RPL_SKIP_FILTER_ON_MASTER 2
+
+
int init_slave();
void init_slave_skip_errors(const char* arg);
bool flush_relay_log_info(Relay_log_info* rli);