diff options
author | unknown <bell@laptop.sanja.is.com.ua> | 2003-08-26 16:42:49 +0300 |
---|---|---|
committer | unknown <bell@laptop.sanja.is.com.ua> | 2003-08-26 16:42:49 +0300 |
commit | 30c291ade8c10791646d24a53eb1d0d44c84eb6d (patch) | |
tree | 43cd0ccd1cec7a1aab30ca406d2a2872708a937b /sql | |
parent | 9e01611209a80e24e71f5db8746fafb0c91f26fb (diff) | |
parent | 54e252bf7498078b54d7dc38f9fb09f05bcc678d (diff) | |
download | mariadb-git-30c291ade8c10791646d24a53eb1d0d44c84eb6d.tar.gz |
Merge laptop.sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1
into laptop.sanja.is.com.ua:/home/bell/mysql/bk/work-qc-4.1
sql/sql_cache.cc:
Auto merged
sql/sql_cache.h:
Auto merged
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sql_cache.cc | 42 | ||||
-rw-r--r-- | sql/sql_cache.h | 2 |
2 files changed, 44 insertions, 0 deletions
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 64e8be8e224..f7742c6b7a7 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -769,9 +769,18 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used) STRUCT_LOCK(&structure_guard_mutex); if (query_cache_size == 0) + { + STRUCT_UNLOCK(&structure_guard_mutex); DBUG_VOID_RETURN; + } DUMP(this); + if (ask_handler_allowance(thd, tables_used)) + { + STRUCT_UNLOCK(&structure_guard_mutex); + DBUG_VOID_RETURN; + } + /* Key is query + database + flag */ if (thd->db_length) { @@ -2548,6 +2557,39 @@ TABLE_COUNTER_TYPE Query_cache::is_cacheable(THD *thd, uint32 query_len, DBUG_RETURN(0); } +/* + Check handler allowence to cache query with this tables + + SYNOPSYS + Query_cache::ask_handler_allowance() + thd - thread handlers + tables_used - tables list used in query + + RETURN + 0 - caching allowed + 1 - caching disallowed +*/ +my_bool Query_cache::ask_handler_allowance(THD *thd, + TABLE_LIST *tables_used) +{ + DBUG_ENTER("Query_cache::is_cacheable"); + + for (; tables_used; tables_used= tables_used->next) + { + TABLE *table= tables_used->table; + if (!handler::caching_allowed(thd, table->table_cache_key, + table->key_length, + table->file->table_cache_type())) + { + DBUG_PRINT("qcache", ("Handler does not allow caching for %s.%s", + tables_used->db, tables_used->alias)); + thd->lex.safe_to_cache_query= 0; // Don't try to cache this + DBUG_RETURN(1); + } + } + DBUG_RETURN(0); +} + /***************************************************************************** Packing diff --git a/sql/sql_cache.h b/sql/sql_cache.h index f6eb7c7a0fb..68e69ab523f 100644 --- a/sql/sql_cache.h +++ b/sql/sql_cache.h @@ -345,6 +345,8 @@ protected: TABLE_COUNTER_TYPE is_cacheable(THD *thd, uint32 query_len, char *query, LEX *lex, TABLE_LIST *tables_used, uint8 *tables_type); + + static my_bool ask_handler_allowance(THD *thd, TABLE_LIST *tables_used); public: Query_cache(ulong query_cache_limit = ULONG_MAX, |