Small fixes in move-tables config initialization#1712
Merged
danieljoos merged 1 commit intoJun 17, 2026
Conversation
zacharysierakowski
approved these changes
Jun 17, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request fixes move-tables mode initialization so the target connection credentials and migration lock DB selection behave correctly when the target DB/credentials differ from the source, aligning runtime behavior with the move-tables connection model described in issue #1681.
Changes:
- Derive move-tables connection credentials from the source/inspector credentials, and only override them when
--target-user/--target-passwordare explicitly provided. - Use the target database name when opening the dedicated DB handle used to acquire the migration user-level lock.
- Remove the earlier CLI-time defaulting of
TargetUser/TargetPass, centralizing the behavior inApplyCredentials().
Show a summary per file
| File | Description |
|---|---|
| go/logic/applier.go | Uses GetTargetDatabaseName() for migration lock name/DB URI so lock acquisition works when target DB differs. |
| go/cmd/gh-ost/main.go | Removes move-tables credential defaulting at flag-parsing time; relies on centralized credential application. |
| go/base/context.go | Applies move-tables credential overrides only when non-empty; otherwise reuses inspector/source credentials. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/3 changed files
- Comments generated: 1
Comment on lines
+986
to
+990
| if mctx.MoveTables.TargetUser != "" { | ||
| // Override | ||
| mctx.MoveTables.ConnectionConfig.User = mctx.MoveTables.TargetUser | ||
| } | ||
| if mctx.MoveTables.TargetPass != "" { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A Pull Request should be associated with an Issue.
Related issue: #1681
Description
This PR fixes the credential loading for move-tables mode. It only uses the
--target-userand--target-passwordif not empty. Otherwise it re-uses the same credentials as for the source connection.It also fixes the lock database connection, using the target database instead of the source database name. These can differ in move-tables mode.