From 1ffdb9e81e5ab46ba809829c11ca1aafdc238db8 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 23 Nov 2004 09:50:33 +0000 Subject: [PATCH] enabling control of query cache for ndb --- sql/ha_ndbcluster.cc | 2 +- sql/mysqld.cc | 13 ++++++++++++- sql/set_var.cc | 6 ++++++ sql/sql_class.h | 1 + 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 6f7940caf75..db031c632ff 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -3004,7 +3004,7 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type) m_transaction_on= FALSE; else m_transaction_on= thd->variables.ndb_use_transactions; - // m_use_local_query_cache= thd->variables.ndb_use_local_query_cache; + m_use_local_query_cache= thd->variables.ndb_use_local_query_cache; m_active_trans= thd->transaction.all.ndb_tid ? (NdbConnection*)thd->transaction.all.ndb_tid: diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 5033c42ac69..f7c89f6dde3 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2227,7 +2227,11 @@ extern "C" pthread_handler_decl(handle_shutdown,arg) #endif -const char *load_default_groups[]= { "mysqld","server",MYSQL_BASE_VERSION,0,0}; +const char *load_default_groups[]= { +#ifdef HAVE_NDBCLUSTER_DB + "mysql_cluster", +#endif + "mysqld","server",MYSQL_BASE_VERSION,0,0}; bool open_log(MYSQL_LOG *log, const char *hostname, const char *opt_name, const char *extension, @@ -3950,6 +3954,7 @@ enum options_mysqld OPT_INNODB, OPT_ISAM, OPT_NDBCLUSTER, OPT_NDB_CONNECTSTRING, OPT_NDB_USE_EXACT_COUNT, OPT_NDB_FORCE_SEND, OPT_NDB_AUTOINCREMENT_PREFETCH_SZ, + OPT_NDB_USE_LOCAL_QUERY_CACHE, OPT_SKIP_SAFEMALLOC, OPT_TEMP_POOL, OPT_TX_ISOLATION, OPT_SKIP_STACK_TRACE, OPT_SKIP_SYMLINKS, @@ -4409,6 +4414,12 @@ Disable with --skip-ndbcluster (will save memory).", (gptr*) &global_system_variables.ndb_use_exact_count, (gptr*) &global_system_variables.ndb_use_exact_count, 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0}, + {"ndb_use_local_query_cache", OPT_NDB_USE_LOCAL_QUERY_CACHE, + "Use local query cache, note that this cache will _not_ " + "be invalidated if data is updated through other mysql servers", + (gptr*) &global_system_variables.ndb_use_local_query_cache, + (gptr*) &global_system_variables.ndb_use_local_query_cache, + 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0}, #endif {"new", 'n', "Use very new possible 'unsafe' functions.", (gptr*) &global_system_variables.new_mode, diff --git a/sql/set_var.cc b/sql/set_var.cc index f1973b53e49..6bf151be83f 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -371,6 +371,9 @@ sys_var_thd_bool sys_ndb_use_exact_count("ndb_use_exact_count", &SV::ndb_use_exact_count); sys_var_thd_bool +sys_ndb_use_local_query_cache("ndb_use_local_query_cache", + &SV::ndb_use_local_query_cache); +sys_var_thd_bool sys_ndb_use_transactions("ndb_use_transactions", &SV::ndb_use_transactions); // ndb server global variable settings @@ -634,6 +637,7 @@ sys_var *sys_variables[]= &sys_ndb_autoincrement_prefetch_sz, &sys_ndb_force_send, &sys_ndb_use_exact_count, + &sys_ndb_use_local_query_cache, &sys_ndb_use_transactions, #endif &sys_unique_checks, @@ -801,6 +805,8 @@ struct show_var_st init_vars[]= { (char*) &sys_ndb_autoincrement_prefetch_sz, SHOW_SYS}, {sys_ndb_force_send.name, (char*) &sys_ndb_force_send, SHOW_SYS}, {sys_ndb_use_exact_count.name,(char*) &sys_ndb_use_exact_count, SHOW_SYS}, + {sys_ndb_use_local_query_cache.name, + (char*) &sys_ndb_use_local_query_cache, SHOW_SYS}, {sys_ndb_use_transactions.name,(char*) &sys_ndb_use_transactions, SHOW_SYS}, #endif {sys_net_buffer_length.name,(char*) &sys_net_buffer_length, SHOW_SYS}, diff --git a/sql/sql_class.h b/sql/sql_class.h index d0d9afc7746..06975730195 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -403,6 +403,7 @@ struct system_variables ulong ndb_autoincrement_prefetch_sz; my_bool ndb_force_send; my_bool ndb_use_exact_count; + my_bool ndb_use_local_query_cache; my_bool ndb_use_transactions; #endif /* HAVE_NDBCLUSTER_DB */ my_bool old_passwords;