Commit 149a2833 authored by unknown's avatar unknown

To help people avoid BUG#2122 "changing hostname confuses master or slave" until it's fixed,

we now issue a warning (at slave's server startup only) when a relay log is named
using the implicit hostname-relay-bin naming. Like we already do for binlogs.


sql/slave.cc:
  To help people avoid BUG#2122 "changing hostname confuses master or slave" until it's fixed,
  we now issue a warning (at slave's server startup only) when a relay log is named
  using the implicit hostname-relay-bin naming. Like I had already added a similar startup warning
  when a binlog is named using the implicit hostname-bin naming.
  name_warning_sent is so that at most one warning per startup is sent.
parent 62d62278
......@@ -1722,9 +1722,26 @@ static int init_relay_log_info(RELAY_LOG_INFO* rli,
{
char buf[FN_REFLEN];
const char *ln;
static bool name_warning_sent= 0;
ln= rli->relay_log.generate_name(opt_relay_logname, "-relay-bin",
1, buf);
/* We send the warning only at startup, not after every RESET SLAVE */
if (!opt_relay_logname && !opt_relaylog_index_name && !name_warning_sent)
{
/*
User didn't give us info to name the relay log index file.
Picking `hostname`-relay-bin.index like we do, causes replication to
fail if this slave's hostname is changed later. So, we would like to
instead require a name. But as we don't want to break many existing
setups, we only give warning, not error.
*/
sql_print_warning("Neither --relay-log nor --relay-log-index were used;"
" so replication "
"may break when this MySQL server acts as a "
"slave and has his hostname changed!! Please "
"use '--relay-log=%s' to avoid this problem.", ln);
name_warning_sent= 1;
}
/*
note, that if open() fails, we'll still have index file open
but a destructor will take care of that
......
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