diff options
author | Konstantin Osipov <kostja@sun.com> | 2009-10-13 22:18:48 +0400 |
---|---|---|
committer | Konstantin Osipov <kostja@sun.com> | 2009-10-13 22:18:48 +0400 |
commit | 99420dd913333cf7bb109e9c5d71d2daf66e3dca (patch) | |
tree | dbed8bfecfa79c568812273856637bd355bb78eb /sql/sql_cache.h | |
parent | 9a65687bd9e76783d3e34cb35b5c8cc05421134d (diff) | |
download | mariadb-git-99420dd913333cf7bb109e9c5d71d2daf66e3dca.tar.gz |
Introduce thd->query_cache_tls (thread
local storage for query cache).
We need more than one pointer in a thread to
represent the query cache and net->query_cache_query can not be used
any more (due to ABI compatibility issues and to different life
time of NET and THD).
This is a backport of the following patch from 6.0:
----------------------------------------------------------
revno: 2476.1157.2
committer: kostja@bodhi.(none)
timestamp: Sat 2007-06-16 13:29:24 +0400
include/mysql.h.pp:
Update the ABI (NET::query_cache_query is now unused).
include/mysql_com.h:
NET::query_cache_query is now unused.
sql/mysql_priv.h:
Update signatures of ex-functios now member functions.
sql/sql_cache.cc:
Introduce THD::query_cache_tls.
sql/sql_cache.h:
Introduce THD::query_cache_tls.
sql/sql_class.cc:
Introduce THD::query_cache_tls.
sql/sql_class.h:
Introduce THD::query_cache_tls.
sql/sql_parse.cc:
Use THD::query_cache_tls.
sql/sql_select.cc:
Use THD::query_cache_tls.
Diffstat (limited to 'sql/sql_cache.h')
-rw-r--r-- | sql/sql_cache.h | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/sql/sql_cache.h b/sql/sql_cache.h index 777ddd39280..a1132adfa5a 100644 --- a/sql/sql_cache.h +++ b/sql/sql_cache.h @@ -64,6 +64,8 @@ struct Query_cache_table; struct Query_cache_query; struct Query_cache_result; class Query_cache; +struct Query_cache_tls; +struct st_lex; /** This class represents a node in the linked chain of queries @@ -137,7 +139,7 @@ struct Query_cache_query ulonglong limit_found_rows; rw_lock_t lock; Query_cache_block *res; - NET *wri; + Query_cache_tls *wri; ulong len; uint8 tbls_type; unsigned int last_pkt_nr; @@ -149,8 +151,8 @@ struct Query_cache_query inline void found_rows(ulonglong rows) { limit_found_rows= rows; } inline Query_cache_block *result() { return res; } inline void result(Query_cache_block *p) { res= p; } - inline NET *writer() { return wri; } - inline void writer(NET *p) { wri= p; } + inline Query_cache_tls *writer() { return wri; } + inline void writer(Query_cache_tls *p) { wri= p; } inline uint8 tables_type() { return tbls_type; } inline void tables_type(uint8 type) { tbls_type= type; } inline ulong length() { return len; } @@ -407,7 +409,8 @@ protected: If query is cacheable return number tables in query (query without tables not cached) */ - TABLE_COUNTER_TYPE is_cacheable(THD *thd, uint32 query_len, char *query, + TABLE_COUNTER_TYPE is_cacheable(THD *thd, size_t query_len, + const char *query, LEX *lex, TABLE_LIST *tables_used, uint8 *tables_type); TABLE_COUNTER_TYPE process_and_count_tables(THD *thd, @@ -462,10 +465,13 @@ protected: void destroy(); - friend void query_cache_init_query(NET *net); - friend void query_cache_insert(NET *net, const char *packet, ulong length); - friend void query_cache_end_of_result(THD *thd); - friend void query_cache_abort(NET *net); + void insert(Query_cache_tls *query_cache_tls, + const char *packet, + ulong length, + unsigned pkt_nr); + + void end_of_result(THD *thd); + void abort(Query_cache_tls *query_cache_tls); /* The following functions are only used when debugging @@ -493,9 +499,4 @@ protected: extern Query_cache query_cache; extern TYPELIB query_cache_type_typelib; -void query_cache_init_query(NET *net); -void query_cache_insert(NET *net, const char *packet, ulong length); -void query_cache_end_of_result(THD *thd); -void query_cache_abort(NET *net); - #endif |