From 1cb5d98d85dd055c7255b7a77f71dd91760cd14b Mon Sep 17 00:00:00 2001 From: "guilhem@mysql.com" <> Date: Sun, 16 Jan 2005 15:46:28 +0100 Subject: [PATCH] When we warn that --log-bin alone is dangerous, we give a suggestion. --- sql/mysqld.cc | 30 ++++++++++++++++-------------- sql/sql_class.h | 1 + 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 415ad446779..b66d1ce3c24 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -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 { diff --git a/sql/sql_class.h b/sql/sql_class.h index 033f5674d34..ca65f011b9d 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -205,6 +205,7 @@ public: 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; }