Repository navigation
[4.2] fix(cnservice): gate startup on self-visible cluster inventory - #27167
Conversation
Wait for a successful CN heartbeat and an authoritative MOCluster refresh that contains the current CN generation before opening ingress. This prevents replacement CNs from serving IVF queries against a pre-registration local inventory. Add deterministic startup ordering, stale generation, cancellation, refresh failure, and capability regression tests.
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep-reviewed exact head 12b383f2e03499163c077dc979c9a48f12e309d7. No blocking findings.
The startup invariant is closed end-to-end: a successful current CN heartbeat is committed by HAKeeper, a serialized authoritative refresh publishes a newer local snapshot, and the snapshot must contain the exact UUID/pipeline-address/commit generation before bootstrap or Query/SQL/pipeline ingress starts. This preserves the existing label/work-state/pool selection semantics rather than bypassing them.
I specifically revalidated the 4.2 lifecycle differences from main. Failure is fail-closed and reaches the existing startup rollback: the stopper terminates heartbeat/cluster tasks and the cluster/HAKeeper/RPC resources are closed. Heartbeat wait, refresh admission/RPC, and retry timers all have context deadlines; there is no new goroutine or unbounded accumulation.
Local validation:
pkg/cnservice/...: full tests passedpkg/cnservice/...: full-racepassed- 5 new readiness/lifecycle tests:
-race -count=100passed - clusterservice authoritative-refresh/cancel tests:
-race -count=100passed go vet ./pkg/cnservice/...andgit diff --check: passed
Required CI is green; the two cancelled connector jobs are unrelated optional workflows.
Merge Queue Status
This pull request spent 16 seconds in the queue, including 2 seconds running CI. Required conditions to merge
|
What type of PR is this?
Which issue(s) this PR fixes:
issue #27152
What this PR does / why we need it:
Backports #27166 (
f0d9a378ed) to4.2-dev.A replacement CN can publish a successful heartbeat and become visible to Proxy while its own local
MOClusterstill contains a pre-registration snapshot that does not include that CN. IVF entries scans require the current coordinator CN because only it can expose local appendable ranges, so this ordering gap can reject valid requests withrequired-current-cn-outside-pool.This change gates CN startup before bootstrap and all query ingress until:
The retry is bounded by the existing HAKeeper discovery timeout. Failure uses the existing CN startup rollback path. The change does not relax tenant/label pool isolation or IVF's
CurrentCNRequiredrule, and it adds no query or transaction hot-path work.The original regression tests are included unchanged.
Testing
go list -mod=readonly ./pkg/cnservicego build -mod=readonly ./pkg/cnservicego test -mod=readonly -count=1 -timeout=300s ./pkg/cnservice-race -count=100go test -mod=readonly -race -count=1 -timeout=600s ./pkg/cnservicego vet -mod=readonly ./pkg/cnservice