mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
Modified fix for bug#36876 due to reviews: See bug report.
This commit is contained in:
parent
b33437f18a
commit
2255610125
3 changed files with 92 additions and 81 deletions
|
@ -28,59 +28,68 @@
|
|||
|
||||
--source include/load_sysvars.inc
|
||||
|
||||
########################################################################
|
||||
let $minimum_range= BETWEEN 8 AND 36;
|
||||
########################################################################
|
||||
# START OF key_buffer_size TESTS #
|
||||
########################################################################
|
||||
########################################################################
|
||||
|
||||
--disable_warnings
|
||||
########################################################################
|
||||
########################################################################
|
||||
# Saving initial value of key_buffer_size in a temporary variable #
|
||||
########################################################################
|
||||
########################################################################
|
||||
|
||||
SET @start_value = @@global.key_buffer_size;
|
||||
|
||||
--echo '#--------------------FN_DYNVARS_055_01------------------------#'
|
||||
########################################################################
|
||||
########################################################################
|
||||
# Display the DEFAULT value of key_buffer_size #
|
||||
########################################################################
|
||||
########################################################################
|
||||
|
||||
SET @@global.key_buffer_size = 99;
|
||||
--Error ER_NO_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-------------------------#'
|
||||
###############################################
|
||||
###############################################
|
||||
# Verify default value of variable #
|
||||
###############################################
|
||||
###############################################
|
||||
|
||||
SET @@global.key_buffer_size = @start_value;
|
||||
SELECT @@global.key_buffer_size = @start_value;
|
||||
|
||||
--echo '#--------------------FN_DYNVARS_055_03------------------------#'
|
||||
########################################################################
|
||||
########################################################################
|
||||
# Change the value of key_buffer_size to a valid value #
|
||||
########################################################################
|
||||
########################################################################
|
||||
|
||||
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
|
||||
#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;
|
||||
--enable_warnings
|
||||
#SELECT @@global.key_buffer_size;
|
||||
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;
|
||||
SELECT @@global.key_buffer_size;
|
||||
|
||||
--echo '#--------------------FN_DYNVARS_055_04-------------------------#'
|
||||
###########################################################################
|
||||
###########################################################################
|
||||
# Change the value of key_buffer_size to invalid value #
|
||||
###########################################################################
|
||||
###########################################################################
|
||||
|
||||
# Due to increasing the runtime significantly and allocating the buffer instantly
|
||||
# with a size of 18446744073709551615 bytes with 32bit exec.
|
||||
# The next subtests are set to comment because they 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.
|
||||
# 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;
|
||||
#SELECT @@global.key_buffer_size;
|
||||
#SET @@global.key_buffer_size = 100000000000;
|
||||
|
@ -91,46 +100,49 @@ SELECT @@global.key_buffer_size;
|
|||
#SET @@global.key_buffer_size = -1024;
|
||||
#SELECT @@global.key_buffer_size;
|
||||
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
|
||||
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
|
||||
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----------------------------#'
|
||||
###########################################################################
|
||||
###########################################################################
|
||||
# Test if accessing session key_buffer_size gives error #
|
||||
###########################################################################
|
||||
###########################################################################
|
||||
|
||||
--Error ER_GLOBAL_VARIABLE
|
||||
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------------------------#'
|
||||
##############################################################################
|
||||
##############################################################################
|
||||
# Check if the value in GLOBAL & SESSION Tables matches values in variable #
|
||||
##############################################################################
|
||||
|
||||
SELECT @@global.key_buffer_size = VARIABLE_VALUE
|
||||
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
||||
SELECT @@global.key_buffer_size = VARIABLE_VALUE
|
||||
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
||||
WHERE VARIABLE_NAME='key_buffer_size';
|
||||
|
||||
SELECT @@key_buffer_size = VARIABLE_VALUE
|
||||
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
|
||||
SELECT @@key_buffer_size = VARIABLE_VALUE
|
||||
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
|
||||
WHERE VARIABLE_NAME='key_buffer_size';
|
||||
|
||||
--echo '#---------------------FN_DYNVARS_055_07----------------------#'
|
||||
###################################################################
|
||||
###################################################################
|
||||
# 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;
|
||||
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;
|
||||
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----------------------#'
|
||||
#####################################################################
|
||||
|
@ -145,13 +157,13 @@ SELECT @@key_buffer_size = @@global.key_buffer_size;
|
|||
--enable_warnings
|
||||
|
||||
--echo '#---------------------FN_DYNVARS_055_09----------------------#'
|
||||
##########################################################################
|
||||
##########################################################################
|
||||
# Check if key_buffer_size can be accessed with and without @@ sign #
|
||||
##########################################################################
|
||||
|
||||
--Error ER_GLOBAL_VARIABLE
|
||||
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
|
||||
SET local.key_buffer_size = 10;
|
||||
--Error ER_UNKNOWN_TABLE
|
||||
|
@ -163,8 +175,7 @@ SELECT global.key_buffer_size;
|
|||
--Error ER_BAD_FIELD_ERROR
|
||||
SELECT key_buffer_size = @@session.key_buffer_size;
|
||||
|
||||
|
||||
##############################
|
||||
##############################
|
||||
# Restore initial value #
|
||||
##############################
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@ SET @start_value = @@global.key_buffer_size;
|
|||
SET @@global.key_buffer_size = 99;
|
||||
SET @@global.key_buffer_size = DEFAULT;
|
||||
ERROR 42000: Variable 'key_buffer_size' doesn't have a default value
|
||||
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36;
|
||||
@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36
|
||||
SELECT @@global.key_buffer_size BETWEEN 8 AND 36;
|
||||
@@global.key_buffer_size BETWEEN 8 AND 36
|
||||
1
|
||||
'#---------------------FN_DYNVARS_055_02-------------------------#'
|
||||
SET @@global.key_buffer_size = @start_value;
|
||||
|
@ -13,14 +13,14 @@ SELECT @@global.key_buffer_size = @start_value;
|
|||
1
|
||||
'#--------------------FN_DYNVARS_055_03------------------------#'
|
||||
SET @@global.key_buffer_size = 8 ;
|
||||
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36;
|
||||
@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36
|
||||
SELECT @@global.key_buffer_size BETWEEN 8 AND 36;
|
||||
@@global.key_buffer_size BETWEEN 8 AND 36
|
||||
1
|
||||
SET @@global.key_buffer_size = 1800;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect key_buffer_size value: '1800'
|
||||
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36;
|
||||
@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36
|
||||
SELECT @@global.key_buffer_size BETWEEN 8 AND 36;
|
||||
@@global.key_buffer_size BETWEEN 8 AND 36
|
||||
1
|
||||
SET @@global.key_buffer_size = 65535;
|
||||
SELECT @@global.key_buffer_size;
|
||||
|
@ -35,24 +35,24 @@ SELECT @@global.key_buffer_size;
|
|||
SET @@global.key_buffer_size = 4;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect key_buffer_size value: '4'
|
||||
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36;
|
||||
@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36
|
||||
SELECT @@global.key_buffer_size BETWEEN 8 AND 36;
|
||||
@@global.key_buffer_size BETWEEN 8 AND 36
|
||||
1
|
||||
SET @@global.key_buffer_size = ON;
|
||||
ERROR 42000: Incorrect argument type to variable 'key_buffer_size'
|
||||
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36;
|
||||
@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36
|
||||
SELECT @@global.key_buffer_size BETWEEN 8 AND 36;
|
||||
@@global.key_buffer_size BETWEEN 8 AND 36
|
||||
1
|
||||
SET @@global.key_buffer_size = 'test';
|
||||
ERROR 42000: Incorrect argument type to variable 'key_buffer_size'
|
||||
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36;
|
||||
@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36
|
||||
SELECT @@global.key_buffer_size BETWEEN 8 AND 36;
|
||||
@@global.key_buffer_size BETWEEN 8 AND 36
|
||||
1
|
||||
'#-------------------FN_DYNVARS_055_05----------------------------#'
|
||||
SET @@session.key_buffer_size = 0;
|
||||
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;
|
||||
@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36
|
||||
SELECT @@global.key_buffer_size BETWEEN 8 AND 36;
|
||||
@@global.key_buffer_size BETWEEN 8 AND 36
|
||||
1
|
||||
'#----------------------FN_DYNVARS_055_06------------------------#'
|
||||
SELECT @@global.key_buffer_size = VARIABLE_VALUE
|
||||
|
@ -69,14 +69,14 @@ WHERE VARIABLE_NAME='key_buffer_size';
|
|||
SET @@global.key_buffer_size = TRUE;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect key_buffer_size value: '1'
|
||||
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36;
|
||||
@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36
|
||||
SELECT @@global.key_buffer_size BETWEEN 8 AND 36;
|
||||
@@global.key_buffer_size BETWEEN 8 AND 36
|
||||
1
|
||||
SET @@global.key_buffer_size = FALSE;
|
||||
Warnings:
|
||||
Warning 1438 Cannot drop default keycache
|
||||
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36;
|
||||
@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36
|
||||
SELECT @@global.key_buffer_size BETWEEN 8 AND 36;
|
||||
@@global.key_buffer_size BETWEEN 8 AND 36
|
||||
1
|
||||
'#---------------------FN_DYNVARS_055_08----------------------#'
|
||||
SET @@global.key_buffer_size = 8 ;
|
||||
|
@ -86,8 +86,8 @@ SELECT @@key_buffer_size = @@global.key_buffer_size;
|
|||
'#---------------------FN_DYNVARS_055_09----------------------#'
|
||||
SET key_buffer_size = 8 ;
|
||||
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;
|
||||
@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36
|
||||
SELECT @@global.key_buffer_size BETWEEN 8 AND 36;
|
||||
@@global.key_buffer_size BETWEEN 8 AND 36
|
||||
1
|
||||
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
|
||||
|
|
|
@ -3,8 +3,8 @@ SET @start_value = @@global.key_buffer_size;
|
|||
SET @@global.key_buffer_size = 99;
|
||||
SET @@global.key_buffer_size = DEFAULT;
|
||||
ERROR 42000: Variable 'key_buffer_size' doesn't have a default value
|
||||
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36;
|
||||
@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36
|
||||
SELECT @@global.key_buffer_size BETWEEN 8 AND 36;
|
||||
@@global.key_buffer_size BETWEEN 8 AND 36
|
||||
1
|
||||
'#---------------------FN_DYNVARS_055_02-------------------------#'
|
||||
SET @@global.key_buffer_size = @start_value;
|
||||
|
@ -13,14 +13,14 @@ SELECT @@global.key_buffer_size = @start_value;
|
|||
1
|
||||
'#--------------------FN_DYNVARS_055_03------------------------#'
|
||||
SET @@global.key_buffer_size = 8 ;
|
||||
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36;
|
||||
@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36
|
||||
SELECT @@global.key_buffer_size BETWEEN 8 AND 36;
|
||||
@@global.key_buffer_size BETWEEN 8 AND 36
|
||||
1
|
||||
SET @@global.key_buffer_size = 1800;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect key_buffer_size value: '1800'
|
||||
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36;
|
||||
@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36
|
||||
SELECT @@global.key_buffer_size BETWEEN 8 AND 36;
|
||||
@@global.key_buffer_size BETWEEN 8 AND 36
|
||||
1
|
||||
SET @@global.key_buffer_size = 65535;
|
||||
SELECT @@global.key_buffer_size;
|
||||
|
@ -35,33 +35,33 @@ SELECT @@global.key_buffer_size;
|
|||
SET @@global.key_buffer_size = 4;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect key_buffer_size value: '4'
|
||||
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36;
|
||||
@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36
|
||||
SELECT @@global.key_buffer_size BETWEEN 8 AND 36;
|
||||
@@global.key_buffer_size BETWEEN 8 AND 36
|
||||
1
|
||||
SET @@global.key_buffer_size = ON;
|
||||
ERROR 42000: Incorrect argument type to variable 'key_buffer_size'
|
||||
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36;
|
||||
@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36
|
||||
SELECT @@global.key_buffer_size BETWEEN 8 AND 36;
|
||||
@@global.key_buffer_size BETWEEN 8 AND 36
|
||||
1
|
||||
SET @@global.key_buffer_size = 'test';
|
||||
ERROR 42000: Incorrect argument type to variable 'key_buffer_size'
|
||||
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36;
|
||||
@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36
|
||||
SELECT @@global.key_buffer_size BETWEEN 8 AND 36;
|
||||
@@global.key_buffer_size BETWEEN 8 AND 36
|
||||
1
|
||||
'#-------------------FN_DYNVARS_055_05----------------------------#'
|
||||
SET @@session.key_buffer_size = 0;
|
||||
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;
|
||||
@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36
|
||||
SELECT @@global.key_buffer_size BETWEEN 8 AND 36;
|
||||
@@global.key_buffer_size BETWEEN 8 AND 36
|
||||
1
|
||||
'#----------------------FN_DYNVARS_055_06------------------------#'
|
||||
SELECT @@global.key_buffer_size = VARIABLE_VALUE
|
||||
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
||||
SELECT @@global.key_buffer_size = VARIABLE_VALUE
|
||||
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
||||
WHERE VARIABLE_NAME='key_buffer_size';
|
||||
@@global.key_buffer_size = VARIABLE_VALUE
|
||||
1
|
||||
SELECT @@key_buffer_size = VARIABLE_VALUE
|
||||
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
|
||||
SELECT @@key_buffer_size = VARIABLE_VALUE
|
||||
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
|
||||
WHERE VARIABLE_NAME='key_buffer_size';
|
||||
@@key_buffer_size = VARIABLE_VALUE
|
||||
1
|
||||
|
@ -69,14 +69,14 @@ WHERE VARIABLE_NAME='key_buffer_size';
|
|||
SET @@global.key_buffer_size = TRUE;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect key_buffer_size value: '1'
|
||||
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36;
|
||||
@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36
|
||||
SELECT @@global.key_buffer_size BETWEEN 8 AND 36;
|
||||
@@global.key_buffer_size BETWEEN 8 AND 36
|
||||
1
|
||||
SET @@global.key_buffer_size = FALSE;
|
||||
Warnings:
|
||||
Warning 1438 Cannot drop default keycache
|
||||
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36;
|
||||
@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36
|
||||
SELECT @@global.key_buffer_size BETWEEN 8 AND 36;
|
||||
@@global.key_buffer_size BETWEEN 8 AND 36
|
||||
1
|
||||
'#---------------------FN_DYNVARS_055_08----------------------#'
|
||||
SET @@global.key_buffer_size = 8 ;
|
||||
|
@ -86,8 +86,8 @@ SELECT @@key_buffer_size = @@global.key_buffer_size;
|
|||
'#---------------------FN_DYNVARS_055_09----------------------#'
|
||||
SET key_buffer_size = 8 ;
|
||||
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;
|
||||
@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36
|
||||
SELECT @@global.key_buffer_size BETWEEN 8 AND 36;
|
||||
@@global.key_buffer_size BETWEEN 8 AND 36
|
||||
1
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue