Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-4851

can't drop mysql.slow_log if slow_log=on even with log_output=FILE

Details

    Description

      See also http://bugs.mysql.com/bug.php?id=69953

      Can't drop mysql.slow_log if slow_log=on even with log_output=FILE or NONE

      I can understand preventing dropping of a log table that is in active use,
      but with log_output!=TABLE it should be dropable the same way as it is when logging is not active at all

      How to repeat:

      SET GLOBAL log_output='FILE';
      SET GLOBAL slow_query_log=1;
      SET GLOBAL slow_query_log_file='/tmp/slow.log';
       
      DROP TABLE mysql.slow_log;
      # => ERROR 1580 (HY000): You cannot 'DROP' a log table if logging is enabled
       
      SET GLOBAL log_output='NONE';
       
      DROP TABLE mysql.slow_log;
      # => ERROR 1580 (HY000): You cannot 'DROP' a log table if logging is enabled
       
      SET GLOBAL slow_query_log=0;
       
      DROP TABLE mysql.slow_log;
      # => success

      Suggested fix:
      only prevent drop of "magic" log tables if logging is enabled and configured to log to the table

      Attachments

        Activity

          hholzgra Hartmut Holzgraefe created issue -

          Reproducible on MySQL 5.1 - 5.6, but not 5.7, apparently it was fixed there

          elenst Elena Stepanova added a comment - Reproducible on MySQL 5.1 - 5.6, but not 5.7, apparently it was fixed there
          elenst Elena Stepanova made changes -
          Field Original Value New Value
          Labels upstream
          elenst Elena Stepanova made changes -
          elenst Elena Stepanova made changes -
          Description See also http://bugs.mysql.com/bug.php?id=69953

          Can't drop mysql.slow_log if slow_log=on even with log_output=FILE or NONE

          I can understand preventing dropping of a log table that is in active use,
          but with log_output!=TABLE it should be dropable the same way as it is when logging is not active at all

          How to repeat:
          SET GLOBAL log_output='FILE';
          SET GLOBAL slow_query_log=1;
          SET GLOBAL slow_query_log_file='/tmp/slow.log';

          DROP TABLE mysql.slow_log;
          => ERROR 1580 (HY000): You cannot 'DROP' a log table if logging is enabled

          SET GLOBAL log_output='NONE';

          DROP TABLE mysql.slow_log;
          => ERROR 1580 (HY000): You cannot 'DROP' a log table if logging is enabled

          SET GLOBAL slow_query_log=0;

          DROP TABLE mysql.slow_log;
          => success

          Suggested fix:
          only prevent drop of "magic" log tables if logging is enabled *and* configured to log to the table
          See also http://bugs.mysql.com/bug.php?id=69953

          Can't drop mysql.slow_log if slow_log=on even with log_output=FILE or NONE

          I can understand preventing dropping of a log table that is in active use,
          but with log_output!=TABLE it should be dropable the same way as it is when logging is not active at all

          How to repeat:
          {code:sql}
          SET GLOBAL log_output='FILE';
          SET GLOBAL slow_query_log=1;
          SET GLOBAL slow_query_log_file='/tmp/slow.log';

          DROP TABLE mysql.slow_log;
          # => ERROR 1580 (HY000): You cannot 'DROP' a log table if logging is enabled

          SET GLOBAL log_output='NONE';

          DROP TABLE mysql.slow_log;
          # => ERROR 1580 (HY000): You cannot 'DROP' a log table if logging is enabled

          SET GLOBAL slow_query_log=0;

          DROP TABLE mysql.slow_log;
          # => success
          {code}

          Suggested fix:
          only prevent drop of "magic" log tables if logging is enabled *and* configured to log to the table
          serg Sergei Golubchik made changes -
          Fix Version/s 5.5.33 [ 13300 ]
          serg Sergei Golubchik made changes -
          Fix Version/s 5.5.34 [ 13500 ]
          Fix Version/s 5.5.33 [ 13300 ]
          serg Sergei Golubchik made changes -
          Fix Version/s 5.5.34 [ 13700 ]
          Fix Version/s 5.5.33a [ 13500 ]
          serg Sergei Golubchik made changes -
          Fix Version/s 5.5.35 [ 14000 ]
          Fix Version/s 5.5.34 [ 13700 ]
          serg Sergei Golubchik made changes -
          Fix Version/s 5.5.36 [ 14600 ]
          Fix Version/s 5.5.35 [ 14000 ]
          serg Sergei Golubchik made changes -
          Fix Version/s 5.5.37 [ 15000 ]
          Fix Version/s 5.5.36 [ 14600 ]
          serg Sergei Golubchik made changes -
          Fix Version/s 5.5.38 [ 15400 ]
          Fix Version/s 5.5.37 [ 15000 ]
          serg Sergei Golubchik made changes -
          Fix Version/s 5.5.39 [ 15800 ]
          Fix Version/s 5.5.38 [ 15400 ]
          serg Sergei Golubchik made changes -
          Workflow defaullt [ 28338 ] MariaDB v2 [ 44269 ]

          Fixed in 5.7.0:

          revno: 4513
          revision-id: nisha.gopalakrishnan@oracle.com-20120920070431-rzm71cm934l01kmo
          parent: marko.makela@oracle.com-20120920060910-53jj3opi391gn2ph
          committer: Nisha Gopalakrishnan <nisha.gopalakrishnan@oracle.com>
          branch nick: mysql-trunk-11763447
          timestamp: Thu 2012-09-20 12:34:31 +0530
          message:
            BUG#11763447: 'YOU CANNOT 'ALTER' A LOG TABLE IF LOGGING IS ENABLED'  
                           EVEN IF I LOG TO FILE.
            
            Analysis:
            ----------
                  
            MYSQL_UPGRADE of the master breaks the replication when
            the query logging is enabled with FILE/NONE 'log-output'
            option on the slave.
               
            mysql_upgrade modifies the 'general_log' and 'slow_log'
            tables after the logging is disabled as below:
                  
            SET @old_log_state = @@global.general_log;
            SET GLOBAL general_log = 'OFF';
            ALTER TABLE general_log
            MODIFY event_time TIMESTAMP NOT NULL,
            ( .... );
            SET GLOBAL general_log = @old_log_state;
                  
            and
                  
            SET @old_log_state = @@global.slow_query_log;
            SET GLOBAL slow_query_log = 'OFF';
            ALTER TABLE slow_log
            MODIFY start_time TIMESTAMP NOT NULL,
            ( .... );
            SET GLOBAL slow_query_log = @old_log_state;
                 
            In the binary log, only the ALTER statements are logged
            but not the SET statements which turns ON/OFF the logging.
            So when the slave replays the binary log,the ALTER of LOG
            tables throws an error since the logging is enabled. Also
            the 'log-output' option is not checked to determine
            whether to allow/disallow the ALTER operation.
                  
            Fix:
            ----
            The 'log-output' option is included in the check while
            determining whether the query logging happens using the
            log tables.

          elenst Elena Stepanova added a comment - Fixed in 5.7.0: revno: 4513 revision-id: nisha.gopalakrishnan@oracle.com-20120920070431-rzm71cm934l01kmo parent: marko.makela@oracle.com-20120920060910-53jj3opi391gn2ph committer: Nisha Gopalakrishnan <nisha.gopalakrishnan@oracle.com> branch nick: mysql-trunk-11763447 timestamp: Thu 2012-09-20 12:34:31 +0530 message: BUG#11763447: 'YOU CANNOT 'ALTER' A LOG TABLE IF LOGGING IS ENABLED' EVEN IF I LOG TO FILE. Analysis: ---------- MYSQL_UPGRADE of the master breaks the replication when the query logging is enabled with FILE/NONE 'log-output' option on the slave. mysql_upgrade modifies the 'general_log' and 'slow_log' tables after the logging is disabled as below: SET @old_log_state = @@global.general_log; SET GLOBAL general_log = 'OFF'; ALTER TABLE general_log MODIFY event_time TIMESTAMP NOT NULL, ( .... ); SET GLOBAL general_log = @old_log_state; and SET @old_log_state = @@global.slow_query_log; SET GLOBAL slow_query_log = 'OFF'; ALTER TABLE slow_log MODIFY start_time TIMESTAMP NOT NULL, ( .... ); SET GLOBAL slow_query_log = @old_log_state; In the binary log, only the ALTER statements are logged but not the SET statements which turns ON/OFF the logging. So when the slave replays the binary log,the ALTER of LOG tables throws an error since the logging is enabled. Also the 'log-output' option is not checked to determine whether to allow/disallow the ALTER operation. Fix: ---- The 'log-output' option is included in the check while determining whether the query logging happens using the log tables.
          elenst Elena Stepanova made changes -
          Fix Version/s 10.1 [ 16100 ]
          Fix Version/s 5.5 [ 15800 ]
          Labels upstream upstream-fixed
          elenst Elena Stepanova made changes -
          Affects Version/s 10.0 [ 16000 ]
          elenst Elena Stepanova made changes -
          Affects Version/s 10.1 [ 16100 ]
          Affects Version/s 5.5 [ 15800 ]
          Labels upstream-fixed upstream-fixed verified
          elenst Elena Stepanova made changes -
          Component/s Admin statements [ 11400 ]
          ratzpo Rasmus Johansson (Inactive) made changes -
          Workflow MariaDB v2 [ 44269 ] MariaDB v3 [ 63269 ]
          serg Sergei Golubchik made changes -
          Priority Minor [ 4 ] Major [ 3 ]
          alice Alice Sherepa made changes -
          Affects Version/s 10.2 [ 14601 ]
          Affects Version/s 10.3 [ 22126 ]
          alice Alice Sherepa made changes -
          Status Open [ 1 ] Confirmed [ 10101 ]
          danblack Daniel Black made changes -
          Assignee Daniel Black [ danblack ]
          danblack Daniel Black made changes -
          Fix Version/s 10.1.48 [ 25108 ]
          Fix Version/s 10.1 [ 16100 ]
          Resolution Fixed [ 1 ]
          Status Confirmed [ 10101 ] Closed [ 6 ]
          serg Sergei Golubchik made changes -
          Workflow MariaDB v3 [ 63269 ] MariaDB v4 [ 146908 ]

          People

            danblack Daniel Black
            hholzgra Hartmut Holzgraefe
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.