1############## mysql-test\t\transaction_prealloc_size_basic.test ##############
2#                                                                             #
3# Variable Name: transaction_prealloc_size                                    #
4# Scope: GLOBAL | SESSION                                                     #
5# Access Type: Dynamic                                                        #
6# Data Type: numeric                                                          #
7# Default Value: 4096                                                         #
8# Range: 1024-131072                                                          #
9#                                                                             #
10#                                                                             #
11# Creation Date: 2008-02-14                                                   #
12# Author: Sharique Abdullah                                                       #
13#                                                                             #
14# Description: Test Cases of Dynamic System Variable transaction_prealloc_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#                                                                             #
21# Reference: http://dev.mysql.com/doc/refman/5.1/en/                          #
22#  server-system-variables.html#option_mysqld_transaction_prealloc_size       #
23#                                                                             #
24###############################################################################
25
26--source include/load_sysvars.inc
27
28########################################################################
29#           START OF transaction_prealloc_size TESTS                   #
30########################################################################
31
32
33#############################################################
34#                 Save initial value                        #
35#############################################################
36
37SET @start_global_value = @@global.transaction_prealloc_size;
38SELECT @start_global_value;
39SET @start_session_value = @@session.transaction_prealloc_size;
40SELECT @start_session_value;
41
42--echo '#--------------------FN_DYNVARS_005_01-------------------------#'
43########################################################################
44#     Display the DEFAULT value of transaction_prealloc_size           #
45########################################################################
46
47SET @@global.transaction_prealloc_size = 100;
48SET @@global.transaction_prealloc_size = DEFAULT;
49SELECT @@global.transaction_prealloc_size;
50
51
52SET @@session.transaction_prealloc_size = 200;
53SET @@session.transaction_prealloc_size = DEFAULT;
54SELECT @@session.transaction_prealloc_size;
55
56--echo '#--------------------FN_DYNVARS_005_02-------------------------#'
57########################################################################
58#     Check the DEFAULT value of transaction_prealloc_size             #
59########################################################################
60
61SET @@global.transaction_prealloc_size = DEFAULT;
62SELECT @@global.transaction_prealloc_size = 4096;
63
64SET @@session.transaction_prealloc_size = DEFAULT;
65SELECT @@session.transaction_prealloc_size = 4096;
66
67--echo '#--------------------FN_DYNVARS_005_03-------------------------#'
68##################################################################
69# Change the value of variable to a valid value for GLOBAL Scope #
70##################################################################
71
72SET @@global.transaction_prealloc_size = 1024;
73SELECT @@global.transaction_prealloc_size;
74
75SET @@global.transaction_prealloc_size = 60020;
76SELECT @@global.transaction_prealloc_size;
77
78--echo '#--------------------FN_DYNVARS_005_04-------------------------#'
79###################################################################
80# Change the value of variable to a valid value for SESSION Scope #
81###################################################################
82
83SET @@session.transaction_prealloc_size = 1024;
84SELECT @@session.transaction_prealloc_size;
85
86SET @@session.transaction_prealloc_size = 65535;
87SELECT @@session.transaction_prealloc_size;
88
89
90--echo '#------------------FN_DYNVARS_005_05-----------------------#'
91#####################################################################
92# Change the value of transaction_prealloc_size to an invalid value #
93#####################################################################
94
95SET @@global.transaction_prealloc_size = 0;
96SELECT @@global.transaction_prealloc_size;
97
98SET @@global.transaction_prealloc_size = -1024;
99SELECT @@global.transaction_prealloc_size;
100
101-- Error ER_WRONG_TYPE_FOR_VAR
102SET @@global.transaction_prealloc_size = ON;
103
104
105-- Error ER_WRONG_TYPE_FOR_VAR
106SET @@global.transaction_prealloc_size = OFF;
107
108
109SET @@global.transaction_prealloc_size = True;
110SELECT @@global.transaction_prealloc_size;
111
112SET @@global.transaction_prealloc_size = False;
113SELECT @@global.transaction_prealloc_size;
114
115
116-- Error ER_WRONG_TYPE_FOR_VAR
117SET @@global.transaction_prealloc_size = 65530.34;
118
119-- Error ER_WRONG_TYPE_FOR_VAR
120SET @@global.transaction_prealloc_size ="Test";
121
122SET @@global.transaction_prealloc_size = 1000;
123SELECT @@global.transaction_prealloc_size;
124
125-- Error ER_WRONG_TYPE_FOR_VAR
126SET @@session.transaction_prealloc_size = ON;
127
128
129-- Error ER_WRONG_TYPE_FOR_VAR
130SET @@session.transaction_prealloc_size = OFF;
131
132SET @@session.transaction_prealloc_size = True;
133SELECT @@session.transaction_prealloc_size;
134
135SET @@session.transaction_prealloc_size = False;
136SELECT @@session.transaction_prealloc_size;
137
138--Error ER_WRONG_TYPE_FOR_VAR
139SET @@session.transaction_prealloc_size = "Test";
140
141SET @@session.transaction_prealloc_size = 135217728;
142SELECT @@session.transaction_prealloc_size;
143
144
145--echo '#------------------FN_DYNVARS_005_06-----------------------#'
146####################################################################
147#   Check if the value in GLOBAL Table matches value in variable   #
148####################################################################
149
150
151--disable_warnings
152SELECT @@global.transaction_prealloc_size = VARIABLE_VALUE
153FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
154WHERE VARIABLE_NAME='transaction_prealloc_size';
155
156--echo '#------------------FN_DYNVARS_005_07-----------------------#'
157####################################################################
158#  Check if the value in SESSION Table matches value in variable   #
159####################################################################
160
161SELECT @@session.transaction_prealloc_size = VARIABLE_VALUE
162FROM INFORMATION_SCHEMA.SESSION_VARIABLES
163WHERE VARIABLE_NAME='transaction_prealloc_size';
164--enable_warnings
165
166
167
168--echo '#---------------------FN_DYNVARS_001_09----------------------#'
169###########################################################################
170#  Check if global and session variable are independent of each other     #
171###########################################################################
172
173SET @@global.transaction_prealloc_size = 1024;
174SET @@global.transaction_prealloc_size = 10;
175
176SELECT @@transaction_prealloc_size = @@global.transaction_prealloc_size;
177
178
179--echo '#---------------------FN_DYNVARS_001_10----------------------#'
180########################################################################
181#    Check if accessing variable with SESSION,LOCAL and without SCOPE  #
182#    points to same session variable                                   #
183########################################################################
184
185SET @@transaction_prealloc_size = 100;
186SELECT @@transaction_prealloc_size = @@local.transaction_prealloc_size;
187SELECT @@local.transaction_prealloc_size = @@session.transaction_prealloc_size;
188
189
190--echo '#---------------------FN_DYNVARS_001_11----------------------#'
191###############################################################################
192# Check if transaction_prealloc_size can be accessed with and without @@ sign #
193###############################################################################
194
195SET transaction_prealloc_size = 1027;
196SELECT @@transaction_prealloc_size;
197
198--Error ER_UNKNOWN_TABLE
199SELECT local.transaction_prealloc_size;
200
201--Error ER_UNKNOWN_TABLE
202SELECT session.transaction_prealloc_size;
203
204--Error ER_BAD_FIELD_ERROR
205SELECT transaction_prealloc_size = @@session.transaction_prealloc_size;
206
207####################################
208#     Restore initial value        #
209####################################
210
211SET @@global.transaction_prealloc_size = @start_global_value;
212SELECT @@global.transaction_prealloc_size;
213SET @@session.transaction_prealloc_size = @start_session_value;
214SELECT @@session.transaction_prealloc_size;
215
216
217#############################################################
218#                 END OF transaction_prealloc_size TESTS     #
219#############################################################
220