-
Notifications
You must be signed in to change notification settings - Fork 88
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
Add missing options to CHANGE MASTER TO #63
base: main
Are you sure you want to change the base?
Add missing options to CHANGE MASTER TO #63
Conversation
@Andersson007 @bmalynovytch @bmildren I'm not quite sure how to write tests for this, other than running the module with the new options and check that the sent query matches expectation and the server doesn't spit an error. Do you have any suggestions? |
Codecov Report
@@ Coverage Diff @@
## main #63 +/- ##
=======================================
Coverage 77.88% 77.88%
=======================================
Files 28 28
Lines 2347 2347
Branches 552 552
=======================================
Hits 1828 1828
Misses 362 362
Partials 157 157
Flags with carried forward coverage won't be shown. Click here to find out more. Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
@Andersson007 the sanity checks say I can't define choices for an integer parameter. What's the proper way to define an |
@@ -0,0 +1,2 @@ | |||
minor_changes: | |||
- mysql_replication - add missing CHANGE MASTER TO options (https://github.com/ansible-collections/community.mysql/issues/59). |
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.
- mysql_replication - add missing CHANGE MASTER TO options (https://github.com/ansible-collections/community.mysql/issues/59). | |
- "mysql_replication - add the new options: ``master_bind``,... (https://github.com/ansible-collections/community.mysql/issues/59)." |
alternatively, we could use separate entries for each parameter
plugins/modules/mysql_replication.py
Outdated
@@ -42,6 +43,11 @@ | |||
- resetslave | |||
- resetslaveall | |||
default: getslave | |||
master_bind: | |||
description: | |||
- same as mysql_variable. |
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.
- same as mysql_variable. | |
- same as mysql_variable. |
- same as mysql_variable. | |
- Same as mysql variable. |
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.
Argh, IDE autocomplete. Nicely spotted. 👍
I've never seen int ranges, there aren't a lot to list the whole sequence, i.e. [1, 2, ...] , or maybe we could just document this and check in the code if a passed value is in the range. |
Can we run the 3d instance? As i can see there are but @bmildren and @bmalynovytch , as experts, know better:) |
Absolutely, you may have 1 master with 2 slaves and switch one of the slaves to master and attach the second one as new slave of the new master. |
@bmalynovytch since all of the options to The other, more complicated question is what kind of effects to look for to verify that the command succeeded. But in that case I would assume that if the query sent to the server matches the expectation and the server doesn't err then the server has done as requested. |
Maybe we can define it as a list of string representations of integers. At the end of the day however the value is written in YAML didn't make that much of a difference, and we end up turning it into a string for the cursor query anyway. |
For me personally the best approach is documenting the acceptable range, removing choices, and checking on the passed value in the code with raising a helpful message if the value is out of the borders. |
I'm going to abandon this PR draft, as it relates to replication and we have modifications regarding that component and the language used. |
@Jorge-Rodriguez sure, it's marked as DRAFT, so, people will be warned. Maybe also would be good to put something like "TEMPORARY FROZEN" to the description. |
@Jorge-Rodriguez any updates on the PR? |
I haven't gotten the chance to work on this for quite some time. I'll pick it up, seems there's only the "enum" issue to solve and to write appropriate tests. Thanks for the ping. |
bc19516
to
278f10f
Compare
@Andersson007 I have just brought the code of this PR back to date. Still pending changes to the "enum" issue and testing, so I'm not moving it from draft status yet. |
I am unable to run integration tests locally, When running on docker the first |
I found out that all our tests were run with the |
cc2ac60
to
eb761f4
Compare
Tests are broken because downloading the MySQL tarball consistently fails with HTTP 403. The reason is unknown as of this writing. |
It seems that the old |
@Jorge-Rodriguez great work, thank you!
|
Yeah, it might be a good idea not to introduce futile backwards compatibility on new features, I'll remove the aliases. |
@Jorge-Rodriguez thanks! please let me know when it's ready for review. |
7b99668
to
7664da7
Compare
I've just rebased the whole thing to make the commit history clearer. I'm still keeping the CI fixup so the tests run correctly, I'll remove them when #491 is merged. @Andersson007 no need for review just yet. I still have to write tests for the new parameters, I'm going to keep the PR as a draft until those are ready. |
7664da7
to
d337f8c
Compare
d337f8c
to
cd29b79
Compare
@Andersson007 What's the proper way to document an option that is only available since a specific version of MySQL? |
@Jorge-Rodriguez imo just to add another row to each option saying something like @laurent-indermuehle @betanummeric @bmalynovytch other thoughts ^ ? |
I hope that 'Plugins CI' will tell us once it runs ;) |
I believe just crashing is OK as soon as the versions are documented. We, of course, can check versions in our code, etc. but shouldn't this be user's responsibility? If a user runs unsupported SQL, RDBMS just shows errors (invalid syntax or something), doesn't it? |
I searched the repo and found many occurences:
English is not my first language, so I don't know what the most correct form is. But I know I don't like seen a dot at the end of the version. |
I'm planning to spot the problematic options as I progress with test writing and have the module fail gracefully with an appropriate message. |
In a different order of things, it seems that since we started making modificaciones to the replication module, MySQL has settled on replacing the |
The problem with delegating the error to the connector is that it can become very unclear. As a user you'd get a message such as
But the user didn't construct that query, the module did, so it would require intimate knowledge of the module's inner workings to determine what is causing the problem. IMO it'd be better to have the module do the version checking and fail with a proper message like
|
It's a linguistics problem because we're mixing the syntaxes of versioning and the English language, the latter being infamous for being anything but formal. We could of course do some language gymnastics and rewrite it as something like
although it's a bit clunky. The last option is probably best since it keeps the same semantics while removing the version number from the end of the sentence
We even get the chance to use Oxford commas
Or, we leverage markdown notation
|
I hope MariaDB will not introduce other aliases, there'll be too many imo in that case:))
if you're happy to write all the checks, WFM:)
I like this one ^. Plus I would add the markdown to highlight the versions a bit, so something like:
Though I would suggest to conduct the rewording in a separate PR:) |
MariaDB od still stuck in the political correctness flame war of 2020, so I don't expect much progress on the rewording front any time soon |
Since MariaDB 10.5 you can write |
Well, that would be in line with MySQL terms. |
This is still in progress, I want to be thorough with the test suite so it's taking some time. It seems that MariaDB is going with I will introduce support for MySQL's |
@Jorge-Rodriguez are we talking about reflecting the differences in naming in aliases? If yes, i wonder if we really need them. Maybe we should just use one set of names? Maybe we could just mention in |
While not strictly necessary, I believe the option aliases would work better in the future for users who are used to the newer terminology. I also think an alias would probably work better than an explanation in notes that might not be read. |
I'm not strictly against of the aliases if it helps though i think we shouldn't overuse them:) OK, let's discuss this later in a dedicated PR/Issue/Discussion |
I would like to use the MASTER_BIND with the module, would it be acceptable to extract parts of this PR to support this parameter? |
Hi @simonpahl, I think it's a question for @Jorge-Rodriguez. |
SUMMARY
Added all missing options for CHANGE MASTER TO, according to https://dev.mysql.com/doc/refman/8.0/en/change-master-to.html
Fixes #59
ISSUE TYPE
COMPONENT NAME
mysql_replication