diff options
author | Kristofer Pettersson <kpettersson@mysql.com> | 2008-07-16 14:34:54 +0200 |
---|---|---|
committer | Kristofer Pettersson <kpettersson@mysql.com> | 2008-07-16 14:34:54 +0200 |
commit | 51ef885ce0e17fbba7c51535ceddf047722526ae (patch) | |
tree | d1cccd566a9c16e138890dee2180bdd3bac932a4 /sql | |
parent | d56f9ab755f1b3841f2dd1dfe5baf91266758948 (diff) | |
parent | f81c2f070bce73dbf5d659199e3e2bffc26e41cf (diff) | |
download | mariadb-git-51ef885ce0e17fbba7c51535ceddf047722526ae.tar.gz |
merge
Diffstat (limited to 'sql')
-rw-r--r-- | sql/set_var.cc | 14 | ||||
-rw-r--r-- | sql/share/errmsg.txt | 14 | ||||
-rw-r--r-- | sql/sql_cache.cc | 35 | ||||
-rw-r--r-- | sql/sql_cache.h | 2 |
4 files changed, 40 insertions, 25 deletions
diff --git a/sql/set_var.cc b/sql/set_var.cc index 7d9d88f0281..134a8564145 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -1046,19 +1046,7 @@ static void fix_net_retry_count(THD *thd __attribute__((unused)), static void fix_query_cache_size(THD *thd, enum_var_type type) { #ifdef HAVE_QUERY_CACHE - ulong new_cache_size= query_cache.resize(query_cache_size); - - /* - Note: query_cache_size is a global variable reflecting the - requested cache size. See also query_cache_size_arg - */ - - if (query_cache_size != new_cache_size) - push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, - ER_WARN_QC_RESIZE, ER(ER_WARN_QC_RESIZE), - query_cache_size, new_cache_size); - - query_cache_size= new_cache_size; + query_cache_size= query_cache.resize(query_cache_size); #endif } diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt index 426290714eb..04fa1c57cd1 100644 --- a/sql/share/errmsg.txt +++ b/sql/share/errmsg.txt @@ -4995,13 +4995,13 @@ ER_WRONG_NAME_FOR_CATALOG 42000 spa "Nombre de catalog incorrecto '%-.100s'" swe "Felaktigt katalog namn '%-.100s'" ER_WARN_QC_RESIZE - eng "Query cache failed to set size %lu; new query cache size is %lu" - ger "Änderung der Query-Cache-Größe auf %lu fehlgeschlagen; neue Query-Cache-Größe ist %lu" - por "Falha em Query cache para configurar tamanho %lu, novo tamanho de query cache é %lu" - rus "ëÅÛ ÚÁÐÒÏÓÏ× ÎÅ ÍÏÖÅÔ ÕÓÔÁÎÏ×ÉÔØ ÒÁÚÍÅÒ %lu, ÎÏ×ÙÊ ÒÁÚÍÅÒ ËÅÛÁ ÚÐÒÏÓÏ× - %lu" - spa "Query cache fallada para configurar tamaño %lu, nuevo tamaño de query cache es %lu" - swe "Storleken av "Query cache" kunde inte sättas till %lu, ny storlek är %lu" - ukr "ëÅÛ ÚÁÐÉÔ¦× ÎÅÓÐÒÏÍÏÖÅÎ ×ÓÔÁÎÏ×ÉÔÉ ÒÏÚÍ¦Ò %lu, ÎÏ×ÉÊ ÒÏÚÍ¦Ò ËÅÛÁ ÚÁÐÉÔ¦× - %lu" + eng "Query cache failed to set size %lu (minimal value: %lu); new query cache size is %lu" + ger "Änderung der Query-Cache-Größe auf %lu (Minimale Zahl: %lu) fehlgeschlagen; neue Query-Cache-Größe ist %lu" + por "Falha em Query cache para configurar tamanho %lu (Número mínimo: %lu), novo tamanho de query cache é %lu" + rus "ëÅÛ ÚÁÐÒÏÓÏ× ÎÅ ÍÏÖÅÔ ÕÓÔÁÎÏ×ÉÔØ ÒÁÚÍÅÒ %lu (minimal value: %lu), ÎÏ×ÙÊ ÒÁÚÍÅÒ ËÅÛÁ ÚÐÒÏÓÏ× - %lu" + spa "Query cache fallada para configurar tamaño %lu (Número mínimo: %lu), nuevo tamaño de query cache es %lu" + swe "Storleken av "Query cache" kunde inte sättas till %lu (minsta värde: %lu); ny storlek är %lu" + ukr "ëÅÛ ÚÁÐÉÔ¦× ÎÅÓÐÒÏÍÏÖÅÎ ×ÓÔÁÎÏ×ÉÔÉ ÒÏÚÍ¦Ò %lu (minimal value: %lu), ÎÏ×ÉÊ ÒÏÚÍ¦Ò ËÅÛÁ ÚÁÐÉÔ¦× - %lu" ER_BAD_FT_COLUMN eng "Column '%-.192s' cannot be part of FULLTEXT index" ger "Feld '%-.192s' kann nicht Teil eines FULLTEXT-Index sein" diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 375ffc882b4..38c429a56a4 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -942,18 +942,25 @@ ulong Query_cache::resize(ulong query_cache_size_arg) } while (block != queries_blocks); } free_cache(); - query_cache_size= query_cache_size_arg; - new_query_cache_size= init_cache(); + ::query_cache_size= init_cache(); + + if (::query_cache_size != query_cache_size_arg) + { + push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_WARN_QC_RESIZE, ER(ER_WARN_QC_RESIZE), + query_cache_size_arg, + get_minimal_size_limit(), + ::query_cache_size); + } STRUCT_LOCK(&structure_guard_mutex); m_cache_status= Query_cache::NO_FLUSH_IN_PROGRESS; pthread_cond_signal(&COND_cache_status_changed); - if (new_query_cache_size) - DBUG_EXECUTE("check_querycache",check_integrity(1);); + STRUCT_UNLOCK(&structure_guard_mutex); - DBUG_RETURN(new_query_cache_size); + DBUG_RETURN(::query_cache_size); } @@ -1816,6 +1823,24 @@ void Query_cache::init() DBUG_VOID_RETURN; } +/** + Return the lowest possible query cache size. +*/ + +ulong Query_cache::get_minimal_size_limit() +{ + ulong approx_additional_data_size= (sizeof(Query_cache) + + sizeof(void*)*(def_query_hash_size+ + def_table_hash_size)); + + ulong data_size= (min_allocation_unit << QUERY_CACHE_MEM_BIN_STEP_PWR2 << + QUERY_CACHE_MEM_BIN_FIRST_STEP_PWR2) + + ALIGN_SIZE(1) - 1 + + (1 << QUERY_CACHE_MEM_BIN_STEP_PWR2) - 1 + + (1 << QUERY_CACHE_MEM_BIN_FIRST_STEP_PWR2) - 1; + + return(data_size + approx_additional_data_size); +} ulong Query_cache::init_cache() { diff --git a/sql/sql_cache.h b/sql/sql_cache.h index f2c33eff614..6af1998a73e 100644 --- a/sql/sql_cache.h +++ b/sql/sql_cache.h @@ -282,6 +282,8 @@ private: void free_query_internal(Query_cache_block *point); void invalidate_table_internal(THD *thd, uchar *key, uint32 key_length); + ulong get_minimal_size_limit(); + protected: /* The following mutex is locked when searching or changing global |