Commit 11f44544 authored by Tatiana A. Nurnberg's avatar Tatiana A. Nurnberg

Bug#43835: SHOW VARIABLES does not include 0 for slave_skip_errors

We didn't expect "error: no error", although this is
in fact a legitimate state (if something is erroneous
on the master, but not on the slave, e.g. INSERT fails
on master due to UNIQUE constraint which does not exist
on slave).

We now list the ignore for "0: no error" the same way
as any other ignore; moreover, if no or an empty
--slave-skip-errors is passed at start-up, we show
"OFF" instead of empty list, as intended. (The code
for that was there, but was only run for the empty-
argument case, even if it subsequently tested for
both conditions.) 
parent 78fa1a66
select 1; select 1;
1 1
1 1
SHOW VARIABLES like 'slave_skip_errors';
Variable_name Value
slave_skip_errors OFF
...@@ -11,7 +11,7 @@ Variable_name Value ...@@ -11,7 +11,7 @@ Variable_name Value
slave_load_tmpdir SLAVE_LOAD_TMPDIR slave_load_tmpdir SLAVE_LOAD_TMPDIR
show variables like 'slave_skip_errors'; show variables like 'slave_skip_errors';
Variable_name Value Variable_name Value
slave_skip_errors 3,100,137,643,1752 slave_skip_errors 0,3,100,137,643,1752
---- Clean Up ---- ---- Clean Up ----
set global slave_net_timeout=default; set global slave_net_timeout=default;
set global sql_slave_skip_counter= 0; set global sql_slave_skip_counter= 0;
...@@ -98,12 +98,12 @@ ERROR HY000: Variable 'slave_load_tmpdir' is a read only variable ...@@ -98,12 +98,12 @@ ERROR HY000: Variable 'slave_load_tmpdir' is a read only variable
# #
SHOW VARIABLES like 'slave_skip_errors'; SHOW VARIABLES like 'slave_skip_errors';
Variable_name Value Variable_name Value
slave_skip_errors 3,100,137,643,1752 slave_skip_errors 0,3,100,137,643,1752
SELECT @@session.slave_skip_errors; SELECT @@session.slave_skip_errors;
ERROR HY000: Variable 'slave_skip_errors' is a GLOBAL variable ERROR HY000: Variable 'slave_skip_errors' is a GLOBAL variable
SELECT @@global.slave_skip_errors; SELECT @@global.slave_skip_errors;
@@global.slave_skip_errors @@global.slave_skip_errors
3,100,137,643,1752 0,3,100,137,643,1752
SET @@session.slave_skip_errors= 7; SET @@session.slave_skip_errors= 7;
ERROR HY000: Variable 'slave_skip_errors' is a read only variable ERROR HY000: Variable 'slave_skip_errors' is a read only variable
SET @@global.slave_skip_errors= 7; SET @@global.slave_skip_errors= 7;
......
...@@ -36,4 +36,10 @@ select 1; ...@@ -36,4 +36,10 @@ select 1;
#execute stmt1; #execute stmt1;
#deallocate prepare stmt1; #deallocate prepare stmt1;
#
# Bug#43835: SHOW VARIABLES does not include 0 for slave_skip_errors
#
SHOW VARIABLES like 'slave_skip_errors';
# End of 5.1 tests # End of 5.1 tests
--loose-slave-skip-errors=3,100,137,643,1752 --loose-slave-skip-errors=3,100,137,0,643,1752
...@@ -128,6 +128,7 @@ static bool wait_for_relay_log_space(Relay_log_info* rli); ...@@ -128,6 +128,7 @@ static bool wait_for_relay_log_space(Relay_log_info* rli);
static inline bool io_slave_killed(THD* thd,Master_info* mi); static inline bool io_slave_killed(THD* thd,Master_info* mi);
static inline bool sql_slave_killed(THD* thd,Relay_log_info* rli); static inline bool sql_slave_killed(THD* thd,Relay_log_info* rli);
static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type); static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type);
static void print_slave_skip_errors(void);
static int safe_connect(THD* thd, MYSQL* mysql, Master_info* mi); static int safe_connect(THD* thd, MYSQL* mysql, Master_info* mi);
static int safe_reconnect(THD* thd, MYSQL* mysql, Master_info* mi, static int safe_reconnect(THD* thd, MYSQL* mysql, Master_info* mi,
bool suppress_warnings); bool suppress_warnings);
...@@ -231,6 +232,15 @@ int init_slave() ...@@ -231,6 +232,15 @@ int init_slave()
*/ */
active_mi= new Master_info; active_mi= new Master_info;
/*
If --slave-skip-errors=... was not used, the string value for the
system variable has not been set up yet. Do it now.
*/
if (!use_slave_mask)
{
print_slave_skip_errors();
}
/* /*
If master_host is not specified, try to read it from the master_info file. If master_host is not specified, try to read it from the master_info file.
If master_host is specified, create the master_info file if it doesn't If master_host is specified, create the master_info file if it doesn't
...@@ -311,7 +321,7 @@ static void print_slave_skip_errors(void) ...@@ -311,7 +321,7 @@ static void print_slave_skip_errors(void)
char *bend= buff + sizeof(slave_skip_error_names); char *bend= buff + sizeof(slave_skip_error_names);
int errnum; int errnum;
for (errnum= 1; errnum < MAX_SLAVE_ERROR; errnum++) for (errnum= 0; errnum < MAX_SLAVE_ERROR; errnum++)
{ {
if (bitmap_is_set(&slave_error_mask, errnum)) if (bitmap_is_set(&slave_error_mask, errnum))
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment