Commit f33566b5 authored by unknown's avatar unknown
Browse files

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


sql/mysqld.cc:
  more suggestive warning message
sql/sql_class.h:
  need a method to see MYSQL_LOG::name (the name of the binlog but without the numeric extension)
parent 0be99226
Loading
Loading
Loading
Loading
+16 −14
Original line number Diff line number Diff line
@@ -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
  {
+1 −0
Original line number Diff line number Diff line
@@ -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; }