diff --git a/Docs/manual.texi b/Docs/manual.texi index 1eed35d90ed..e79621ef0f1 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -23935,8 +23935,13 @@ of the are available starting in 3.23.15 unless indicated otherwise. @code{log-bin} @tab Should be set on the master. Tells it to keep a binary update log. If a parameter is specified, the log will be written to the specified -location. -(Set on @strong{Master}, Example: @code{log-bin}) +location. Note that if you give it a parameter with an extention +(eg. @code{log-bin=/mysql/logs/replication.log} ) versions up to +3.23.24 will not work right during replication if you do +@code{FLUSH LOGS} . The problem is fixed +in 3.23.25. If you are using this kind of log name, @code{FLUSH LOGS} +will be ignored on binlog. To clear the log, run @code{FLUSH MASTER}, +and do not forget to run @code{FLUSH SLAVE} on all slaves. @item @code{log-bin-index} @@ -36742,6 +36747,9 @@ though, so 3.23 is not released as a stable version yet. @appendixsubsec Changes in release 3.23.25 @itemize @bullet @item +@code{FLUSH LOGS} broke replication if one had @code{log-bin} with +a log with explicit extension +@item Fixed a bug in MyISAM with packed multi-part keys. @item Fixed crash when using @code{CHECK TABLE} on Windows. diff --git a/sql/log.cc b/sql/log.cc index d23c71e6ef3..94cd553bfce 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -77,7 +77,8 @@ static int find_uniq_filename(char *name) MYSQL_LOG::MYSQL_LOG(): file(0),index_file(0),last_time(0),query_start(0), - name(0), log_type(LOG_CLOSED),write_error(0),inited(0) + name(0), log_type(LOG_CLOSED),write_error(0),inited(0), + no_rotate(0) { /* We don't want to intialize LOCK_Log here as the thread system may @@ -133,6 +134,8 @@ void MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg, inited=1; (void) pthread_mutex_init(&LOCK_log,NULL); (void) pthread_mutex_init(&LOCK_index, NULL); + if(log_type_arg == LOG_BIN && *fn_ext(log_name)) + no_rotate = 1; } log_type=log_type_arg; @@ -320,6 +323,9 @@ void MYSQL_LOG::new_file() { if (file) { + if(no_rotate) // do not rotate logs that are marked non-rotatable + return; // ( for binlog with constant name) + char new_name[FN_REFLEN], *old_name=name; VOID(pthread_mutex_lock(&LOCK_log)); if (generate_new_name(new_name, name)) diff --git a/sql/sql_class.h b/sql/sql_class.h index 7c67b0e7a4a..9e4293c7b62 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -85,6 +85,10 @@ class MYSQL_LOG { char time_buff[20],db[NAME_LEN+1]; char log_file_name[FN_REFLEN],index_file_name[FN_REFLEN]; bool write_error,inited; + bool no_rotate; // for binlog - if log name can never change + // we should not try to rotate it or write any rotation events + // the user should use FLUSH MASTER instead of FLUSH LOGS for + // purging public: MYSQL_LOG();