Debian Codegraph @

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

raw
1 ############## mysql-test\t\max_delayed_threads_basic.test ###############
2 # #
3 # Variable Name: max_delayed_threads #
4 # Scope: GLOBAL | SESSION #
5 # Access Type: Dynamic #
6 # Data Type: numeric #
7 # Default Value: 20 #
8 # Range: 0-16384 #
9 # #
10 # #
11 # Creation Date: 2008-02-07 #
12 # Author: Salman #
13 # #
14 # Description: Test Cases of Dynamic System Variable max_delayed_threads #
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 # #
21 # Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
22 # server-system-variables.html #
23 # #
24 ###############################################################################
25
26 --source include/load_sysvars.inc
27
28 ##################################################################
29 # START OF max_delayed_threads TESTS #
30 ##################################################################
31
32
33 #############################################################
34 # Save initial value #
35 #############################################################
36
37 SET @start_global_value = @@global.max_delayed_threads;
38 SELECT @start_global_value;
39 SET @start_session_value = @@session.max_delayed_threads;
40 SELECT @start_session_value;
41
42
43 --echo '#--------------------FN_DYNVARS_075_01-------------------------#'
44 ##################################################################
45 # Display the DEFAULT value of max_delayed_threads #
46 ##################################################################
47
48 SET @@global.max_delayed_threads = 1000;
49 SET @@global.max_delayed_threads = DEFAULT;
50 SELECT @@global.max_delayed_threads;
51
52 --Error ER_WRONG_VALUE_FOR_VAR
53 SET @@session.max_delayed_threads = 1000;
54 SET @@session.max_delayed_threads = DEFAULT;
55 SELECT @@session.max_delayed_threads;
56
57
58 --echo '#--------------------FN_DYNVARS_075_02-------------------------#'
59 ##################################################################
60 # Check the DEFAULT value of max_delayed_threads #
61 ##################################################################
62
63 SET @@global.max_delayed_threads = DEFAULT;
64 SELECT @@global.max_delayed_threads = 20;
65
66 SET @@session.max_delayed_threads = DEFAULT;
67 SELECT @@session.max_delayed_threads = 20;
68
69
70 --echo '#--------------------FN_DYNVARS_075_03-------------------------#'
71 ############################################################################
72 # Change the value of max_delayed_threads to a valid value for GLOBAL Scope #
73 ############################################################################
74
75 SET @@global.max_delayed_threads = 1;
76 SELECT @@global.max_delayed_threads;
77 SET @@global.max_delayed_threads = 1025;
78 SELECT @@global.max_delayed_threads;
79
80 SET @@global.max_delayed_threads = 0;
81 SELECT @@global.max_delayed_threads;
82 SET @@global.max_delayed_threads = 16384;
83 SELECT @@global.max_delayed_threads;
84 SET @@global.max_delayed_threads = 16383;
85 SELECT @@global.max_delayed_threads;
86
87 --echo '#--------------------FN_DYNVARS_075_04-------------------------#'
88 #############################################################################
89 # Change the value of max_delayed_threads to a valid value for SESSION Scope #
90 #############################################################################
91
92 --Error ER_WRONG_VALUE_FOR_VAR
93 SET @@session.max_delayed_threads = 1;
94 SELECT @@session.max_delayed_threads;
95 --Error ER_WRONG_VALUE_FOR_VAR
96 SET @@session.max_delayed_threads = 1025;
97 SELECT @@session.max_delayed_threads;
98
99 SET @@session.max_delayed_threads = 0;
100 SELECT @@session.max_delayed_threads;
101 --Error ER_WRONG_VALUE_FOR_VAR
102 SET @@session.max_delayed_threads = 16384;
103 SELECT @@session.max_delayed_threads;
104
105 SET @@session.max_delayed_threads = 16383;
106 SELECT @@session.max_delayed_threads;
107
108
109 --echo '#------------------FN_DYNVARS_075_05-----------------------#'
110 ##############################################################
111 # Change the value of max_delayed_threads to an invalid value #
112 ##############################################################
113
114 SET @@global.max_delayed_threads = -1024;
115 SELECT @@global.max_delayed_threads;
116 SET @@global.max_delayed_threads = -1;
117 SELECT @@global.max_delayed_threads;
118 SET @@global.max_delayed_threads = 16385;
119 SELECT @@global.max_delayed_threads;
120 SET @@global.max_delayed_threads = 1638523;
121 SELECT @@global.max_delayed_threads;
122
123 --Error ER_WRONG_TYPE_FOR_VAR
124 SET @@global.max_delayed_threads = 65530.34;
125 SELECT @@global.max_delayed_threads;
126 --Error ER_WRONG_TYPE_FOR_VAR
127 SET @@global.max_delayed_threads = test;
128 SELECT @@global.max_delayed_threads;
129 --Error ER_WRONG_TYPE_FOR_VAR
130 SET @@global.max_delayed_threads = ' ';
131 SELECT @@global.max_delayed_threads;
132
133 SET @@session.max_delayed_threads = 16385;
134 SELECT @@session.max_delayed_threads;
135 SET @@session.max_delayed_threads = -1;
136 SELECT @@session.max_delayed_threads;
137 SET @@session.max_delayed_threads = -2;
138 SELECT @@session.max_delayed_threads;
139 SET @@session.max_delayed_threads = -1024;
140 SELECT @@session.max_delayed_threads;
141
142 --Error ER_WRONG_TYPE_FOR_VAR
143 SET @@session.max_delayed_threads = 65530.34;
144 SELECT @@session.max_delayed_threads;
145 SET @@session.max_delayed_threads = 10737418241;
146 SELECT @@session.max_delayed_threads;
147 --Error ER_WRONG_TYPE_FOR_VAR
148 SET @@session.max_delayed_threads = test;
149 SELECT @@session.max_delayed_threads;
150 --Error ER_WRONG_TYPE_FOR_VAR
151 SET @@session.max_delayed_threads = ' ';
152 SELECT @@session.max_delayed_threads;
153
154
155 --echo '#------------------FN_DYNVARS_075_06-----------------------#'
156 ####################################################################
157 # Check if the value in GLOBAL Table matches value in variable #
158 ####################################################################
159
160 --disable_warnings
161 SELECT VARIABLE_VALUE
162 FROM performance_schema.global_variables
163 WHERE VARIABLE_NAME='max_delayed_threads'
164 into @tmp;
165 --enable_warnings
166
167 SELECT @@global.max_delayed_threads = @tmp;
168
169 --echo '#------------------FN_DYNVARS_075_07-----------------------#'
170 ####################################################################
171 # Check if the value in SESSION Table matches value in variable #
172 ####################################################################
173
174 --disable_warnings
175 SELECT VARIABLE_VALUE
176 FROM performance_schema.session_variables
177 WHERE VARIABLE_NAME='max_delayed_threads'
178 into @tmp;
179 --enable_warnings
180
181 SELECT @@session.max_delayed_threads = @tmp;
182
183 --echo '#------------------FN_DYNVARS_075_08-----------------------#'
184 ####################################################################
185 # Check if TRUE and FALSE values can be used on variable #
186 ####################################################################
187
188 SET @@global.max_delayed_threads = TRUE;
189 SELECT @@global.max_delayed_threads;
190 SET @@global.max_delayed_threads = FALSE;
191 SELECT @@global.max_delayed_threads;
192
193
194 --echo '#---------------------FN_DYNVARS_001_09----------------------#'
195 #################################################################################
196 # Check if accessing variable with and without GLOBAL point to same variable #
197 #################################################################################
198
199 SET @@global.max_delayed_threads = 2048;
200 SELECT @@max_delayed_threads = @@global.max_delayed_threads;
201
202
203 --echo '#---------------------FN_DYNVARS_001_10----------------------#'
204 ########################################################################################################
205 # Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
206 ########################################################################################################
207
208 --Error ER_WRONG_VALUE_FOR_VAR
209 SET @@max_delayed_threads = 100000;
210 SELECT @@max_delayed_threads = @@local.max_delayed_threads;
211 SELECT @@local.max_delayed_threads = @@session.max_delayed_threads;
212
213
214 --echo '#---------------------FN_DYNVARS_001_11----------------------#'
215 #############################################################################
216 # Check if max_delayed_threads can be accessed with and without @@ sign #
217 #############################################################################
218
219 --Error ER_WRONG_VALUE_FOR_VAR
220 SET max_delayed_threads = 1024;
221 SELECT @@max_delayed_threads;
222 --Error ER_UNKNOWN_TABLE
223 SELECT local.max_delayed_threads;
224 --Error ER_UNKNOWN_TABLE
225 SELECT session.max_delayed_threads;
226 --Error ER_BAD_FIELD_ERROR
227 SELECT max_delayed_threads = @@session.max_delayed_threads;
228
229 --echo '#---------------------FN_DYNVARS_001_12----------------------#'
230 ######################################################################################
231 # Check if changing session variable throws error without sufficient privileges #
232 ######################################################################################
233 CREATE USER foo, bar;
234 GRANT SESSION_VARIABLES_ADMIN ON *.* TO bar;
235 --let $conn_name = foo_connection
236 --connect($conn_name, localhost, foo,,,)
237 SELECT @@session.max_delayed_threads;
238 --error ER_SPECIFIC_ACCESS_DENIED_ERROR
239 SET @@session.max_delayed_threads = 2048;
240 --connection default
241 disconnect $conn_name;
242 --let $conn_name = bar_connection
243 --connect($conn_name, localhost, bar,,,)
244 SELECT @@session.max_delayed_threads;
245 SET @@session.max_delayed_threads = 2048;
246 SELECT @@session.max_delayed_threads;
247 --connection default
248 disconnect $conn_name;
249 DROP USER foo, bar;
250
251 ####################################
252 # Restore initial value #
253 ####################################
254
255 SET @@global.max_delayed_threads = @start_global_value;
256 SELECT @@global.max_delayed_threads;
257 SET @@session.max_delayed_threads = @start_session_value;
258 SELECT @@session.max_delayed_threads;
259
260
261 #######################################################
262 # END OF max_delayed_threads TESTS #
263 #######################################################
264