diff options
author | Nuno Carvalho <nuno.carvalho@oracle.com> | 2012-11-20 12:37:23 +0000 |
---|---|---|
committer | Nuno Carvalho <nuno.carvalho@oracle.com> | 2012-11-20 12:37:23 +0000 |
commit | d0f5427cd77327e858d2c661ec0d4a8e4794ac55 (patch) | |
tree | d1ecf48b3c9b6cdff5f784b7d154a1833295ea97 /sql/sys_vars.cc | |
parent | ea69084e02e80d0dd07b1fc95f53167eecc6a0fd (diff) | |
download | mariadb-git-d0f5427cd77327e858d2c661ec0d4a8e4794ac55.tar.gz |
BUG#15891524: RLI_FAKE MODE IS NOT UNSET AFTER BINLOG REPLAY
When a binlog is replayed into a server, e.g.:
$ mysqlbinlog binlog.000001 | mysql
it sets a pseudo slave mode on the client connection in order to server
be able to read binlog events, there is, a format description event is
needed to correctly read following events.
Also this pseudo slave mode applies to the current connection
replication rules that are needed to correctly apply binlog events.
If a binlog dump is sourced on a connection, this pseudo slave mode will
remains after it, what will apply unexpected rules from customer
perspective to following commands.
Added a new SET statement to binlog dump that will unset pseudo slave
mode at the end of dump file.
Diffstat (limited to 'sql/sys_vars.cc')
-rw-r--r-- | sql/sys_vars.cc | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 06f97af2ade..5a0d2709a52 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -3270,6 +3270,62 @@ static Sys_var_ulong Sys_sp_cache_size( GLOBAL_VAR(stored_program_cache_size), CMD_LINE(REQUIRED_ARG), VALID_RANGE(256, 512 * 1024), DEFAULT(256), BLOCK_SIZE(1)); +static bool check_pseudo_slave_mode(sys_var *self, THD *thd, set_var *var) +{ + longlong previous_val= thd->variables.pseudo_slave_mode; + longlong val= (longlong) var->save_result.ulonglong_value; + bool rli_fake= false; + +#ifndef EMBEDDED_LIBRARY + rli_fake= thd->rli_fake ? true : false; +#endif + + if (rli_fake) + { + if (!val) + { +#ifndef EMBEDDED_LIBRARY + delete thd->rli_fake; + thd->rli_fake= NULL; +#endif + } + else if (previous_val && val) + goto ineffective; + else if (!previous_val && val) + push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_WRONG_VALUE_FOR_VAR, + "'pseudo_slave_mode' is already ON."); + } + else + { + if (!previous_val && !val) + goto ineffective; + else if (previous_val && !val) + push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_WRONG_VALUE_FOR_VAR, + "Slave applier execution mode not active, " + "statement ineffective."); + } + goto end; + +ineffective: + push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_WRONG_VALUE_FOR_VAR, + "'pseudo_slave_mode' change was ineffective."); + +end: + return FALSE; +} +static Sys_var_mybool Sys_pseudo_slave_mode( + "pseudo_slave_mode", + "SET pseudo_slave_mode= 0,1 are commands that mysqlbinlog " + "adds to beginning and end of binary log dumps. While zero " + "value indeed disables, the actual enabling of the slave " + "applier execution mode is done implicitly when a " + "Format_description_event is sent through the session.", + SESSION_ONLY(pseudo_slave_mode), NO_CMD_LINE, DEFAULT(FALSE), + NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_pseudo_slave_mode)); + /**************************************************************************** Used templates |