Loading mysql-test/r/query_cache.result +10 −0 Original line number Diff line number Diff line Loading @@ -526,3 +526,13 @@ show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 2 drop table t1, t2, t3; use mysql; select * from db; show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 0 use test; select * from mysql.db; show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 0 mysql-test/t/query_cache.test +14 −0 Original line number Diff line number Diff line Loading @@ -367,3 +367,17 @@ show status like "Qcache_queries_in_cache"; select * from t3; show status like "Qcache_queries_in_cache"; drop table t1, t2, t3; # # system databse test # use mysql; disable_result_log; select * from db; enable_result_log; show status like "Qcache_queries_in_cache"; use test; disable_result_log; select * from mysql.db; enable_result_log; show status like "Qcache_queries_in_cache"; sql/sql_cache.cc +17 −5 Original line number Diff line number Diff line Loading @@ -342,6 +342,12 @@ TODO list: #define DUMP(C) #endif #ifdef FN_NO_CASE_SENCE #define DB_NAME_PREPROCESS(C) tolower(C) #else #define DB_NAME_PREPROCESS(C) (C) #endif const char *query_cache_type_names[]= { "OFF", "ON", "DEMAND",NullS }; TYPELIB query_cache_type_typelib= { Loading Loading @@ -1378,11 +1384,11 @@ ulong Query_cache::init_cache() VOID(hash_init(&queries,def_query_hash_size, 0, 0, query_cache_query_get_key, 0, 0)); #ifndef __WIN__ #ifndef FN_NO_CASE_SENCE VOID(hash_init(&tables,def_table_hash_size, 0, 0, query_cache_table_get_key, 0, 0)); #else // windows case insensitive file names work around // windows, OS/2 or other case insensitive file names work around VOID(hash_init(&tables,def_table_hash_size, 0, 0, query_cache_table_get_key, 0, (lower_case_table_names?0:HASH_CASE_INSENSITIVE))); Loading Loading @@ -2442,10 +2448,16 @@ TABLE_COUNTER_TYPE Query_cache::is_cacheable(THD *thd, uint32 query_len, tables_used->table->file->has_transactions()); if (tables_used->table->db_type == DB_TYPE_MRG_ISAM || tables_used->table->tmp_table != NO_TMP_TABLE) tables_used->table->tmp_table != NO_TMP_TABLE || (tables_used->db_length == 5 && DB_NAME_PREPROCESS(tables_used->db[0])=='m' && DB_NAME_PREPROCESS(tables_used->db[1])=='y' && DB_NAME_PREPROCESS(tables_used->db[2])=='s' && DB_NAME_PREPROCESS(tables_used->db[3])=='q' && DB_NAME_PREPROCESS(tables_used->db[4])=='l')) { DBUG_PRINT("qcache", ("select not cacheable: used MRG_ISAM or temporary table(s)")); ("select not cacheable: used MRG_ISAM, temporary or system table(s)")); DBUG_RETURN(0); } if (tables_used->table->db_type == DB_TYPE_MRG_MYISAM) Loading Loading
mysql-test/r/query_cache.result +10 −0 Original line number Diff line number Diff line Loading @@ -526,3 +526,13 @@ show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 2 drop table t1, t2, t3; use mysql; select * from db; show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 0 use test; select * from mysql.db; show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 0
mysql-test/t/query_cache.test +14 −0 Original line number Diff line number Diff line Loading @@ -367,3 +367,17 @@ show status like "Qcache_queries_in_cache"; select * from t3; show status like "Qcache_queries_in_cache"; drop table t1, t2, t3; # # system databse test # use mysql; disable_result_log; select * from db; enable_result_log; show status like "Qcache_queries_in_cache"; use test; disable_result_log; select * from mysql.db; enable_result_log; show status like "Qcache_queries_in_cache";
sql/sql_cache.cc +17 −5 Original line number Diff line number Diff line Loading @@ -342,6 +342,12 @@ TODO list: #define DUMP(C) #endif #ifdef FN_NO_CASE_SENCE #define DB_NAME_PREPROCESS(C) tolower(C) #else #define DB_NAME_PREPROCESS(C) (C) #endif const char *query_cache_type_names[]= { "OFF", "ON", "DEMAND",NullS }; TYPELIB query_cache_type_typelib= { Loading Loading @@ -1378,11 +1384,11 @@ ulong Query_cache::init_cache() VOID(hash_init(&queries,def_query_hash_size, 0, 0, query_cache_query_get_key, 0, 0)); #ifndef __WIN__ #ifndef FN_NO_CASE_SENCE VOID(hash_init(&tables,def_table_hash_size, 0, 0, query_cache_table_get_key, 0, 0)); #else // windows case insensitive file names work around // windows, OS/2 or other case insensitive file names work around VOID(hash_init(&tables,def_table_hash_size, 0, 0, query_cache_table_get_key, 0, (lower_case_table_names?0:HASH_CASE_INSENSITIVE))); Loading Loading @@ -2442,10 +2448,16 @@ TABLE_COUNTER_TYPE Query_cache::is_cacheable(THD *thd, uint32 query_len, tables_used->table->file->has_transactions()); if (tables_used->table->db_type == DB_TYPE_MRG_ISAM || tables_used->table->tmp_table != NO_TMP_TABLE) tables_used->table->tmp_table != NO_TMP_TABLE || (tables_used->db_length == 5 && DB_NAME_PREPROCESS(tables_used->db[0])=='m' && DB_NAME_PREPROCESS(tables_used->db[1])=='y' && DB_NAME_PREPROCESS(tables_used->db[2])=='s' && DB_NAME_PREPROCESS(tables_used->db[3])=='q' && DB_NAME_PREPROCESS(tables_used->db[4])=='l')) { DBUG_PRINT("qcache", ("select not cacheable: used MRG_ISAM or temporary table(s)")); ("select not cacheable: used MRG_ISAM, temporary or system table(s)")); DBUG_RETURN(0); } if (tables_used->table->db_type == DB_TYPE_MRG_MYISAM) Loading