-
-
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-35635: START SLAVE UNTIL allows CHANGE MASTER TO options #3909
base: main
Are you sure you want to change the base?
Conversation
START SLAVE UNTIL uses the master_file_def options contains options available in CHANGE MASTER command This commit separates master's options from slave options in ```sql_yacc.yy``` by replacing master_file_def with slave_until_file_def which only contain the options needed in the START SLAVE command MASTER_LOG_FILE_SYM, MASTER_LOG_POS_SYM, RELAY_LOG_FILE_SYM and RELAY_LOG_POS_SYM
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.
Hi @MohanadKh03 !
Thanks for submitting the patch with a test case already! I've left a few suggestions to the test, and then a couple more suggestions for the git commit message itself:
- Please keep each line to 72 characters in length
- Git commit messages don't support markdown, so you can remove/simplify the formatting a bit (though note the PR description does support markdown)
- Can you re-phrase/extend the problem description to start off with a description that is more user-facing? That is, a typical user won't know what "master_file_def options" are, but you can describe the problem without using that phrase. Then later in the commit message, you can mention it (as it is good to still mention this for developers).
# Clean up after tests. | ||
DROP TABLE t1; | ||
source include/rpl_end.inc; | ||
# ==== End of test ==== |
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.
Can you echo
the "End of test" line? And also end the file in a new line.
|
||
connection slave; | ||
-- error ER_PARSE_ERROR | ||
start slave until master_log_file='$master_log_file', master_log_pos=$master_log_pos_1, MASTER_USE_GTID=NO, MASTER_DEMOTE_TO_SLAVE=1; |
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.
To use value substitution (using for variables set via the let
mysqltest construct), you need to start the line with the mysqltest command eval
. So this should be
start slave until master_log_file='$master_log_file', master_log_pos=$master_log_pos_1, MASTER_USE_GTID=NO, MASTER_DEMOTE_TO_SLAVE=1; | |
eval start slave until master_log_file='$master_log_file', master_log_pos=$master_log_pos_1, MASTER_USE_GTID=NO, MASTER_DEMOTE_TO_SLAVE=1; |
Though to the complete test case, I don't think you actually need to use substitution at all, as you are just testing parsing options. So ultimately I'd say you could do something like
start slave until master_log_file='$master_log_file', master_log_pos=$master_log_pos_1, MASTER_USE_GTID=NO, MASTER_DEMOTE_TO_SLAVE=1; | |
--error ER_PARSE_ERROR | |
start slave until master_log_file='master-bin.000001', master_log_pos=4, MASTER_USE_GTID=NO, MASTER_DEMOTE_TO_SLAVE=1; | |
--error ER_BAD_SLAVE | |
start slave until master_log_file='master-bin.000001', master_log_pos=4; |
and a few other options to test completeness.
# MDEV-35635 | ||
# Testing issues around invalid parameters and START SLAVE UNTIL behavior. | ||
|
||
# Include necessary configurations |
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.
You shouldn't need any pre-amble source
for this test, as it is just testing parsing. I think really all that this test needs are the actual start slave
lines, no set-up data is needed. Then, for a "passing" test, you can just set the expectation ER_BAD_SLAVE
(as no slave is actually configured, but it proves the parsing has gone through)
NOTE: This is still a draft PR as I am still writing its .test file
Description
This commit separates master's options from slave options in
sql_yacc.yy
by replacingmaster_file_def
withslave_until_file_def
which only contain the options needed in the query:These are the only options valid in this query
MASTER_LOG_FILE_SYM, MASTER_LOG_POS_SYM, RELAY_LOG_FILE_SYM and RELAY_LOG_POS_SYM
This is only a change in the symbols the START SLAVE command did not use any functionalty related to what was included in
master_file_def
Release Notes
How can this PR be tested?
This can be tested using
start_slave_until.test
file which should test valid options queries and invalid onesInvalid being anything that is not part of this
MASTER_LOG_FILE_SYM, MASTER_LOG_POS_SYM, RELAY_LOG_FILE_SYM and RELAY_LOG_POS_SYM
Basing the PR against the correct MariaDB version
main
branch.PR quality check