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

Slow log: RENAME TABLE is not "admin", while ALTER TABLE..RENAME is

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.1(EOL), 10.2(EOL), 10.3(EOL), 10.4(EOL)
    • 10.1.39
    • OTHER
    • None

    Description

      RENAME TABLE is not an "admin" command from the point of view of slow log. Its alias "ALTER TABLE..RENAME" is. They should be both "admin" for consistency.

      This script demonstrates that RENAME TABLE does not honor log_slow_filter='admin':

      SET @@GLOBAL.slow_query_log=OFF;
      SET @@GLOBAL.log_output='TABLE';
      TRUNCATE TABLE mysql.slow_log;
      FLUSH SLOW LOGS;
      SET @@GLOBAL.slow_query_log=ON;
       
      SET @@GLOBAL.log_slow_admin_statements=ON;
      SET log_slow_filter='admin';
      SET long_query_time=0.000001;
       
      DROP TABLE IF EXISTS t1,t2,t3;
      CREATE TABLE t1 (a INT);
      ALTER TABLE t1 RENAME t2;
      RENAME TABLE t2 TO t3;
      DROP TABLE t3;
       
      SELECT sql_text FROM mysql.slow_log;
      

      +--------------------------+
      | sql_text                 |
      +--------------------------+
      | ALTER TABLE t1 RENAME t2 |
      +--------------------------+
      

      Attachments

        Issue Links

          Activity

            bar Alexander Barkov created issue -
            bar Alexander Barkov made changes -
            Field Original Value New Value
            bar Alexander Barkov made changes -
            Description RENAME TABLE is not an "admin" command from the point of view of slow log. It's alias "ALTER TABLE..RENAME" is. They should be both "admin" for consistency.

            This script demonstrates that {{RENAME TABLE}} does not honor {{log_slow_filter='admin'}}:
            {code:sql}
            SET @@GLOBAL.slow_query_log=OFF;
            SET @@GLOBAL.log_output='TABLE';
            TRUNCATE TABLE mysql.slow_log;
            FLUSH SLOW LOGS;
            SET @@GLOBAL.slow_query_log=ON;

            SET @@GLOBAL.log_slow_admin_statements=ON;
            SET log_slow_filter='admin';
            SET long_query_time=0.000001;

            DROP TABLE IF EXISTS t1,t2,t3;
            CREATE TABLE t1 (a INT);
            ALTER TABLE t1 RENAME t2;
            RENAME TABLE t2 TO t3;
            DROP TABLE t3;

            SELECT sql_text FROM mysql.slow_log;
            {code}
            {noformat}
            +--------------------------+
            | sql_text |
            +--------------------------+
            | ALTER TABLE t1 RENAME t2 |
            +--------------------------+
            {noformat}
            RENAME TABLE is not an "admin" command from the point of view of slow log. Its alias "ALTER TABLE..RENAME" is. They should be both "admin" for consistency.

            This script demonstrates that {{RENAME TABLE}} does not honor {{log_slow_filter='admin'}}:
            {code:sql}
            SET @@GLOBAL.slow_query_log=OFF;
            SET @@GLOBAL.log_output='TABLE';
            TRUNCATE TABLE mysql.slow_log;
            FLUSH SLOW LOGS;
            SET @@GLOBAL.slow_query_log=ON;

            SET @@GLOBAL.log_slow_admin_statements=ON;
            SET log_slow_filter='admin';
            SET long_query_time=0.000001;

            DROP TABLE IF EXISTS t1,t2,t3;
            CREATE TABLE t1 (a INT);
            ALTER TABLE t1 RENAME t2;
            RENAME TABLE t2 TO t3;
            DROP TABLE t3;

            SELECT sql_text FROM mysql.slow_log;
            {code}
            {noformat}
            +--------------------------+
            | sql_text |
            +--------------------------+
            | ALTER TABLE t1 RENAME t2 |
            +--------------------------+
            {noformat}
            bar Alexander Barkov made changes -
            issue.field.resolutiondate 2019-03-13 11:39:03.0 2019-03-13 11:39:03.761
            bar Alexander Barkov made changes -
            Fix Version/s 10.1.39 [ 23305 ]
            Fix Version/s 10.1 [ 16100 ]
            Resolution Fixed [ 1 ]
            Status Open [ 1 ] Closed [ 6 ]
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 93240 ] MariaDB v4 [ 155914 ]

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.