feat(config): add MultiSubnetFailover support - #15
Merged
Merged
Conversation
Integrate upstream PR #378 (resolves #337). Add a `multi_subnet_failover` option to `Config` with a setter/getter and ADO/JDBC connection-string parsing of the `MultiSubnetFailover` keyword (via the shared `ConfigString` trait, so it works for both string formats). When enabled, the SQL Browser `connect_named` paths (tokio, async-std, smol) attempt connections to every resolved address in parallel using `FuturesUnordered` and return the first stream to succeed; otherwise they fall back to the existing sequential behaviour. The per-address connect logic is factored into a `connect_addr` helper, and the first observed error is now preserved instead of being masked by a generic "not found". Adds unit tests for keyword parsing and end-to-end `from_ado_string` propagation.
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.
Integrates upstream prisma/tiberius#378 (resolves #337, supersedes #357) onto current
dev.What
multi_subnet_failoverfield toConfigwith amulti_subnet_failover(bool)setter andget_multi_subnet_failover()getter (defaults tofalse).MultiSubnetFailoverkeyword from both ADO.NET and JDBC connection strings via the sharedConfigStringtrait, using the existingparse_boolhelper (acceptstrue/false/yes/no).connect_namedimplementations for tokio, async-std and smol now connect to every resolved address in parallel withFuturesUnorderedand return the first successful stream; when disabled they keep the previous sequential behaviour.connect_addrhelper in each backend and preserves the first observed error rather than masking it with a generic "Could not resolve server host".Reconciliation with current dev
Config/ConfigStringplumbing without disturbing the TDS 8.0 strict encryption path: the parallel address selection happens while establishing theTcpStream(inSqlBrowser::connect_named), beforeClient::connect/Connection::connect, which continue to receive an already-connected stream. Doc comments on those constructors now note this.Verification
cargo build(default features): passes.cargo test --libandcargo test --features=all --lib: pass, including the new parsing tests (multi_subnet_failover_parsing,multi_subnet_failover_parsing_missing,multi_subnet_failover_from_ado_string).cargo clippy --features=all: introduces no new lints in the touched code (pre-existing lints from newer stable toolchain are unrelated).cargo fmt: clean.Opened as a draft because the runtime parallel-connect failover behaviour can only be exercised against a live multi-subnet SQL Server (e.g. an Always On availability group listener) with the SQL Browser; the config/connection-string surface is fully unit-tested.
🤖 Generated with Claude Code