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

Query with reversed executable comments gets in query cache, but never hits

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • N/A
    • None
    • None
    • None

    Description

      Query with reversed executable comment will be in cache, but never used. And such queries could pollute the cache.
      in test - added to compare reversed and "normal" executable comment:

      --source include/have_query_cache.inc
      set @@global.query_cache_type=1;
      set @@global.query_cache_size=1024*1024;
       
      CREATE TABLE t1(c1 INT);
      INSERT INTO t1 values (1),(2),(3);
       
      SELECT /*!!999999 c1 */ FROM t1;
      SELECT /*!!999999 c1 */ FROM t1;
       
      SHOW STATUS LIKE 'Qcache_hits';
       
      SELECT /*M!50300 c1 */ FROM t1;
      SELECT /*M!50300 c1 */ FROM t1;
       
      SHOW STATUS LIKE 'Qcache_hits';
       
      DROP TABLE t1;
      

      SELECT /*!!999999 c1 */ FROM t1;
      c1
      1
      2
      3
      SELECT /*!!999999 c1 */ FROM t1;
      c1
      1
      2
      3
      SHOW STATUS LIKE 'Qcache_hits';
      Variable_name	Value
      Qcache_hits	0
      SELECT /*M!50300 c1 */ FROM t1;
      c1
      1
      2
      3
      SELECT /*M!50300 c1 */ FROM t1;
      c1
      1
      2
      3
      SHOW STATUS LIKE 'Qcache_hits';
      Variable_name	Value
      Qcache_hits	1
      

      Attachments

        Issue Links

          Activity

            People

              gkodinov Georgi Kodinov
              alice Alice Sherepa
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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