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

Invalid "use" and "Schema" in slow query log file with multi-line schema

Details

    Description

      Hi,

      In addition of MariaDB being impacted by Bug#115526 : Invalid multi-line "use" in slow query log file with multi-line schema, the "Schema" part of the file is wrong. How to reproduce below.

      I only tested with MariaDB 11.4.2, but I guess many other versions are affected.

      A suggestion for fixing this is in the upstream bug report.

      Many thanks for looking into this,

      Jean-François Gagné

      v=mariadb_11.4.2
      dbdeployer deploy single $v -c slow_query_log_file=slow.log -c slow_query_log=ON
      cd ~/sandboxes/msb_${v//./_}
      db_name='test
      jfg'
      ./use <<< "create database \`$db_name\`; create table \`$db_name\`.t(id int); insert into \`$db_name\`.t values (1);"
      ./use "$db_name" <<< "set session long_query_time=0.5; select sleep(1), t.* from t;" > /dev/null
       
      tail -n 10  data/slow.log
      # Time: 240705 19:12:03
      # User@Host: msandbox[msandbox] @ localhost []
      # Thread_id: 5  Schema: test
      jfg  QC_hit: No
      # Query_time: 1.000310  Lock_time: 0.000058  Rows_sent: 1  Rows_examined: 1
      # Rows_affected: 0  Bytes_sent: 108
      use test
      jfg;
      SET timestamp=1720206723;
      select sleep(1), t.* from t;
      

      Attachments

        Issue Links

          Activity

            I don't see how it is a problem, slow log isn't supposed to be a piped to a mysql client. For starters it has a non-sql header in the first lines.

            but this nuisance can be confusing, so let's fix it, it's easy.

            serg Sergei Golubchik added a comment - I don't see how it is a problem, slow log isn't supposed to be a piped to a mysql client. For starters it has a non-sql header in the first lines. but this nuisance can be confusing, so let's fix it, it's easy.

            > I don't see how it is a problem, slow log isn't supposed to be a piped to a mysql client. For starters it has a non-sql header in the first lines.

            Right, I am not disagreeing with you, but in both cases ("use" and "Schema"), it might break parsing.

            I would suggest removing the "use" and escaping the "Schema". Ideally, the Schema should be escape in such a way that automation can send this "escaped" Schema to a MySQL sorry MariaDB client.

            jeanfrancois.gagne Jean-François Gagné added a comment - > I don't see how it is a problem, slow log isn't supposed to be a piped to a mysql client. For starters it has a non-sql header in the first lines. Right, I am not disagreeing with you, but in both cases ("use" and "Schema"), it might break parsing. I would suggest removing the "use" and escaping the "Schema". Ideally, the Schema should be escape in such a way that automation can send this "escaped" Schema to a MySQL sorry MariaDB client.

            People

              serg Sergei Golubchik
              jeanfrancois.gagne Jean-François Gagné
              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.