Fix for Bug#36876:

The minimum value differs depending on the OS and mysqld build, so that the test fail spradically.
The check of this value has been changed from check of concrete values to the check of a range that is near by the expected value.
This commit is contained in:
Horst Hunger 2008-12-02 11:05:56 +01:00
parent 90152c1733
commit bf1e547779
5 changed files with 68 additions and 98 deletions

View file

@ -9,7 +9,6 @@ SET @min_flush_time = 0;
#SET @max_flush_time = 0;
SET @default_key_buffer_size = 131072;
SET @min_key_buffer_size = 36;
#SET @default_join_buffer_size = 131072;
#SET @min_join_buffer_size = 8200;

View file

@ -9,7 +9,6 @@ SET @min_flush_time = 0;
#SET @max_flush_time = 0;
SET @default_key_buffer_size= 131072;
SET @min_key_buffer_size= 8;
#SET @default_join_buffer_size = 131072;
#SET @min_join_buffer_size = 8200;

View file

@ -17,14 +17,14 @@
# * Valid & Invalid values #
# * Scope & Access method #
# * Data Integrity #
# Modified: Horst Hunger 2008-11-27 #
# Due to OS depending values the check has been changed #
# from concrete values to ranges. #
# #
# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
# server-system-variables.html #
# Reference: #
# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
# #
###############################################################################
# Changes: #
# 2008-03-06 hhunger Got "lost connections with 5.1.24 #
########################################################################
--source include/load_sysvars.inc
@ -38,8 +38,6 @@
########################################################################
SET @start_value = @@global.key_buffer_size;
SELECT @start_value;
--echo '#--------------------FN_DYNVARS_055_01------------------------#'
########################################################################
@ -49,9 +47,7 @@ SELECT @start_value;
SET @@global.key_buffer_size = 99;
--Error ER_NO_DEFAULT
SET @@global.key_buffer_size = DEFAULT;
--echo 'Bug# 34878: This variable has default value according to documentation';
SELECT @@global.key_buffer_size = @min_key_buffer_size;
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36;
--echo '#---------------------FN_DYNVARS_055_02-------------------------#'
###############################################
@ -66,26 +62,25 @@ SELECT @@global.key_buffer_size = @start_value;
# Change the value of key_buffer_size to a valid value #
########################################################################
SET @@global.key_buffer_size = @min_key_buffer_size;
SELECT @@global.key_buffer_size= @min_key_buffer_size;
SET @@global.key_buffer_size = 8 ;
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36;
--disable_warnings
#Due to "lost connection"
#Due to increasing the runtime significantly and allocating the buffer instantly.
#SET @@global.key_buffer_size = 4294967295;
--enable_warnings
#SELECT @@global.key_buffer_size;
SET @@global.key_buffer_size = 1800;
SELECT @@global.key_buffer_size = @min_key_buffer_size;
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36;
SET @@global.key_buffer_size = 65535;
SELECT @@global.key_buffer_size;
echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable';
--echo '#--------------------FN_DYNVARS_055_04-------------------------#'
###########################################################################
# Change the value of key_buffer_size to invalid value #
###########################################################################
# Due to "lost connection"
# Due to increasing the runtime significantly and allocating the buffer instantly
# with a size of 18446744073709551615 bytes with 32bit exec.
#SET @@global.key_buffer_size = -1;
#SELECT @@global.key_buffer_size;
#SET @@global.key_buffer_size = 100000000000;
@ -96,16 +91,14 @@ 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 = @min_key_buffer_size;
--echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable';
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36;
--Error ER_WRONG_TYPE_FOR_VAR
SET @@global.key_buffer_size = ON;
SELECT @@global.key_buffer_size = @min_key_buffer_size;
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36;
--Error ER_WRONG_TYPE_FOR_VAR
SET @@global.key_buffer_size = 'test';
SELECT @@global.key_buffer_size = @min_key_buffer_size;
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36;
--echo '#-------------------FN_DYNVARS_055_05----------------------------#'
###########################################################################
@ -114,8 +107,7 @@ SELECT @@global.key_buffer_size = @min_key_buffer_size;
--Error ER_GLOBAL_VARIABLE
SET @@session.key_buffer_size = 0;
SELECT @@key_buffer_size = @min_key_buffer_size;
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36;
--echo '#----------------------FN_DYNVARS_055_06------------------------#'
##############################################################################
@ -130,17 +122,15 @@ 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 #
###################################################################
SET @@global.key_buffer_size = TRUE;
SELECT @@global.key_buffer_size = @min_key_buffer_size;
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36;
SET @@global.key_buffer_size = FALSE;
SELECT @@global.key_buffer_size = @min_key_buffer_size;
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36;
--echo '#---------------------FN_DYNVARS_055_08----------------------#'
#####################################################################
@ -150,7 +140,7 @@ SELECT @@global.key_buffer_size = @min_key_buffer_size;
# due to differences in contents of the warnings
--disable_warnings
SET @@global.key_buffer_size = @min_key_buffer_size;
SET @@global.key_buffer_size = 8 ;
SELECT @@key_buffer_size = @@global.key_buffer_size;
--enable_warnings
@ -160,8 +150,8 @@ SELECT @@key_buffer_size = @@global.key_buffer_size;
##########################################################################
--Error ER_GLOBAL_VARIABLE
SET key_buffer_size = @min_key_buffer_size;
SELECT @@key_buffer_size = @min_key_buffer_size;
SET key_buffer_size = 8 ;
SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36;
--Error ER_PARSE_ERROR
SET local.key_buffer_size = 10;
--Error ER_UNKNOWN_TABLE
@ -179,9 +169,9 @@ SELECT key_buffer_size = @@session.key_buffer_size;
##############################
SET @@global.key_buffer_size = @start_value;
SELECT @@global.key_buffer_size;
--enable_warnings
#######################################################################
# END OF key_buffer_size TESTS #
#######################################################################

