Skip to content

Commit

Permalink
Better error messages if slave is not properly configured
Browse files Browse the repository at this point in the history
  • Loading branch information
montywi committed Oct 8, 2015
1 parent a69a6dd commit 6dd4114
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion mysql-test/suite/rpl/r/rpl_row_reset_slave.result
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ include/start_slave.inc
include/stop_slave.inc
reset slave all;
start slave;
ERROR HY000: The server is not configured as slave; fix in config file or with CHANGE MASTER TO
ERROR HY000: Misconfigured slave: MASTER_HOST was not set; Fix in config file or with CHANGE MASTER TO
CHANGE MASTER TO MASTER_HOST= 'MASTER_HOST', MASTER_USER= 'MASTER_USER', MASTER_PORT= MASTER_PORT;
include/start_slave.inc
include/rpl_end.inc
2 changes: 1 addition & 1 deletion mysql-test/suite/rpl/r/rpl_stm_reset_slave.result
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ include/start_slave.inc
include/stop_slave.inc
reset slave all;
start slave;
ERROR HY000: The server is not configured as slave; fix in config file or with CHANGE MASTER TO
ERROR HY000: Misconfigured slave: MASTER_HOST was not set; Fix in config file or with CHANGE MASTER TO
CHANGE MASTER TO MASTER_HOST= 'MASTER_HOST', MASTER_USER= 'MASTER_USER', MASTER_PORT= MASTER_PORT;
include/start_slave.inc
include/rpl_end.inc
16 changes: 13 additions & 3 deletions sql/sql_repl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2869,7 +2869,19 @@ int start_slave(THD* thd , Master_info* mi, bool net_report)
if (init_master_info(mi,master_info_file_tmp,relay_log_info_file_tmp, 0,
thread_mask))
slave_errno=ER_MASTER_INFO;
else if (server_id_supplied && *mi->host)
else if (!server_id_supplied)
{
slave_errno= ER_BAD_SLAVE; net_report= 0;
my_message(slave_errno, "Misconfigured slave: server_id was not set; Fix in config file",
MYF(0));
}
else if (!*mi->host)
{
slave_errno= ER_BAD_SLAVE; net_report= 0;
my_message(slave_errno, "Misconfigured slave: MASTER_HOST was not set; Fix in config file or with CHANGE MASTER TO",
MYF(0));
}
else
{
/*
If we will start SQL thread we will care about UNTIL options If
Expand Down Expand Up @@ -2963,8 +2975,6 @@ int start_slave(THD* thd , Master_info* mi, bool net_report)
relay_log_info_file_tmp,
thread_mask);
}
else
slave_errno = ER_BAD_SLAVE;
}
else
{
Expand Down

0 comments on commit 6dd4114

Please sign in to comment.