diff options
author | Tatiana A. Nurnberg <azundris@mysql.com> | 2009-04-06 13:42:33 +0200 |
---|---|---|
committer | Tatiana A. Nurnberg <azundris@mysql.com> | 2009-04-06 13:42:33 +0200 |
commit | 88a9e65ba63216b36900ba06d7c34ae608b6e017 (patch) | |
tree | 098220086c1c9b28c9e1c80a6234dc28222532e7 | |
parent | ff9803acea8e7270e1b58f8221fbcd902580e052 (diff) | |
download | mariadb-git-88a9e65ba63216b36900ba06d7c34ae608b6e017.tar.gz |
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.)
mysql-test/r/not_embedded_server.result:
Show that passing no --slave-skip-errors results
in "OFF" being shown as the variable's value. This
test's "twin" (also not embedded, but setting
--slave-skip-errors in its -opt file) lives in
variables-notembbeded.test.
mysql-test/r/variables-notembedded.result:
Show that error-ignore 0 is handled just like any other
ignore. This test's "twin" (also not embedded, but not
setting --slave-skip-errors in its -opt file) lives in
not_embbeded_server.test.
mysql-test/t/not_embedded_server.test:
Show that passing no --slave-skip-errors results
in "OFF" being shown as the variable's value.
mysql-test/t/variables-notembedded-master.opt:
Show that error-ignore 0 is handled just like any other
ignore.
sql/slave.cc:
- set up error-ignore-info even if --slave-skip-errors
was not passed at start-up.
- handle error 0 just like any other error.
-rw-r--r-- | mysql-test/r/not_embedded_server.result | 3 | ||||
-rw-r--r-- | mysql-test/r/variables-notembedded.result | 6 | ||||
-rw-r--r-- | mysql-test/t/not_embedded_server.test | 6 | ||||
-rw-r--r-- | mysql-test/t/variables-notembedded-master.opt | 2 | ||||
-rw-r--r-- | sql/slave.cc | 12 |
5 files changed, 24 insertions, 5 deletions
diff --git a/mysql-test/r/not_embedded_server.result b/mysql-test/r/not_embedded_server.result index 8f7c125196a..60c92bd0196 100644 --- a/mysql-test/r/not_embedded_server.result +++ b/mysql-test/r/not_embedded_server.result @@ -1,3 +1,6 @@ select 1; 1 1 +SHOW VARIABLES like 'slave_skip_errors'; +Variable_name Value +slave_skip_errors OFF diff --git a/mysql-test/r/variables-notembedded.result b/mysql-test/r/variables-notembedded.result index c9125bcee90..8c6d54757ed 100644 --- a/mysql-test/r/variables-notembedded.result +++ b/mysql-test/r/variables-notembedded.result @@ -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; diff --git a/mysql-test/t/not_embedded_server.test b/mysql-test/t/not_embedded_server.test index 233ac3edfbb..fa2b659ec57 100644 --- a/mysql-test/t/not_embedded_server.test +++ b/mysql-test/t/not_embedded_server.test @@ -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 diff --git a/mysql-test/t/variables-notembedded-master.opt b/mysql-test/t/variables-notembedded-master.opt index a684e591d10..8a173a043ac 100644 --- a/mysql-test/t/variables-notembedded-master.opt +++ b/mysql-test/t/variables-notembedded-master.opt @@ -1 +1 @@ ---loose-slave-skip-errors=3,100,137,643,1752 +--loose-slave-skip-errors=3,100,137,0,643,1752 diff --git a/sql/slave.cc b/sql/slave.cc index 8c29cb8a72f..b862c5eff20 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -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); @@ -232,6 +233,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 exists. @@ -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)) { |