Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Minor
-
Resolution: Won't Fix
-
Affects Version/s: 10.1, 10.0, 5.5
-
Fix Version/s: N/A
-
Component/s: Query Cache
-
Labels:None
Description
when using
SELECT sql_some_hint SQL_NO_CACHE ...
or
SELECT sql_some_hint SQL_CACHE ...
the query cache 'parser' don't check for SQL_CACHE/SQL_NO_CACHE if it's not after "SELECT", we should check more bytes after "SELECT" to make sure we don't have "SQL_NO_CACHE"/"SQL_CACHE" hint, i think 50~100 bytes of search is ok, but we can have some situations like
SELECT /* comments more than 100 byts */ SQL_CACHE/SQL_NO_CACHE -- must read only hints, not comments
or
SELECT /* comment SQL_CACHE */ SQL_NO_CACHE ... -- should not cache
or
SELECT /* comment SQL_NO_CACHE */ SQL_CACHE ... -- should cache
must check what's a nice number to have as 'buffer size' to execute this "HINT" search
- a idea is search one space after each hint, we could check 10 spaces, if SQL_NO_CACHE / SQL_CACHE isn't found, continue checking qc normally as we don't know if hints are present or not without executing the "real" parser
- another idea is search for 50~100 bytes after "SELECT"
- run query cache before and after parser (to execute a 100% SQL_NO_CACHE / SQL_CACHE search)
Gliffy Diagrams
Attachments
Issue Links
- relates to
-
MDEV-6631 No cache directive(SQL_CACHE) query still wait for "query cache lock" on query_cache_type=DEMAND mode
-
- Open
-
- links to
Activity
- All
- Comments
- Work Log
- History
- Activity
- Transitions
roberto spadim as per your parent issue comment yes only a propper parse will probably do. ./sql/sql_parse.cc:mysql_parse contains some FIXMEs that seem to indicate this. Attempting to parse the query as just a SELECT before deciding on query_cache_send_result_to_client is one way, but looking at the bison generated parse code I'm out of my depth.