Repository navigation
fix(cdc): bound takeover CN label updates - #30337
Conversation
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? |
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 12138fb854b292928341662dd0dbd51ff855cd3f
Assessment: request_changes
Reviewed the complete four-file delta and affected callers. The design preserves legacy timeouts, reuses the existing RPC owner, and adds no SQL hot-path work. Race tests passed; no code defect was found. One PR-description delivery requirement remains.
Model: gpt-6-astra / xhigh
Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1
- P2
.github/mergify.yml:10: Squash-merge automation extracts## What this PR does / why we need it:from the PR body, but the frozen description contains only## Summaryand## Validation.
Impact: The required input to the commit-message template is missing. Restore the repository’s PR headings, place the issue reference in its issue section, and move the existing explanation and validation under the required description heading.
Evidence: The stored evidence.json body omits all three template headings. pr-description-check.log and receipt checks/1792125643517963896-4.json confirm this delivery-contract failure with exit 1. This is a static input-contract finding, not an observed Mergify execution failure.
Validation:
-
Full clusterservice package passed with -race: 37 root tests, including legacy label behavior and caller-deadline validation. Receipt checks/1792125448285410337-4.json; clusterservice-race.log.
-
Exact TestCDCNoFullPublicTakeoverLifecycle passed with -race -short -tags=matrixone_test in 20.22 seconds, including teardown. Receipt checks/1792125649887025169-3.json; cdc-takeover-race.log.
-
Isolation preflight passed. Verified 192 matching native inputs and 19 retained artifacts against the repository-owner build evidence before reuse.
-
Source remained clean at the frozen head; supplied patch and diff checks matched. Commands, source fingerprints, exit receipts and logs were reconciled in /home/xupeng/.local/state/mo-bot/jobs/5a89e612a2261ed988ea9e4b/attempt-1/review-evidence.json.
Limitations:
-
Linked issue #30231’s original body and logs were absent from frozen evidence; its contract was assessed from the PR description and source.
-
The supplied CI snapshot reports successful substantive checks, but detailed CI logs and author-run receipts were unavailable. Local runs establish the focused behavioral results above.
-
One takeover execution does not measure long-run flake frequency; no performance improvement percentage is claimed.
aptend
left a comment
There was a problem hiding this comment.
Deep review of exact head 12138fb854b292928341662dd0dbd51ff855cd3f against base 76deafc8062f9a7e33a31a4df858ebcdb9477cb5: APPROVE. No remaining blocking finding.
The previous review's description/template finding is now closed. I independently checked the default-branch template and merge configuration, then reread the live GitHub body immediately before submission: the type, real issue #30231 and exact ## What this PR does / why we need it: headings are present in order, with substantive content. The code head is unchanged. An earlier prepared delivery-only request-changes payload was not posted, because the pre-submit body-equality guard detected the author's correction. Metadata-only correction does not invalidate the exact-head code/test evidence below. This is not an assertion that a live Mergify rendering failure occurred or was experimentally reproduced.
Implementation and validation
Read all four changed files, surrounding callers, full linked issue #30231, the previous review and conversation; there are no inline comments or review threads. This narrow deadline-ownership bugfix is design-document-exempt, not a new feature/major refactor.
The legacy API still constructs its three-second cause-bearing context. The new optional capability rejects nil, unbounded and pre-canceled contexts before contacting HAKeeper, and forwards a valid caller context without shortening its deadline. Existing MOCluster implementers are not forced to implement a new method. All takeover label updates/cleanup use fresh 30-second children capped by the unchanged 240-second scenario budget. Phase barriers, ownership-generation/checkpoint assertions and cleanup are retained; no new sleeps, retry loops or global timeout increases.
Traced managed HAKeeper retry/RPC/raft forwarding: the caller owns cancellation, the existing request/future owner still releases RPC resources, and no new goroutine, shared lock-held wait or retained queue is introduced. Expired scenario contexts fail before another label RPC; the test still closes its owned cluster generation.
In the detached exact-head worktree, with fresh make -j4 cgo and the repository CGo wrapper:
- Full clusterservice normal
-count=1 -vet=all: 37 roots PASS, package 0.371s. - Full clusterservice
-race -count=1 -vet=all: 37 roots PASS, package 1.383s. - Exact legacy
TestCluster_DebugUpdateCNLabeland newTestCluster_DebugUpdateCNLabelWithContexteach passed a separate-race -count=100command. Initial per-test times were below JSON resolution, so adaptive B=30s selects N=100; no repeated whole-package stress. - Exact
TestCDCNoFullPublicTakeoverLifecycle,-race -short -tags matrixone_test -count=1 -vet=all: PASS, root 21.500s, package/teardown 22.659s, terminal exit 0. B=30s gives N=1, covered by this exact execution. This includes real A→B→C ownership transfer and delayed cancellation/checkpoint assertions. - Diff whitespace and clean-source checks pass. No production changes or temporary source probes.
- Exact-head CI Required and substantive checks report success; skipped lanes are not executed passes.
One successful takeover run does not establish a long-run flake rate or prove that all possible HAKeeper progress stalls are repaired. The bounded caller-deadline policy is sound in the reviewed scope; no implementation or delivery change is requested.
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep review completed for 5b93943f340debc6245dfcc8467b0a48b6120b03 against aa4b6eddfdad54d11be6fd75a5675eb9801f6690. No blocking findings.
Design and ownership: the optional context-aware capability follows the existing CN work-state API. The legacy label entry point retains its three-second deadline and cause. The takeover test supplies a bounded child context to the existing HAKeeper RPC; no second retry loop, state owner, storage or execution path is introduced. This is a narrow bug fix, exempt from a separate feature design document.
I traced the test's actual label calls through clusterservice, the managed HAKeeper client, RPC future cleanup and the store proposal. Nil/unbounded/canceled/expired contexts fail before dispatch; downstream errors propagate; caller deadlines are preserved. The test retains its takeover, generation, watermark and cancellation assertions. Barrier-release defers and owned cluster-generation teardown cover assertion failures. This addresses the local three-second budget identified in #30231; it does not claim to fix every underlying HAKeeper stall.
The implementation delta is +25 lines across two files; test delta +78/-5 across two files; no separate documentation files. The tests cover observable API behavior and reuse existing fixtures. There is no additional SQL/CDC data-path work or new background resource; no production throughput benchmark is claimed.
Validation evidence was independently reconciled with source and terminal raw logs, rather than rerun solely to refresh timestamps:
- Exact-head clusterservice normal and race suites: 37 passing tests each; both label API roots also passed 100 race repetitions each.
- Exact-head formatting, vet, configured molint/golangci scope passed.
- SQL integration normal (315 named tests), takeover lifecycle race (20.07s test / 23.02s package), and ctl normal/race (52 named tests each) passed on earlier validated commits. I checked the complete intervening diffs: only clusterservice unit-test changes and an interface documentation clarification differ; production behavior, integration/consumer tests, dependencies, native inputs and fixtures are unchanged. Those results are applicable semantic reuse, not new exact-head executions.
- Current CI Required is successful.
Review history was rechecked: the prior requested change concerned the required PR-body template; the current body contains the required headings and fixes reference. There are no unresolved inline review threads.
Merge Queue Status
This pull request spent 4 hours 31 minutes 35 seconds in the queue, including 50 minutes 26 seconds running CI. Required conditions to merge
|
|
合并后独立实测(2026-10-17,冻结 main 完整 pkg/clusterservice 普通/race 各 37 个命名测试通过;legacy ctl consumer 普通/race 各 52 个通过。验证旧 API 固定 3 秒期限仍保留、新 API 原样转发有界 caller deadline,nil/无期限/取消/过期 context 在 RPC 前拒绝,及 RPC 错误传播对照。 真实多 CN 的 TestCDCNoFullPublicTakeoverLifecycle,normal 19.34s、race 23.48s,均实际执行且 teardown 成功,保留 A→B→C 的 daemon claim 转移、checkpoint/generation、取消和清理断言。 结论覆盖调用方 deadline 边界及本次真实接管回归;两次通过不等同长期 flake rate 保证,也不宣称所有 HAKeeper progress stall 或原始完整 CI 环境问题消失。 原 issue 报告的 main 修复范围已验证,按约定转给 @Ariznawlll;新增独立问题继续由其单独 issue 跟踪。 |
## What type of PR is this? - [x] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [x] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Related to #30231. ## What this PR does / why we need it: Fix two independently reproduced UT flake mechanisms seen in #30609 and #30612 on `4.2-dev`: - Scope catalog admission hooks to the intended service, connection and active transaction. An unrelated transaction on the same CN could capture the barrier and leave the writer admission count at zero. Apply the same ownership rule to the neighboring DDL-first and stale-ALTER fixtures. Add real competing SQL before and during the paused writer; retain all ALTER/standalone, retry, rollback, result and neighboring-index assertions. - Semantic-backport main's optional caller-context CN label API from #30337, preserving the legacy three-second operational API and existing HAKeeper execution path. Use a bounded phase context and authoritative refresh in the IVF integration test. Remove redundant label updates and resultless refresh polling. - Serialize strict-boundary invalidation with cleanup. Cancel and join the callback before restoring labels with a fresh context; attempt every target after partial failure and report cleanup errors. Check exact CN identities and both labels. Validation (Go 1.26.4, Darwin/arm64, matching native libraries): - Full `clusterservice` and operational `ctl` packages: normal and race. - All affected Issue29715/27966 tests: normal and race. - Ten race repetitions of ALTER/standalone late admission; three race repetitions of the real IVF test. - Deadline/error/identity and partial-update/refresh/cleanup unit cases; configured incremental gofmt, vet, molint and golangci-lint. - `gpt-6.1-sol` / `xhigh` design and overall review. No production query-path, wire, schema or global-timeout change. This fixes the demonstrated fixture mechanisms; it does not establish the physical cause of the historical HAKeeper slowdown or eliminate every possible CI flake. Linux CI remains pending. ### CI follow-up The first Linux run exposed two additional test synchronization defects: - Lock caller-deadline tests shared the holder's setup budget, then asserted a lower bound on only the remaining wait. Separate setup from the fresh caller deadline, observe real contention, and require `context.DeadlineExceeded` rather than elapsed-time floors. Cover zero and explicit lock timeouts and successful release; cancel, release and join workers before restoring private hooks. - The tenant stage/fulltext2 test polled MATCH before CDC readiness. Wait for the durable tail before the first content query, using the same boundary as its mutation checks. Bound tail/checksum SQL with one 30-second context per transition, report SQL errors, and stop indexed work before closing the HTTP source. Preserve TXT/PDF/Chinese/DOCX, mutation, compaction/HNSW and authorization assertions. A real-SQL diagnostic probe observed an initial empty MATCH, recovery after durable tail, and successful first MATCH on a fresh readiness-first table. It did not reproduce a persistent stale cache or prove the historical failure's exact cache state; no diagnostic eviction is included in the patch. Additional local validation: complete lockservice/embed packages in normal and race modes; final changed lock cases in normal/race with ten bounded repetitions; three focused readiness-root race repetitions; two expected-failure controls rejecting premature errors and ignored caller contexts; incremental formatting/vet/molint/lint. The `gpt-6.1-sol` / `xhigh` review's cleanup finding was corrected and re-reviewed. The old UT run also exhausted the outer 60-minute wrapper before plan/report completion. These focused corrections do not establish a whole-CI runtime improvement. PROXY's check annotation reports that its hosted runner lost communication; its absent coverage is a consequence of that interruption. New-head remote CI remains pending.
## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [x] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Related to #30847 and #30337; umbrella #30838. ## What this PR does / why we need it: CN label update, patch and deletion detached their preflight checker-state reads into a fresh background deadline even when the caller supplied a bounded context. Use the caller context for both read and proposal, matching CN work-state updates. Reuse the existing store fixture to distinguish rejection of an expired request from a missing-CN error or successful no-op deletion. Keep the CDC takeover cleanup and ownership/checkpoint assertions intact; the original timeout was not reproduced locally, so this does not claim to eliminate every HAKeeper stall. The grouped SUM portion adds correctness tests and caller-sized benchmark controls only. Production SUM code is identical to main. Group invokes BatchFill in hashmap.UnitLimit-sized chunks (256 rows), so cover those calls with original vector offsets, 4/254/255/256 groups, sequential/permuted high-cardinality IDs and a high endpoint. Preserve large-call controls, NULLs, constants, sparse/unmatched groups, repeated groups and the deferred physical-overflow order witness. The range-index optimization and its previous 5.07x claim are withdrawn. Its recorded regressions are rejected results, not accepted tradeoffs or current-head performance evidence. No replacement SUM optimization, speedup, retry loop, global timeout increase, test hook or wire change is introduced. Validation on Linux/amd64: affected store and HAKeeper RPC consumers and grouped SUM regressions pass normally and under race; full local static checks pass. A matched current-source comparison against clean main uses independent binaries and ten balanced process pairs, excluding the first result per case/process. Production SUM is byte-identical. The large-call permuted control measures 400.272 versus 404.339 microseconds (+0.95% paired; ratio 95% interval [0.9958, 1.0228]); the caller-sized permuted control measures 130.859 versus 131.376 microseconds (+0.40%; [0.9863, 1.0119]). All nine intervals include equality and all scored controls report zero allocations. These measurements do not claim a SUM speedup. The historical +155.68% result describes the removed implementation. Fresh remote CI is pending. The previous preflight exceeded its execution limit; its targeted retry passed. Coverage then timed out fetching the repository before tests. No coverage threshold or job timeout is weakened. --------- Co-authored-by: XuPeng-SH <[email protected]> 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 #30231
What this PR does / why we need it:
The CDC takeover lifecycle test used
DebugUpdateCNLabel, whose fixed three-second deadline could expire during real multi-CN takeover even while the scenario's 240-second budget remained valid. Let this caller own a bounded label-update deadline while preserving the legacy operational API.MOCluster.DebugUpdateCNLabeland its three-second cause-bearing deadline unchanged for existing callers.CNLabelUpdaterWithContext; require a non-nil context with a deadline, reject canceled/expired contexts before RPC, and forward valid contexts to the existing HAKeeper client.Rebased onto main
aa4b6eddfdad54d11be6fd75a5675eb9801f6690.No new retry loop, sleep, global timeout/configuration change, wire/schema change or SQL/CDC data-path work is introduced. This fixes the helper-local deadline mismatch; it does not claim to repair every HAKeeper progress stall or establish a long-run flake rate.
Validation
Final-content validation on macOS arm64, Go 1.27.1, with repository-supported native artifacts and CGo test wrapper:
make -j4 cgo: passed; the immutable ONNX dependency was served from a local cache with the official pinned SHA-256 check retained.pkg/clusterservice, normal and-race -count=1: 37 named tests each passed. Exact legacy/new label-update roots each passed a separate-race -count=100run selected from a 30-second adaptive budget.pkg/tests/sqlintegration,-short -tags matrixone_test -p=1 -count=1: 315 named tests passed, includingTestCDCNoFullPublicTakeoverLifecycle(19.28s).TestCDCNoFullPublicTakeoverLifecycle,-race -short -tags matrixone_test -p=1 -count=1: passed in 20.07s; package/teardown completed in 23.02s. The 30-second adaptive budget selects one run.pkg/sql/plan/function/ctl, normal and race short/tagged: 52 named tests each passed.go vet, configured molint and golangci-lint 2.14.0 over the two changed packages plusctl: passed; golangci reported 0 issues. Formatting and diff whitespace checks passed. On macOS the identical configured golangci command was invoked directly to preserve its native-library loader environment.The required
gpt-6.1-sol / xhighdesign and final overall review, source fingerprints and terminal command receipts are retained in the delivery task record. CI triggered by the updated branch remains pending; local results do not claim CI success.