Skip to content

[4.2] fix: stabilize UT admission, deadlines and CDC readiness - #30620

Merged
XuPeng-SH merged 3 commits into
4.2-devfrom
codex/fix-ut-flaky-4.2-20261020
Oct 20, 2026
Merged

XuPeng-SH merged 3 commits into
4.2-devfrom
codex/fix-ut-flaky-4.2-20261020

Conversation

@XuPeng-SH

@XuPeng-SH XuPeng-SH commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • 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 fix(cdc): bound takeover CN label updates #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.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@XuPeng-SH

XuPeng-SH commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-xupeng · superseded

Commit: fe74e344e7353b973c4d6bfbf3df10d77310ac4b

"interrupted"

@XuPeng-SH

XuPeng-SH commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-local · done

Commit: fe74e344e7353b973c4d6bfbf3df10d77310ac4b

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mo-bot review · mo-bot-local · review

Commit: fe74e344e7353b973c4d6bfbf3df10d77310ac4b

Assessment: approve

Reviewed the complete five-file delta and affected callers. Transaction-specific admission prevents unrelated SQL from capturing test barriers. Label phases reuse existing update/refresh owners, bound cancellation and cleanup, and preserve the legacy three-second operational API. The design is cohesive and proportionate; no actionable findings remain.

Model: gpt-6-astra / xhigh

Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1

Validation:

  • Reviewed transaction identity, competing SQL, commit/rollback/retry assertions, partial label-update failures, authoritative observation, callback shutdown, restoration and API compatibility.

  • On Linux/amd64 with Go 1.26.4, isolation preflight passed and native prerequisites were built through the repository Makefile from 173 verified frozen inputs. Formatting, diff checks, targeted build and vet passed; source remained unchanged.

  • All eight affected issue-test roots passed normally. Full clusterservice and ctl suites passed normally; full clusterservice, ctl and issues suites passed under the race detector, covering 121 top-level tests.

  • Race stress passed: ODKU 16 repetitions, stale COPY ALTER 81, stale INPLACE ALTER 90, standalone DROP 17, IVF 3, and 100 each for transaction identity, label phases, legacy label API and context-aware label API.

  • Independently reconciled commands, source fingerprints, exits, retained logs and behavioral scope for 19 execution receipts. Evidence mapping and detailed assessment are retained in /home/xupeng/.local/state/mo-bot/jobs/ccdeba0f1517821332f7e0bc/attempt-1/validation-manifest.json, receipt-audit.log and review-notes.json.

Limitations:

  • The supplied CI snapshot still had Linux checks in progress. Author Darwin/arm64 claims lacked retained execution receipts and were not relied upon.

  • Linked issue bodies and historical failure logs were not supplied. Validation establishes current ownership and deadline behavior, without establishing the historical latency cause or eliminating every possible flake.

  • No throughput benchmark was run: normal SELECT/DML/DDL paths are unchanged. Source analysis shows constant-time operational API checks and fewer fixture label-update/refresh calls; these are not measured workload gains.

@XuPeng-SH XuPeng-SH changed the title [4.2] fix: scope flaky UT admission and label phases [4.2] fix: stabilize UT admission, deadlines and CDC readiness Oct 20, 2026
@XuPeng-SH

XuPeng-SH commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-xupeng · superseded

Commit: 7d9fb439950aa2e9165cfd886067f568a39f8725

"interrupted"

@XuPeng-SH

XuPeng-SH commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-local · done

Commit: 7d9fb439950aa2e9165cfd886067f568a39f8725

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mo-bot review · mo-bot-local · review

Commit: 7d9fb439950aa2e9165cfd886067f568a39f8725

Assessment: approve

Reviewed the complete seven-file delta and affected callers. The design preserves existing label-update ownership and compatibility while correcting test admission, deadline, readiness and cleanup contracts. Normal SQL paths remain unchanged. No actionable findings remain.

Model: gpt-6-astra / xhigh

Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1

Validation:

  • Reconciled 14 current check receipts and 19 retained receipts/logs. Verified unchanged inputs before reusing earlier clusterservice, ctl and issues validation.

  • Linux/amd64, Go 1.26.4: isolation preflight passed; all 173 native inputs and recovered library hashes verified.

  • All four focused test roots passed normally. Full lockservice and embed race suites passed 548 top-level tests.

  • Lock race stress passed 52 explicit-timeout, 53 zero-timeout and 100 holder-release repetitions. CDC integration passed two race repetitions in one process.

  • Injected premature-error and ignored-context controls failed as expected, confirming the deadline tests detect those regressions.

  • Formatting, diff checks and targeted go vet passed. Source remained unchanged.

  • Evidence and detailed review: /home/xupeng/.local/state/mo-bot/jobs/f0bb841657e2546d44a300f9/attempt-1/validation-manifest.json and review-notes.json.

Limitations:

  • The frozen CI snapshot remained in progress. Darwin execution claims lacked retained receipts; independent execution was Linux/amd64.

  • Existing TestRestartCN remains skipped. Linked issue bodies and historical failure logs were unavailable; elimination of every historical flake is not established.

  • No throughput benchmark was needed for the constant-time checks on operational label updates; test timings do not establish whole-CI performance improvements.

@iamlinjunhong iamlinjunhong left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已审查 head 7d9fb439950aa2e9165cfd886067f568a39f8725 相对目标分支 4.2-dev base 7ea8a11b78a673079316aed85ed9b07edc5072ce 的全部七个文件变更,未发现可确认的 P0、P1、P2 或 P3 问题。结论:APPROVE。

