-
Nisha Gopalakrishnan authored
DOLLAR SIGN AND ENGINE IS INNODB Analysis -------- The query cache is not used when the database name or the table name contains special characters and the engine used is INNODB. Ex: CREATE TABLE 'db-test'.'query$table'(fld int) ENGINE=INNODB; While storing the query, the query cache interface checks with the storage engine module to determine whether the query can be cached. INNODB uses the canonical format ('db@002dtest/query@0024table') as the key to find the corresponding table object. The query cache interface passes the key which is a string of the format 'databasename/0tablename' in a non-canonical format ('db-test/0query$table'). Hence the hash value generated is different and the table object is not found. So when the query cache interface checks with storage engine to determine whether the query can be cached, the storage engine INNODB does not find the corresponding table object. Hence the query is not cached. Fix --- a) The query cache interface now passes the normalized path to the table in its canonical form to the storage engines. b) The piece of code in the routine 'innobase_query_caching_of_table_permitted' used to normalize the table name is replaced with an existing macro 'normalize_table_name' which does the same. c) THE NDB handler code which used to perform the conversion of the key to canonical format has been removed. This is because the query cache interface now passes the canonical format of the key to the storage engines.
Nisha Gopalakrishnan authoredDOLLAR SIGN AND ENGINE IS INNODB Analysis -------- The query cache is not used when the database name or the table name contains special characters and the engine used is INNODB. Ex: CREATE TABLE 'db-test'.'query$table'(fld int) ENGINE=INNODB; While storing the query, the query cache interface checks with the storage engine module to determine whether the query can be cached. INNODB uses the canonical format ('db@002dtest/query@0024table') as the key to find the corresponding table object. The query cache interface passes the key which is a string of the format 'databasename/0tablename' in a non-canonical format ('db-test/0query$table'). Hence the hash value generated is different and the table object is not found. So when the query cache interface checks with storage engine to determine whether the query can be cached, the storage engine INNODB does not find the corresponding table object. Hence the query is not cached. Fix --- a) The query cache interface now passes the normalized path to the table in its canonical form to the storage engines. b) The piece of code in the routine 'innobase_query_caching_of_table_permitted' used to normalize the table name is replaced with an existing macro 'normalize_table_name' which does the same. c) THE NDB handler code which used to perform the conversion of the key to canonical format has been removed. This is because the query cache interface now passes the canonical format of the key to the storage engines.
Loading