-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MDEV-30189 Add remaining replication options as system variables #3865
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reminders for myself:
-
mentionobsoleted by MDEV-30189 Add remaining replication options as system variables #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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there even a convention where to put new system variables?…
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
select VARIABLE_NAME,VARIABLE_SCOPE,VARIABLE_TYPE,VARIABLE_COMMENT,NUMERIC_MIN_VALUE,NUMERIC_MAX_VALUE,NUMERIC_BLOCK_SIZE,ENUM_VALUE_LIST,READ_ONLY,COMMAND_LINE_ARGUMENT |
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) variants
Both “‘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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the patch, @ParadoxV5 , great work! Please see my few notes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 👍)
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>
There, with this amend I undid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks @ParadoxV5 ! Note, you'll need to re-record sysvars_server_notembedded
to account for the read-only change.
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_file
Multi-Source Replication uses this
master.info
config across all connections.@@replicate_same_server_id
Server 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_info
This 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-count
and--skip-slave-start
respectively.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-id
and--show-slave-auth-info
are 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-file
and--show-slave-auth-info
don’t have existing function tests ❗, so I wrote #3875 to backport them.PR quality check
main
branch.This is a bug fix, and the PR is based against the earliest maintained branch in which the bug can be reproduced.