| 1 |
# ==== Purpose ==== |
| 2 |
# |
| 3 |
# Check the behavior of all system variables that have an alias. |
| 4 |
# |
| 5 |
# ==== Requirements ==== |
| 6 |
# |
| 7 |
# For dynamic variables, see |
| 8 |
# mysql-test/suite/sys_vars/t/check_dynamic_sysvar.inc |
| 9 |
# |
| 10 |
# For readonly varialbes, see |
| 11 |
# mysql-test/suite/sys_vars/t/check_readonly_sysvar.inc |
| 12 |
# |
| 13 |
# ==== Implementation ==== |
| 14 |
# |
| 15 |
# This is part of a framework of several files. The framework is |
| 16 |
# organized in three layers: |
| 17 |
# |
| 18 |
# - Control layer: this iterates over all system variables. For each |
| 19 |
# variable it chooses a set of scenarios to execute, depending on |
| 20 |
# the properties of the variable. |
| 21 |
# |
| 22 |
# The control layer is split into the following files: |
| 23 |
# |
| 24 |
# - control_for_sysvars_with_aliases.inc |
| 25 |
# Iterate over variables. For each variable, invoke |
| 26 |
# control_for_session_and_global_sysvar.inc twice: first for the |
| 27 |
# variable and then for the alias. |
| 28 |
# |
| 29 |
# - control_for_sysvar.inc |
| 30 |
# Check the properties of the variable: whether it exists on |
| 31 |
# session/global scope, and whether it is dynamic or readonly. |
| 32 |
# Invoke a file in the scenario layer according to the outcome. |
| 33 |
# |
| 34 |
# - Scenario layer: this executes a number of scenarios. Each file in |
| 35 |
# this layer executes scenarios relevant for a certain kind of |
| 36 |
# variable: a dynamic (settable) variable, a read-only variable, or |
| 37 |
# a variable that does not exist in the given scope. The files are: |
| 38 |
# |
| 39 |
# - scenarios_for_dynamic_sysvar.inc |
| 40 |
# Execute the following scenarios for a dynamic sysvar: |
| 41 |
# - The default is as expected |
| 42 |
# - SET ... = DEFAULT works |
| 43 |
# - SET ... = <value> works, for all listed values |
| 44 |
# - For numeric variables, the range is as specified |
| 45 |
# - SET ... = <value> fails, for all listed invalid values. |
| 46 |
# |
| 47 |
# - scenarios_for_readonly_sysvar.inc |
| 48 |
# Execute the following scenarios for a readonly sysvar: |
| 49 |
# - The default is as expected |
| 50 |
# - SET ... = DEFAULT fails |
| 51 |
# - SET ... = <value> fails, for all listed values |
| 52 |
# |
| 53 |
# - scenarios_for_wrong_scope_sysvar.inc |
| 54 |
# Execute the following scenarios for a sysvar that is not defined |
| 55 |
# on the given scope: |
| 56 |
# - SET ... = DEFAULT fails |
| 57 |
# - SET ... = <value> fails, for all listed values |
| 58 |
# - SELECT ... fails |
| 59 |
# - If the scope is global, the variable does not exist in the |
| 60 |
# performance_schema.global_variables. |
| 61 |
# - If the given scope is session, the variable exists in the |
| 62 |
# performance_schema.session_variables table (which is according |
| 63 |
# to the specification for that table; it shall list global |
| 64 |
# variables that do not have a session counterpart). |
| 65 |
# |
| 66 |
# The files in the scenario layer typically invoke files in the |
| 67 |
# assertion layer, for each scenario that they setup. |
| 68 |
# |
| 69 |
# - assert_sysvar_value.inc |
| 70 |
# Asserts that the variable has the expected values... |
| 71 |
# - when accessed as @@variable, |
| 72 |
# - in performance_schema.global_variables and/or |
| 73 |
# performance_schema.session_variables, |
| 74 |
# - in performance_schema.persisted_variables, |
| 75 |
# - in the persisted variables file. |
| 76 |
# Asserts that the variable has the expected source in |
| 77 |
# performance_schema.variables_info. |
| 78 |
# |
| 79 |
# - assert_sysvar_and_alias_value.inc |
| 80 |
# Invokes assert_sysvar_value.inc for the variable, and then |
| 81 |
# invokes assert_sysvar_value.inc for its alias. |
| 82 |
# |
| 83 |
# - assert_sysvar_warnings.inc |
| 84 |
# Asserts that SHOW WARNINGS returns the expected set of warnings |
| 85 |
# (possibly none). |
| 86 |
|
| 87 |
|
| 88 |
# This test checks the behavior of configuration variables. If the |
| 89 |
# test is invoked with some of those variables set to specific values, |
| 90 |
# that interferes with the test. So we disable runs that set the |
| 91 |
# tested variables. |
| 92 |
|
| 93 |
# Binlog-less runs use --skip-log-replica-updates. |
| 94 |
--source include/have_log_bin.inc |
| 95 |
|
| 96 |
|
| 97 |
--echo #### Initialize #### |
| 98 |
|
| 99 |
--let $assert_escape = 1 |
| 100 |
|
| 101 |
--source json_sysvar_spec.inc |
| 102 |
|
| 103 |
--let $json_label = value |
| 104 |
--source include/create_json_iterator.inc |
| 105 |
|
| 106 |
--let $json_label = invalid |
| 107 |
--source include/create_json_iterator.inc |
| 108 |
|
| 109 |
--echo #### Run #### |
| 110 |
|
| 111 |
--let $json_array = $sysvar_specs |
| 112 |
--source $json_sysvar_start |
| 113 |
while (!$json_sysvar_done) { |
| 114 |
if ($mask_value) { |
| 115 |
--echo - default=MASKED |
| 116 |
--echo - values=MASKED |
| 117 |
} |
| 118 |
if (!$mask_value) { |
| 119 |
--echo - default=$default |
| 120 |
--echo - values=$values |
| 121 |
} |
| 122 |
|
| 123 |
--source control_for_sysvar.inc |
| 124 |
|
| 125 |
# Above, we ran a number of test scenarios where we *SET* $name, and |
| 126 |
# *checked* both $name and $alias. |
| 127 |
# Below, we run a number of test scenarios where we *SET* $alias, |
| 128 |
# and *check* both $alias and $name (by swapping the values of $name |
| 129 |
# and $alias here). |
| 130 |
if ($alias) { |
| 131 |
--let $expect_deprecation_warning = 1 |
| 132 |
--let $tmp = $alias |
| 133 |
--let $alias = $name |
| 134 |
--let $name = $tmp |
| 135 |
--source control_for_sysvar.inc |
| 136 |
--let $expect_deprecation_warning = 0 |
| 137 |
} |
| 138 |
|
| 139 |
--source $json_sysvar_next |
| 140 |
} |
| 141 |
|
| 142 |
--echo #### Clean up #### |
| 143 |
|
| 144 |
--source include/destroy_json_functions.inc |