Commit 554970c0 authored by guilhem@mysql.com's avatar guilhem@mysql.com

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.
parent bef189cc
...@@ -1722,9 +1722,26 @@ static int init_relay_log_info(RELAY_LOG_INFO* rli, ...@@ -1722,9 +1722,26 @@ static int init_relay_log_info(RELAY_LOG_INFO* rli,
{ {
char buf[FN_REFLEN]; char buf[FN_REFLEN];
const char *ln; const char *ln;
static bool name_warning_sent= 0;
ln= rli->relay_log.generate_name(opt_relay_logname, "-relay-bin", ln= rli->relay_log.generate_name(opt_relay_logname, "-relay-bin",
1, buf); 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 note, that if open() fails, we'll still have index file open
but a destructor will take care of that 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