Support custom MySQL dial network#9
Merged
Merged
Conversation
RainbowDashy
approved these changes
May 12, 2026
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.
Summary
mysql.ConnectionConfigso embedded callers can route gh-ost through a caller-managed SSH tunnel.Networkforgo-sql-driver/mysqlDSNs instead of always generating@tcp(host:port).Dialerforgo-mysql-org/go-mysqlbinlog streamer connections, which do not usedatabase/sqlDSNs.Usage
Callers that need to route gh-ost connections through an SSH tunnel can register a custom dialer with
go-sql-driver/mysql, then assign the registered network name and a go-mysql dialer to the gh-ost connection config:After this, gh-ost SQL connections build DSNs like:
This follows the extension model provided by
go-sql-driver/mysql: callers register a custom network viaRegisterDialContext, then use that network in the DSN asnetwork(address). gh-ost2 also needs the explicitDialerbecause binlog streaming usesgo-mysql-org/go-mysql, notdatabase/sql.With this approach, gh-ost2 remains responsible for connection configuration, while the embedding application owns SSH authentication, secret handling, host-key policy, lifecycle, and cleanup.
Test Plan
go test ./go/mysql ./go/binlog ./go/basegit diff --checkNote: I also tried
go test ./go/..., but the full suite did not exit in this local environment, so this PR validates the changed packages plus adjacent pure unit packages.