mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Manual merge from mysql-trunk.
Conflicts: - client/mysqltest.cc - mysql-test/collections/default.experimental - mysql-test/suite/rpl/t/disabled.def - sql/mysqld.cc - sql/opt_range.cc - sql/sp.cc - sql/sql_acl.cc - sql/sql_partition.cc - sql/sql_table.cc
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 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; }
|
||||
@ -279,8 +281,11 @@ private:
|
||||
enum Cache_lock_status { UNLOCKED, LOCKED_NO_WAIT, LOCKED };
|
||||
Cache_lock_status m_cache_lock_status;
|
||||
|
||||
bool m_query_cache_is_disabled;
|
||||
|
||||
void free_query_internal(Query_cache_block *point);
|
||||
void invalidate_table_internal(THD *thd, uchar *key, uint32 key_length);
|
||||
void disable_query_cache(void) { m_query_cache_is_disabled= TRUE; }
|
||||
|
||||
protected:
|
||||
/*
|
||||
@ -407,7 +412,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,
|
||||
@ -423,6 +429,8 @@ protected:
|
||||
uint def_query_hash_size = QUERY_CACHE_DEF_QUERY_HASH_SIZE,
|
||||
uint def_table_hash_size = QUERY_CACHE_DEF_TABLE_HASH_SIZE);
|
||||
|
||||
bool is_disabled(void) { return m_query_cache_is_disabled; }
|
||||
|
||||
/* initialize cache (mutex) */
|
||||
void init();
|
||||
/* resize query cache (return real query size, 0 if disabled) */
|
||||
@ -462,10 +470,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 +504,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