mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
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.
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user