Commit cd13c844 authored by unknown's avatar unknown

Docs/manual.texi

    added updated for FLUSH LOGS and replication
sql/log.cc
    fixed the log rotation bug when the log name did not change after
    FLUSH LOGS


Docs/manual.texi:
  added updated for FLUSH LOGS and replication
sql/log.cc:
  fixed the log rotation bug when the log name did not change after
  FLUSH LOGS
sql/sql_class.h:
  fixed the log rotation bug when the log name did not change after
  FLUSH LOGS
parent 5f124862
...@@ -23935,8 +23935,13 @@ of the are available starting in 3.23.15 unless indicated otherwise. ...@@ -23935,8 +23935,13 @@ of the are available starting in 3.23.15 unless indicated otherwise.
@code{log-bin} @code{log-bin}
@tab Should be set on the master. Tells it to keep a binary update log. @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 If a parameter is specified, the log will be written to the specified
location. location. Note that if you give it a parameter with an extention
(Set on @strong{Master}, Example: @code{log-bin}) (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 @item
@code{log-bin-index} @code{log-bin-index}
...@@ -36742,6 +36747,9 @@ though, so 3.23 is not released as a stable version yet. ...@@ -36742,6 +36747,9 @@ though, so 3.23 is not released as a stable version yet.
@appendixsubsec Changes in release 3.23.25 @appendixsubsec Changes in release 3.23.25
@itemize @bullet @itemize @bullet
@item @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. Fixed a bug in MyISAM with packed multi-part keys.
@item @item
Fixed crash when using @code{CHECK TABLE} on Windows. Fixed crash when using @code{CHECK TABLE} on Windows.
...@@ -77,7 +77,8 @@ static int find_uniq_filename(char *name) ...@@ -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), 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 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, ...@@ -133,6 +134,8 @@ void MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
inited=1; inited=1;
(void) pthread_mutex_init(&LOCK_log,NULL); (void) pthread_mutex_init(&LOCK_log,NULL);
(void) pthread_mutex_init(&LOCK_index, 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; log_type=log_type_arg;
...@@ -320,6 +323,9 @@ void MYSQL_LOG::new_file() ...@@ -320,6 +323,9 @@ void MYSQL_LOG::new_file()
{ {
if (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; char new_name[FN_REFLEN], *old_name=name;
VOID(pthread_mutex_lock(&LOCK_log)); VOID(pthread_mutex_lock(&LOCK_log));
if (generate_new_name(new_name, name)) if (generate_new_name(new_name, name))
......
...@@ -85,6 +85,10 @@ class MYSQL_LOG { ...@@ -85,6 +85,10 @@ class MYSQL_LOG {
char time_buff[20],db[NAME_LEN+1]; char time_buff[20],db[NAME_LEN+1];
char log_file_name[FN_REFLEN],index_file_name[FN_REFLEN]; char log_file_name[FN_REFLEN],index_file_name[FN_REFLEN];
bool write_error,inited; 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: public:
MYSQL_LOG(); MYSQL_LOG();
......
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