Repository navigation
enhance: resolve global cluster topology via DNS SRV records - #3753
Conversation
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3753 +/- ##
==========================================
+ Coverage 94.73% 94.89% +0.16%
==========================================
Files 81 81
Lines 17102 17784 +682
==========================================
+ Hits 16201 16877 +676
- Misses 901 907 +6 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
bff88a1 to
cee8d91
Compare
ededb38 to
231aa9e
Compare
bigsheeper
left a comment
There was a problem hiding this comment.
Code review of the SRV topology resolution change. 10 findings, ranked most severe first as inline comments (1 = most severe). Findings 1-5 are correctness issues; 6-10 are diagnostics and cleanup.
e14cbba to
0c76258
Compare
0c76258 to
edeb7a0
Compare
Adversarial review found one high-severity address-normalization bug in the new High
(raised by xiaocai2333, tinswzy) Medium
(raised by xiaocai2333)
(raised by tinswzy, xiaocai2333) |
This review found one concurrency regression in the recovery path and one correctness issue in the new bounded topology refresh. High
(raised by chyezh, bigsheeper) Medium
(raised by chyezh, bigsheeper) |
Adversarial review found no issues requiring changes. Verified:
Tests were read but not run in this round. The relevant ones are the event-gated concurrent-recovery and late-delivery tests in |
Discover ha-manager seed servers through the _grpc._tcp.<host> SRV record set instead of hitting the global endpoint directly, then concurrently probe the nearest seeds (spanning priorities) and use the topology with the highest version. The topology request now carries the raw endpoint hostname verbatim via the ?endpoint= query parameter; the server derives the global cluster id from it (its first DNS label), so the SDK does no gcid parsing. Endpoints without SRV records raise instead of falling back to the legacy beta path. Adds a dnspython dependency for SRV resolution. Signed-off-by: huanghaoyuanhhy <haoyuan.huang@zilliz.com>
All writes to the connection strategy's shared topology now funnel through
a lock-guarded compare-and-set (_accept_topology), so a stale answer can
no longer regress the version however threads interleave:
- initial connect: a background watcher answer arriving before the main
thread installs the first answer is no longer overwritten by it
- on_unavailable: a wait-all answer at or behind the cached version is
rejected instead of being assigned unconditionally
- _on_topology_change: late callbacks from older watchers/refreshes are
ignored when they do not advance the version
fetch_topology now returns None when cached_version is set and no seed
reports a strictly higher version ("no update available"), and the
refresher's private-snapshot write is a compare-and-set under its lock
as well.
Adds tests for the initial-connect lost-update race, stale-answer
rejection on the callback and UNAVAILABLE paths, the None contract, and
the refresher's get_current (shared topology) comparison path.
Signed-off-by: huanghaoyuanhhy <haoyuan.huang@zilliz.com>
48ec0da to
2e55db0
Compare
|
/lgtm |
|
/assign @XuanYang-cn Hi @XuanYang-cn, this PR is ready for approval: all findings from bigsheeper's three adversarial reviews are fixed and verified (0 must-fix in the final pass), he has given |
pymilvus-bot review follow-ups: - _primary_host_port re-adds the brackets urlparse().hostname strips from an IPv6 literal, so handlers and recovery reconnect build valid gRPC targets like [2001:db8::5]:443; on_unavailable still compares the same normalized form on both sides. - _probe_seed now raises SeedAuthError (a MilvusException subclass) for HTTP 401/403. _probe_candidates aborts the wait as soon as one seed rejects the token and no seed has answered yet: the same token goes to every seed, so waiting out a stalled probe cannot change the outcome. A rejection arriving after a successful answer is kept as before and never discards the answer. Covered by IPv6 normalization/handler/on_unavailable tests and two-seed fail-fast and answer-preservation regression tests. Signed-off-by: huanghaoyuanhhy <haoyuan.huang@zilliz.com>
…ange Address remaining pymilvus-bot review findings: - Verify resolved SRV seed hostnames belong to the global endpoint's authorized delegated domain before sending bearer tokens over HTTPS. Anchors at the global-cluster subzone label when present (covering SaaS, BYOC, and multi-label public suffixes like .com.cn) with a parent-domain fallback, rejecting untrusted targets on a label boundary without retry. - Retry initial sync/async connection once against the updated primary if readiness fails after the background watcher installs a newer topology. Clean up the strategy (stopping TopologyRefresher and closing the handler) when initial handler creation or readiness fails. - Normalize scheme-less primary endpoints in _primary_host_port. Signed-off-by: huanghaoyuanhhy <haoyuan.huang@zilliz.com>
|
This pull request is merged. |
Signed-off-by: huanghaoyuanhhy <haoyuan.huang@zilliz.com>
a9d84b5 to
54efcc6
Compare
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: huanghaoyuanhhy, XuanYang-cn The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Why
Global cluster connections previously fetched topology by hitting the global endpoint directly. This PR switches the SDK to discover ha-manager seed servers through the
_grpc._tcp.<host>SRV record set, verify target domain authorization before sending credentials, probe seeds concurrently, and adopt the highest topology version with strict no-rollback semantics across every refresh and recovery path.What changed
_grpc._tcp.<endpoint hostname>to ha-manager seeds, ordered bypriorityascending andweightdescending (filtering RFC 2782.targets). Endpoints without SRV records (NXDOMAIN,NoAnswer, or.) raise immediately instead of falling back to the legacy direct-endpoint path.global-cluster.<base>when present, with a parent-domain fallback) before sending bearer tokens over HTTPS. Untrusted targets are dropped, and if all targets fail verificationSrvTargetValidationErroris raised without retry.DEFAULT_PROBE_COUNT = 2seeds spanning priorities (weighted by SRV weight, or uniformly when all weights are zero) and return the first healthy answer immediately while a daemon watcher drains remaining probes and applies strictly higher versions. If initial channel readiness fails on a stale primary after the watcher advances the cached primary, retry once against the updated primary and clean upTopologyRefresherif setup still fails.TopologyRefresher&on_unavailable): poll every seed concurrently, bound the extra foreground wait after the first healthy answer toPROBE_GRACE_PERIOD = 1.0sso blackholed seeds cannot stall RPC recovery, and hand still-pending probes to the background watcher.initial connect,watcher,TopologyRefresher, andon_unavailable) through a lock-guarded compare-and-set (_accept_topology), removing the refresher's private snapshot so no interleaving can regress the version.host:portwith scheme-aware default ports and preserved IPv6 brackets) across handler creation,get_recovery_address, andon_unavailable(primary_address != handler.server_address), and re-checkrecovery_genon synchandle_errorso concurrent callers still retry after another thread recovers the connection.MAX_RETRIES = 3), keeping the last seed error on final failure.SeedAuthError, aborting stalled waits when no seed has succeeded yet), and server APIcode != 0.?endpoint=(server derives the global cluster id; no client-side gcid parsing).dnspython>=2.0.0dependency for SRV resolution.Tests
277 passedDeployment note
HA manager SRV records must be in place before this SDK version ships — endpoints without SRV records will raise instead of falling back to the legacy path.