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