MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
join_buffer_size_basic.inc
1 ############## mysql-test\t\join_buffer_size_basic.test ###############
2 # #
3 # Variable Name: join_buffer_size #
4 # Scope: GLOBAL | SESSION #
5 # Access Type: Dynamic #
6 # Data Type: numeric #
7 # Default Value: 262144 #
8 # Range: 8200-4294967295 #
9 # #
10 # #
11 # Creation Date: 2008-02-07 #
12 # Author: Salman #
13 # #
14 # Description: Test Cases of Dynamic System Variable join_buffer_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 #
23 # #
24 ###############################################################################
25 
26 --source include/load_sysvars.inc
27 
28 ################################################################
29 # START OF join_buffer_size TESTS #
30 ################################################################
31 
32 
33 #############################################################
34 # Save initial value #
35 #############################################################
36 
37 SET @start_global_value = @@global.join_buffer_size;
38 SELECT @start_global_value;
39 SET @start_session_value = @@session.join_buffer_size;
40 SELECT @start_session_value;
41 
42 
43 --echo '#--------------------FN_DYNVARS_053_01-------------------------#'
44 ################################################################
45 # Display the DEFAULT value of join_buffer_size #
46 ################################################################
47 
48 SET @@global.join_buffer_size = DEFAULT;
49 SELECT @@global.join_buffer_size;
50 
51 SET @@session.join_buffer_size = DEFAULT;
52 SELECT @@session.join_buffer_size;
53 
54 
55 --echo '#--------------------FN_DYNVARS_053_03-------------------------#'
56 ##########################################################################
57 # Change the value of join_buffer_size to a valid value for GLOBAL Scope #
58 ##########################################################################
59 
60 SET @@global.join_buffer_size = 8200;
61 SELECT @@global.join_buffer_size;
62 SET @@global.join_buffer_size = 65536;
63 SELECT @@global.join_buffer_size;
64 SET @@global.join_buffer_size = 4294967295;
65 SELECT @@global.join_buffer_size;
66 
67 --echo '#--------------------FN_DYNVARS_053_04-------------------------#'
68 ###########################################################################
69 # Change the value of join_buffer_size to a valid value for SESSION Scope #
70 ###########################################################################
71 
72 SET @@session.join_buffer_size = 8200;
73 SELECT @@session.join_buffer_size;
74 SET @@session.join_buffer_size = 65536;
75 SELECT @@session.join_buffer_size;
76 SET @@session.join_buffer_size = 4294967295;
77 SELECT @@session.join_buffer_size;
78 
79 --echo '#------------------FN_DYNVARS_053_05-----------------------#'
80 ############################################################
81 # Change the value of join_buffer_size to an invalid value #
82 ############################################################
83 
84 SET @@global.join_buffer_size = 0;
85 SELECT @@global.join_buffer_size;
86 SET @@global.join_buffer_size = -1024;
87 SELECT @@global.join_buffer_size;
88 SET @@global.join_buffer_size = 127;
89 SELECT @@global.join_buffer_size;
90 SET @@global.join_buffer_size = 42949672951;
91 SELECT @@global.join_buffer_size;
92 
93 --Error ER_WRONG_TYPE_FOR_VAR
94 SET @@global.join_buffer_size = 65530.34;
95 SELECT @@global.join_buffer_size;
96 --Error ER_WRONG_TYPE_FOR_VAR
97 SET @@global.join_buffer_size = test;
98 SELECT @@global.join_buffer_size;
99 
100 SET @@session.join_buffer_size = 0;
101 SELECT @@session.join_buffer_size;
102 SET @@session.join_buffer_size = -1024;
103 SELECT @@session.join_buffer_size;
104 SET @@session.join_buffer_size = 127;
105 SELECT @@session.join_buffer_size;
106 SET @@session.join_buffer_size = 42949672951;
107 SELECT @@session.join_buffer_size;
108 
109 --Error ER_WRONG_TYPE_FOR_VAR
110 SET @@session.join_buffer_size = 65530.34;
111 SELECT @@session.join_buffer_size;
112 
113 --Error ER_WRONG_TYPE_FOR_VAR
114 SET @@session.join_buffer_size = test;
115 SELECT @@session.join_buffer_size;
116 
117 --echo '#------------------FN_DYNVARS_053_06-----------------------#'
118 ####################################################################
119 # Check if the value in GLOBAL Table matches value in variable #
120 ####################################################################
121 
122 
123 SELECT @@global.join_buffer_size = VARIABLE_VALUE
124 FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
125 WHERE VARIABLE_NAME='join_buffer_size';
126 
127 --echo '#------------------FN_DYNVARS_053_07-----------------------#'
128 ####################################################################
129 # Check if the value in SESSION Table matches value in variable #
130 ####################################################################
131 
132 SELECT @@session.join_buffer_size = VARIABLE_VALUE
133 FROM INFORMATION_SCHEMA.SESSION_VARIABLES
134 WHERE VARIABLE_NAME='join_buffer_size';
135 
136 
137 --echo '#------------------FN_DYNVARS_053_08-----------------------#'
138 ####################################################################
139 # Check if TRUE and FALSE values can be used on variable #
140 ####################################################################
141 
142 SET @@global.join_buffer_size = TRUE;
143 SET @@global.join_buffer_size = FALSE;
144 
145 --echo '#---------------------FN_DYNVARS_001_09----------------------#'
146 #################################################################################
147 # Check if accessing variable with and without GLOBAL point to same variable #
148 #################################################################################
149 
150 SET @@global.join_buffer_size = 10;
151 SELECT @@join_buffer_size = @@global.join_buffer_size;
152 
153 --echo '#---------------------FN_DYNVARS_001_10----------------------#'
154 ########################################################################################################
155 # Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
156 ########################################################################################################
157 
158 SET @@join_buffer_size = 100;
159 SELECT @@join_buffer_size = @@local.join_buffer_size;
160 SELECT @@local.join_buffer_size = @@session.join_buffer_size;
161 
162 --echo '#---------------------FN_DYNVARS_001_11----------------------#'
163 ##############################################################################
164 # Check if join_buffer_size can be accessed with and without @@ sign #
165 ##############################################################################
166 
167 SET join_buffer_size = 1;
168 SELECT @@join_buffer_size;
169 --Error ER_UNKNOWN_TABLE
170 SELECT local.join_buffer_size;
171 --Error ER_UNKNOWN_TABLE
172 SELECT session.join_buffer_size;
173 --Error ER_BAD_FIELD_ERROR
174 SELECT join_buffer_size = @@session.join_buffer_size;
175 
176 ####################################
177 # Restore initial value #
178 ####################################
179 
180 SET @@global.join_buffer_size = @start_global_value;
181 SELECT @@global.join_buffer_size;
182 SET @@session.join_buffer_size = @start_session_value;
183 SELECT @@session.join_buffer_size;
184 
185 
186 ########################################################
187 # END OF join_buffer_size TESTS #
188 ########################################################
189