Repository navigation
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? |
aptend
left a comment
There was a problem hiding this comment.
Deep-reviewed the startup readiness invariant and the success, timeout, cancellation, refresh-failure, rollback, and concurrent-refresh paths. The gate is bounded, stays off query hot paths, preserves fail-closed pool semantics, and verifies the exact heartbeat identity fields needed for the replacement-CN race. Exact-head package build, vet, full cnservice tests, and focused race tests passed.
|
Queued — the merge queue status continues in this comment ↓. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep review completed on exact head f0d9a378ed0524ca36140bc9c129b535b51f4ef6.
No blocking findings. The startup gate closes the actual replacement-CN race at the ownership boundary: it waits for a successful current-generation heartbeat, performs a serialized authoritative refresh, and verifies the local inventory entry by service ID, pipeline address, and commit before bootstrap or ingress can open. It preserves fail-closed placement and IVF current-CN correctness instead of synthesizing pool membership.
I traced startup, heartbeat, authoritative refresh serialization, timeout/cancellation, partial-start rollback, concurrent background refresh, and shutdown dependencies. The wait is bounded by the existing HAKeeper discovery timeout, retries follow the heartbeat cadence, and there is no query-path cost. On this exact head, git diff --check, package list/build/vet, the full pkg/cnservice test suite, and the focused readiness tests under -race -count=20 all passed.
Merge Queue Status
This pull request spent 26 minutes 58 seconds in the queue, with no time running CI. ReasonPull request #27166 has been merged manually at 91dfe8c HintYou were too fast! Tick the box to put this pull request back in the merge queue (same as
|
…27167) Backports #27166 (`f0d9a378ed`) to `4.2-dev`. A replacement CN can publish a successful heartbeat and become visible to Proxy while its own local `MOCluster` still 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 with `required-current-cn-outside-pool`. This change gates CN startup before bootstrap and all query ingress until: 1. the first CN heartbeat succeeds; 2. an authoritative local cluster refresh succeeds; and 3. the refreshed snapshot contains this CN's service ID, pipeline address, and build commit. 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 `CurrentCNRequired` rule, and it adds no query or transaction hot-path work. The original regression tests are included unchanged. Approved by: @XuPeng-SH
…xorigin#27166) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes matrixorigin#27152 ## What this PR does / why we need it: A replacement CN can publish a successful heartbeat and become visible to Proxy while its own local `MOCluster` still 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. The pool-aware scheduler therefore rejects those requests with `required-current-cn-outside-pool`. This PR adds a CN startup readiness gate before bootstrap and all query ingress: 1. Wait for the first successful CN heartbeat. 2. Synchronously refresh the local cluster snapshot through `AuthoritativeRefresher`. 3. Require the snapshot to contain this CN's service ID, pipeline address, and build commit. 4. Retry at the heartbeat cadence while bounded by the existing HAKeeper discovery timeout. 5. Fail startup and use the existing rollback path if readiness cannot be established. The change does not synthesize the current CN into a resolved pool and does not relax IVF's `CurrentCNRequired` rule, so tenant/label pool isolation and IVF local-range correctness are unchanged. It runs only during CN startup and adds no query or transaction hot-path work. Regression tests cover: - stale CN generations with an old pipeline address or build commit; - cancellation before the first successful heartbeat; - authoritative refresh failure; - rejection of a cluster implementation without authoritative refresh; - proof that `service.Start` cannot enter bootstrap before the self-visible inventory gate opens. ## Testing - `go test -mod=readonly -count=1 -timeout 300s ./pkg/cnservice` - `go test -mod=readonly -race -count=10 -timeout 300s ./pkg/cnservice -run '^(TestClusterSelfReadiness.*|TestServiceStartDoesNotBootstrapBeforeClusterSelfReady)$'` - `go test -mod=readonly -race -count=1 -timeout 600s ./pkg/cnservice` - `go vet -mod=readonly ./pkg/cnservice` New production functions have 90.9%, 90.0%, 100%, and 100% statement coverage. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…xorigin#27166) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes matrixorigin#27152 ## What this PR does / why we need it: A replacement CN can publish a successful heartbeat and become visible to Proxy while its own local `MOCluster` still 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. The pool-aware scheduler therefore rejects those requests with `required-current-cn-outside-pool`. This PR adds a CN startup readiness gate before bootstrap and all query ingress: 1. Wait for the first successful CN heartbeat. 2. Synchronously refresh the local cluster snapshot through `AuthoritativeRefresher`. 3. Require the snapshot to contain this CN's service ID, pipeline address, and build commit. 4. Retry at the heartbeat cadence while bounded by the existing HAKeeper discovery timeout. 5. Fail startup and use the existing rollback path if readiness cannot be established. The change does not synthesize the current CN into a resolved pool and does not relax IVF's `CurrentCNRequired` rule, so tenant/label pool isolation and IVF local-range correctness are unchanged. It runs only during CN startup and adds no query or transaction hot-path work. Regression tests cover: - stale CN generations with an old pipeline address or build commit; - cancellation before the first successful heartbeat; - authoritative refresh failure; - rejection of a cluster implementation without authoritative refresh; - proof that `service.Start` cannot enter bootstrap before the self-visible inventory gate opens. ## Testing - `go test -mod=readonly -count=1 -timeout 300s ./pkg/cnservice` - `go test -mod=readonly -race -count=10 -timeout 300s ./pkg/cnservice -run '^(TestClusterSelfReadiness.*|TestServiceStartDoesNotBootstrapBeforeClusterSelfReady)$'` - `go test -mod=readonly -race -count=1 -timeout 600s ./pkg/cnservice` - `go vet -mod=readonly ./pkg/cnservice` New production functions have 90.9%, 90.0%, 100%, and 100% statement coverage. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…xorigin#27166) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes matrixorigin#27152 ## What this PR does / why we need it: A replacement CN can publish a successful heartbeat and become visible to Proxy while its own local `MOCluster` still 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. The pool-aware scheduler therefore rejects those requests with `required-current-cn-outside-pool`. This PR adds a CN startup readiness gate before bootstrap and all query ingress: 1. Wait for the first successful CN heartbeat. 2. Synchronously refresh the local cluster snapshot through `AuthoritativeRefresher`. 3. Require the snapshot to contain this CN's service ID, pipeline address, and build commit. 4. Retry at the heartbeat cadence while bounded by the existing HAKeeper discovery timeout. 5. Fail startup and use the existing rollback path if readiness cannot be established. The change does not synthesize the current CN into a resolved pool and does not relax IVF's `CurrentCNRequired` rule, so tenant/label pool isolation and IVF local-range correctness are unchanged. It runs only during CN startup and adds no query or transaction hot-path work. Regression tests cover: - stale CN generations with an old pipeline address or build commit; - cancellation before the first successful heartbeat; - authoritative refresh failure; - rejection of a cluster implementation without authoritative refresh; - proof that `service.Start` cannot enter bootstrap before the self-visible inventory gate opens. ## Testing - `go test -mod=readonly -count=1 -timeout 300s ./pkg/cnservice` - `go test -mod=readonly -race -count=10 -timeout 300s ./pkg/cnservice -run '^(TestClusterSelfReadiness.*|TestServiceStartDoesNotBootstrapBeforeClusterSelfReady)$'` - `go test -mod=readonly -race -count=1 -timeout 600s ./pkg/cnservice` - `go vet -mod=readonly ./pkg/cnservice` New production functions have 90.9%, 90.0%, 100%, and 100% statement coverage. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #27152
What this PR does / why we need it:
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. The pool-aware scheduler therefore rejects those requests withrequired-current-cn-outside-pool.This PR adds a CN startup readiness gate before bootstrap and all query ingress:
AuthoritativeRefresher.The change does not synthesize the current CN into a resolved pool and does not relax IVF's
CurrentCNRequiredrule, so tenant/label pool isolation and IVF local-range correctness are unchanged. It runs only during CN startup and adds no query or transaction hot-path work.Regression tests cover:
service.Startcannot enter bootstrap before the self-visible inventory gate opens.Testing
go test -mod=readonly -count=1 -timeout 300s ./pkg/cnservicego test -mod=readonly -race -count=10 -timeout 300s ./pkg/cnservice -run '^(TestClusterSelfReadiness.*|TestServiceStartDoesNotBootstrapBeforeClusterSelfReady)$'go test -mod=readonly -race -count=1 -timeout 600s ./pkg/cnservicego vet -mod=readonly ./pkg/cnserviceNew production functions have 90.9%, 90.0%, 100%, and 100% statement coverage.