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