05.08.2013 18:05, Roberto Spadim пишет:
Hi guys! I was reading (again) the query cache source code of 10.0.3 ... please tell me if i understood right
when we insert at query cache... thread put a lock in query cache (no one can result from query cache) thread read all data and write to network (caching the result to query cache) after end of thread real the query cache is unlocked..
my doubts are... what happen if the query is too slow? the query cache is disabled while executing the query? what happen if two equal queries (same SELECT) execute? the first one is locked until the second one end the query and get the result from query cache? or the first lock query cache and the second runs without query cache?
You are wrong. Lock put only to register the query, then it will be unlocked and it is not connected to time of query executed. QC could be disabled during query execution and even situation when two same queries processed in the same time was taken into consideration and works properly. Also we put lock when write result to the cache (when intercept network output), again the lock time do not depend on query execution time.
the last one there's any query cache changes in mind? i was reading the sql_cache.cc of old mysql servers and there's a todo list (very old i think) that didn't changed from old mysql to today mariadb 10.0.3, this todo list is inside mysql bug tracker? or mariadb jira?
There are some QC changes planed (to make it more lock free for big (in terms of load) MariaDB database and you can find the task in Jira https://mariadb.atlassian.net/browse/MDEV-4454 [skip]