| 1 |
# |
| 2 |
# WL#12002: SET system variable values as a component service |
| 3 |
# |
| 4 |
call mtr.add_suppression("Setting session values for system variables only makes sense in a user session"); |
| 5 |
call mtr.add_suppression("duplicate variable name"); |
| 6 |
INSTALL COMPONENT "file://component_test_mysql_system_variable_set"; |
| 7 |
INSTALL COMPONENT "file://component_test_sys_var_service"; |
| 8 |
SET @orig_connection_memory_limit = @@GLOBAL.connection_memory_limit; |
| 9 |
SET @orig_lc_messages = @@GLOBAL.lc_messages; |
| 10 |
# Ensure the value of super read only is off |
| 11 |
SELECT @@global.super_read_only; |
| 12 |
@@global.super_read_only |
| 13 |
0 |
| 14 |
# Try setting wrong variable name in the same thread. Should fail |
| 15 |
SELECT test_set_system_variable_string(0, NULL, "the_meaning_of_life", "42", "GLOBAL"); |
| 16 |
ERROR HY000: Unknown system variable 'the_meaning_of_life' |
| 17 |
# Try setting wrong variable name in a new sub-thread. Should fail |
| 18 |
SELECT test_set_system_variable_string(1, NULL, "the_meaning_of_life", "42", "GLOBAL"); |
| 19 |
ERROR HY000: Unknown system variable 'the_meaning_of_life' |
| 20 |
# Try setting wrong (empty) variable name in the same thread. Should fail with NULL |
| 21 |
SELECT test_set_system_variable_string(0, NULL, "", "42", "GLOBAL"); |
| 22 |
test_set_system_variable_string(0, NULL, "", "42", "GLOBAL") |
| 23 |
NULL |
| 24 |
# Try setting wrong value to super_read_only, Should fail |
| 25 |
SELECT test_set_system_variable_string(0, NULL, "super_read_only", "gizmo", "GLOBAL"); |
| 26 |
ERROR 42000: Variable 'super_read_only' can't be set to the value of 'gizmo' |
| 27 |
# Ensure the value of super read only is still off |
| 28 |
SELECT @@global.super_read_only; |
| 29 |
@@global.super_read_only |
| 30 |
0 |
| 31 |
# Try setting super_read_only on using the same thread. Should succeed |
| 32 |
SELECT test_set_system_variable_string(0, NULL, "super_read_only", "on", "GLOBAL"); |
| 33 |
test_set_system_variable_string(0, NULL, "super_read_only", "on", "GLOBAL") |
| 34 |
0 |
| 35 |
# Ensure the value of super read only is on |
| 36 |
SELECT @@global.super_read_only; |
| 37 |
@@global.super_read_only |
| 38 |
1 |
| 39 |
# Try setting super_read_only to off using a new sub-thread. Should succeed |
| 40 |
SELECT test_set_system_variable_string(1, NULL, "super_read_only", "off", "GLOBAL"); |
| 41 |
test_set_system_variable_string(1, NULL, "super_read_only", "off", "GLOBAL") |
| 42 |
0 |
| 43 |
# Ensure the value of super read only is off |
| 44 |
SELECT @@global.super_read_only; |
| 45 |
@@global.super_read_only |
| 46 |
0 |
| 47 |
# Check that the variable is not yet persisted: |
| 48 |
SELECT * FROM performance_schema.persisted_variables WHERE VARIABLE_NAME='super_read_only'; |
| 49 |
VARIABLE_NAME VARIABLE_VALUE |
| 50 |
# Try setting PERSIST super_read_only. Should succeed |
| 51 |
SELECT test_set_system_variable_string(0, NULL, "super_read_only", "off", "PERSIST"); |
| 52 |
test_set_system_variable_string(0, NULL, "super_read_only", "off", "PERSIST") |
| 53 |
0 |
| 54 |
# Check that the variable is now persisted: |
| 55 |
SELECT VARIABLE_VALUE,@@global.super_read_only |
| 56 |
FROM performance_schema.persisted_variables WHERE VARIABLE_NAME='super_read_only'; |
| 57 |
VARIABLE_VALUE @@global.super_read_only |
| 58 |
OFF 0 |
| 59 |
# reset persisted value |
| 60 |
RESET PERSIST super_read_only; |
| 61 |
# Try setting PERSIST_ONLY super_read_only. Should succeed |
| 62 |
SELECT test_set_system_variable_string(0, NULL, "super_read_only", "on", "PERSIST_ONLY"); |
| 63 |
test_set_system_variable_string(0, NULL, "super_read_only", "on", "PERSIST_ONLY") |
| 64 |
0 |
| 65 |
# Check that the variable is now persisted only but not changed: |
| 66 |
SELECT VARIABLE_VALUE,@@global.super_read_only |
| 67 |
FROM performance_schema.persisted_variables WHERE VARIABLE_NAME='super_read_only'; |
| 68 |
VARIABLE_VALUE @@global.super_read_only |
| 69 |
ON 0 |
| 70 |
# reset persisted value |
| 71 |
RESET PERSIST super_read_only; |
| 72 |
# Show initial value of str_sys_var component system variable |
| 73 |
SELECT @@test_component.str_sys_var; |
| 74 |
@@test_component.str_sys_var |
| 75 |
NULL |
| 76 |
# Try setting str_sys_var from test component to some value. Should succeed |
| 77 |
SELECT test_set_system_variable_string(0, "test_component", "str_sys_var", "Sample text", "GLOBAL"); |
| 78 |
test_set_system_variable_string(0, "test_component", "str_sys_var", "Sample text", "GLOBAL") |
| 79 |
0 |
| 80 |
# Ensure the value of str_sys_var component system variable has changed |
| 81 |
SELECT @@test_component.str_sys_var; |
| 82 |
@@test_component.str_sys_var |
| 83 |
Sample text |
| 84 |
# Show initial value of super read only before next test |
| 85 |
SELECT @@global.super_read_only; |
| 86 |
@@global.super_read_only |
| 87 |
0 |
| 88 |
# Bug#34072134: mysql_system_variable_update_string::set does not allow NULL for variable_type |
| 89 |
# Try setting super_read_only on using NULL type (defaults to GLOBAL). Should succeed |
| 90 |
SELECT test_set_system_variable_string(0, NULL, "super_read_only", "on", NULL); |
| 91 |
test_set_system_variable_string(0, NULL, "super_read_only", "on", NULL) |
| 92 |
0 |
| 93 |
# Ensure the value of super read only is on |
| 94 |
SELECT @@global.super_read_only; |
| 95 |
@@global.super_read_only |
| 96 |
1 |
| 97 |
# Bug#34072155: Improve mysql_system_variable_update_string::set to add error information |
| 98 |
# Try using SESSION type with sub-thread, Should fail with NULL |
| 99 |
SELECT test_set_system_variable_string(1, NULL, "super_read_only", "off", "SESSION"); |
| 100 |
test_set_system_variable_string(1, NULL, "super_read_only", "off", "SESSION") |
| 101 |
NULL |
| 102 |
# Ensure the value of super read only is still on |
| 103 |
SELECT @@global.super_read_only; |
| 104 |
@@global.super_read_only |
| 105 |
1 |
| 106 |
# Bug#34302316: Sig11 when passing THD parameter value greater than 0 via service methods |
| 107 |
# Try setting PERSIST_ONLY super_read_only with sub-thread. Should succeed |
| 108 |
SELECT test_set_system_variable_string(1, NULL, "super_read_only", "off", "PERSIST_ONLY"); |
| 109 |
test_set_system_variable_string(1, NULL, "super_read_only", "off", "PERSIST_ONLY") |
| 110 |
0 |
| 111 |
# Check that the variable is now persisted only but not changed: |
| 112 |
SELECT VARIABLE_VALUE,@@global.super_read_only |
| 113 |
FROM performance_schema.persisted_variables WHERE VARIABLE_NAME='super_read_only'; |
| 114 |
VARIABLE_VALUE @@global.super_read_only |
| 115 |
OFF 1 |
| 116 |
# Try setting PERSIST super_read_only with sub-thread. Should succeed |
| 117 |
SELECT test_set_system_variable_string(1, NULL, "super_read_only", "off", "PERSIST"); |
| 118 |
test_set_system_variable_string(1, NULL, "super_read_only", "off", "PERSIST") |
| 119 |
0 |
| 120 |
# reset persisted value |
| 121 |
RESET PERSIST super_read_only; |
| 122 |
# |
| 123 |
# WL#15168: Component service to set integer values to sysvars |
| 124 |
# |
| 125 |
|
| 126 |
# 1. Testing mysql_service_mysql_system_variable_update_integer::set_signed method |
| 127 |
|
| 128 |
# Try setting wrong variable name in the same thread. Should fail |
| 129 |
SELECT test_set_system_variable_signed_integer(0, NULL, "the_meaning_of_life", 42, "GLOBAL"); |
| 130 |
ERROR HY000: Unknown system variable 'the_meaning_of_life' |
| 131 |
# Try setting wrong variable name in a new sub-thread. Should fail |
| 132 |
SELECT test_set_system_variable_signed_integer(1, NULL, "the_meaning_of_life", 42, "GLOBAL"); |
| 133 |
ERROR HY000: Unknown system variable 'the_meaning_of_life' |
| 134 |
# Try setting wrong (empty) variable name in the same thread. Should fail with NULL |
| 135 |
SELECT test_set_system_variable_signed_integer(0, NULL, "", 42, "GLOBAL"); |
| 136 |
test_set_system_variable_signed_integer(0, NULL, "", 42, "GLOBAL") |
| 137 |
NULL |
| 138 |
# Set initial value of connection_memory_limit before the test |
| 139 |
SET @@global.connection_memory_limit = 16777216; |
| 140 |
# Try setting connection_memory_limit to valid value. Should succeed |
| 141 |
SELECT test_set_system_variable_signed_integer(0, NULL, "connection_memory_limit", 33333333, "GLOBAL"); |
| 142 |
test_set_system_variable_signed_integer(0, NULL, "connection_memory_limit", 33333333, "GLOBAL") |
| 143 |
0 |
| 144 |
# Ensure the value of connection_memory_limit has changed |
| 145 |
SELECT @@global.connection_memory_limit; |
| 146 |
@@global.connection_memory_limit |
| 147 |
33333333 |
| 148 |
# Try setting connection_memory_limit to max value. Should succeed but value truncated (differs on 32 vs 64-bit) |
| 149 |
SELECT test_set_system_variable_signed_integer(0, NULL, "connection_memory_limit", @ui_max, "GLOBAL"); |
| 150 |
test_set_system_variable_signed_integer(0, NULL, "connection_memory_limit", @ui_max, "GLOBAL") |
| 151 |
0 |
| 152 |
# Try setting admin_port (read-only variable) to valid value. Should fail |
| 153 |
SELECT test_set_system_variable_signed_integer(0, NULL, "admin_port", 10000, "GLOBAL"); |
| 154 |
ERROR HY000: Variable 'admin_port' is a read only variable |
| 155 |
# Show initial value of block_encryption_mode before the test |
| 156 |
SELECT @@global.block_encryption_mode; |
| 157 |
@@global.block_encryption_mode |
| 158 |
aes-128-ecb |
| 159 |
# Try setting block_encryption_mode (string with limited set of accepted values) to integer. Should fail |
| 160 |
SELECT test_set_system_variable_signed_integer(0, NULL, "block_encryption_mode", 10000, "GLOBAL"); |
| 161 |
ERROR 42000: Variable 'block_encryption_mode' can't be set to the value of '10000' |
| 162 |
# Ensure the value of block_encryption_mode has not changed |
| 163 |
SELECT @@global.block_encryption_mode; |
| 164 |
@@global.block_encryption_mode |
| 165 |
aes-128-ecb |
| 166 |
# Try setting string variable to an integer. Should fail |
| 167 |
SELECT test_set_system_variable_signed_integer(0, NULL, "init_connect", 42, "GLOBAL"); |
| 168 |
ERROR 42000: Incorrect argument type to variable 'init_connect' |
| 169 |
# Try setting super_read_only (boolean) to integer. Should fail |
| 170 |
SELECT test_set_system_variable_signed_integer(0, NULL, "super_read_only", 10000, "GLOBAL"); |
| 171 |
ERROR 42000: Variable 'super_read_only' can't be set to the value of '10000' |
| 172 |
# Ensure the value of super_read_only has not changed |
| 173 |
SELECT @@global.super_read_only; |
| 174 |
@@global.super_read_only |
| 175 |
0 |
| 176 |
# Try setting super_read_only (boolean) to value that can be converted to boolean. Should suceed |
| 177 |
SELECT test_set_system_variable_signed_integer(0, NULL, "super_read_only", 0, "GLOBAL"); |
| 178 |
test_set_system_variable_signed_integer(0, NULL, "super_read_only", 0, "GLOBAL") |
| 179 |
0 |
| 180 |
# Ensure the value of super_read_only has changed |
| 181 |
SELECT @@global.super_read_only; |
| 182 |
@@global.super_read_only |
| 183 |
0 |
| 184 |
# Check that the variable connection_memory_limit is not yet persisted: |
| 185 |
SELECT * FROM performance_schema.persisted_variables WHERE VARIABLE_NAME='connection_memory_limit'; |
| 186 |
VARIABLE_NAME VARIABLE_VALUE |
| 187 |
# Try setting PERSIST connection_memory_limit. Should succeed |
| 188 |
SELECT test_set_system_variable_signed_integer(0, NULL, "connection_memory_limit", 44444444, "PERSIST"); |
| 189 |
test_set_system_variable_signed_integer(0, NULL, "connection_memory_limit", 44444444, "PERSIST") |
| 190 |
0 |
| 191 |
# Check that the variable is now persisted: |
| 192 |
SELECT VARIABLE_VALUE,@@global.connection_memory_limit |
| 193 |
FROM performance_schema.persisted_variables WHERE VARIABLE_NAME='connection_memory_limit'; |
| 194 |
VARIABLE_VALUE @@global.connection_memory_limit |
| 195 |
44444444 44444444 |
| 196 |
# reset persisted value |
| 197 |
RESET PERSIST connection_memory_limit; |
| 198 |
# Try setting PERSIST_ONLY connection_memory_limit. Should succeed |
| 199 |
SELECT test_set_system_variable_signed_integer(0, NULL, "connection_memory_limit", 55555555, "PERSIST_ONLY"); |
| 200 |
test_set_system_variable_signed_integer(0, NULL, "connection_memory_limit", 55555555, "PERSIST_ONLY") |
| 201 |
0 |
| 202 |
# Check that the variable is now persisted only but not changed: |
| 203 |
SELECT VARIABLE_VALUE,@@global.connection_memory_limit |
| 204 |
FROM performance_schema.persisted_variables WHERE VARIABLE_NAME='connection_memory_limit'; |
| 205 |
VARIABLE_VALUE @@global.connection_memory_limit |
| 206 |
55555555 44444444 |
| 207 |
# reset persisted value |
| 208 |
RESET PERSIST connection_memory_limit; |
| 209 |
# Try setting connection_memory_limit with NULL type (defaults to GLOBAL). Should succeed |
| 210 |
SELECT test_set_system_variable_signed_integer(0, NULL, "connection_memory_limit", 77777777, NULL); |
| 211 |
test_set_system_variable_signed_integer(0, NULL, "connection_memory_limit", 77777777, NULL) |
| 212 |
0 |
| 213 |
# Ensure the value has changed |
| 214 |
SELECT @@global.connection_memory_limit; |
| 215 |
@@global.connection_memory_limit |
| 216 |
77777777 |
| 217 |
# Set initial session value before the test |
| 218 |
SET @@session.connection_memory_limit=55555555; |
| 219 |
# Try using SESSION type with sub-thread, Should fail with NULL |
| 220 |
SELECT test_set_system_variable_signed_integer(1, NULL, "connection_memory_limit", 88888888, "SESSION"); |
| 221 |
test_set_system_variable_signed_integer(1, NULL, "connection_memory_limit", 88888888, "SESSION") |
| 222 |
NULL |
| 223 |
# Ensure the session value has not changed |
| 224 |
SELECT @@session.connection_memory_limit; |
| 225 |
@@session.connection_memory_limit |
| 226 |
55555555 |
| 227 |
# Try using SESSION type with current thread, Should succeed |
| 228 |
SELECT test_set_system_variable_signed_integer(0, NULL, "connection_memory_limit", 99999999, "SESSION"); |
| 229 |
test_set_system_variable_signed_integer(0, NULL, "connection_memory_limit", 99999999, "SESSION") |
| 230 |
0 |
| 231 |
# Ensure the session value has changed |
| 232 |
SELECT @@session.connection_memory_limit; |
| 233 |
@@session.connection_memory_limit |
| 234 |
99999999 |
| 235 |
# Show initial value of int_sys_var component system variable |
| 236 |
SELECT @@test_component.int_sys_var; |
| 237 |
@@test_component.int_sys_var |
| 238 |
8 |
| 239 |
# Try setting int_sys_var from test component to some value. Should succeed |
| 240 |
SELECT test_set_system_variable_signed_integer(0, "test_component", "int_sys_var", 1024, "GLOBAL"); |
| 241 |
test_set_system_variable_signed_integer(0, "test_component", "int_sys_var", 1024, "GLOBAL") |
| 242 |
0 |
| 243 |
# Ensure the value of int_sys_var component system variable has changed |
| 244 |
SELECT @@test_component.int_sys_var; |
| 245 |
@@test_component.int_sys_var |
| 246 |
1024 |
| 247 |
# Bug#34294012: Sig11 when passing THD parameter value greater than 0 via service methods |
| 248 |
# Try setting PERSIST_ONLY connection_memory_limit with sub-thread. Should succeed |
| 249 |
SELECT test_set_system_variable_signed_integer(1, NULL, "connection_memory_limit", 5000000, "PERSIST_ONLY"); |
| 250 |
test_set_system_variable_signed_integer(1, NULL, "connection_memory_limit", 5000000, "PERSIST_ONLY") |
| 251 |
0 |
| 252 |
# Check that the variable is now persisted only but not changed: |
| 253 |
SELECT VARIABLE_VALUE,@@global.connection_memory_limit |
| 254 |
FROM performance_schema.persisted_variables WHERE VARIABLE_NAME='connection_memory_limit'; |
| 255 |
VARIABLE_VALUE @@global.connection_memory_limit |
| 256 |
5000000 77777777 |
| 257 |
# Try setting PERSIST connection_memory_limit with sub-thread. Should succeed |
| 258 |
SELECT test_set_system_variable_signed_integer(1, NULL, "connection_memory_limit", 5000000, "PERSIST"); |
| 259 |
test_set_system_variable_signed_integer(1, NULL, "connection_memory_limit", 5000000, "PERSIST") |
| 260 |
0 |
| 261 |
# reset persisted value |
| 262 |
RESET PERSIST connection_memory_limit; |
| 263 |
|
| 264 |
# 2. Testing mysql_service_mysql_system_variable_update_integer::set_unsigned method |
| 265 |
|
| 266 |
# Try setting wrong variable name in the same thread. Should fail |
| 267 |
SELECT test_set_system_variable_unsigned_integer(0, NULL, "the_meaning_of_life", 42, "GLOBAL"); |
| 268 |
ERROR HY000: Unknown system variable 'the_meaning_of_life' |
| 269 |
# Try setting wrong variable name in a new sub-thread. Should fail |
| 270 |
SELECT test_set_system_variable_unsigned_integer(1, NULL, "the_meaning_of_life", 42, "GLOBAL"); |
| 271 |
ERROR HY000: Unknown system variable 'the_meaning_of_life' |
| 272 |
# Try setting wrong (empty) variable name in the same thread. Should fail with NULL |
| 273 |
SELECT test_set_system_variable_unsigned_integer(0, NULL, "", 42, "GLOBAL"); |
| 274 |
test_set_system_variable_unsigned_integer(0, NULL, "", 42, "GLOBAL") |
| 275 |
NULL |
| 276 |
# Show initial value before the test |
| 277 |
SELECT @@global.connection_memory_limit; |
| 278 |
@@global.connection_memory_limit |
| 279 |
5000000 |
| 280 |
# Try setting connection_memory_limit to max value. Should succeed |
| 281 |
SELECT test_set_system_variable_unsigned_integer(0, NULL, "connection_memory_limit", @ui_max, "GLOBAL"); |
| 282 |
test_set_system_variable_unsigned_integer(0, NULL, "connection_memory_limit", @ui_max, "GLOBAL") |
| 283 |
0 |
| 284 |
# Ensure the value of connection_memory_limit has changed |
| 285 |
SELECT @@global.connection_memory_limit = @ui_max; |
| 286 |
@@global.connection_memory_limit = @ui_max |
| 287 |
1 |
| 288 |
# Try setting connection_memory_limit to other valid value. Should succeed |
| 289 |
SELECT test_set_system_variable_unsigned_integer(0, NULL, "connection_memory_limit", 33333333, "GLOBAL"); |
| 290 |
test_set_system_variable_unsigned_integer(0, NULL, "connection_memory_limit", 33333333, "GLOBAL") |
| 291 |
0 |
| 292 |
# Ensure the value of connection_memory_limit has changed |
| 293 |
SELECT @@global.connection_memory_limit; |
| 294 |
@@global.connection_memory_limit |
| 295 |
33333333 |
| 296 |
# Try setting connection_memory_limit to negative value. Should succeed (but value truncated) |
| 297 |
SELECT test_set_system_variable_unsigned_integer(0, NULL, "connection_memory_limit", -100000, "GLOBAL"); |
| 298 |
test_set_system_variable_unsigned_integer(0, NULL, "connection_memory_limit", -100000, "GLOBAL") |
| 299 |
0 |
| 300 |
# Try setting admin_port (read-only variable) to valid value. Should fail |
| 301 |
SELECT test_set_system_variable_unsigned_integer(0, NULL, "admin_port", 10000, "GLOBAL"); |
| 302 |
ERROR HY000: Variable 'admin_port' is a read only variable |
| 303 |
# Show initial value of block_encryption_mode before the test |
| 304 |
SELECT @@global.block_encryption_mode; |
| 305 |
@@global.block_encryption_mode |
| 306 |
aes-128-ecb |
| 307 |
# Try setting block_encryption_mode (string with limited set of accepted values) to integer. Should fail |
| 308 |
SELECT test_set_system_variable_unsigned_integer(0, NULL, "block_encryption_mode", 10000, "GLOBAL"); |
| 309 |
ERROR 42000: Variable 'block_encryption_mode' can't be set to the value of '10000' |
| 310 |
# Ensure the value of block_encryption_mode has not changed |
| 311 |
SELECT @@global.block_encryption_mode; |
| 312 |
@@global.block_encryption_mode |
| 313 |
aes-128-ecb |
| 314 |
# Try setting string variable to an integer. Should fail |
| 315 |
SELECT test_set_system_variable_unsigned_integer(0, NULL, "init_connect", 42, "GLOBAL"); |
| 316 |
ERROR 42000: Incorrect argument type to variable 'init_connect' |
| 317 |
# Try setting super_read_only (boolean) to integer. Should fail |
| 318 |
SELECT test_set_system_variable_unsigned_integer(0, NULL, "super_read_only", 10000, "GLOBAL"); |
| 319 |
ERROR 42000: Variable 'super_read_only' can't be set to the value of '10000' |
| 320 |
# Ensure the value of super_read_only has not changed |
| 321 |
SELECT @@global.super_read_only; |
| 322 |
@@global.super_read_only |
| 323 |
0 |
| 324 |
# Try setting super_read_only (boolean) to value that can be converted to boolean. Should suceed |
| 325 |
SELECT test_set_system_variable_unsigned_integer(0, NULL, "super_read_only", 1, "GLOBAL"); |
| 326 |
test_set_system_variable_unsigned_integer(0, NULL, "super_read_only", 1, "GLOBAL") |
| 327 |
0 |
| 328 |
# Ensure the value of super_read_only has changed |
| 329 |
SELECT @@global.super_read_only; |
| 330 |
@@global.super_read_only |
| 331 |
1 |
| 332 |
# Check that the variable connection_memory_limit is not yet persisted: |
| 333 |
SELECT * FROM performance_schema.persisted_variables WHERE VARIABLE_NAME='connection_memory_limit'; |
| 334 |
VARIABLE_NAME VARIABLE_VALUE |
| 335 |
# Try setting PERSIST connection_memory_limit. Should succeed |
| 336 |
SELECT test_set_system_variable_unsigned_integer(0, NULL, "connection_memory_limit", 44444444, "PERSIST"); |
| 337 |
test_set_system_variable_unsigned_integer(0, NULL, "connection_memory_limit", 44444444, "PERSIST") |
| 338 |
0 |
| 339 |
# Check that the variable is now persisted: |
| 340 |
SELECT VARIABLE_VALUE,@@global.connection_memory_limit |
| 341 |
FROM performance_schema.persisted_variables WHERE VARIABLE_NAME='connection_memory_limit'; |
| 342 |
VARIABLE_VALUE @@global.connection_memory_limit |
| 343 |
44444444 44444444 |
| 344 |
# reset persisted value |
| 345 |
RESET PERSIST connection_memory_limit; |
| 346 |
# Try setting PERSIST_ONLY connection_memory_limit. Should succeed |
| 347 |
SELECT test_set_system_variable_unsigned_integer(0, NULL, "connection_memory_limit", 55555555, "PERSIST_ONLY"); |
| 348 |
test_set_system_variable_unsigned_integer(0, NULL, "connection_memory_limit", 55555555, "PERSIST_ONLY") |
| 349 |
0 |
| 350 |
# Check that the variable is now persisted only but not changed: |
| 351 |
SELECT VARIABLE_VALUE,@@global.connection_memory_limit |
| 352 |
FROM performance_schema.persisted_variables WHERE VARIABLE_NAME='connection_memory_limit'; |
| 353 |
VARIABLE_VALUE @@global.connection_memory_limit |
| 354 |
55555555 44444444 |
| 355 |
# reset persisted value |
| 356 |
RESET PERSIST connection_memory_limit; |
| 357 |
# Try setting connection_memory_limit with NULL type (defaults to GLOBAL). Should succeed |
| 358 |
SELECT test_set_system_variable_unsigned_integer(0, NULL, "connection_memory_limit", 77777777, NULL); |
| 359 |
test_set_system_variable_unsigned_integer(0, NULL, "connection_memory_limit", 77777777, NULL) |
| 360 |
0 |
| 361 |
# Ensure the value has changed |
| 362 |
SELECT @@global.connection_memory_limit; |
| 363 |
@@global.connection_memory_limit |
| 364 |
77777777 |
| 365 |
# Set initial session value before the test |
| 366 |
SET @@session.connection_memory_limit=55555555; |
| 367 |
# Try using SESSION type with sub-thread, Should fail with NULL |
| 368 |
SELECT test_set_system_variable_unsigned_integer(1, NULL, "connection_memory_limit", 88888888, "SESSION"); |
| 369 |
test_set_system_variable_unsigned_integer(1, NULL, "connection_memory_limit", 88888888, "SESSION") |
| 370 |
NULL |
| 371 |
# Ensure the session value has not changed |
| 372 |
SELECT @@session.connection_memory_limit; |
| 373 |
@@session.connection_memory_limit |
| 374 |
55555555 |
| 375 |
# Try using SESSION type with current thread, Should succeed |
| 376 |
SELECT test_set_system_variable_unsigned_integer(0, NULL, "connection_memory_limit", 99999999, "SESSION"); |
| 377 |
test_set_system_variable_unsigned_integer(0, NULL, "connection_memory_limit", 99999999, "SESSION") |
| 378 |
0 |
| 379 |
# Ensure the session value has changed |
| 380 |
SELECT @@session.connection_memory_limit; |
| 381 |
@@session.connection_memory_limit |
| 382 |
99999999 |
| 383 |
# Show initial value of uint_sys_var component system variable |
| 384 |
SELECT @@test_component.uint_sys_var; |
| 385 |
@@test_component.uint_sys_var |
| 386 |
1024 |
| 387 |
# Try setting uint_sys_var from test component to some value. Should succeed |
| 388 |
SELECT test_set_system_variable_unsigned_integer(0, "test_component", "uint_sys_var", 100000, "GLOBAL"); |
| 389 |
test_set_system_variable_unsigned_integer(0, "test_component", "uint_sys_var", 100000, "GLOBAL") |
| 390 |
0 |
| 391 |
# Ensure the value of uint_sys_var component system variable has changed |
| 392 |
SELECT @@test_component.uint_sys_var; |
| 393 |
@@test_component.uint_sys_var |
| 394 |
100000 |
| 395 |
# Bug#34294012: Sig11 when passing THD parameter value greater than 0 via service methods |
| 396 |
# Try setting PERSIST_ONLY connection_memory_limit with sub-thread. Should succeed |
| 397 |
SELECT test_set_system_variable_unsigned_integer(1, NULL, "connection_memory_limit", 6000000, "PERSIST_ONLY"); |
| 398 |
test_set_system_variable_unsigned_integer(1, NULL, "connection_memory_limit", 6000000, "PERSIST_ONLY") |
| 399 |
0 |
| 400 |
# Check that the variable is now persisted only but not changed: |
| 401 |
SELECT VARIABLE_VALUE,@@global.connection_memory_limit |
| 402 |
FROM performance_schema.persisted_variables WHERE VARIABLE_NAME='connection_memory_limit'; |
| 403 |
VARIABLE_VALUE @@global.connection_memory_limit |
| 404 |
6000000 77777777 |
| 405 |
# Try setting PERSIST connection_memory_limit with sub-thread. Should succeed |
| 406 |
SELECT test_set_system_variable_unsigned_integer(1, NULL, "connection_memory_limit", 6000000, "PERSIST"); |
| 407 |
test_set_system_variable_unsigned_integer(1, NULL, "connection_memory_limit", 6000000, "PERSIST") |
| 408 |
0 |
| 409 |
# reset persisted value |
| 410 |
RESET PERSIST connection_memory_limit; |
| 411 |
|
| 412 |
# 3. Testing mysql_service_mysql_system_variable_update_default::set method |
| 413 |
|
| 414 |
# Try setting wrong variable name in the same thread. Should fail |
| 415 |
SELECT test_set_system_variable_default(0, NULL, "the_meaning_of_life", "GLOBAL"); |
| 416 |
ERROR HY000: Unknown system variable 'the_meaning_of_life' |
| 417 |
# Try setting wrong variable name in a new sub-thread. Should fail |
| 418 |
SELECT test_set_system_variable_default(1, NULL, "the_meaning_of_life", "GLOBAL"); |
| 419 |
ERROR HY000: Unknown system variable 'the_meaning_of_life' |
| 420 |
# Try setting wrong (empty) variable name in the same thread. Should fail with NULL |
| 421 |
SELECT test_set_system_variable_default(0, NULL, "", "GLOBAL"); |
| 422 |
test_set_system_variable_default(0, NULL, "", "GLOBAL") |
| 423 |
NULL |
| 424 |
# Try setting admin_port (read-only variable) to default value. Should fail |
| 425 |
SELECT test_set_system_variable_default(0, NULL, "admin_port", "GLOBAL"); |
| 426 |
ERROR HY000: Variable 'admin_port' is a read only variable |
| 427 |
# Try setting connection_memory_limit (unsigned) to default value. Should succeed |
| 428 |
SELECT test_set_system_variable_default(0, NULL, "connection_memory_limit", "GLOBAL"); |
| 429 |
test_set_system_variable_default(0, NULL, "connection_memory_limit", "GLOBAL") |
| 430 |
0 |
| 431 |
# Ensure the value of connection_memory_limit has changed |
| 432 |
SELECT @@global.connection_memory_limit=@ui_max; |
| 433 |
@@global.connection_memory_limit=@ui_max |
| 434 |
1 |
| 435 |
# Change value to non-default |
| 436 |
SET @@global.lc_messages = "en_GB"; |
| 437 |
# Try setting lc_messages (string) to default value. Should succeed |
| 438 |
SELECT test_set_system_variable_default(0, NULL, "lc_messages", "GLOBAL"); |
| 439 |
test_set_system_variable_default(0, NULL, "lc_messages", "GLOBAL") |
| 440 |
0 |
| 441 |
# Ensure the value of lc_messages has changed to default |
| 442 |
SELECT @@global.lc_messages; |
| 443 |
@@global.lc_messages |
| 444 |
en_US |
| 445 |
# Try setting super_read_only (boolean) to default. Should succeed |
| 446 |
SELECT test_set_system_variable_default(0, NULL, "super_read_only", "GLOBAL"); |
| 447 |
test_set_system_variable_default(0, NULL, "super_read_only", "GLOBAL") |
| 448 |
0 |
| 449 |
# Ensure the value of super_read_only has changed to OFF |
| 450 |
SELECT @@global.super_read_only; |
| 451 |
@@global.super_read_only |
| 452 |
0 |
| 453 |
# Set the session variable to non-default value |
| 454 |
SET @@session.connection_memory_limit=9999999; |
| 455 |
# Try using SESSION type with sub-thread, Should fail with NULL |
| 456 |
SELECT test_set_system_variable_default(1, NULL, "connection_memory_limit", "SESSION"); |
| 457 |
test_set_system_variable_default(1, NULL, "connection_memory_limit", "SESSION") |
| 458 |
NULL |
| 459 |
# Ensure the value has not changed |
| 460 |
SELECT @@session.connection_memory_limit; |
| 461 |
@@session.connection_memory_limit |
| 462 |
9999999 |
| 463 |
# Try using SESSION type with current thread, Should succeed |
| 464 |
SELECT test_set_system_variable_default(0, NULL, "connection_memory_limit", "SESSION"); |
| 465 |
test_set_system_variable_default(0, NULL, "connection_memory_limit", "SESSION") |
| 466 |
0 |
| 467 |
# Ensure the session value has changed |
| 468 |
SELECT @@session.connection_memory_limit=@ui_max; |
| 469 |
@@session.connection_memory_limit=@ui_max |
| 470 |
1 |
| 471 |
# Set the variable to non-default value |
| 472 |
SET @@global.connection_memory_limit=16777216; |
| 473 |
# Check that the variable connection_memory_limit is not yet persisted: |
| 474 |
SELECT * FROM performance_schema.persisted_variables WHERE VARIABLE_NAME='connection_memory_limit'; |
| 475 |
VARIABLE_NAME VARIABLE_VALUE |
| 476 |
# Try setting PERSIST connection_memory_limit. Should succeed |
| 477 |
SELECT test_set_system_variable_default(0, NULL, "connection_memory_limit", "PERSIST"); |
| 478 |
test_set_system_variable_default(0, NULL, "connection_memory_limit", "PERSIST") |
| 479 |
0 |
| 480 |
# Check that the variable is now persisted: |
| 481 |
SELECT VARIABLE_VALUE=@ui_max,@@global.connection_memory_limit=@ui_max |
| 482 |
FROM performance_schema.persisted_variables WHERE VARIABLE_NAME='connection_memory_limit'; |
| 483 |
VARIABLE_VALUE=@ui_max @@global.connection_memory_limit=@ui_max |
| 484 |
1 1 |
| 485 |
# reset persisted value |
| 486 |
RESET PERSIST connection_memory_limit; |
| 487 |
# Set the variable to non-default value |
| 488 |
SET @@global.connection_memory_limit=16777216; |
| 489 |
# Try setting PERSIST_ONLY connection_memory_limit. Should succeed |
| 490 |
SELECT test_set_system_variable_default(0, NULL, "connection_memory_limit", "PERSIST_ONLY"); |
| 491 |
test_set_system_variable_default(0, NULL, "connection_memory_limit", "PERSIST_ONLY") |
| 492 |
0 |
| 493 |
# Check that the variable is now persisted only but not changed: |
| 494 |
SELECT VARIABLE_VALUE=@ui_max,@@global.connection_memory_limit |
| 495 |
FROM performance_schema.persisted_variables WHERE VARIABLE_NAME='connection_memory_limit'; |
| 496 |
VARIABLE_VALUE=@ui_max @@global.connection_memory_limit |
| 497 |
1 16777216 |
| 498 |
# reset persisted value |
| 499 |
RESET PERSIST connection_memory_limit; |
| 500 |
# Show initial value of uint_sys_var component system variable |
| 501 |
SELECT @@test_component.uint_sys_var; |
| 502 |
@@test_component.uint_sys_var |
| 503 |
100000 |
| 504 |
# Try setting uint_sys_var from test component to default value. Should succeed |
| 505 |
SELECT test_set_system_variable_default(0, "test_component", "uint_sys_var", "GLOBAL"); |
| 506 |
test_set_system_variable_default(0, "test_component", "uint_sys_var", "GLOBAL") |
| 507 |
0 |
| 508 |
# Ensure the value of uint_sys_var component system variable has changed |
| 509 |
SELECT @@test_component.uint_sys_var; |
| 510 |
@@test_component.uint_sys_var |
| 511 |
1024 |
| 512 |
# Bug#34294012: Sig11 when passing THD parameter value greater than 0 via service methods |
| 513 |
# Set the variable to non-default value |
| 514 |
SET @@global.connection_memory_limit=16777216; |
| 515 |
# Try setting PERSIST_ONLY connection_memory_limit with sub-thread. Should succeed |
| 516 |
SELECT test_set_system_variable_default(1, NULL, "connection_memory_limit", "PERSIST_ONLY"); |
| 517 |
test_set_system_variable_default(1, NULL, "connection_memory_limit", "PERSIST_ONLY") |
| 518 |
0 |
| 519 |
# Check that the variable is now persisted only but not changed: |
| 520 |
SELECT VARIABLE_VALUE=@ui_max,@@global.connection_memory_limit |
| 521 |
FROM performance_schema.persisted_variables WHERE VARIABLE_NAME='connection_memory_limit'; |
| 522 |
VARIABLE_VALUE=@ui_max @@global.connection_memory_limit |
| 523 |
1 16777216 |
| 524 |
# Try setting PERSIST connection_memory_limit with sub-thread. Should succeed |
| 525 |
SELECT test_set_system_variable_default(1, NULL, "connection_memory_limit", "PERSIST"); |
| 526 |
test_set_system_variable_default(1, NULL, "connection_memory_limit", "PERSIST") |
| 527 |
0 |
| 528 |
# reset persisted value |
| 529 |
RESET PERSIST connection_memory_limit; |
| 530 |
# Cleanup |
| 531 |
SET @@GLOBAL.connection_memory_limit = @orig_connection_memory_limit; |
| 532 |
SET @@GLOBAL.lc_messages = @orig_lc_messages; |
| 533 |
SET GLOBAL read_only = DEFAULT; |
| 534 |
RESET PERSIST; |
| 535 |
UNINSTALL COMPONENT "file://component_test_mysql_system_variable_set"; |
| 536 |
UNINSTALL COMPONENT "file://component_test_sys_var_service"; |
| 537 |
# End of 8.0 tests |