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-134217728                                                       #
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--echo '#------------------FN_DYNVARS_005_05-----------------------#'
90#####################################################################
91# Change the value of transaction_prealloc_size to an invalid value #
92#####################################################################
93
94SET @@global.transaction_prealloc_size = 0;
95SELECT @@global.transaction_prealloc_size;
96
97SET @@global.transaction_prealloc_size = -1024;
98SELECT @@global.transaction_prealloc_size;
99
100-- Error ER_WRONG_TYPE_FOR_VAR
101SET @@global.transaction_prealloc_size = ON;
102
103
104-- Error ER_WRONG_TYPE_FOR_VAR
105SET @@global.transaction_prealloc_size = OFF;
106
107
108SET @@global.transaction_prealloc_size = True;
109SELECT @@global.transaction_prealloc_size;
110
111SET @@global.transaction_prealloc_size = False;
112SELECT @@global.transaction_prealloc_size;
113
114
115-- Error ER_WRONG_TYPE_FOR_VAR
116SET @@global.transaction_prealloc_size = 65530.34;
117
118-- Error ER_WRONG_TYPE_FOR_VAR
119SET @@global.transaction_prealloc_size ="Test";
120
121SET @@global.transaction_prealloc_size = 1000;
122SELECT @@global.transaction_prealloc_size;
123
124-- Error ER_WRONG_TYPE_FOR_VAR
125SET @@session.transaction_prealloc_size = ON;
126
127
128-- Error ER_WRONG_TYPE_FOR_VAR
129SET @@session.transaction_prealloc_size = OFF;
130
131SET @@session.transaction_prealloc_size = True;
132SELECT @@session.transaction_prealloc_size;
133
134SET @@session.transaction_prealloc_size = False;
135SELECT @@session.transaction_prealloc_size;
136
137--Error ER_WRONG_TYPE_FOR_VAR
138SET @@session.transaction_prealloc_size = "Test";
139
140SET @@session.transaction_prealloc_size = 135217728;
141SELECT @@session.transaction_prealloc_size;
142
143
144--echo '#------------------FN_DYNVARS_005_06-----------------------#'
145####################################################################
146#   Check if the value in GLOBAL Table matches value in variable   #
147####################################################################
148
149
150SELECT @@global.transaction_prealloc_size = VARIABLE_VALUE
151FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
152WHERE VARIABLE_NAME='transaction_prealloc_size';
153
154--echo '#------------------FN_DYNVARS_005_07-----------------------#'
155####################################################################
156#  Check if the value in SESSION Table matches value in variable   #
157####################################################################
158
159SELECT @@session.transaction_prealloc_size = VARIABLE_VALUE
160FROM INFORMATION_SCHEMA.SESSION_VARIABLES
161WHERE VARIABLE_NAME='transaction_prealloc_size';
162
163--echo '#---------------------FN_DYNVARS_001_09----------------------#'
164###########################################################################
165#  Check if global and session variable are independent of each other     #
166###########################################################################
167
168SET @@global.transaction_prealloc_size = 1024;
169SET @@global.transaction_prealloc_size = 10;
170
171SELECT @@transaction_prealloc_size = @@global.transaction_prealloc_size;
172
173--echo '#---------------------FN_DYNVARS_001_10----------------------#'
174########################################################################
175#    Check if accessing variable with SESSION,LOCAL and without SCOPE  #
176#    points to same session variable                                   #
177########################################################################
178
179SET @@transaction_prealloc_size = 100;
180SELECT @@transaction_prealloc_size = @@local.transaction_prealloc_size;
181SELECT @@local.transaction_prealloc_size = @@session.transaction_prealloc_size;
182
183
184--echo '#---------------------FN_DYNVARS_001_11----------------------#'
185###############################################################################
186# Check if transaction_prealloc_size can be accessed with and without @@ sign #
187###############################################################################
188
189SET transaction_prealloc_size = 1027;
190SELECT @@transaction_prealloc_size;
191
192--Error ER_UNKNOWN_TABLE
193SELECT local.transaction_prealloc_size;
194
195--Error ER_UNKNOWN_TABLE
196SELECT session.transaction_prealloc_size;
197
198--Error ER_BAD_FIELD_ERROR
199SELECT transaction_prealloc_size = @@session.transaction_prealloc_size;
200
201####################################
202#     Restore initial value        #
203####################################
204
205SET @@global.transaction_prealloc_size = @start_global_value;
206SELECT @@global.transaction_prealloc_size;
207SET @@session.transaction_prealloc_size = @start_session_value;
208SELECT @@session.transaction_prealloc_size;
209
210
211#############################################################
212#                 END OF transaction_prealloc_size TESTS     #
213#############################################################
214
215