重点核查了可选 CN 标签更新接口与旧三秒超时 API 的兼容性、HAKeeper 更新和权威刷新调用链、事务与连接身份匹配、锁等待 deadline 断言、异步回调与清理的同步,以及 fulltext2 CDC 事件帧持久化和 MATCH 就绪边界。现有结果、重试、回滚及相邻索引断言保留。

验证:本地完成代码静态审查,git diff --check 通过;未展开稀疏检出或在本地执行测试。Loom 提供的当前 head CI 快照包含 36 个已结束检查:20 success、14 skipped、2 neutral,无失败;其中 Ubuntu UT、UT Coverage 和 SCA 检查成功。PR mergeable=true,mergeable_state=behind。

已读取历史 reviews、inline comments 和 PR conversation;没有此前由本审查账号提出的待回复问题。本次结论基于当前代码与提供的 CI 快照,未将其他自动审查正文中的测试执行声明视为本次独立验证。

@iamlinjunhong iamlinjunhong left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已独立审查 PR #30620 当前 head 7d9fb439950aa2e9165cfd886067f568a39f8725 相对目标分支 4.2-dev base 7ea8a11b78a673079316aed85ed9b07edc5072ce 的全部七个文件变更,未发现可确认的 P0、P1、P2 或 P3 问题。结论:APPROVE。

已同步 origin/main 和 PR 远端 head,并确认 head 未变化。重点核查了可选 CN 标签接口与旧三秒超时 API 的兼容性、HAKeeper 更新与权威刷新调用链、事务和连接身份匹配、锁等待的 caller deadline 及 worker 清理、标签失效回调与恢复的同步,以及 fulltext2 CDC 帧在同一事务持久化后首次 MATCH 的就绪边界。现有结果、回滚、重试、相邻索引和授权断言仍保留。

验证范围:本地完成静态代码审查,git diff --check 通过;未展开稀疏检出,未修改源代码,未在本地运行测试。Loom 提供的当前 head CI 快照共 36 个已结束检查:20 success、14 skipped、2 neutral,无失败,其中 Ubuntu UT、UT Coverage 和 SCA 检查成功。历史 review、inline comments 和 PR conversation 已读取;既有同 head APPROVE 没有遗留问题,本次结论未依赖其他自动 review 中的测试执行声明。

@aptend aptend left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

APPROVE at exact head 7d9fb439950aa2e9165cfd886067f568a39f8725, declared base/merge-base 7ea8a11b78a673079316aed85ed9b07edc5072ce on 4.2-dev (freshly fetched). Reviewed all seven files and every changed hunk, all four historical reviews/discussion; no inline or resolved/unresolved threads. This is focused fixture/deadline correctness repair and a compatibility-preserving semantic backport, not a major architecture change requiring a separate design artifact.

Independently checked:

  • Optional context capability does not widen MOCluster or change the legacy three-second ctl API. Caller deadline and cancellation propagate through the existing HAKeeper retry/RPC/error owner; invalid contexts do not contact HAKeeper.
  • Admission hooks identify the active transaction, service and exact connection, without reading unrelated mutable session status. Real competing SQL before/during the pause is excluded; ALTER/standalone, DDL-first, rebuild/retry, rollback/result and neighboring-index assertions remain.
  • IVF label phases verify exact CN identities and both account/role labels after authoritative refresh. Callback mutation and cleanup serialize; cancel/join precedes fresh-context restoration, which attempts every target after partial failure and reports errors.
  • Lock tests separate holder setup from the caller budget, prove live contention and exact DeadlineExceeded, cover zero/explicit timeouts and holder release, and join before hook restoration.
  • First fulltext MATCH waits for durable CDC frames (persisted with the watermark in one transaction), then checks exact TXT/PDF/Chinese results. Mutation/compaction/HNSW and tenant-authority assertions remain. Database/index cleanup runs before closing the HTTP source.

Validation reused only after inspecting exact-head execution, selection/mode and terminal outcomes:

  • Linux UT118409425180, Go1.26.4, native CGo wrapper smoke, -race -short -tags matrixone_test, all light/exclusive/heavy groups: terminal success, no failed packages/cases. Named affected Issue29715, IVF and tenant CDC scenarios PASS; the root selector/runner includes clusterservice, ctl and lockservice. IVF21.51s, tenant CDC101.48s are observations, not performance claims.
  • Coverage execution retained report: producer passed, exit0,34151 pass events, no package/test failure.
  • Configured SCA118409425263: Go1.26.4/arm64, golangci-lint2.6.2,0 final issues, terminal success.
  • Local git diff --check PASS. No redundant local build/test run or other reviewer's stress count is presented as my own execution.
Audit Closure
Q1 Connections, fixture, HTTP server, timers and workers retain cleanup owners; callback cancel/join precedes restoration and teardown.
Q2 Caller/phase deadlines reach existing wait/RPC/refresh owners; barriers release on failure; no new wait cycle.
Q3 Finite fixture CN targets, buffered completion channels and scoped observations; no new production retained state or unbounded retry.

No blocking finding. This does not establish the physical cause of historical HAKeeper slowdown, eliminate every flake, fix unrelated cache coherence, or prove whole-CI runtime improvement. Primary workspace/source untouched; review performed in its own exact-head detached worktree.

This branch was previously deployed

1 inactive deployment
ci — 0698b4c9 Deployed Oct 20, 2026 by XuPeng-SH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/api-change kind/bug Something isn't working kind/test-ci size/L Denotes a PR that changes [500,999] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants