MDEV-30189 Add remaining replication options as system variables#3865
MDEV-30189 Add remaining replication options as system variables#3865
Conversation
There was a problem hiding this comment.
Reminders for myself:
-
mentionobsoleted by #3865 (comment)SET @@show_slave_auth_info’s required privilege in the commit description -
check option IDs – that seems to be a thingnope, not here - update sys.vars results – oops forgot that one
There was a problem hiding this comment.
Is there even a convention where to put new system variables?…
There was a problem hiding this comment.
I don't think any specific pattern. Generally, I'd suggest (as you've already done) to keep things logically related
| @@ -0,0 +1,32 @@ | |||
| --source include/not_embedded.inc | |||
| # MDEV-30189: Test minimal correctness of `@@show_slave_auth_info` itself | |||
There was a problem hiding this comment.
Since sys_vars.sysvars_server_(not)embedded dump the output of information_schema.system_variables, my idea is to treat this view as authoritative and only test that the behavior of “basic” syntaxes matches.
The idea puts the correctness of “alternate” syntaxes their own responsibility that they match the behavior of the “basic” syntaxes.
Those include:
SHOW GLOBAL/SESSION VARIABLES LIKE name;
SELECT GLOBAL/SESSION_VALUE FROM information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='name';
SELECT VARIABLE_VALUE FROM information_schema.GLOBAL/SESSION_VARIABLES WHERE VARIABLE_NAME='name';
SELECT VARIABLE_VALUE FROM performance_schema.global/session_variables WHERE VARIABLE_NAME='name';
SET GLOBAL/SESSION name = value;
SELECT value INTO @@GLOBAL/SESSION.name;
@@GLOBAL/SESSION.name := value;
SET STATEMENT name = value FOR statement;
# and automatic-scope (i.e., `GLOBAL`/`SESSION`-less) variantsBoth “‘basic’ syntaxes matches IS.system_variables” and “TIMTOWTDI syntaxes matches each other” can be generic tests agnostic of specific variables.
They can test every variable with a for-loop or only a random sample.
There was a problem hiding this comment.
About this ideal unit testing, @mariadb-SusilBehera do you know how well they hold up currently, or does the status quo require manually testing each of @@, @@global. and @@session.?
There was a problem hiding this comment.
I'd agree with the premise of the basic test, and testing alternate syntax for the same functionality isn't really related to the addition of a variable itself. Though ensuring a variable is at the proper scope (session vs global) wouldn't fall into that category (which in this patch, you have already accounted for 👍)
There was a problem hiding this comment.
#3865 (comment)
I think a single unit test which covers all sysvars and checks for sysvar compliances is good enough. Beyond this, the functional tests around the new sysvars should be done in different MTR tests.
mariadb-SusilBehera
left a comment
There was a problem hiding this comment.
Added my review comments on MTR tests.
| --error ER_WRONG_VALUE_FOR_VAR | ||
| SET @@show_slave_auth_info= 2; | ||
| --error ER_WRONG_VALUE_FOR_VAR | ||
| SET @@show_slave_auth_info= 'lorem'; |
There was a problem hiding this comment.
An actual SHOW SLAVE/REPLICA HOSTS result check after a SET show_slave_auth_info= ON would have been better.
There was a problem hiding this comment.
--show-slave-auth-info doen’t have existing function tests.
Though I just realized: if it does, this variable would supercede the option.
There was a problem hiding this comment.
master_info_file also doesn't have any existing functional tests 🤦. I do suppose we should add test cases for both variables in with this patch, to at least prove nothing is breaking.
There was a problem hiding this comment.
I’ve written test for the two options at #3875.
We can merge that PR into this one, though I prefer merging through 10.11→main.
bnestere
left a comment
There was a problem hiding this comment.
Thanks for the patch, @ParadoxV5 , great work! Please see my few notes
There was a problem hiding this comment.
I don't think any specific pattern. Generally, I'd suggest (as you've already done) to keep things logically related
| --error ER_WRONG_VALUE_FOR_VAR | ||
| SET @@show_slave_auth_info= 2; | ||
| --error ER_WRONG_VALUE_FOR_VAR | ||
| SET @@show_slave_auth_info= 'lorem'; |
There was a problem hiding this comment.
master_info_file also doesn't have any existing functional tests 🤦. I do suppose we should add test cases for both variables in with this patch, to at least prove nothing is breaking.
| @@ -0,0 +1,32 @@ | |||
| --source include/not_embedded.inc | |||
| # MDEV-30189: Test minimal correctness of `@@show_slave_auth_info` itself | |||
There was a problem hiding this comment.
I'd agree with the premise of the basic test, and testing alternate syntax for the same functionality isn't really related to the addition of a variable itself. Though ensuring a variable is at the proper scope (session vs global) wouldn't fall into that category (which in this patch, you have already accounted for 👍)
|
There, with this amend I undid |
bnestere
left a comment
There was a problem hiding this comment.
Looks good, thanks @ParadoxV5 ! Note, you'll need to re-record sysvars_server_notembedded to account for the read-only change.
Promote the last few SQL-inaccessible replication options (command line or `mariadb.cnf`) as these GLOBAL read-only system variables: ``` @@master_info_file @@replicate_same_server_id @@show_slave_auth_info ``` Side effect: The latter two options changed from no argument to optional argument. Quote `include/my_getopt.h`: > It should be noted that for historical reasons variables with the > combination arg_type=NO_ARG, my_option::var_type=GET_BOOL still > accepts arguments. This is someone counter intuitive and care should > be taken if the code is refactored. Reviewed-by: Brandon Nesterenko <brandon.nesterenko@mariadb.com>
and aliasremaining mariadbd replication command line options as system variablesDescription
Promote the last few SQL-inaccessible replication options (command line or
mariadb.cnf) as these GLOBAL read-only system variables:@@master_info_fileMulti-Source Replication uses this
master.infoconfig across all connections.@@replicate_same_server_idServer IDs are a lower level than replication sources, so I made this a global variable rather than a SHOW REPLICA STATUS column.
And it’s also too esoteric (to exist in the first place, I feel), so I left out its setter (at least for now).
@@show_slave_auth_infoThis determines whether SHOW REPLICA HOSTS includes replicas’
@@GLOBAL.report_user&@@GLOBAL.report_password.@bnestere finds this toggle esoteric too, so I’m skipping its setter too to avoid side effects from mutability (the scope only required getters ¯\_(ツ)_/¯)
other variables listed on the JIRA issue
MDEV-25674 and MDEV-27669 covers
--master-retry-countand--skip-slave-startrespectively.Do you think this patch might introduce side-effects in other parts of the server?
Due to technical limitations, the latter two options changed from no argument to optional argument.
server/sql/sys_vars.inl
Lines 465 to 469 in 3a81664
server/include/my_getopt.h
Lines 51 to 58 in 3a81664
Release Notes
--master-info-file,--replicate-same-server-idand--show-slave-auth-infoare now available as system variables.https://mariadb.com/kb/ pages that need changing
As stated, those Replication and Binary Logging Options have ascended to Replication and Binary Log System Variables
How can this PR be tested?
This commit includes minimal MTR tests, one for each variable.
Each file asserts the variable’s scope and read-only property.
Thread suggesting generic (QA) testing of system variables and syntaxes: #3865 (comment)
Note that
--master-info-fileand--show-slave-auth-infodon’t have existing function tests ❗, so I wrote #3875 to backport them.PR quality check
mainbranch.This is a bug fix, and the PR is based against the earliest maintained branch in which the bug can be reproduced.