Commit 1cb5d98d authored by guilhem@mysql.com's avatar guilhem@mysql.com

When we warn that --log-bin alone is dangerous, we give a suggestion.

parent c30e6000
......@@ -2687,20 +2687,6 @@ with --log-bin instead.");
if (opt_bin_log)
{
if (!opt_bin_logname && !opt_binlog_index_name)
{
/*
User didn't give us info to name the binlog index file.
Picking `hostname`-bin.index like did in 4.x, causes replication to
fail if the 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("\
No argument was provided to --log-bin, and --log-bin-index was not used. "
"Replication may break when this MySQL server acts as a master and has his "
"hostname changed.");
}
/* If we fail to open binlog, it's going to hinder our recovery, so die */
if (open_log(&mysql_bin_log, glob_hostname, opt_bin_logname, "-bin",
opt_binlog_index_name, LOG_BIN, 0, 0, max_binlog_size))
......@@ -2714,6 +2700,22 @@ No argument was provided to --log-bin, and --log-bin-index was not used. "
mysql_bin_log.purge_logs_before_date(purge_time);
}
#endif
if (!opt_bin_logname && !opt_binlog_index_name)
{
/*
User didn't give us info to name the binlog index file.
Picking `hostname`-bin.index like did in 4.x, causes replication to
fail if the 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("\
No argument was provided to --log-bin, and --log-bin-index was not used; \
so replication may break when this MySQL server acts as a master and \
has his hostname changed!! Please use '--log-bin=%s' to avoid \
this problem.",
mysql_bin_log.get_name());
}
}
else
{
......
......@@ -205,6 +205,7 @@ class MYSQL_LOG
inline bool is_open() { return log_type != LOG_CLOSED; }
inline char* get_index_fname() { return index_file_name;}
inline char* get_log_fname() { return log_file_name; }
inline char* get_name() { return name; }
inline pthread_mutex_t* get_log_lock() { return &LOCK_log; }
inline IO_CACHE* get_log_file() { return &log_file; }
......
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