From ea6a22bfa816ebc373316eee36c18952e812e7f6 Mon Sep 17 00:00:00 2001 From: Konstantin Osipov Date: Tue, 13 Oct 2009 22:18:48 +0400 Subject: 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 --- sql/net_serv.cc | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'sql/net_serv.cc') diff --git a/sql/net_serv.cc b/sql/net_serv.cc index 7a830e0961a..4945ee8d94f 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -95,8 +95,8 @@ extern pthread_mutex_t LOCK_bytes_sent , LOCK_bytes_received; #ifndef MYSQL_INSTANCE_MANAGER #ifdef HAVE_QUERY_CACHE #define USE_QUERY_CACHE -extern void query_cache_init_query(NET *net); -extern void query_cache_insert(NET *net, const char *packet, ulong length); +extern void query_cache_insert(const char *packet, ulong length, + unsigned pkt_nr); #endif // HAVE_QUERY_CACHE #define update_statistics(A) A #endif /* MYSQL_INSTANCE_MANGER */ @@ -132,11 +132,7 @@ my_bool my_net_init(NET *net, Vio* vio) net->compress=0; net->reading_or_writing=0; net->where_b = net->remain_in_buf=0; net->last_errno=0; -#ifdef USE_QUERY_CACHE - query_cache_init_query(net); -#else - net->query_cache_query= 0; -#endif + net->unused= 0; if (vio != 0) /* If real connection */ { @@ -586,7 +582,7 @@ net_real_write(NET *net,const uchar *packet, size_t len) DBUG_ENTER("net_real_write"); #if defined(MYSQL_SERVER) && defined(USE_QUERY_CACHE) - query_cache_insert(net, (char*) packet, len); + query_cache_insert((char*) packet, len, net->pkt_nr); #endif if (net->error == 2) -- cgit v1.2.1