Debian Codegraph @

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

raw
1 ####################### mysql-test\t\max_statement_time_basic.test ###############
2 # #
3 # Variable Name: max_statement_time #
4 # Scope: GLOBAL | SESSION #
5 # Access Type: Dynamic #
6 # Data Type: numeric #
7 # Default Value:10 #
8 # Min Value: 1 #
9 # #
10 # #
11 # Creation Date: 2012-12-30 #
12 # Author: Monty #
13 # #
14 # Description: Test Cases of Dynamic System Variable max_statement_time #
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: https://kb.askmonty.org/en/how-to-limittimeout-queries/ #
22 # server-system-variables.html #
23 # #
24 ###############################################################################
25
26 --source include/load_sysvars.inc
27
28 ############################################################
29 # START OF max_statement_time TESTS #
30 ############################################################
31
32
33 #############################################################
34 # Save initial value #
35 #############################################################
36
37 SET @start_global_value = @@global.max_statement_time;
38 SELECT @start_global_value;
39 SET @start_session_value = @@session.max_statement_time;
40 SELECT @start_session_value;
41
42
43 --echo '#--------------------FN_DYNVARS_068_01-------------------------#'
44 ###############################################################
45 # Display the DEFAULT value of max_statement_time #
46 ###############################################################
47
48 SET @@global.max_statement_time = 100;
49 SET @@global.max_statement_time = DEFAULT;
50 SELECT @@global.max_statement_time;
51
52 SET @@session.max_statement_time = 200;
53 SET @@session.max_statement_time = DEFAULT;
54 SELECT @@session.max_statement_time;
55
56
57 --echo '#--------------------FN_DYNVARS_068_02-------------------------#'
58 ###############################################################
59 # Check the DEFAULT value of max_statement_time #
60 ###############################################################
61
62 SET @@global.max_statement_time = DEFAULT;
63 SELECT @@global.max_statement_time = 0;
64
65 SET @@session.max_statement_time = DEFAULT;
66 SELECT @@session.max_statement_time = 0;
67
68
69 --echo '#--------------------FN_DYNVARS_068_03-------------------------#'
70 #########################################################################
71 # Change the value of max_statement_time to a valid value for GLOBAL Scope #
72 #########################################################################
73
74 SET @@global.max_statement_time = 0;
75 SELECT @@global.max_statement_time;
76 SET @@global.max_statement_time = 0.123456;
77 SELECT @@global.max_statement_time;
78 SET @@global.max_statement_time = 60020;
79 SELECT @@global.max_statement_time;
80 SET @@global.max_statement_time = 31536000;
81 SELECT @@global.max_statement_time;
82 SET @@global.max_statement_time = 65536;
83 SELECT @@global.max_statement_time;
84
85
86 --echo '#--------------------FN_DYNVARS_068_04-------------------------#'
87 ##########################################################################
88 # Change the value of max_statement_time to a valid value for SESSION Scope #
89 ##########################################################################
90
91 SET @@session.max_statement_time = 0;
92 SELECT @@session.max_statement_time;
93 SET @@session.max_statement_time = 1;
94 SELECT @@session.max_statement_time;
95 SET @@session.max_statement_time = 50050;
96 SELECT @@session.max_statement_time;
97 SET @@session.max_statement_time = 31536000;
98 SELECT @@session.max_statement_time;
99 SET @@session.max_statement_time = 65550;
100 SELECT @@session.max_statement_time;
101
102
103 --echo '#------------------FN_DYNVARS_068_05-----------------------#'
104 ########################################################
105 # Change the value of max_statement_time to an invalid value #
106 ########################################################
107
108 SET @@global.max_statement_time = 100000000000;
109 SELECT @@global.max_statement_time;
110 SET @@global.max_statement_time = -1;
111 SELECT @@global.max_statement_time;
112 SET @@global.max_statement_time = 65530.34;
113 SELECT @@global.max_statement_time;
114 --Error ER_WRONG_TYPE_FOR_VAR
115 SET @@global.max_statement_time = test;
116 SELECT @@global.max_statement_time;
117
118 SET @@session.max_statement_time = 100000000000;
119 SELECT @@session.max_statement_time;
120 SET @@session.max_statement_time = -2;
121 SELECT @@session.max_statement_time;
122 SET @@session.max_statement_time = 65530.34;
123 SELECT @@session.max_statement_time;
124
125 --Error ER_WRONG_TYPE_FOR_VAR
126 SET @@session.max_statement_time = test;
127 SELECT @@session.max_statement_time;
128
129
130 --echo '#------------------FN_DYNVARS_068_06-----------------------#'
131 ####################################################################
132 # Check if the value in GLOBAL Table matches value in variable #
133 ####################################################################
134
135
136 SELECT @@global.max_statement_time = VARIABLE_VALUE
137 FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
138 WHERE VARIABLE_NAME='max_statement_time';
139
140 --echo '#------------------FN_DYNVARS_068_07-----------------------#'
141 ####################################################################
142 # Check if the value in SESSION Table matches value in variable #
143 ####################################################################
144
145 SELECT @@session.max_statement_time = VARIABLE_VALUE
146 FROM INFORMATION_SCHEMA.SESSION_VARIABLES
147 WHERE VARIABLE_NAME='max_statement_time';
148
149
150 --echo '#------------------FN_DYNVARS_068_08-----------------------#'
151 ####################################################################
152 # Check if TRUE and FALSE values can be used on variable #
153 ####################################################################
154
155 SET @@global.max_statement_time = TRUE;
156 SELECT @@global.max_statement_time;
157 SET @@global.max_statement_time = FALSE;
158 SELECT @@global.max_statement_time;
159
160
161 --echo '#---------------------FN_DYNVARS_001_09----------------------#'
162 #################################################################################
163 # Check if accessing variable with and without GLOBAL point to same variable #
164 #################################################################################
165
166 SET @@global.max_statement_time = 10;
167 SELECT @@max_statement_time = @@global.max_statement_time;
168
169
170 --echo '#---------------------FN_DYNVARS_001_10----------------------#'
171 ########################################################################################################
172 # Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
173 ########################################################################################################
174
175 SET @@max_statement_time = 100;
176 SELECT @@max_statement_time = @@local.max_statement_time;
177 SELECT @@local.max_statement_time = @@session.max_statement_time;
178
179
180 --echo '#---------------------FN_DYNVARS_001_11----------------------#'
181 ##########################################################################
182 # Check if max_statement_time can be accessed with and without @@ sign #
183 ##########################################################################
184
185 SET max_statement_time = 1;
186 SELECT @@max_statement_time;
187 --Error ER_UNKNOWN_TABLE
188 SELECT local.max_statement_time;
189 --Error ER_UNKNOWN_TABLE
190 SELECT session.max_statement_time;
191 --Error ER_BAD_FIELD_ERROR
192 SELECT max_statement_time = @@session.max_statement_time;
193
194 --echo #
195 --echo # Check that one can use max_statement_time as a field
196 --echo #
197
198 --disable_warnings
199 drop table if exists t1;
200 --enable_warnings
201 create table t1 (a int, max_statement_time int);
202 drop table t1;
203
204 ####################################
205 # Restore initial value #
206 ####################################
207
208 SET @@global.max_statement_time = @start_global_value;
209 SELECT @@global.max_statement_time;
210 SET @@session.max_statement_time = @start_session_value;
211 SELECT @@session.max_statement_time;
212
213
214 ####################################################
215 # END OF max_statement_time TESTS #
216 ####################################################
217