Skip to content

Commit cbd6755

Browse files
committed
MDEV-27669: Add skip-slave-start info message
When a slave does not start up the slave threads on restart, but not reporting anything to the error log about startup failures either, this can be due to `skip-slave-start` being set in the config file(s) or on the command line (and most likely is). Reviewed-by: Sergei Golubchik <[email protected]>
1 parent 48a20c7 commit cbd6755

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CHANGE MASTER TO
2+
master_host='127.0.0.1', master_user='root', master_ssl_verify_server_cert=0;
3+
# restart: --skip-slave-start
4+
FOUND 1 /\[Note\] .*skip-slave-start.*/ in mysqld.1.err
5+
SELECT Slave_SQL_Running, Slave_IO_Running FROM INFORMATION_SCHEMA.SLAVE_STATUS;
6+
Slave_SQL_Running Slave_IO_Running
7+
No No

mysql-test/main/skip_slave_start.test

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Test `--skip-slave-start`
2+
3+
CHANGE MASTER TO
4+
master_host='127.0.0.1', master_user='root', master_ssl_verify_server_cert=0;
5+
6+
--let $restart_parameters= --skip-slave-start
7+
--source include/restart_mysqld.inc # not_embedded
8+
# Outside of `--skip-slave-start`, `mariadbd` will start the CHANGE MASTER TO
9+
# above when restarting even though it had no explicit START REPLICA.
10+
11+
--let SEARCH_FILE= `SELECT @@log_error`
12+
--let SEARCH_PATTERN=\[Note\] .*skip-slave-start.*
13+
--source include/search_pattern_in_file.inc
14+
SELECT Slave_SQL_Running, Slave_IO_Running FROM INFORMATION_SCHEMA.SLAVE_STATUS;

sql/slave.cc

+4-1
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,10 @@ int init_slave()
609609

610610
/* If server id is not set, start_slave_thread() will say it */
611611

612-
if (active_mi->host[0] && !opt_skip_slave_start)
612+
if (opt_skip_slave_start)
613+
sql_print_information("Replication not automatically started: "
614+
"--skip-slave-start was specified");
615+
else if (active_mi->host[0])
613616
{
614617
int error;
615618
THD *thd= new THD(next_thread_id());

0 commit comments

Comments
 (0)