View file

@ -1,14 +1,10 @@
SET @start_value = @@global.key_buffer_size;
SELECT @start_value;
@start_value
1048576
'#--------------------FN_DYNVARS_055_01------------------------#'
SET @@global.key_buffer_size = 99;
SET @@global.key_buffer_size = DEFAULT;
ERROR 42000: Variable 'key_buffer_size' doesn't have a default value
'Bug# 34878: This variable has default value according to documentation';
SELECT @@global.key_buffer_size = @min_key_buffer_size;
@@global.key_buffer_size = @min_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
1
'#---------------------FN_DYNVARS_055_02-------------------------#'
SET @@global.key_buffer_size = @start_value;
@ -16,21 +12,20 @@ SELECT @@global.key_buffer_size = @start_value;
@@global.key_buffer_size = @start_value
1
'#--------------------FN_DYNVARS_055_03------------------------#'
SET @@global.key_buffer_size = @min_key_buffer_size;
SELECT @@global.key_buffer_size= @min_key_buffer_size;
@@global.key_buffer_size= @min_key_buffer_size
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
1
SET @@global.key_buffer_size = 1800;
Warnings:
Warning 1292 Truncated incorrect key_buffer_size value: '1800'
SELECT @@global.key_buffer_size = @min_key_buffer_size;
@@global.key_buffer_size = @min_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
1
SET @@global.key_buffer_size = 65535;
SELECT @@global.key_buffer_size;
@@global.key_buffer_size
61440
'Bug # 34837: Errors are not coming on assigning invalid values to variable'
'#--------------------FN_DYNVARS_055_04-------------------------#'
SET @@global.key_buffer_size = 10000.01;
ERROR 42000: Incorrect argument type to variable 'key_buffer_size'
@ -40,25 +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 = @min_key_buffer_size;
@@global.key_buffer_size = @min_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
1
'Bug # 34837: Errors are not coming on assigning invalid values to variable';
SET @@global.key_buffer_size = ON;
ERROR 42000: Incorrect argument type to variable 'key_buffer_size'
SELECT @@global.key_buffer_size = @min_key_buffer_size;
@@global.key_buffer_size = @min_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
1
SET @@global.key_buffer_size = 'test';
ERROR 42000: Incorrect argument type to variable 'key_buffer_size'
SELECT @@global.key_buffer_size = @min_key_buffer_size;
@@global.key_buffer_size = @min_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
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 @@key_buffer_size = @min_key_buffer_size;
@@key_buffer_size = @min_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
1
'#----------------------FN_DYNVARS_055_06------------------------#'
SELECT @@global.key_buffer_size = VARIABLE_VALUE
@ -75,25 +69,25 @@ 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 = @min_key_buffer_size;
@@global.key_buffer_size = @min_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
1
SET @@global.key_buffer_size = FALSE;
Warnings:
Warning 1438 Cannot drop default keycache
SELECT @@global.key_buffer_size = @min_key_buffer_size;
@@global.key_buffer_size = @min_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
1
'#---------------------FN_DYNVARS_055_08----------------------#'
SET @@global.key_buffer_size = @min_key_buffer_size;
SET @@global.key_buffer_size = 8 ;
SELECT @@key_buffer_size = @@global.key_buffer_size;
@@key_buffer_size = @@global.key_buffer_size
1
'#---------------------FN_DYNVARS_055_09----------------------#'
SET key_buffer_size = @min_key_buffer_size;
SET key_buffer_size = 8 ;
ERROR HY000: Variable 'key_buffer_size' is a GLOBAL variable and should be set with SET GLOBAL
SELECT @@key_buffer_size = @min_key_buffer_size;
@@key_buffer_size = @min_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
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
@ -106,6 +100,3 @@ ERROR 42S02: Unknown table 'global' in field list
SELECT key_buffer_size = @@session.key_buffer_size;
ERROR 42S22: Unknown column 'key_buffer_size' in 'field list'
SET @@global.key_buffer_size = @start_value;
SELECT @@global.key_buffer_size;
@@global.key_buffer_size
1048576

