Commit 9e5c20f3 authored by unknown's avatar unknown
Browse files

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.


mysql-test/r/key_cache.result:
  Bug#10473 - Can't set 'key_buffer_size' system variable to ZERO
  The test result.
mysql-test/t/key_cache.test:
  Bug#10473 - Can't set 'key_buffer_size' system variable to ZERO
  The test case.
sql/share/errmsg.txt:
  Bug#10473 - Can't set 'key_buffer_size' system variable to ZERO
  The new message string.
parent 9cd28273
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -289,3 +289,9 @@ check table t1;
Table	Op	Msg_type	Msg_text
test.t1	check	status	OK
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
+7 −0
Original line number Diff line number Diff line
@@ -168,4 +168,11 @@ check 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
+5 −0
Original line number Diff line number Diff line
@@ -2293,7 +2293,12 @@ bool sys_var_key_buffer_size::update(THD *thd, set_var *var)
  if (!tmp)					// Zero size means delete
  {
    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
    }

    if (key_cache->key_cache_inited)		// If initied
    {
+3 −0
Original line number Diff line number Diff line
@@ -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."
ER_TOO_LONG_BODY 42000 S1009
	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"