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

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

    XMLWordPrintable

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

            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.