PT-1776: Adding in slave-user and slave-password for dsn table based …#425
PT-1776: Adding in slave-user and slave-password for dsn table based …#425mbenshoof wants to merge 7 commits into
Conversation
svetasmirnova
left a comment
There was a problem hiding this comment.
Thank you for your contribution.
You modified the auto-generated code. It will be removed once we run the update-modules utility. Please put your changes into the MasterSlave package.
|
Another issue with this proposal is that it modifies DSN table entries without checking if they have user and password defined. This could cause issues when users have, say, 10 replicas with the same user/password pairs and two with different ones. We also need a test case to accept this PR. |
|
There is also similar PR at #381 |
… making them not overwrite what is specified in DSN table.
|
@svetasmirnova - Modified the logic to check for user/pass specified in DSN string. Only sets the CLI passed options if they are not set in the DSN table. For the test case, I've been using dbdeployer for a quick primary/replica environment and setting different variations of DSN string in the table (with both user/pass, with only one, with neither) to validate it doesn't overwrite, but sets if missing |
|
Thank you for the changes; I will review them in the new year.
We need automatic test cases to run them at each release and ensure your changes are not overwritten by another contribution. We use a solution similar to MySQL Sandbox and dbdeployer for automatic test cases. Please check directory t and CONTRIBUTING.md. |
There was a problem hiding this comment.
Pull request overview
This PR aims to make DSN-table–based recursion honor --slave-user and --slave-password when constructing slave connections, aligning DSN-table recursion with other recursion methods in Percona Toolkit’s replication tooling.
Changes:
- Adds logic in
lib/MasterSlave.pmto apply--slave-user/--slave-passwordwhen DSNs are sourced from a DSN table. - Touches the embedded
MasterSlavecopies insidept-table-syncandpt-table-checksum(currently only whitespace), but they still need the functional update to actually deliver the feature in those tools. - No tests added/updated for the new DSN-table credential override behavior.
Reviewed changes
Copilot reviewed 1 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| lib/MasterSlave.pm | Adds DSN-table credential injection; currently risks password exposure and fragile DSN-string construction; should instead override creds on parsed DSN hashrefs and preserve “copy from previous DSN” semantics. |
| bin/pt-table-sync | Embedded MasterSlave copy still does not apply --slave-user/--slave-password for DSN-table recursion (only whitespace change in this PR). |
| bin/pt-table-checksum | Same as pt-table-sync: embedded MasterSlave copy still lacks the feature (only whitespace change in this PR). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
- Merged version 3.x - Run update-modules and fixed some tests
- Re-added the fix - Created test case for lib/MasterSlave.pm - Updated modules
…recursion