Commit bdf15475 authored by Horst Hunger's avatar Horst Hunger

Modified fix for bug#36876 due to reviews: See bug report.

parent 1c23fb68
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
--source include/load_sysvars.inc --source include/load_sysvars.inc
let $minimum_range= BETWEEN 8 AND 36;
######################################################################## ########################################################################
# START OF key_buffer_size TESTS # # START OF key_buffer_size TESTS #
######################################################################## ########################################################################
...@@ -47,7 +48,7 @@ SET @start_value = @@global.key_buffer_size; ...@@ -47,7 +48,7 @@ SET @start_value = @@global.key_buffer_size;
SET @@global.key_buffer_size = 99; SET @@global.key_buffer_size = 99;
--Error ER_NO_DEFAULT --Error ER_NO_DEFAULT
SET @@global.key_buffer_size = DEFAULT; SET @@global.key_buffer_size = DEFAULT;
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; eval SELECT @@global.key_buffer_size $minimum_range;
--echo '#---------------------FN_DYNVARS_055_02-------------------------#' --echo '#---------------------FN_DYNVARS_055_02-------------------------#'
############################################### ###############################################
...@@ -63,14 +64,17 @@ SELECT @@global.key_buffer_size = @start_value; ...@@ -63,14 +64,17 @@ SELECT @@global.key_buffer_size = @start_value;
######################################################################## ########################################################################
SET @@global.key_buffer_size = 8 ; SET @@global.key_buffer_size = 8 ;
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; eval SELECT @@global.key_buffer_size $minimum_range;
--disable_warnings --disable_warnings
#Due to increasing the runtime significantly and allocating the buffer instantly. # The next subtest is set to comment because it will
# be tried to allocate the buffer instantly which
# might lead to a message about missing resources,
# excessive runtime etc. especially if the main memory is less than 4GB.
#SET @@global.key_buffer_size = 4294967295; #SET @@global.key_buffer_size = 4294967295;
--enable_warnings --enable_warnings
#SELECT @@global.key_buffer_size; #SELECT @@global.key_buffer_size;
SET @@global.key_buffer_size = 1800; SET @@global.key_buffer_size = 1800;
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; eval SELECT @@global.key_buffer_size $minimum_range;
SET @@global.key_buffer_size = 65535; SET @@global.key_buffer_size = 65535;
SELECT @@global.key_buffer_size; SELECT @@global.key_buffer_size;
...@@ -79,8 +83,13 @@ SELECT @@global.key_buffer_size; ...@@ -79,8 +83,13 @@ SELECT @@global.key_buffer_size;
# Change the value of key_buffer_size to invalid value # # Change the value of key_buffer_size to invalid value #
########################################################################### ###########################################################################
# Due to increasing the runtime significantly and allocating the buffer instantly # The next subtests are set to comment because they will
# with a size of 18446744073709551615 bytes with 32bit exec. # be tried to allocate the buffer instantly which
# might lead to a message about missing resources,
# excessive runtime etc. especially if the main memory is less than 4GB.
# The negative values lead to very big numbers, e.g. -1 to
# a size of 18446744073709551615 bytes with a 32bit binary.
# See Bug #42103.
#SET @@global.key_buffer_size = -1; #SET @@global.key_buffer_size = -1;
#SELECT @@global.key_buffer_size; #SELECT @@global.key_buffer_size;
#SET @@global.key_buffer_size = 100000000000; #SET @@global.key_buffer_size = 100000000000;
...@@ -91,14 +100,14 @@ SELECT @@global.key_buffer_size; ...@@ -91,14 +100,14 @@ SELECT @@global.key_buffer_size;
#SET @@global.key_buffer_size = -1024; #SET @@global.key_buffer_size = -1024;
#SELECT @@global.key_buffer_size; #SELECT @@global.key_buffer_size;
SET @@global.key_buffer_size = 4; SET @@global.key_buffer_size = 4;
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; eval SELECT @@global.key_buffer_size $minimum_range;
--Error ER_WRONG_TYPE_FOR_VAR --Error ER_WRONG_TYPE_FOR_VAR
SET @@global.key_buffer_size = ON; SET @@global.key_buffer_size = ON;
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; eval SELECT @@global.key_buffer_size $minimum_range;
--Error ER_WRONG_TYPE_FOR_VAR --Error ER_WRONG_TYPE_FOR_VAR
SET @@global.key_buffer_size = 'test'; SET @@global.key_buffer_size = 'test';
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; eval SELECT @@global.key_buffer_size $minimum_range;
--echo '#-------------------FN_DYNVARS_055_05----------------------------#' --echo '#-------------------FN_DYNVARS_055_05----------------------------#'
########################################################################### ###########################################################################
...@@ -107,7 +116,7 @@ SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; ...@@ -107,7 +116,7 @@ SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36;
--Error ER_GLOBAL_VARIABLE --Error ER_GLOBAL_VARIABLE
SET @@session.key_buffer_size = 0; SET @@session.key_buffer_size = 0;
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; eval SELECT @@global.key_buffer_size $minimum_range;
--echo '#----------------------FN_DYNVARS_055_06------------------------#' --echo '#----------------------FN_DYNVARS_055_06------------------------#'
############################################################################## ##############################################################################
...@@ -127,10 +136,13 @@ WHERE VARIABLE_NAME='key_buffer_size'; ...@@ -127,10 +136,13 @@ WHERE VARIABLE_NAME='key_buffer_size';
# Check if TRUE and FALSE values can be used on variable # # Check if TRUE and FALSE values can be used on variable #
################################################################### ###################################################################
# The following assignment are accepted, but should be rejected
# like the value ON (see above).
# See Bug #42104
SET @@global.key_buffer_size = TRUE; SET @@global.key_buffer_size = TRUE;
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; eval SELECT @@global.key_buffer_size $minimum_range;
SET @@global.key_buffer_size = FALSE; SET @@global.key_buffer_size = FALSE;
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; eval SELECT @@global.key_buffer_size $minimum_range;
--echo '#---------------------FN_DYNVARS_055_08----------------------#' --echo '#---------------------FN_DYNVARS_055_08----------------------#'
##################################################################### #####################################################################
...@@ -151,7 +163,7 @@ SELECT @@key_buffer_size = @@global.key_buffer_size; ...@@ -151,7 +163,7 @@ SELECT @@key_buffer_size = @@global.key_buffer_size;
--Error ER_GLOBAL_VARIABLE --Error ER_GLOBAL_VARIABLE
SET key_buffer_size = 8 ; SET key_buffer_size = 8 ;
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; eval SELECT @@global.key_buffer_size $minimum_range;
--Error ER_PARSE_ERROR --Error ER_PARSE_ERROR
SET local.key_buffer_size = 10; SET local.key_buffer_size = 10;
--Error ER_UNKNOWN_TABLE --Error ER_UNKNOWN_TABLE
...@@ -163,7 +175,6 @@ SELECT global.key_buffer_size; ...@@ -163,7 +175,6 @@ SELECT global.key_buffer_size;
--Error ER_BAD_FIELD_ERROR --Error ER_BAD_FIELD_ERROR
SELECT key_buffer_size = @@session.key_buffer_size; SELECT key_buffer_size = @@session.key_buffer_size;
############################## ##############################
# Restore initial value # # Restore initial value #
############################## ##############################
......
...@@ -3,8 +3,8 @@ SET @start_value = @@global.key_buffer_size; ...@@ -3,8 +3,8 @@ SET @start_value = @@global.key_buffer_size;
SET @@global.key_buffer_size = 99; SET @@global.key_buffer_size = 99;
SET @@global.key_buffer_size = DEFAULT; SET @@global.key_buffer_size = DEFAULT;
ERROR 42000: Variable 'key_buffer_size' doesn't have a default value ERROR 42000: Variable 'key_buffer_size' doesn't have a default value
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; SELECT @@global.key_buffer_size BETWEEN 8 AND 36;
@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 @@global.key_buffer_size BETWEEN 8 AND 36
1 1
'#---------------------FN_DYNVARS_055_02-------------------------#' '#---------------------FN_DYNVARS_055_02-------------------------#'
SET @@global.key_buffer_size = @start_value; SET @@global.key_buffer_size = @start_value;
...@@ -13,14 +13,14 @@ SELECT @@global.key_buffer_size = @start_value; ...@@ -13,14 +13,14 @@ SELECT @@global.key_buffer_size = @start_value;
1 1
'#--------------------FN_DYNVARS_055_03------------------------#' '#--------------------FN_DYNVARS_055_03------------------------#'
SET @@global.key_buffer_size = 8 ; SET @@global.key_buffer_size = 8 ;
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; SELECT @@global.key_buffer_size BETWEEN 8 AND 36;
@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 @@global.key_buffer_size BETWEEN 8 AND 36
1 1
SET @@global.key_buffer_size = 1800; SET @@global.key_buffer_size = 1800;
Warnings: Warnings:
Warning 1292 Truncated incorrect key_buffer_size value: '1800' Warning 1292 Truncated incorrect key_buffer_size value: '1800'
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; SELECT @@global.key_buffer_size BETWEEN 8 AND 36;
@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 @@global.key_buffer_size BETWEEN 8 AND 36
1 1
SET @@global.key_buffer_size = 65535; SET @@global.key_buffer_size = 65535;
SELECT @@global.key_buffer_size; SELECT @@global.key_buffer_size;
...@@ -35,24 +35,24 @@ SELECT @@global.key_buffer_size; ...@@ -35,24 +35,24 @@ SELECT @@global.key_buffer_size;
SET @@global.key_buffer_size = 4; SET @@global.key_buffer_size = 4;
Warnings: Warnings:
Warning 1292 Truncated incorrect key_buffer_size value: '4' Warning 1292 Truncated incorrect key_buffer_size value: '4'
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; SELECT @@global.key_buffer_size BETWEEN 8 AND 36;
@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 @@global.key_buffer_size BETWEEN 8 AND 36
1 1
SET @@global.key_buffer_size = ON; SET @@global.key_buffer_size = ON;
ERROR 42000: Incorrect argument type to variable 'key_buffer_size' ERROR 42000: Incorrect argument type to variable 'key_buffer_size'
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; SELECT @@global.key_buffer_size BETWEEN 8 AND 36;
@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 @@global.key_buffer_size BETWEEN 8 AND 36
1 1
SET @@global.key_buffer_size = 'test'; SET @@global.key_buffer_size = 'test';
ERROR 42000: Incorrect argument type to variable 'key_buffer_size' ERROR 42000: Incorrect argument type to variable 'key_buffer_size'
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; SELECT @@global.key_buffer_size BETWEEN 8 AND 36;
@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 @@global.key_buffer_size BETWEEN 8 AND 36
1 1
'#-------------------FN_DYNVARS_055_05----------------------------#' '#-------------------FN_DYNVARS_055_05----------------------------#'
SET @@session.key_buffer_size = 0; SET @@session.key_buffer_size = 0;
ERROR HY000: Variable 'key_buffer_size' is a GLOBAL variable and should be set with SET GLOBAL ERROR HY000: Variable 'key_buffer_size' is a GLOBAL variable and should be set with SET GLOBAL
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; SELECT @@global.key_buffer_size BETWEEN 8 AND 36;
@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 @@global.key_buffer_size BETWEEN 8 AND 36
1 1
'#----------------------FN_DYNVARS_055_06------------------------#' '#----------------------FN_DYNVARS_055_06------------------------#'
SELECT @@global.key_buffer_size = VARIABLE_VALUE SELECT @@global.key_buffer_size = VARIABLE_VALUE
...@@ -69,14 +69,14 @@ WHERE VARIABLE_NAME='key_buffer_size'; ...@@ -69,14 +69,14 @@ WHERE VARIABLE_NAME='key_buffer_size';
SET @@global.key_buffer_size = TRUE; SET @@global.key_buffer_size = TRUE;
Warnings: Warnings:
Warning 1292 Truncated incorrect key_buffer_size value: '1' Warning 1292 Truncated incorrect key_buffer_size value: '1'
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; SELECT @@global.key_buffer_size BETWEEN 8 AND 36;
@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 @@global.key_buffer_size BETWEEN 8 AND 36
1 1
SET @@global.key_buffer_size = FALSE; SET @@global.key_buffer_size = FALSE;
Warnings: Warnings:
Warning 1438 Cannot drop default keycache Warning 1438 Cannot drop default keycache
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; SELECT @@global.key_buffer_size BETWEEN 8 AND 36;
@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 @@global.key_buffer_size BETWEEN 8 AND 36
1 1
'#---------------------FN_DYNVARS_055_08----------------------#' '#---------------------FN_DYNVARS_055_08----------------------#'
SET @@global.key_buffer_size = 8 ; SET @@global.key_buffer_size = 8 ;
...@@ -86,8 +86,8 @@ SELECT @@key_buffer_size = @@global.key_buffer_size; ...@@ -86,8 +86,8 @@ SELECT @@key_buffer_size = @@global.key_buffer_size;
'#---------------------FN_DYNVARS_055_09----------------------#' '#---------------------FN_DYNVARS_055_09----------------------#'
SET key_buffer_size = 8 ; SET key_buffer_size = 8 ;
ERROR HY000: Variable 'key_buffer_size' is a GLOBAL variable and should be set with SET GLOBAL ERROR HY000: Variable 'key_buffer_size' is a GLOBAL variable and should be set with SET GLOBAL
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; SELECT @@global.key_buffer_size BETWEEN 8 AND 36;
@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 @@global.key_buffer_size BETWEEN 8 AND 36
1 1
SET local.key_buffer_size = 10; SET local.key_buffer_size = 10;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key_buffer_size = 10' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key_buffer_size = 10' at line 1
......
...@@ -3,8 +3,8 @@ SET @start_value = @@global.key_buffer_size; ...@@ -3,8 +3,8 @@ SET @start_value = @@global.key_buffer_size;
SET @@global.key_buffer_size = 99; SET @@global.key_buffer_size = 99;
SET @@global.key_buffer_size = DEFAULT; SET @@global.key_buffer_size = DEFAULT;
ERROR 42000: Variable 'key_buffer_size' doesn't have a default value ERROR 42000: Variable 'key_buffer_size' doesn't have a default value
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; SELECT @@global.key_buffer_size BETWEEN 8 AND 36;
@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 @@global.key_buffer_size BETWEEN 8 AND 36
1 1
'#---------------------FN_DYNVARS_055_02-------------------------#' '#---------------------FN_DYNVARS_055_02-------------------------#'
SET @@global.key_buffer_size = @start_value; SET @@global.key_buffer_size = @start_value;
...@@ -13,14 +13,14 @@ SELECT @@global.key_buffer_size = @start_value; ...@@ -13,14 +13,14 @@ SELECT @@global.key_buffer_size = @start_value;
1 1
'#--------------------FN_DYNVARS_055_03------------------------#' '#--------------------FN_DYNVARS_055_03------------------------#'
SET @@global.key_buffer_size = 8 ; SET @@global.key_buffer_size = 8 ;
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; SELECT @@global.key_buffer_size BETWEEN 8 AND 36;
@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 @@global.key_buffer_size BETWEEN 8 AND 36
1 1
SET @@global.key_buffer_size = 1800; SET @@global.key_buffer_size = 1800;
Warnings: Warnings:
Warning 1292 Truncated incorrect key_buffer_size value: '1800' Warning 1292 Truncated incorrect key_buffer_size value: '1800'
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; SELECT @@global.key_buffer_size BETWEEN 8 AND 36;
@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 @@global.key_buffer_size BETWEEN 8 AND 36
1 1
SET @@global.key_buffer_size = 65535; SET @@global.key_buffer_size = 65535;
SELECT @@global.key_buffer_size; SELECT @@global.key_buffer_size;
...@@ -35,24 +35,24 @@ SELECT @@global.key_buffer_size; ...@@ -35,24 +35,24 @@ SELECT @@global.key_buffer_size;
SET @@global.key_buffer_size = 4; SET @@global.key_buffer_size = 4;
Warnings: Warnings:
Warning 1292 Truncated incorrect key_buffer_size value: '4' Warning 1292 Truncated incorrect key_buffer_size value: '4'
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; SELECT @@global.key_buffer_size BETWEEN 8 AND 36;
@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 @@global.key_buffer_size BETWEEN 8 AND 36
1 1
SET @@global.key_buffer_size = ON; SET @@global.key_buffer_size = ON;
ERROR 42000: Incorrect argument type to variable 'key_buffer_size' ERROR 42000: Incorrect argument type to variable 'key_buffer_size'
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; SELECT @@global.key_buffer_size BETWEEN 8 AND 36;
@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 @@global.key_buffer_size BETWEEN 8 AND 36
1 1
SET @@global.key_buffer_size = 'test'; SET @@global.key_buffer_size = 'test';
ERROR 42000: Incorrect argument type to variable 'key_buffer_size' ERROR 42000: Incorrect argument type to variable 'key_buffer_size'
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; SELECT @@global.key_buffer_size BETWEEN 8 AND 36;
@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 @@global.key_buffer_size BETWEEN 8 AND 36
1 1
'#-------------------FN_DYNVARS_055_05----------------------------#' '#-------------------FN_DYNVARS_055_05----------------------------#'
SET @@session.key_buffer_size = 0; SET @@session.key_buffer_size = 0;
ERROR HY000: Variable 'key_buffer_size' is a GLOBAL variable and should be set with SET GLOBAL ERROR HY000: Variable 'key_buffer_size' is a GLOBAL variable and should be set with SET GLOBAL
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; SELECT @@global.key_buffer_size BETWEEN 8 AND 36;
@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 @@global.key_buffer_size BETWEEN 8 AND 36
1 1
'#----------------------FN_DYNVARS_055_06------------------------#' '#----------------------FN_DYNVARS_055_06------------------------#'
SELECT @@global.key_buffer_size = VARIABLE_VALUE SELECT @@global.key_buffer_size = VARIABLE_VALUE
...@@ -69,14 +69,14 @@ WHERE VARIABLE_NAME='key_buffer_size'; ...@@ -69,14 +69,14 @@ WHERE VARIABLE_NAME='key_buffer_size';
SET @@global.key_buffer_size = TRUE; SET @@global.key_buffer_size = TRUE;
Warnings: Warnings:
Warning 1292 Truncated incorrect key_buffer_size value: '1' Warning 1292 Truncated incorrect key_buffer_size value: '1'
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; SELECT @@global.key_buffer_size BETWEEN 8 AND 36;
@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 @@global.key_buffer_size BETWEEN 8 AND 36
1 1
SET @@global.key_buffer_size = FALSE; SET @@global.key_buffer_size = FALSE;
Warnings: Warnings:
Warning 1438 Cannot drop default keycache Warning 1438 Cannot drop default keycache
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; SELECT @@global.key_buffer_size BETWEEN 8 AND 36;
@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 @@global.key_buffer_size BETWEEN 8 AND 36
1 1
'#---------------------FN_DYNVARS_055_08----------------------#' '#---------------------FN_DYNVARS_055_08----------------------#'
SET @@global.key_buffer_size = 8 ; SET @@global.key_buffer_size = 8 ;
...@@ -86,8 +86,8 @@ SELECT @@key_buffer_size = @@global.key_buffer_size; ...@@ -86,8 +86,8 @@ SELECT @@key_buffer_size = @@global.key_buffer_size;
'#---------------------FN_DYNVARS_055_09----------------------#' '#---------------------FN_DYNVARS_055_09----------------------#'
SET key_buffer_size = 8 ; SET key_buffer_size = 8 ;
ERROR HY000: Variable 'key_buffer_size' is a GLOBAL variable and should be set with SET GLOBAL ERROR HY000: Variable 'key_buffer_size' is a GLOBAL variable and should be set with SET GLOBAL
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; SELECT @@global.key_buffer_size BETWEEN 8 AND 36;
@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 @@global.key_buffer_size BETWEEN 8 AND 36
1 1
SET local.key_buffer_size = 10; SET local.key_buffer_size = 10;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key_buffer_size = 10' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key_buffer_size = 10' at line 1
......
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