Commit 1147e002 authored by ingo@mysql.com's avatar ingo@mysql.com

Bug#10473 - Can't set 'key_buffer_size' system variable to ZERO

Give the user a warning if he tries to destroy the default key cache.
parent b76cea46
...@@ -289,3 +289,9 @@ check table t1; ...@@ -289,3 +289,9 @@ check table t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 check status OK test.t1 check status OK
drop table t1; drop table t1;
set @@global.key_buffer_size=0;
Warnings:
Warning 1438 Cannot drop default keycache
select @@global.key_buffer_size;
@@global.key_buffer_size
2097152
...@@ -168,4 +168,11 @@ check table t1; ...@@ -168,4 +168,11 @@ check table t1;
drop table t1; drop table t1;
#
# Bug#10473 - Can't set 'key_buffer_size' system variable to ZERO
# (One cannot drop the default key cache.)
#
set @@global.key_buffer_size=0;
select @@global.key_buffer_size;
# End of 4.1 tests # End of 4.1 tests
...@@ -2293,7 +2293,12 @@ bool sys_var_key_buffer_size::update(THD *thd, set_var *var) ...@@ -2293,7 +2293,12 @@ bool sys_var_key_buffer_size::update(THD *thd, set_var *var)
if (!tmp) // Zero size means delete if (!tmp) // Zero size means delete
{ {
if (key_cache == dflt_key_cache) if (key_cache == dflt_key_cache)
{
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_CANT_DROP_DEFAULT_KEYCACHE,
ER(ER_WARN_CANT_DROP_DEFAULT_KEYCACHE));
goto end; // Ignore default key cache goto end; // Ignore default key cache
}
if (key_cache->key_cache_inited) // If initied if (key_cache->key_cache_inited) // If initied
{ {
......
...@@ -5388,3 +5388,6 @@ ER_STACK_OVERRUN_NEED_MORE ...@@ -5388,3 +5388,6 @@ ER_STACK_OVERRUN_NEED_MORE
eng "Thread stack overrun: %ld bytes used of a %ld byte stack, and %ld bytes needed. Use 'mysqld -O thread_stack=#' to specify a bigger stack." eng "Thread stack overrun: %ld bytes used of a %ld byte stack, and %ld bytes needed. Use 'mysqld -O thread_stack=#' to specify a bigger stack."
ER_TOO_LONG_BODY 42000 S1009 ER_TOO_LONG_BODY 42000 S1009
eng "Routine body for '%-.100s' is too long" eng "Routine body for '%-.100s' is too long"
ER_WARN_CANT_DROP_DEFAULT_KEYCACHE
eng "Cannot drop default keycache"
ger "Der Default-Keycache kann nicht gelscht werden"
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