View file

@ -1,14 +1,10 @@
SET @start_value = @@global.key_buffer_size;
SELECT @start_value;
@start_value
1048576
'#--------------------FN_DYNVARS_055_01------------------------#'
SET @@global.key_buffer_size = 99;
SET @@global.key_buffer_size = DEFAULT;
ERROR 42000: Variable 'key_buffer_size' doesn't have a default value
'Bug# 34878: This variable has default value according to documentation';
SELECT @@global.key_buffer_size = @min_key_buffer_size;
@@global.key_buffer_size = @min_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
1
'#---------------------FN_DYNVARS_055_02-------------------------#'
SET @@global.key_buffer_size = @start_value;
@ -16,21 +12,20 @@ SELECT @@global.key_buffer_size = @start_value;
@@global.key_buffer_size = @start_value
1
'#--------------------FN_DYNVARS_055_03------------------------#'
SET @@global.key_buffer_size = @min_key_buffer_size;
SELECT @@global.key_buffer_size= @min_key_buffer_size;
@@global.key_buffer_size= @min_key_buffer_size
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
1
SET @@global.key_buffer_size = 1800;
Warnings:
Warning 1292 Truncated incorrect key_buffer_size value: '1800'
SELECT @@global.key_buffer_size = @min_key_buffer_size;
@@global.key_buffer_size = @min_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
1
SET @@global.key_buffer_size = 65535;
SELECT @@global.key_buffer_size;
@@global.key_buffer_size
61440
'Bug # 34837: Errors are not coming on assigning invalid values to variable'
'#--------------------FN_DYNVARS_055_04-------------------------#'
SET @@global.key_buffer_size = 10000.01;
ERROR 42000: Incorrect argument type to variable 'key_buffer_size'
@ -40,25 +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 = @min_key_buffer_size;
@@global.key_buffer_size = @min_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
1
'Bug # 34837: Errors are not coming on assigning invalid values to variable';
SET @@global.key_buffer_size = ON;
ERROR 42000: Incorrect argument type to variable 'key_buffer_size'
SELECT @@global.key_buffer_size = @min_key_buffer_size;
@@global.key_buffer_size = @min_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
1
SET @@global.key_buffer_size = 'test';
ERROR 42000: Incorrect argument type to variable 'key_buffer_size'
SELECT @@global.key_buffer_size = @min_key_buffer_size;
@@global.key_buffer_size = @min_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
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 @@key_buffer_size = @min_key_buffer_size;
@@key_buffer_size = @min_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
1
'#----------------------FN_DYNVARS_055_06------------------------#'
SELECT @@global.key_buffer_size = VARIABLE_VALUE
@ -75,25 +69,25 @@ 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 = @min_key_buffer_size;
@@global.key_buffer_size = @min_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
1
SET @@global.key_buffer_size = FALSE;
Warnings:
Warning 1438 Cannot drop default keycache
SELECT @@global.key_buffer_size = @min_key_buffer_size;
@@global.key_buffer_size = @min_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
1
'#---------------------FN_DYNVARS_055_08----------------------#'
SET @@global.key_buffer_size = @min_key_buffer_size;
SET @@global.key_buffer_size = 8 ;
SELECT @@key_buffer_size = @@global.key_buffer_size;
@@key_buffer_size = @@global.key_buffer_size
1
'#---------------------FN_DYNVARS_055_09----------------------#'
SET key_buffer_size = @min_key_buffer_size;
SET key_buffer_size = 8 ;
ERROR HY000: Variable 'key_buffer_size' is a GLOBAL variable and should be set with SET GLOBAL
SELECT @@key_buffer_size = @min_key_buffer_size;
@@key_buffer_size = @min_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
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
@ -106,6 +100,3 @@ ERROR 42S02: Unknown table 'global' in field list
SELECT key_buffer_size = @@session.key_buffer_size;
ERROR 42S22: Unknown column 'key_buffer_size' in 'field list'
SET @@global.key_buffer_size = @start_value;
SELECT @@global.key_buffer_size;
@@global.key_buffer_size
1048576