Uploaded image for project: 'Percona Server for MySQL'
  1. Percona Server for MySQL
  2. PS-1606

LP #1416582: Slow query log is rotated before it should when using max_slowlog_size

    Details

    • Type: Bug
    • Status: Done
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:

      Description

      **Reported in Launchpad by Agustín last update 27-05-2015 06:44:00

      While using max_slowlog_size, the slow query log is rotated every time slow_query_log is enabled, not really checking if the current slow log is indeed bigger than max_slowlog_size or not. The queries are being correctly logged in the slow log, though I don't show that here, to keep it short.

      See the following outputs to reproduce.

      mysql> show variables like '%version%';
      -------------------------------------------------------------------------+

      Variable_name Value

      -------------------------------------------------------------------------+

      innodb_version 5.6.22-rel71.0
      protocol_version 10
      slave_type_conversions  
      version 5.6.22-71.0-log
      version_comment Percona Server (GPL), Release 71.0, Revision 726
      version_compile_machine x86_64
      version_compile_os Linux

      -------------------------------------------------------------------------+
      7 rows in set (0.00 sec)

      mysql> show variables like 'max_slowlog_%';
      ------------------------+

      Variable_name Value

      ------------------------+

      max_slowlog_files 0
      max_slowlog_size 8192

      ------------------------+
      2 rows in set (0.00 sec)

      mysql> show variables like 'slow_query_log%';
      -------------------------------------------------------------------------------------------------------+

      Variable_name Value

      -------------------------------------------------------------------------------------------------------+

      slow_query_log ON
      slow_query_log_always_write_time 10.000000
      slow_query_log_file /home/agustin.gallego/sandboxes/msb_ps5_6_22/data/msandbox-slow-log
      slow_query_log_timestamp_always OFF
      slow_query_log_timestamp_precision second
      slow_query_log_use_global_control  

      -------------------------------------------------------------------------------------------------------+
      6 rows in set (0.00 sec)

      shell> ls -o msandbox-slow-log*
      rw-rw--- 1 agustin.gallego 250 Jan 30 19:32 msandbox-slow-log.000001

      mysql> set global slow_query_log=0;
      Query OK, 0 rows affected (0.00 sec)

      mysql> set global slow_query_log=1;
      Query OK, 0 rows affected (0.00 sec)

      shell> ls -o msandbox-slow-log*
      rw-rw--- 1 agustin.gallego 250 Jan 30 19:32 msandbox-slow-log.000001
      rw-rw--- 1 agustin.gallego 250 Jan 30 19:34 msandbox-slow-log.000002

      shell> cat msandbox-slow-log.000001
      /home/agustin.gallego/mysql-binaries/ps5.6.22/bin/mysqld, Version: 5.6.22-71.0-log (Percona Server (GPL), Release 71.0, Revision 726). started with:
      Tcp port: 5622 Unix socket: /tmp/mysql_sandbox5622.sock
      Time Id Command Argument

      This is also happening with latest percona server 5.5.

      Let me know if you need any other outputs.

      Agustn.

        Smart Checklist

          Attachments

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                lpjirasync lpjirasync (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: