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

SELECT from I_S.QUERY_CACHE_INFO produces ER_UNKNOWN_ERROR when query cache size is 0

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • 5.5.31
    • 5.5.32
    • None
    • None

    Description

      MariaDB [test]> set global query_cache_size = 1024*1024;
      Query OK, 0 rows affected (0.00 sec)
       
      MariaDB [test]> select * from information_schema.query_cache_info;
      Empty set (0.00 sec)
       
      MariaDB [test]> set global query_cache_size = 0;
      Query OK, 0 rows affected (0.00 sec)
       
      MariaDB [test]> select * from information_schema.query_cache_info;
      ERROR 1105 (HY000): Unknown error

      bzr version-info

      revision-id: monty@askmonty.org-20130512082916-vjlzg3tjtlbvnowy
      revno: 3759
      branch-nick: 5.5

      Attachments

        Issue Links

          Activity

            elenst Elena Stepanova created issue -
            elenst Elena Stepanova made changes -
            Field Original Value New Value
            elenst Elena Stepanova made changes -
            rspadim roberto spadim made changes -
            Comment [ file #sqlc24_7_1a6.MAD
            http://www.megafileupload.com/en/file/420206/-sqlc24-7-1a6-MAD.html

            sorry there wasn't another open place to upload a binary file ]
            rspadim roberto spadim made changes -
            Comment [ hum.. temporary file isn't deleted
            my temporary folder have about 10 files like this
            #sqlc24_7_16e.MAD
            #sqlc24_7_16c.MAD
            #sqlc24_7_2d4.MAD
            #sqlc24_7_2b8.MAD
            ... ]
            rspadim roberto spadim made changes -
            Comment [ MDEV-249 have more information about others errors

            1)flush query cache don't work
            Qcache_queries_in_cache=1
            select * from query_cache_info -> return 1 row
            FLUSH QUERY CACHE;
            Qcache_queries_in_cache=1
            select * from query_cache_info -> return 1 row (the same row)

            flush tables works...

            Qcache_queries_in_cache=1
            select * from query_cache_info -> return 1 row
            FLUSH TABLES;
            Qcache_queries_in_cache=0
            select * from query_cache_info -> return 0 row

            2)
            "select * from query_cache_information"
            many times per second (press f5 in heidisql and leave pressed)
            give errors some times, errcode=13 (no permission?) sql err=6 (problem deleting temporary file)
            maybe a problem when deleting some temporary table file
            show warnings
            "Level" "Code" "Message"
            "Error" "6" "Error on delete of 'C:\Users\Beto\AppData\Local\Temp\#sqlc24_7_1a6.MAD' (Errcode: 13)"

            3)when query_cache_size=0

            set global query_cache_size=0;
            select * from `information_schema`.`QUERY_CACHE_INFO`;
            /* Erro SQL (1105): Unknown error */


            4)DELETE?
            could we delete some query cached? ok =) not now, but maybe in future?

            5)more columns
            i don't know if we have this information but, could be nice have a hit_count per query

            6)how to use query_cache_stip_comments var?
            what it do? how to use it? ]
            rspadim roberto spadim added a comment - - edited

            MDEV-249 have more information about others errors

            1)flush query cache don't work (DISCONSIDER THIS, I SHOULD USE reset query cache)
            Qcache_queries_in_cache=1
            select * from query_cache_info -> return 1 row
            FLUSH QUERY CACHE;
            Qcache_queries_in_cache=1
            select * from query_cache_info -> return 1 row (the same row)

            -------
            flush tables works...

            Qcache_queries_in_cache=1
            select * from query_cache_info -> return 1 row
            FLUSH TABLES;
            Qcache_queries_in_cache=0
            select * from query_cache_info -> return 0 row

            -------
            uninstall plugin QUERY_CACHE_INFO;
            Qcache_queries_in_cache=1;
            flush query cache;
            Qcache_queries_in_cache=1;

            that's not a plugin problem, maybe a mariadb query cache problem

            2)
            "select * from query_cache_information"
            many times per second (press f5 in heidisql and leave pressed)
            give errors some times, errcode=13 (no permission?) sql err=6 (problem deleting file)
            show warnings
            "Level" "Code" "Message"
            "Error" "6" "Error on delete of 'C:\Users\Beto\AppData\Local\Temp#sqlc24_7_1a6.MAD' (Errcode: 13)"


            file #sqlc24_7_1a6.MAD
            http://www.megafileupload.com/en/file/420206/-sqlc24-7-1a6-MAD.html
            sorry there wasn't another open place to upload a binary file


            hum.. temporary file isn't deleted
            my temporary folder have about 10 files like this
            #sqlc24_7_16e.MAD
            #sqlc24_7_16c.MAD
            #sqlc24_7_2d4.MAD
            #sqlc24_7_2b8.MAD
            ....


            3)when query_cache_size=0

            set global query_cache_size=0;
            select * from `information_schema`.`QUERY_CACHE_INFO`;
            /* Erro SQL (1105): Unknown error */

            4)DELETE?
            could we delete some query cached? ok =) not now, but maybe in future?

            5)more columns
            i don't know if we have this information but, could be nice have a hit_count per query

            6)how to use "query_cache_strip_comments" var?
            what it do? how to use it?

            rspadim roberto spadim added a comment - - edited MDEV-249 have more information about others errors 1)flush query cache don't work (DISCONSIDER THIS, I SHOULD USE reset query cache) Qcache_queries_in_cache=1 select * from query_cache_info -> return 1 row FLUSH QUERY CACHE; Qcache_queries_in_cache=1 select * from query_cache_info -> return 1 row (the same row) ------- flush tables works... Qcache_queries_in_cache=1 select * from query_cache_info -> return 1 row FLUSH TABLES; Qcache_queries_in_cache=0 select * from query_cache_info -> return 0 row ------- uninstall plugin QUERY_CACHE_INFO; Qcache_queries_in_cache=1; flush query cache; Qcache_queries_in_cache=1; that's not a plugin problem, maybe a mariadb query cache problem 2) "select * from query_cache_information" many times per second (press f5 in heidisql and leave pressed) give errors some times, errcode=13 (no permission?) sql err=6 (problem deleting file) show warnings "Level" "Code" "Message" "Error" "6" "Error on delete of 'C:\Users\Beto\AppData\Local\Temp#sqlc24_7_1a6.MAD' (Errcode: 13)" file #sqlc24_7_1a6.MAD http://www.megafileupload.com/en/file/420206/-sqlc24-7-1a6-MAD.html sorry there wasn't another open place to upload a binary file hum.. temporary file isn't deleted my temporary folder have about 10 files like this #sqlc24_7_16e.MAD #sqlc24_7_16c.MAD #sqlc24_7_2d4.MAD #sqlc24_7_2b8.MAD .... 3)when query_cache_size=0 set global query_cache_size=0; select * from `information_schema`.`QUERY_CACHE_INFO`; /* Erro SQL (1105): Unknown error */ 4)DELETE? could we delete some query cached? ok =) not now, but maybe in future? 5)more columns i don't know if we have this information but, could be nice have a hit_count per query 6)how to use "query_cache_strip_comments" var? what it do? how to use it?
            rspadim roberto spadim added a comment - - edited

            i was reading review: http://bazaar.launchpad.net/~maria-captains/maria/5.5/revision/3705#plugin/qc_info/qc_info.cc
            some doubts about implementation... i don't know if i'm right, but check:
            1)

            79 HASH *queries = qc->get_queries();

            shouldn't it be after line

            85 if (qc->try_lock(thd))
            86 return status;

            and before line:

            88 /* loop through all queries in the query cache */
            89 for (uint i= 0; i < queries->records; i++)

            2) when query_cache_size=0, queries->records = null? shouldn't the lock (qc->try_lock) return a "can't" information?
            i was reading sql_cache.cc, at flush part:
            they test query_cache_size before flush:
            lock_and_suspend();
            if (query_cache_size > 0)

            { DUMP(this); flush_cache(); DUMP(this); }

            3) the internal key on line 119, is a "primary key" of query cache? could it be exposed for future "delete from query_cache_information where key = 'xyz' "?

            119 key = (const char*)query_cache_query_get_key(query_cache_block_raw,
            120 &key_length, 0);

            rspadim roberto spadim added a comment - - edited i was reading review: http://bazaar.launchpad.net/~maria-captains/maria/5.5/revision/3705#plugin/qc_info/qc_info.cc some doubts about implementation... i don't know if i'm right, but check: 1) 79 HASH *queries = qc->get_queries(); shouldn't it be after line 85 if (qc->try_lock(thd)) 86 return status; and before line: 88 /* loop through all queries in the query cache */ 89 for (uint i= 0; i < queries->records; i++) 2) when query_cache_size=0, queries->records = null? shouldn't the lock (qc->try_lock) return a "can't" information? i was reading sql_cache.cc, at flush part: they test query_cache_size before flush: lock_and_suspend(); if (query_cache_size > 0) { DUMP(this); flush_cache(); DUMP(this); } 3) the internal key on line 119, is a "primary key" of query cache? could it be exposed for future "delete from query_cache_information where key = 'xyz' "? 119 key = (const char*)query_cache_query_get_key(query_cache_block_raw, 120 &key_length, 0);
            serg Sergei Golubchik made changes -
            Status Open [ 1 ] In Progress [ 3 ]

            1) doesn't matter. qc->get_queries() simply returns a pointer to the data structure. This pointer is always (char*)qc + offsetof(Query_cache, queries), that is, it is qc plus fixed constant. So one can call get_queries() any time with or without a lock. But, of course, one should never look into the returned "queries" HASH without a lock.

            2) when query_cache_size==0, qc->try_lock() fails. This is what this bug — MDEV-4516 — is about.

            3) no, I_S tables are strictly read-only views into the internal system data. At least for now. There's no way to modify them.

            serg Sergei Golubchik added a comment - 1) doesn't matter. qc->get_queries() simply returns a pointer to the data structure. This pointer is always (char*)qc + offsetof(Query_cache, queries), that is, it is qc plus fixed constant. So one can call get_queries() any time with or without a lock. But, of course, one should never look into the returned "queries" HASH without a lock. 2) when query_cache_size==0, qc->try_lock() fails. This is what this bug — MDEV-4516 — is about. 3) no, I_S tables are strictly read-only views into the internal system data. At least for now. There's no way to modify them.

            nice =) thanks about source code and memory format information =)

            rspadim roberto spadim added a comment - nice =) thanks about source code and memory format information =)

            what about the temporary file not being deleted?
            should i create some others bugs to track this problems?

            rspadim roberto spadim added a comment - what about the temporary file not being deleted? should i create some others bugs to track this problems?

            yes. please don't report new bugs as comments to existing bugs.
            new bug — new issue in Jira.

            serg Sergei Golubchik added a comment - yes. please don't report new bugs as comments to existing bugs. new bug — new issue in Jira.

            ok MDEV-4576 and MDEV-4571
            thanks!

            rspadim roberto spadim added a comment - ok MDEV-4576 and MDEV-4571 thanks!

            set global query_cache_type=0, global query_cache_size=1000000;

            get the same error code
            /* Erro SQL (1105): Unknown error */

            rspadim roberto spadim added a comment - set global query_cache_type=0, global query_cache_size=1000000; get the same error code /* Erro SQL (1105): Unknown error */

            this is a "patch" (my first one in mariadb!! =) )
            diff -u qc_info.old.cc qc_info.cc > diff_qc_info.cc

            of mariadb 5.5.31 query cache plugin
            i did more checks about query_cache_size and query_cache_type
            i put more columns too (please review since i don't know very well what i'm doing)

            that's all =)

            rspadim roberto spadim added a comment - this is a "patch" (my first one in mariadb!! =) ) diff -u qc_info.old.cc qc_info.cc > diff_qc_info.cc of mariadb 5.5.31 query cache plugin i did more checks about query_cache_size and query_cache_type i put more columns too (please review since i don't know very well what i'm doing) that's all =)
            rspadim roberto spadim made changes -
            Attachment diff_qc_info.cc [ 22229 ]

            Thanks! But this particular bug is already fixed. Could you create a new issue — for adding more columns to the table — and attach your patch there please?

            serg Sergei Golubchik added a comment - Thanks! But this particular bug is already fixed. Could you create a new issue — for adding more columns to the table — and attach your patch there please?
            serg Sergei Golubchik made changes -
            Resolution Fixed [ 1 ]
            Status In Progress [ 3 ] Closed [ 6 ]

            yes, it's: MDEV-4581

            rspadim roberto spadim added a comment - yes, it's: MDEV-4581
            serg Sergei Golubchik made changes -
            Workflow defaullt [ 27380 ] MariaDB v2 [ 46391 ]
            ratzpo Rasmus Johansson (Inactive) made changes -
            Workflow MariaDB v2 [ 46391 ] MariaDB v3 [ 67094 ]
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 67094 ] MariaDB v4 [ 146692 ]

            People

              serg Sergei Golubchik
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.