1 ############## mysql-test\t\bulk_insert_buffer_size_basic.test #################
3 # Variable Name: bulk_insert_buffer_size #
4 # Scope: GLOBAL & SESSION #
5 # Access Type: Dynamic #
7 # Default Value: 8388608 #
8 # Range: 0 - 4294967295 #
11 # Creation Date: 2008-02-07 #
12 # Author: Salman Rawala #
14 # Description: Test Cases of Dynamic System Variable "bulk_insert_buffer_size" #
15 # that checks behavior of this variable in the following ways #
17 # * Valid & Invalid values #
18 # * Scope & Access method #
19 # * Data Integrity . #
21 # Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
22 # server-system-variables.html#option_mysqld_bulk_insert_buffer_size #
24 ################################################################################
26 --source include/load_sysvars.inc
28 #######################################################################
29 # START OF bulk_insert_buffer_size TESTS #
30 #######################################################################
32 #############################################################
33 # Save initial value #
34 #############################################################
36 SET @start_global_value = @@global.bulk_insert_buffer_size;
37 SELECT @start_global_value;
38 SET @start_session_value = @@session.bulk_insert_buffer_size;
39 SELECT @start_session_value;
41 --echo
'#--------------------FN_DYNVARS_007_01-------------------------#'
42 #######################################################################
43 # Display the DEFAULT value of bulk_insert_buffer_size #
44 #######################################################################
46 SET @@global.bulk_insert_buffer_size = 100;
47 SET @@global.bulk_insert_buffer_size = DEFAULT;
48 SELECT @@global.bulk_insert_buffer_size;
50 SET @@session.bulk_insert_buffer_size = 200;
51 SET @@session.bulk_insert_buffer_size = DEFAULT;
52 SELECT @@session.bulk_insert_buffer_size;
55 --echo
'#--------------------FN_DYNVARS_007_02-------------------------#'
56 #######################################################################
57 # Check the DEFAULT value of bulk_insert_buffer_size #
58 #######################################################################
60 SET @@global.bulk_insert_buffer_size = @start_global_value;
61 SELECT @@global.bulk_insert_buffer_size = 8388608;
63 SET @@session.bulk_insert_buffer_size = @start_session_value;
64 SELECT @@session.bulk_insert_buffer_size = 8388608;
67 --echo
'#--------------------FN_DYNVARS_007_03-------------------------#'
68 ###############################################################################
69 #Change the value of bulk_insert_buffer_size to valid values for GLOBAL Scope #
70 ###############################################################################
72 SET @@global.bulk_insert_buffer_size = 0;
73 SELECT @@global.bulk_insert_buffer_size;
74 SET @@global.bulk_insert_buffer_size = 1;
75 SELECT @@global.bulk_insert_buffer_size;
76 SET @@global.bulk_insert_buffer_size = 4294967295;
77 SELECT @@global.bulk_insert_buffer_size;
78 SET @@global.bulk_insert_buffer_size = 429496;
79 SELECT @@global.bulk_insert_buffer_size;
82 --echo
'#--------------------FN_DYNVARS_007_04-------------------------#'
83 ###############################################################################
84 #Change the value of bulk_insert_buffer_size to valid values for SESSION Scope#
85 ###############################################################################
87 SET @@session.bulk_insert_buffer_size = 0;
88 SELECT @@session.bulk_insert_buffer_size;
89 SET @@session.bulk_insert_buffer_size = 1;
90 SELECT @@session.bulk_insert_buffer_size;
91 SET @@session.bulk_insert_buffer_size = 4294967295;
92 SELECT @@session.bulk_insert_buffer_size;
93 SET @@session.bulk_insert_buffer_size = 429496;
94 SELECT @@session.bulk_insert_buffer_size;
97 --echo
'#------------------FN_DYNVARS_007_05-----------------------#'
98 ###################################################################
99 # Change the value of bulk_insert_buffer_size to an invalid value #
100 ###################################################################
102 SET @@global.bulk_insert_buffer_size = 42949672950;
103 SELECT @@global.bulk_insert_buffer_size;
104 SET @@global.bulk_insert_buffer_size = -1024;
105 SELECT @@global.bulk_insert_buffer_size;
107 --Error ER_WRONG_TYPE_FOR_VAR
108 SET @@global.bulk_insert_buffer_size =
test;
109 --Error ER_WRONG_TYPE_FOR_VAR
110 SET @@global.bulk_insert_buffer_size = ON;
111 --Error ER_WRONG_TYPE_FOR_VAR
112 SET @@global.bulk_insert_buffer_size = 429496.10;
114 SET @@session.bulk_insert_buffer_size = 42949672950;
115 SELECT @@session.bulk_insert_buffer_size;
116 SET @@session.bulk_insert_buffer_size = -2;
117 SELECT @@session.bulk_insert_buffer_size;
119 --Error ER_WRONG_TYPE_FOR_VAR
120 SET @@session.bulk_insert_buffer_size =
test;
121 --Error ER_WRONG_TYPE_FOR_VAR
122 SET @@session.bulk_insert_buffer_size = 429496.10;
125 --echo
'#------------------FN_DYNVARS_007_06-----------------------#'
126 ####################################################################
127 # Check if the value in GLOBAL Table matches value in variable #
128 ####################################################################
130 SELECT @@global.bulk_insert_buffer_size = VARIABLE_VALUE
131 FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
132 WHERE VARIABLE_NAME=
'bulk_insert_buffer_size';
134 --echo
'#------------------FN_DYNVARS_007_07-----------------------#'
135 ####################################################################
136 # Check if the value in SESSION Table matches value in variable #
137 ####################################################################
139 SELECT @@session.bulk_insert_buffer_size = VARIABLE_VALUE
140 FROM INFORMATION_SCHEMA.SESSION_VARIABLES
141 WHERE VARIABLE_NAME=
'bulk_insert_buffer_size';
144 --echo
'#------------------FN_DYNVARS_007_08-----------------------#'
145 ####################################################################
146 # Check if TRUE and FALSE values can be used on variable #
147 ####################################################################
149 SET @@global.bulk_insert_buffer_size = TRUE;
150 SELECT @@global.bulk_insert_buffer_size;
151 SET @@global.bulk_insert_buffer_size = FALSE;
152 SELECT @@global.bulk_insert_buffer_size;
154 SET @@session.bulk_insert_buffer_size = TRUE;
155 SELECT @@session.bulk_insert_buffer_size;
156 SET @@session.bulk_insert_buffer_size = FALSE;
157 SELECT @@session.bulk_insert_buffer_size;
160 --echo
'#---------------------FN_DYNVARS_007_09----------------------#'
161 ##############################################################################
162 # Check if accessing variable with SESSION,LOCAL and without SCOPE points #
163 # to same session variable #
164 ##############################################################################
166 SET @@bulk_insert_buffer_size = 100;
167 SELECT @@bulk_insert_buffer_size = @@local.bulk_insert_buffer_size;
168 SELECT @@local.bulk_insert_buffer_size = @@session.bulk_insert_buffer_size;
171 --echo
'#---------------------FN_DYNVARS_007_10----------------------#'
172 ###############################################################################
173 # Check if bulk_insert_buffer_size can be accessed with and without @@ sign #
174 ###############################################################################
176 SET bulk_insert_buffer_size = 1;
177 SELECT @@bulk_insert_buffer_size;
178 --Error ER_PARSE_ERROR
179 SET local.bulk_insert_buffer_size = 1;
180 --Error ER_UNKNOWN_TABLE
181 SELECT local.bulk_insert_buffer_size;
182 --Error ER_PARSE_ERROR
183 SET session.bulk_insert_buffer_size = 1;
184 --Error ER_UNKNOWN_TABLE
185 SELECT session.bulk_insert_buffer_size;
186 --Error ER_BAD_FIELD_ERROR
187 SELECT bulk_insert_buffer_size = @@session.bulk_insert_buffer_size;
190 ####################################
191 # Restore initial value #
192 ####################################
194 SET @@global.bulk_insert_buffer_size = @start_global_value;
195 SELECT @@global.bulk_insert_buffer_size;
196 SET @@session.bulk_insert_buffer_size = @start_session_value;
197 SELECT @@session.bulk_insert_buffer_size;
200 ####################################################
201 # END OF bulk_insert_buffer_size TESTS #
202 ####################################################