[MDEV-4516] SELECT from I_S.QUERY_CACHE_INFO produces ER_UNKNOWN_ERROR when query cache size is 0 Created: 2013-05-12  Updated: 2013-06-11  Resolved: 2013-05-25

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: 5.5.31
Fix Version/s: 5.5.32

Type: Bug Priority: Minor
Reporter: Elena Stepanova Assignee: Sergei Golubchik
Resolution: Fixed Votes: 0
Labels: None

Attachments: Text File diff_qc_info.cc    
Issue Links:
Relates
relates to MDEV-249 QUERY CACHE INFORMATION Closed

 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



 Comments   
Comment by roberto spadim [ 2013-05-24 ]

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?

Comment by roberto spadim [ 2013-05-24 ]

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);

Comment by Sergei Golubchik [ 2013-05-24 ]

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.

Comment by roberto spadim [ 2013-05-24 ]

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

Comment by roberto spadim [ 2013-05-24 ]

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

Comment by Sergei Golubchik [ 2013-05-24 ]

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

Comment by roberto spadim [ 2013-05-24 ]

ok MDEV-4576 and MDEV-4571
thanks!

Comment by roberto spadim [ 2013-05-25 ]

set global query_cache_type=0, global query_cache_size=1000000;

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

Comment by roberto spadim [ 2013-05-25 ]

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 =)

Comment by Sergei Golubchik [ 2013-05-25 ]

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?

Comment by roberto spadim [ 2013-06-11 ]

yes, it's: MDEV-4581

Generated at Thu Feb 08 06:57:02 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.