Bug #14104 FLUSH LOGS should take optional arguments for which log(s) to flush
Submitted: 18 Oct 2005 1:18 Modified: 12 Mar 2010 19:15
Reporter: Tobias Asplund Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: General Severity:S4 (Feature request)
Version:5.0.13-rc OS:Windows (Windows/FreeBSD)
Assigned to: Daogang Qu CPU Architecture:Any
Tags: Contribution

[18 Oct 2005 1:18] Tobias Asplund
Description:
Currently FLUSH LOGS flushes all the logs, even if you just want to flush one.

How to repeat:
FLUSH LOGS

Suggested fix:
FLUSH LOGS error
FLUSH LOGS bin
FLUSH LOGS binary
FLUSH LOGS general
FLUSH LOGS slow
FLUSH LOG log_error
FLUSH LOG log_bin
FLUSH LOG log
FLUSH LOG log_slow

Any naming scheme would probably fit, as long as you would be able to chose, and of course a comma-separated list of more than one.
[22 Jul 2007 16:23] Chris Calender
Furthermore, a FLUSH LOGS IGNORE would be useful if this were implemented.

FLUSH LOGS IGNORE error;
[22 Jul 2007 16:36] Chris Calender
This should also be extended to the --flush-logs option in mysqldump and the mysqladmin flush option as well.
[4 Sep 2007 7:21] Valeriy Kravchuk
Thank you for a reasonable feature request.
[19 May 2008 2:31] Eric Bergen
Here is a patch that implements the basic idea of this bug. I changed the syntax a bit to include the following queries:

flush error log
flush engine log
flush general log
flush slow log
flush binary log
flush relay log

All of the queries support using the word log or logs. 
The patch applies to 6.0.4 and is available here:
http://ebergen.net/patches/flush_logs.patch
[19 May 2008 3:00] Eric Bergen
The patch also applies against 5.1.24
[13 May 2009 6:57] Ganzorig Boldbaatar
Is this fixed?
[10 Jun 2009 16:37] Liz Drachnik
Hello Eric - 

In order for us to continue the process of reviewing your contribution to MySQL - We need you to review and sign the Sun|MySQL contributor agreement (the "SCA")

The process is explained here: 
http://forge.mysql.com/wiki/Sun_Contributor_Agreement

Getting a signed/approved SCA on file will help us facilitate your contribution-- this one, and others in the future.

Thank you ! 

Liz Drachnik  - Program Manager - MySQL
[18 Jun 2009 17:35] Eric Bergen
SCA has been signed and approved.
[20 Nov 2009 10:15] Lars Thalmann
The worklog is WL#5142
[9 Dec 2009 19:53] Daogang Qu
It is synchronized with a WL#5142 entry.
[12 Mar 2010 19:15] Paul DuBois
Noted in 5.5.3, 6.0.14 changelogs.

FLUSH LOGS now takes an optional log_type value so that FLUSH
log_type LOGS can be used to flush only a specified log type. These
log_type options are allowed:
          
* BINARY closes and reopens the binary log files.
            
* ENGINE closes and reopens any flushable logs for installed storage
  engines.

* ERROR closes and reopens the error log file.

* GENERAL closes and reopens the general query log file.

* RELAY closes and reopens the relay log files.
[12 Mar 2010 19:17] Paul DuBois
Thanks to Eric Bergen for the patch to implement this feature.
[12 Mar 2010 23:36] MySQL Verification Team
Does anyone tell me why the new  syntax doesn't have an option for slow log?
[8 Apr 2010 6:16] Luis Soares
Hi Mikiya,
 Answering your question...

 -  From this patch: http://lists.mysql.com/commits/92808

    (...)
    +  if ((options & REFRESH_SLOW_LOG) && opt_slow_log)
    +    logger.flush_slow_log();
    (...)
    +        | SLOW LOGS_SYM
    +          { Lex->type|= REFRESH_SLOW_LOG; }

 - Testing in a client session:

    mysql> FLUSH SLOW LOGS;
    Query OK, 0 rows affected (0.00 sec)

    mysql> 

 So I would say flush slow log syntax *is* supported.
[8 Apr 2010 6:40] Jon Stephens
The SLOW option is documented, both in the changelog entry and at http://dev.mysql.com/doc/refman/5.5/en/flush.html.
[1 Sep 2010 10:49] Sveta Smirnova
Bug #56385  was marked as duplicate of this one.