Commit c5d95b5e authored by bell@sanja.is.com.ua's avatar bell@sanja.is.com.ua

added building without query cache

parent 144b790f
...@@ -1797,6 +1797,18 @@ AC_ARG_WITH(embedded-server, ...@@ -1797,6 +1797,18 @@ AC_ARG_WITH(embedded-server,
[with_embedded_server=no] [with_embedded_server=no]
) )
AC_ARG_WITH(query_cache,
[ --without-query-cache Don't build query cache in embedded server.],
[with_embedded_server=$withval],
[with_embedded_server=yes]
)
if test "$with_embedded_server" = "yes"
then
CFLAGS="$CFLAGS -DHAVE_QUERY_CACHE"
CXXFLAGS="$CXXFLAGS -DHAVE_QUERY_CACHE"
fi
AC_ARG_WITH(extra-tools, AC_ARG_WITH(extra-tools,
[ --without-extra-tools Skip building utilites in the tools directory.], [ --without-extra-tools Skip building utilites in the tools directory.],
[with_tools=$withval], [with_tools=$withval],
......
...@@ -1023,4 +1023,12 @@ typedef union { ...@@ -1023,4 +1023,12 @@ typedef union {
#define C_MODE_END #define C_MODE_END
#endif #endif
/*
Now if query is taken off then tests with query cache fails
SANJA TODO: remove this when problem with mysql-test will be solved
*/
#ifdef MYSQL_SERVER
#define HAVE_QUERY_CACHE
#endif
#endif /* _global_h */ #endif /* _global_h */
-- require r/have_query_cache.require
disable_query_log;
show variables like "have_query_cache";
enable_query_log;
...@@ -28,8 +28,3 @@ select * from t1; ...@@ -28,8 +28,3 @@ select * from t1;
n n
345 345
drop table t1; drop table t1;
flush query cache;
reset query cache;
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
Variable_name Value
have_query_cache YES
...@@ -67,11 +67,3 @@ insert into t1 values (345); ...@@ -67,11 +67,3 @@ insert into t1 values (345);
select * from t1; select * from t1;
drop table t1; drop table t1;
#
# Test that QUERY CACHE commands doesn't core dump.
# (Normally we don't have a cache active at this point)
#
flush query cache;
reset query cache;
show status like "Qcache_queries_in_cache";
-- source include/have_query_cache.inc
# #
# Test grants with query cache # Test grants with query cache
# #
......
-- source include/have_query_cache.inc
# #
# Tests with query cache # Tests with query cache
# #
......
...@@ -46,7 +46,7 @@ int ha_myisammrg::open(const char *name, int mode, uint test_if_locked) ...@@ -46,7 +46,7 @@ int ha_myisammrg::open(const char *name, int mode, uint test_if_locked)
return (my_errno ? my_errno : -1); return (my_errno ? my_errno : -1);
} }
DBUG_PRINT("info", ("ha_myisammrg::open myrg_extrafunc...")) DBUG_PRINT("info", ("ha_myisammrg::open myrg_extrafunc..."))
myrg_extrafunc(file, &query_cache_invalidate_by_MyISAM_filename); myrg_extrafunc(file, query_cache_invalidate_by_MyISAM_filename_ref);
if (!(test_if_locked == HA_OPEN_WAIT_IF_LOCKED || if (!(test_if_locked == HA_OPEN_WAIT_IF_LOCKED ||
test_if_locked == HA_OPEN_ABORT_IF_LOCKED)) test_if_locked == HA_OPEN_ABORT_IF_LOCKED))
myrg_extra(file,HA_EXTRA_NO_WAIT_LOCK); myrg_extra(file,HA_EXTRA_NO_WAIT_LOCK);
......
...@@ -309,8 +309,10 @@ int ha_commit_trans(THD *thd, THD_TRANS* trans) ...@@ -309,8 +309,10 @@ int ha_commit_trans(THD *thd, THD_TRANS* trans)
} }
#endif #endif
#ifdef HAVE_QUERY_CACHE
if (transaction_commited) if (transaction_commited)
query_cache.invalidate(thd->transaction.changed_tables); query_cache.invalidate(thd->transaction.changed_tables);
#endif /*HAVE_QUERY_CACHE*/
if (error && trans == &thd->transaction.all && mysql_bin_log.is_open()) if (error && trans == &thd->transaction.all && mysql_bin_log.is_open())
sql_print_error("Error: Got error during commit; Binlog is not up to date!"); sql_print_error("Error: Got error during commit; Binlog is not up to date!");
thd->tx_isolation=thd->session_tx_isolation; thd->tx_isolation=thd->session_tx_isolation;
......
...@@ -251,7 +251,33 @@ inline THD *_current_thd(void) ...@@ -251,7 +251,33 @@ inline THD *_current_thd(void)
#include "item.h" #include "item.h"
#include "sql_class.h" #include "sql_class.h"
#include "opt_range.h" #include "opt_range.h"
#ifdef HAVE_QUERY_CACHE
#include "sql_cache.h" #include "sql_cache.h"
#define query_cache_store_query(A, B) query_cache.store_query(A, B)
#define query_cache_destroy() query_cache.destroy()
#define query_cache_result_size_limit(A) query_cache.result_size_limit(A)
#define query_cache_resize(A) query_cache.resize(A)
#define query_cache_invalidate3(A, B, C) query_cache.invalidate(A, B, C)
#define query_cache_invalidate1(A) query_cache.invalidate(A)
#define query_cache_send_result_to_client(A, B, C) \
query_cache.send_result_to_client(A, B, C)
#define query_cache_invalidate_by_MyISAM_filename_ref \
&query_cache_invalidate_by_MyISAM_filename
#else
#define query_cache_store_query(A, B)
#define query_cache_destroy()
#define query_cache_result_size_limit(A)
#define query_cache_resize(A)
#define query_cache_invalidate3(A, B, C)
#define query_cache_invalidate1(A)
#define query_cache_send_result_to_client(A, B, C) 0
#define query_cache_invalidate_by_MyISAM_filename_ref NULL
#define query_cache_abort(A)
#define query_cache_end_of_result(A)
#define query_cache_invalidate_by_MyISAM_filename_ref NULL
#endif /*HAVE_QUERY_CACHE*/
int mysql_create_db(THD *thd, char *db, uint create_info, bool silent); int mysql_create_db(THD *thd, char *db, uint create_info, bool silent);
int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent); int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent);
......
...@@ -209,7 +209,11 @@ SHOW_COMP_OPTION have_openssl=SHOW_OPTION_YES; ...@@ -209,7 +209,11 @@ SHOW_COMP_OPTION have_openssl=SHOW_OPTION_YES;
SHOW_COMP_OPTION have_openssl=SHOW_OPTION_NO; SHOW_COMP_OPTION have_openssl=SHOW_OPTION_NO;
#endif #endif
SHOW_COMP_OPTION have_symlink=SHOW_OPTION_YES; SHOW_COMP_OPTION have_symlink=SHOW_OPTION_YES;
#ifdef HAVE_QUERY_CACHE
SHOW_COMP_OPTION have_query_cache=SHOW_OPTION_YES;
#else
SHOW_COMP_OPTION have_query_cache=SHOW_OPTION_NO;
#endif
bool opt_skip_slave_start = 0; // If set, slave is not autostarted bool opt_skip_slave_start = 0; // If set, slave is not autostarted
static bool opt_do_pstack = 0; static bool opt_do_pstack = 0;
...@@ -276,7 +280,11 @@ ulong keybuff_size,sortbuff_size,max_item_sort_length,table_cache_size, ...@@ -276,7 +280,11 @@ ulong keybuff_size,sortbuff_size,max_item_sort_length,table_cache_size,
ulong com_stat[(uint) SQLCOM_END], com_other; ulong com_stat[(uint) SQLCOM_END], com_other;
ulong slave_net_timeout; ulong slave_net_timeout;
ulong thread_cache_size=0, binlog_cache_size=0, max_binlog_cache_size=0; ulong thread_cache_size=0, binlog_cache_size=0, max_binlog_cache_size=0;
#ifdef HAVE_QUERY_CACHE
ulong query_cache_size=0, query_cache_limit=0, query_cache_startup_type=1; ulong query_cache_size=0, query_cache_limit=0, query_cache_startup_type=1;
Query_cache query_cache;
#endif
volatile ulong cached_thread_count=0; volatile ulong cached_thread_count=0;
// replication parameters, if master_host is not NULL, we are a slave // replication parameters, if master_host is not NULL, we are a slave
...@@ -370,8 +378,6 @@ pthread_mutex_t LOCK_mysql_create_db, LOCK_Acl, LOCK_open, LOCK_thread_count, ...@@ -370,8 +378,6 @@ pthread_mutex_t LOCK_mysql_create_db, LOCK_Acl, LOCK_open, LOCK_thread_count,
LOCK_server_id, LOCK_server_id,
LOCK_user_conn, LOCK_slave_list, LOCK_active_mi; LOCK_user_conn, LOCK_slave_list, LOCK_active_mi;
Query_cache query_cache;
pthread_cond_t COND_refresh,COND_thread_count,COND_binlog_update, pthread_cond_t COND_refresh,COND_thread_count,COND_binlog_update,
COND_slave_stopped, COND_slave_start; COND_slave_stopped, COND_slave_start;
pthread_cond_t COND_thread_cache,COND_flush_thread_cache; pthread_cond_t COND_thread_cache,COND_flush_thread_cache;
...@@ -765,7 +771,7 @@ void clean_up(bool print_message) ...@@ -765,7 +771,7 @@ void clean_up(bool print_message)
bitmap_free(&slave_error_mask); bitmap_free(&slave_error_mask);
acl_free(1); acl_free(1);
grant_free(); grant_free();
query_cache.destroy(); query_cache_destroy();
table_cache_free(); table_cache_free();
hostname_cache_free(); hostname_cache_free();
item_user_lock_free(); item_user_lock_free();
...@@ -1870,8 +1876,8 @@ int main(int argc, char **argv) ...@@ -1870,8 +1876,8 @@ int main(int argc, char **argv)
server_init(); server_init();
table_cache_init(); table_cache_init();
hostname_cache_init(); hostname_cache_init();
query_cache.result_size_limit(query_cache_limit); query_cache_result_size_limit(query_cache_limit);
query_cache.resize(query_cache_size); query_cache_resize(query_cache_size);
randominit(&sql_rand,(ulong) start_time,(ulong) start_time/2); randominit(&sql_rand,(ulong) start_time,(ulong) start_time/2);
reset_floating_point_exceptions(); reset_floating_point_exceptions();
init_thr_lock(); init_thr_lock();
...@@ -3001,12 +3007,14 @@ CHANGEABLE_VAR changeable_vars[] = { ...@@ -3001,12 +3007,14 @@ CHANGEABLE_VAR changeable_vars[] = {
0, 0, 65535, 0, 1}, 0, 0, 65535, 0, 1},
{ "query_buffer_size", (long*) &query_buff_size, { "query_buffer_size", (long*) &query_buff_size,
0, MALLOC_OVERHEAD, (long) ~0, MALLOC_OVERHEAD, IO_SIZE }, 0, MALLOC_OVERHEAD, (long) ~0, MALLOC_OVERHEAD, IO_SIZE },
#ifdef HAVE_QUERY_CACHE
{ "query_cache_limit", (long*) &query_cache_limit, { "query_cache_limit", (long*) &query_cache_limit,
1024*1024L, 0, ULONG_MAX, 0, 1}, 1024*1024L, 0, ULONG_MAX, 0, 1},
{ "query_cache_size", (long*) &query_cache_size, { "query_cache_size", (long*) &query_cache_size,
0, 0, ULONG_MAX, 0, 1}, 0, 0, ULONG_MAX, 0, 1},
{ "query_cache_startup_type",(long*) &query_cache_startup_type, { "query_cache_startup_type",(long*) &query_cache_startup_type,
1, 0, 2, 0, 1}, 1, 0, 2, 0, 1},
#endif /*HAVE_QUERY_CACHE*/
{ "record_buffer", (long*) &my_default_record_cache_size, { "record_buffer", (long*) &my_default_record_cache_size,
128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, ~0L, MALLOC_OVERHEAD, IO_SIZE }, 128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, ~0L, MALLOC_OVERHEAD, IO_SIZE },
{ "record_rnd_buffer", (long*) &record_rnd_cache_size, { "record_rnd_buffer", (long*) &record_rnd_cache_size,
...@@ -3068,6 +3076,7 @@ struct show_var_st init_vars[]= { ...@@ -3068,6 +3076,7 @@ struct show_var_st init_vars[]= {
{"have_raid", (char*) &have_raid, SHOW_HAVE}, {"have_raid", (char*) &have_raid, SHOW_HAVE},
{"have_symlink", (char*) &have_symlink, SHOW_HAVE}, {"have_symlink", (char*) &have_symlink, SHOW_HAVE},
{"have_openssl", (char*) &have_openssl, SHOW_HAVE}, {"have_openssl", (char*) &have_openssl, SHOW_HAVE},
{"have_query_cache", (char*) &have_query_cache, SHOW_HAVE},
{"init_file", (char*) &opt_init_file, SHOW_CHAR_PTR}, {"init_file", (char*) &opt_init_file, SHOW_CHAR_PTR},
#ifdef HAVE_INNOBASE_DB #ifdef HAVE_INNOBASE_DB
{"innodb_additional_mem_pool_size", (char*) &innobase_additional_mem_pool_size, SHOW_LONG }, {"innodb_additional_mem_pool_size", (char*) &innobase_additional_mem_pool_size, SHOW_LONG },
...@@ -3135,9 +3144,11 @@ struct show_var_st init_vars[]= { ...@@ -3135,9 +3144,11 @@ struct show_var_st init_vars[]= {
{"record_rnd_buffer", (char*) &record_rnd_cache_size, SHOW_LONG}, {"record_rnd_buffer", (char*) &record_rnd_cache_size, SHOW_LONG},
{"rpl_recovery_rank", (char*) &rpl_recovery_rank, SHOW_LONG}, {"rpl_recovery_rank", (char*) &rpl_recovery_rank, SHOW_LONG},
{"query_buffer_size", (char*) &query_buff_size, SHOW_LONG}, {"query_buffer_size", (char*) &query_buff_size, SHOW_LONG},
#ifdef HAVE_QUERY_CACHE
{"query_cache_limit", (char*) &query_cache.query_cache_limit, SHOW_LONG}, {"query_cache_limit", (char*) &query_cache.query_cache_limit, SHOW_LONG},
{"query_cache_size", (char*) &query_cache.query_cache_size, SHOW_LONG}, {"query_cache_size", (char*) &query_cache.query_cache_size, SHOW_LONG},
{"query_cache_startup_type",(char*) &query_cache_startup_type, SHOW_LONG}, {"query_cache_startup_type",(char*) &query_cache_startup_type, SHOW_LONG},
#endif /*HAVE_QUERY_CACHE*/
{"safe_show_database", (char*) &opt_safe_show_db, SHOW_BOOL}, {"safe_show_database", (char*) &opt_safe_show_db, SHOW_BOOL},
{"server_id", (char*) &server_id, SHOW_LONG}, {"server_id", (char*) &server_id, SHOW_LONG},
{"slave_net_timeout", (char*) &slave_net_timeout, SHOW_LONG}, {"slave_net_timeout", (char*) &slave_net_timeout, SHOW_LONG},
...@@ -3268,6 +3279,7 @@ struct show_var_st status_vars[]= { ...@@ -3268,6 +3279,7 @@ struct show_var_st status_vars[]= {
{"Open_streams", (char*) &my_stream_opened, SHOW_INT_CONST}, {"Open_streams", (char*) &my_stream_opened, SHOW_INT_CONST},
{"Opened_tables", (char*) &opened_tables, SHOW_LONG}, {"Opened_tables", (char*) &opened_tables, SHOW_LONG},
{"Questions", (char*) 0, SHOW_QUESTION}, {"Questions", (char*) 0, SHOW_QUESTION},
#ifdef HAVE_QUERY_CACHE
{"Qcache_queries_in_cache", (char*) &query_cache.queries_in_cache, SHOW_LONG_CONST}, {"Qcache_queries_in_cache", (char*) &query_cache.queries_in_cache, SHOW_LONG_CONST},
{"Qcache_inserts", (char*) &query_cache.inserts, SHOW_LONG}, {"Qcache_inserts", (char*) &query_cache.inserts, SHOW_LONG},
{"Qcache_hits", (char*) &query_cache.hits, SHOW_LONG}, {"Qcache_hits", (char*) &query_cache.hits, SHOW_LONG},
...@@ -3278,6 +3290,7 @@ struct show_var_st status_vars[]= { ...@@ -3278,6 +3290,7 @@ struct show_var_st status_vars[]= {
SHOW_LONG_CONST}, SHOW_LONG_CONST},
{"Qcache_total_blocks", (char*) &query_cache.total_blocks, {"Qcache_total_blocks", (char*) &query_cache.total_blocks,
SHOW_LONG_CONST}, SHOW_LONG_CONST},
#endif /*HAVE_QUERY_CACHE*/
{"Rpl_status", (char*) 0, SHOW_RPL_STATUS}, {"Rpl_status", (char*) 0, SHOW_RPL_STATUS},
{"Select_full_join", (char*) &select_full_join_count, SHOW_LONG}, {"Select_full_join", (char*) &select_full_join_count, SHOW_LONG},
{"Select_full_range_join", (char*) &select_full_range_join_count, SHOW_LONG}, {"Select_full_range_join", (char*) &select_full_range_join_count, SHOW_LONG},
...@@ -3883,7 +3896,9 @@ static void get_options(int argc,char **argv) ...@@ -3883,7 +3896,9 @@ static void get_options(int argc,char **argv)
my_use_symdir=0; my_use_symdir=0;
have_symlink=SHOW_OPTION_DISABLED; have_symlink=SHOW_OPTION_DISABLED;
ha_open_options&= ~HA_OPEN_ABORT_IF_CRASHED; ha_open_options&= ~HA_OPEN_ABORT_IF_CRASHED;
#ifdef HAVE_QUERY_CACHE
query_cache_size=0; query_cache_size=0;
#endif
break; break;
case (int) OPT_SAFE: case (int) OPT_SAFE:
opt_specialflag|= SPECIAL_SAFE_MODE; opt_specialflag|= SPECIAL_SAFE_MODE;
......
...@@ -330,8 +330,10 @@ net_real_write(NET *net,const char *packet,ulong len) ...@@ -330,8 +330,10 @@ net_real_write(NET *net,const char *packet,ulong len)
DBUG_ENTER("net_real_write"); DBUG_ENTER("net_real_write");
#ifdef MYSQL_SERVER #ifdef MYSQL_SERVER
#ifdef HAVE_QUERY_CACHE
if (net->query_cache_query != 0) if (net->query_cache_query != 0)
query_cache_insert(net, packet, len); query_cache_insert(net, packet, len);
#endif
#endif #endif
if (net->error == 2) if (net->error == 2)
......
...@@ -281,6 +281,7 @@ TODO list: ...@@ -281,6 +281,7 @@ TODO list:
*/ */
#include "mysql_priv.h" #include "mysql_priv.h"
#ifdef HAVE_QUERY_CACHE
#include <m_ctype.h> #include <m_ctype.h>
#include <my_dir.h> #include <my_dir.h>
#include <hash.h> #include <hash.h>
...@@ -3460,3 +3461,5 @@ my_bool Query_cache::in_table_list(Query_cache_block_table * root, ...@@ -3460,3 +3461,5 @@ my_bool Query_cache::in_table_list(Query_cache_block_table * root,
} }
#endif /* DBUG_OFF */ #endif /* DBUG_OFF */
#endif /*HAVE_QUERY_CACHE*/
...@@ -122,10 +122,14 @@ THD::THD():user_time(0),fatal_error(0),last_insert_id_used(0), ...@@ -122,10 +122,14 @@ THD::THD():user_time(0),fatal_error(0),last_insert_id_used(0),
server_id = ::server_id; server_id = ::server_id;
slave_net = 0; slave_net = 0;
log_pos = 0; log_pos = 0;
server_status=SERVER_STATUS_AUTOCOMMIT; server_status= SERVER_STATUS_AUTOCOMMIT;
update_lock_default= low_priority_updates ? TL_WRITE_LOW_PRIORITY : TL_WRITE; update_lock_default= low_priority_updates ? TL_WRITE_LOW_PRIORITY : TL_WRITE;
options=thd_startup_options; options= thd_startup_options;
query_cache_type = (byte) query_cache_startup_type; #ifdef HAVE_QUERY_CACHE
query_cache_type= (byte) query_cache_startup_type;
#else
query_cache_type= 0; //Safety
#endif
sql_mode=(uint) opt_sql_mode; sql_mode=(uint) opt_sql_mode;
inactive_timeout=net_wait_timeout; inactive_timeout=net_wait_timeout;
open_options=ha_open_options; open_options=ha_open_options;
......
...@@ -159,7 +159,7 @@ int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent) ...@@ -159,7 +159,7 @@ int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
if ((deleted=mysql_rm_known_files(thd, dirp, db, path,0)) >= 0 && thd) if ((deleted=mysql_rm_known_files(thd, dirp, db, path,0)) >= 0 && thd)
{ {
ha_drop_database(path); ha_drop_database(path);
query_cache.invalidate(db); query_cache_invalidate1(db);
if (!silent) if (!silent)
{ {
if (!thd->query) if (!thd->query)
......
...@@ -182,7 +182,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order, ...@@ -182,7 +182,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
thd->lock=0; thd->lock=0;
} }
if (deleted) if (deleted)
query_cache.invalidate(thd, table_list, 1); query_cache_invalidate3(thd, table_list, 1);
delete select; delete select;
if (error >= 0) // Fatal error if (error >= 0) // Fatal error
send_error(&thd->net,thd->killed ? ER_SERVER_SHUTDOWN: 0); send_error(&thd->net,thd->killed ? ER_SERVER_SHUTDOWN: 0);
...@@ -470,7 +470,7 @@ bool multi_delete::send_eof() ...@@ -470,7 +470,7 @@ bool multi_delete::send_eof()
VOID(ha_autocommit_or_rollback(thd,error > 0)); VOID(ha_autocommit_or_rollback(thd,error > 0));
} }
if (deleted) if (deleted)
query_cache.invalidate(thd, delete_tables, 1); query_cache_invalidate3(thd, delete_tables, 1);
::send_ok(&thd->net,deleted); ::send_ok(&thd->net,deleted);
return 0; return 0;
} }
...@@ -548,7 +548,7 @@ int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok) ...@@ -548,7 +548,7 @@ int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
bzero((char*) &create_info,sizeof(create_info)); bzero((char*) &create_info,sizeof(create_info));
*fn_ext(path)=0; // Remove the .frm extension *fn_ext(path)=0; // Remove the .frm extension
error= ha_create_table(path,&create_info,1) ? -1 : 0; error= ha_create_table(path,&create_info,1) ? -1 : 0;
query_cache.invalidate(thd, table_list, 0); query_cache_invalidate3(thd, table_list, 0);
if (!dont_send_ok) if (!dont_send_ok)
{ {
......
...@@ -311,7 +311,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields, ...@@ -311,7 +311,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields,
} }
thd->proc_info="end"; thd->proc_info="end";
if (info.copied || info.deleted) if (info.copied || info.deleted)
query_cache.invalidate(thd, table_list, 1); query_cache_invalidate3(thd, table_list, 1);
table->time_stamp=save_time_stamp; // Restore auto timestamp ptr table->time_stamp=save_time_stamp; // Restore auto timestamp ptr
table->next_number_field=0; table->next_number_field=0;
thd->count_cuted_fields=0; thd->count_cuted_fields=0;
...@@ -1217,7 +1217,7 @@ bool delayed_insert::handle_inserts(void) ...@@ -1217,7 +1217,7 @@ bool delayed_insert::handle_inserts(void)
sql_print_error("%s",thd.net.last_error); sql_print_error("%s",thd.net.last_error);
goto err; goto err;
} }
query_cache.invalidate(&thd, table, 1); query_cache_invalidate3(&thd, table, 1);
if (thr_reschedule_write_lock(*thd.lock->locks)) if (thr_reschedule_write_lock(*thd.lock->locks))
{ {
/* This should never happen */ /* This should never happen */
...@@ -1242,7 +1242,7 @@ bool delayed_insert::handle_inserts(void) ...@@ -1242,7 +1242,7 @@ bool delayed_insert::handle_inserts(void)
sql_print_error("%s",thd.net.last_error); sql_print_error("%s",thd.net.last_error);
goto err; goto err;
} }
query_cache.invalidate(&thd, table, 1); query_cache_invalidate3(&thd, table, 1);
pthread_mutex_lock(&mutex); pthread_mutex_lock(&mutex);
DBUG_RETURN(0); DBUG_RETURN(0);
...@@ -1330,7 +1330,7 @@ void select_insert::send_error(uint errcode,const char *err) ...@@ -1330,7 +1330,7 @@ void select_insert::send_error(uint errcode,const char *err)
table->file->activate_all_index(thd); table->file->activate_all_index(thd);
ha_rollback_stmt(thd); ha_rollback_stmt(thd);
if (info.copied || info.deleted) if (info.copied || info.deleted)
query_cache.invalidate(thd, table, 1); query_cache_invalidate3(thd, table, 1);
} }
...@@ -1343,7 +1343,7 @@ bool select_insert::send_eof() ...@@ -1343,7 +1343,7 @@ bool select_insert::send_eof()
if ((error2=ha_autocommit_or_rollback(thd,error)) && ! error) if ((error2=ha_autocommit_or_rollback(thd,error)) && ! error)
error=error2; error=error2;
if (info.copied || info.deleted) if (info.copied || info.deleted)
query_cache.invalidate(thd, table, 1); query_cache_invalidate3(thd, table, 1);
if (error) if (error)
{ {
......
...@@ -1310,7 +1310,7 @@ mysql_execute_command(void) ...@@ -1310,7 +1310,7 @@ mysql_execute_command(void)
if (!(res=open_and_lock_tables(thd,tables))) if (!(res=open_and_lock_tables(thd,tables)))
{ {
query_cache.store_query(thd, tables); query_cache_store_query(thd, tables);
res=handle_select(thd, lex, result); res=handle_select(thd, lex, result);
} }
else else
...@@ -1630,7 +1630,7 @@ mysql_execute_command(void) ...@@ -1630,7 +1630,7 @@ mysql_execute_command(void)
goto error; goto error;
} }
} }
query_cache.invalidate(thd, tables, 0); query_cache_invalidate3(thd, tables, 0);
if (end_active_trans(thd)) if (end_active_trans(thd))
res= -1; res= -1;
else if (mysql_rename_tables(thd,tables)) else if (mysql_rename_tables(thd,tables))
...@@ -1669,7 +1669,7 @@ mysql_execute_command(void) ...@@ -1669,7 +1669,7 @@ mysql_execute_command(void)
check_table_access(thd,SELECT_ACL | INSERT_ACL, tables)) check_table_access(thd,SELECT_ACL | INSERT_ACL, tables))
goto error; /* purecov: inspected */ goto error; /* purecov: inspected */
res = mysql_repair_table(thd, tables, &lex->check_opt); res = mysql_repair_table(thd, tables, &lex->check_opt);
query_cache.invalidate(thd, tables, 0); query_cache_invalidate3(thd, tables, 0);
break; break;
} }
case SQLCOM_CHECK: case SQLCOM_CHECK:
...@@ -1678,7 +1678,7 @@ mysql_execute_command(void) ...@@ -1678,7 +1678,7 @@ mysql_execute_command(void)
check_table_access(thd, SELECT_ACL | EXTRA_ACL , tables)) check_table_access(thd, SELECT_ACL | EXTRA_ACL , tables))
goto error; /* purecov: inspected */ goto error; /* purecov: inspected */
res = mysql_check_table(thd, tables, &lex->check_opt); res = mysql_check_table(thd, tables, &lex->check_opt);
query_cache.invalidate(thd, tables, 0); query_cache_invalidate3(thd, tables, 0);
break; break;
} }
case SQLCOM_ANALYZE: case SQLCOM_ANALYZE:
...@@ -2722,7 +2722,7 @@ mysql_parse(THD *thd,char *inBuf,uint length) ...@@ -2722,7 +2722,7 @@ mysql_parse(THD *thd,char *inBuf,uint length)
mysql_init_query(thd); mysql_init_query(thd);
thd->query_length = length; thd->query_length = length;
if (query_cache.send_result_to_client(thd, inBuf, length) <= 0) if (query_cache_send_result_to_client(thd, inBuf, length) <= 0)
{ {
LEX *lex=lex_start(thd, (uchar*) inBuf, length); LEX *lex=lex_start(thd, (uchar*) inBuf, length);
if (!yyparse() && ! thd->fatal_error) if (!yyparse() && ! thd->fatal_error)
...@@ -3282,6 +3282,7 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables) ...@@ -3282,6 +3282,7 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables)
if (ha_flush_logs()) if (ha_flush_logs())
result=1; result=1;
} }
#ifdef HAVE_QUERY_CACHE
if (options & REFRESH_QUERY_CACHE_FREE) if (options & REFRESH_QUERY_CACHE_FREE)
{ {
query_cache.pack(); // FLUSH QUERY CACHE query_cache.pack(); // FLUSH QUERY CACHE
...@@ -3291,6 +3292,7 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables) ...@@ -3291,6 +3292,7 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables)
{ {
query_cache.flush(); // RESET QUERY CACHE query_cache.flush(); // RESET QUERY CACHE
} }
#endif /*HAVE_QUERY_CACHE*/
if (options & (REFRESH_TABLES | REFRESH_READ_LOCK)) if (options & (REFRESH_TABLES | REFRESH_READ_LOCK))
{ {
if ((options & REFRESH_READ_LOCK) && thd) if ((options & REFRESH_READ_LOCK) && thd)
......
...@@ -161,7 +161,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists, ...@@ -161,7 +161,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
} }
if (some_tables_deleted) if (some_tables_deleted)
{ {
query_cache.invalidate(thd, tables, 0); query_cache_invalidate3(thd, tables, 0);
if (!dont_log_query) if (!dont_log_query)
{ {
mysql_update_log.write(thd, thd->query,thd->query_length); mysql_update_log.write(thd, thd->query,thd->query_length);
...@@ -1774,7 +1774,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, ...@@ -1774,7 +1774,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
VOID(pthread_cond_broadcast(&COND_refresh)); VOID(pthread_cond_broadcast(&COND_refresh));
VOID(pthread_mutex_unlock(&LOCK_open)); VOID(pthread_mutex_unlock(&LOCK_open));
table_list->table=0; // For query cache table_list->table=0; // For query cache
query_cache.invalidate(thd, table_list, 0); query_cache_invalidate3(thd, table_list, 0);
end_temporary: end_temporary:
sprintf(tmp_name,ER(ER_INSERT_INFO),(ulong) (copied+deleted), sprintf(tmp_name,ER(ER_INSERT_INFO),(ulong) (copied+deleted),
......
...@@ -324,7 +324,7 @@ int mysql_update(THD *thd, ...@@ -324,7 +324,7 @@ int mysql_update(THD *thd,
thd->lock=0; thd->lock=0;
} }
if (updated) if (updated)
query_cache.invalidate(thd, table_list, 1); query_cache_invalidate3(thd, table_list, 1);
delete select; delete select;
if (error >= 0) if (error >= 0)
...@@ -788,7 +788,7 @@ bool multi_update::send_eof() ...@@ -788,7 +788,7 @@ bool multi_update::send_eof()
sprintf(buff,ER(ER_UPDATE_INFO), (long) found, (long) updated, sprintf(buff,ER(ER_UPDATE_INFO), (long) found, (long) updated,
(long) thd->cuted_fields); (long) thd->cuted_fields);
if (updated) if (updated)
query_cache.invalidate(thd, update_tables, 1); query_cache_invalidate3(thd, update_tables, 1);
::send_ok(&thd->net, ::send_ok(&thd->net,
(thd->client_capabilities & CLIENT_FOUND_ROWS) ? found : updated, (thd->client_capabilities & CLIENT_FOUND_ROWS) ? found : updated,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment