Debian Codegraph @

mysql-test/suite/sys_vars/t/key_buffer_size_basic.test

raw
1 ############## mysql-test\t\key_buffer_size_basic.test ########################
2 # #
3 # Variable Name: key_buffer_size #
4 # Scope: GLOBAL #
5 # Access Type: Dynamic #
6 # Data Type: numeric #
7 # Default Value: 131072 #
8 # Range:8-4294967295 #
9 # #
10 # #
11 # Creation Date: 2008-02-07 #
12 # Author: Salman #
13 # #
14 # Description: Test Cases of Dynamic System Variable key_buffer_size #
15 # that checks the behavior of this variable in the following ways#
16 # * Default Value #
17 # * Valid & Invalid values #
18 # * Scope & Access method #
19 # * Data Integrity #
20 # Modified: Horst Hunger 2008-11-27 #
21 # Due to OS depending values the check has been changed #
22 # from concrete values to ranges. #
23 # #
24 # Reference: #
25 # http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
26 # #
27 ###############################################################################
28
29 --source include/load_sysvars.inc
30
31 ########################################################################
32 # START OF key_buffer_size TESTS #
33 ########################################################################
34
35 ########################################################################
36 # Saving initial value of key_buffer_size in a temporary variable #
37 ########################################################################
38
39 SET @start_value = @@global.key_buffer_size;
40
41 --echo '#--------------------FN_DYNVARS_055_01------------------------#'
42 ########################################################################
43 # Display the DEFAULT value of key_buffer_size #
44 ########################################################################
45
46 SET @@global.key_buffer_size = DEFAULT;
47 SELECT @@global.key_buffer_size;
48
49 --echo '#---------------------FN_DYNVARS_055_02-------------------------#'
50 ###############################################
51 # Verify default value of variable #
52 ###############################################
53
54 SET @@global.key_buffer_size = @start_value;
55 SELECT @@global.key_buffer_size = @start_value;
56
57 --echo '#--------------------FN_DYNVARS_055_03------------------------#'
58 ########################################################################
59 # Change the value of key_buffer_size to a valid value #
60 ########################################################################
61
62 SET @@global.key_buffer_size = 4096;
63 SELECT @@global.key_buffer_size;
64 SET @@global.key_buffer_size = 65535;
65 SELECT @@global.key_buffer_size;
66
67 --echo '#--------------------FN_DYNVARS_055_04-------------------------#'
68 ###########################################################################
69 # Change the value of key_buffer_size to invalid value #
70 ###########################################################################
71
72 --Error ER_WARN_CANT_DROP_DEFAULT_KEYCACHE
73 SET @@global.key_buffer_size = -1;
74 SELECT @@global.key_buffer_size;
75
76 --Error ER_WARN_CANT_DROP_DEFAULT_KEYCACHE
77 SET @@global.key_buffer_size = 4;
78 SELECT @@global.key_buffer_size;
79
80 --Error ER_WARN_CANT_DROP_DEFAULT_KEYCACHE
81 SET @@global.key_buffer_size = -1024;
82 SELECT @@global.key_buffer_size;
83
84 --Error ER_WRONG_TYPE_FOR_VAR
85 SET @@global.key_buffer_size = 10000.01;
86
87 --Error ER_WRONG_TYPE_FOR_VAR
88 SET @@global.key_buffer_size = ' ';
89
90 --Error ER_WRONG_TYPE_FOR_VAR
91 SET @@global.key_buffer_size = " ";
92
93 --Error ER_WRONG_TYPE_FOR_VAR
94 SET @@global.key_buffer_size = ON;
95
96 --Error ER_WRONG_TYPE_FOR_VAR
97 SET @@global.key_buffer_size = 'test';
98
99 --echo '#-------------------FN_DYNVARS_055_05----------------------------#'
100 ###########################################################################
101 # Test if accessing session key_buffer_size gives error #
102 ###########################################################################
103
104 --Error ER_GLOBAL_VARIABLE
105 SET @@session.key_buffer_size = 0;
106
107 --echo '#----------------------FN_DYNVARS_055_06------------------------#'
108 ##############################################################################
109 # Check if the value in GLOBAL & SESSION Tables matches values in variable #
110 ##############################################################################
111
112 --disable_warnings
113 SELECT @@global.key_buffer_size = VARIABLE_VALUE
114 FROM performance_schema.global_variables
115 WHERE VARIABLE_NAME='key_buffer_size';
116
117 SELECT @@key_buffer_size = VARIABLE_VALUE
118 FROM performance_schema.session_variables
119 WHERE VARIABLE_NAME='key_buffer_size';
120 --enable_warnings
121
122 --echo '#---------------------FN_DYNVARS_055_07----------------------#'
123 ###################################################################
124 # Check if TRUE and FALSE values can be used on variable #
125 ###################################################################
126
127 --Error ER_WARN_CANT_DROP_DEFAULT_KEYCACHE
128 SET @@global.key_buffer_size = TRUE;
129 --Error ER_WARN_CANT_DROP_DEFAULT_KEYCACHE
130 SET @@global.key_buffer_size = FALSE;
131
132 --echo '#---------------------FN_DYNVARS_055_08----------------------#'
133 #####################################################################
134 # Check if accessing variable with SESSION,LOCAL and without SCOPE #
135 # points to same session variable #
136 #####################################################################
137
138 SELECT @@key_buffer_size = @@global.key_buffer_size;
139
140 --echo '#---------------------FN_DYNVARS_055_9----------------------#'
141 ##########################################################################
142 # Check if key_buffer_size can be accessed with and without @@ sign #
143 ##########################################################################
144
145 --Error ER_GLOBAL_VARIABLE
146 SET key_buffer_size = 8 ;
147 --Error ER_PARSE_ERROR
148 SET local.key_buffer_size = 10;
149 --Error ER_UNKNOWN_TABLE
150 SELECT local.key_buffer_size;
151 --Error ER_PARSE_ERROR
152 SET global.key_buffer_size = 10;
153 --Error ER_UNKNOWN_TABLE
154 SELECT global.key_buffer_size;
155 --Error ER_BAD_FIELD_ERROR
156 SELECT key_buffer_size;
157 --Error ER_INCORRECT_GLOBAL_LOCAL_VAR
158 SELECT @@session.key_buffer_size;
159
160 ##############################
161 # Restore initial value #
162 ##############################
163
164 SET @@global.key_buffer_size = @start_value;
165
166 #######################################################################
167 # END OF key_buffer_size TESTS #
168 #######################################################################
169