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.)
This commit is contained in:
Tatiana A. Nurnberg 2009-04-06 13:42:33 +02:00
parent 78fa1a6626
commit 11f44544fc
5 changed files with 24 additions and 5 deletions

View File

@ -1,3 +1,6 @@
select 1;
1
1
SHOW VARIABLES like 'slave_skip_errors';
Variable_name Value
slave_skip_errors OFF

View File

@ -11,7 +11,7 @@ Variable_name Value
slave_load_tmpdir SLAVE_LOAD_TMPDIR
show variables like 'slave_skip_errors';
Variable_name Value
slave_skip_errors 3,100,137,643,1752
slave_skip_errors 0,3,100,137,643,1752
---- Clean Up ----
set global slave_net_timeout=default;
set global sql_slave_skip_counter= 0;
@ -98,12 +98,12 @@ ERROR HY000: Variable 'slave_load_tmpdir' is a read only variable
#
SHOW VARIABLES like 'slave_skip_errors';
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;
ERROR HY000: Variable 'slave_skip_errors' is a GLOBAL variable
SELECT @@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;
ERROR HY000: Variable 'slave_skip_errors' is a read only variable
SET @@global.slave_skip_errors= 7;

View File

@ -36,4 +36,10 @@ select 1;
#execute 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

View File

@ -1 +1 @@
--loose-slave-skip-errors=3,100,137,643,1752
--loose-slave-skip-errors=3,100,137,0,643,1752

View File

@ -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 sql_slave_killed(THD* thd,Relay_log_info* rli);
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_reconnect(THD* thd, MYSQL* mysql, Master_info* mi,
bool suppress_warnings);
@ -231,6 +232,15 @@ int init_slave()
*/
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 specified, create the master_info file if it doesn't
@ -311,7 +321,7 @@ static void print_slave_skip_errors(void)
char *bend= buff + sizeof(slave_skip_error_names);
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))
{