| 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 |
|
| 37 |
SET @start_global_value = @@global.transaction_prealloc_size; |
| 38 |
SELECT @start_global_value; |
| 39 |
SET @start_session_value = @@session.transaction_prealloc_size; |
| 40 |
SELECT @start_session_value; |
| 41 |
|
| 42 |
--echo '#--------------------FN_DYNVARS_005_01-------------------------#' |
| 43 |
######################################################################## |
| 44 |
# Display the DEFAULT value of transaction_prealloc_size # |
| 45 |
######################################################################## |
| 46 |
|
| 47 |
SET @@global.transaction_prealloc_size = 100; |
| 48 |
SET @@global.transaction_prealloc_size = DEFAULT; |
| 49 |
SELECT @@global.transaction_prealloc_size; |
| 50 |
|
| 51 |
|
| 52 |
SET @@session.transaction_prealloc_size = 200; |
| 53 |
SET @@session.transaction_prealloc_size = DEFAULT; |
| 54 |
SELECT @@session.transaction_prealloc_size; |
| 55 |
|
| 56 |
--echo '#--------------------FN_DYNVARS_005_02-------------------------#' |
| 57 |
######################################################################## |
| 58 |
# Check the DEFAULT value of transaction_prealloc_size # |
| 59 |
######################################################################## |
| 60 |
|
| 61 |
SET @@global.transaction_prealloc_size = DEFAULT; |
| 62 |
SELECT @@global.transaction_prealloc_size = 4096; |
| 63 |
|
| 64 |
SET @@session.transaction_prealloc_size = DEFAULT; |
| 65 |
SELECT @@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 |
|
| 72 |
SET @@global.transaction_prealloc_size = 1024; |
| 73 |
SELECT @@global.transaction_prealloc_size; |
| 74 |
|
| 75 |
SET @@global.transaction_prealloc_size = 60020; |
| 76 |
SELECT @@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 |
|
| 83 |
SET @@session.transaction_prealloc_size = 1024; |
| 84 |
SELECT @@session.transaction_prealloc_size; |
| 85 |
|
| 86 |
SET @@session.transaction_prealloc_size = 65535; |
| 87 |
SELECT @@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 |
|
| 95 |
SET @@global.transaction_prealloc_size = 0; |
| 96 |
SELECT @@global.transaction_prealloc_size; |
| 97 |
|
| 98 |
SET @@global.transaction_prealloc_size = -1024; |
| 99 |
SELECT @@global.transaction_prealloc_size; |
| 100 |
|
| 101 |
-- Error ER_WRONG_TYPE_FOR_VAR |
| 102 |
SET @@global.transaction_prealloc_size = ON; |
| 103 |
|
| 104 |
|
| 105 |
-- Error ER_WRONG_TYPE_FOR_VAR |
| 106 |
SET @@global.transaction_prealloc_size = OFF; |
| 107 |
|
| 108 |
|
| 109 |
SET @@global.transaction_prealloc_size = True; |
| 110 |
SELECT @@global.transaction_prealloc_size; |
| 111 |
|
| 112 |
SET @@global.transaction_prealloc_size = False; |
| 113 |
SELECT @@global.transaction_prealloc_size; |
| 114 |
|
| 115 |
|
| 116 |
-- Error ER_WRONG_TYPE_FOR_VAR |
| 117 |
SET @@global.transaction_prealloc_size = 65530.34; |
| 118 |
|
| 119 |
-- Error ER_WRONG_TYPE_FOR_VAR |
| 120 |
SET @@global.transaction_prealloc_size ="Test"; |
| 121 |
|
| 122 |
SET @@global.transaction_prealloc_size = 1000; |
| 123 |
SELECT @@global.transaction_prealloc_size; |
| 124 |
|
| 125 |
-- Error ER_WRONG_TYPE_FOR_VAR |
| 126 |
SET @@session.transaction_prealloc_size = ON; |
| 127 |
|
| 128 |
|
| 129 |
-- Error ER_WRONG_TYPE_FOR_VAR |
| 130 |
SET @@session.transaction_prealloc_size = OFF; |
| 131 |
|
| 132 |
SET @@session.transaction_prealloc_size = True; |
| 133 |
SELECT @@session.transaction_prealloc_size; |
| 134 |
|
| 135 |
SET @@session.transaction_prealloc_size = False; |
| 136 |
SELECT @@session.transaction_prealloc_size; |
| 137 |
|
| 138 |
--Error ER_WRONG_TYPE_FOR_VAR |
| 139 |
SET @@session.transaction_prealloc_size = "Test"; |
| 140 |
|
| 141 |
SET @@session.transaction_prealloc_size = 135217728; |
| 142 |
SELECT @@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 |
| 152 |
SELECT @@global.transaction_prealloc_size = VARIABLE_VALUE |
| 153 |
FROM performance_schema.global_variables |
| 154 |
WHERE 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 |
|
| 161 |
SELECT @@session.transaction_prealloc_size = VARIABLE_VALUE |
| 162 |
FROM performance_schema.session_variables |
| 163 |
WHERE 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 |
|
| 173 |
SET @@global.transaction_prealloc_size = 1024; |
| 174 |
SET @@global.transaction_prealloc_size = 10; |
| 175 |
|
| 176 |
SELECT @@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 |
|
| 185 |
SET @@transaction_prealloc_size = 100; |
| 186 |
SELECT @@transaction_prealloc_size = @@local.transaction_prealloc_size; |
| 187 |
SELECT @@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 |
|
| 195 |
SET transaction_prealloc_size = 1027; |
| 196 |
SELECT @@transaction_prealloc_size; |
| 197 |
|
| 198 |
--Error ER_UNKNOWN_TABLE |
| 199 |
SELECT local.transaction_prealloc_size; |
| 200 |
|
| 201 |
--Error ER_UNKNOWN_TABLE |
| 202 |
SELECT session.transaction_prealloc_size; |
| 203 |
|
| 204 |
--Error ER_BAD_FIELD_ERROR |
| 205 |
SELECT transaction_prealloc_size = @@session.transaction_prealloc_size; |
| 206 |
|
| 207 |
#################################### |
| 208 |
# Restore initial value # |
| 209 |
#################################### |
| 210 |
|
| 211 |
SET @@global.transaction_prealloc_size = @start_global_value; |
| 212 |
SELECT @@global.transaction_prealloc_size; |
| 213 |
SET @@session.transaction_prealloc_size = @start_session_value; |
| 214 |
SELECT @@session.transaction_prealloc_size; |
| 215 |
|
| 216 |
|
| 217 |
############################################################# |
| 218 |
# END OF transaction_prealloc_size TESTS # |
| 219 |
############################################################# |