Skip to content

fix(tests): renew view query context after cluster restart - #30517

Merged
mergify[bot] merged 3 commits into
matrixorigin:mainfrom
MatrixAdventurer:fix/30451-restart-query-context
Oct 18, 2026
Merged

mergify[bot] merged 3 commits into
matrixorigin:mainfrom
MatrixAdventurer:fix/30451-restart-query-context

Conversation

@MatrixAdventurer

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 #30451. No automatic issue closure.

What this PR does / why we need it:

由 LW 授权的 ChatGPT Personal 智能体提交。

TestViewDescriptionTwoCN reused its initial three-minute SQL context after releasing and reacquiring the cluster lifecycle lease. A competing package can hold admission beyond that context's deadline: the restart succeeds but the following metadata query fails immediately.

Cancel the first generation's context before restart, then create and defer cancellation of a fresh three-minute query context after cluster.Start() succeeds. Existing SQL, view metadata, persistence, identity and cleanup assertions remain intact. No timeout is extended and admission is unchanged.

Scope: 1 file, +4/-0. No validation workflow or injection helper is included.
Product commit: 1c5bc4a36d0362b5a0ffe6c257ec9031fe81b028, parent/tested main 3c07fac240311d6f2b706674614ed6034e97ff79.
Independent review agent: Approve, including exact remote file/hash, actual test evidence and final delivery object.

Actual verification

Successful fork validation 39098117472, fixed verification commit 83ed8484f8ac69e90620860ea219059d5f476c58, Go 1.27.1 Linux/amd64:

  • Native generation: make -j2 cgo; original no-contention control passes.
  • Controlled failure: actual restart admission wait 185.023274926s, followed by the expected query-context deadline and named-test failure.
  • Same controlled fault with fix: actual admission wait 185.004935538s, named test passes.
  • Full owning package: .agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -vet=all -short -tags=matrixone_test -timeout=20m -v ./pkg/tests/sqlintegration/multicn — 5 root tests pass, 32.641s.
  • Focused race measurement 20.86s, proportional repetition formula selects N=1; the separate race rerun passes (21.07s).
  • gofmt, configured go vet with pinned molint, and incremental golangci-lint v2.14.0 on the owning package pass; lint reports 0 issues.

The controlled red/green phases temporarily use an identical bounded private Unix-socket handshake to order the external 185-second lock holder. The driver archives that instrumentation and byte-restores source before ordinary package, race and static gates. Product SHA256 03c0ad5d1a07addb4dd7288977f8ee5f99642bd1dbcc41b8f51757d74a68e523 matches the restored green artifact and final commit.

Latest main 3fc00709eccc277c175c7a09eed2605ca1aaee29 adds only an unrelated PITR error guard and two frontend test changes after the tested base. Independent review confirmed unchanged target, admission, fixture, native inputs and dependencies; the snapshot-restore test does not exercise that PITR failure path. This evidence is for the fixed tested revision, not a claim of testing a silently rebased tree.

This is focused Linux contention/owning-package validation, not the original 504-package coverage CI or complete repository CI. Upstream merge CI remains to run after PR creation. No merge or deployment is requested.

Keep each generation's 180-second query budget separate from lifecycle admission waiting, and cancel both contexts within the owning test.

由 LW 授权的 ChatGPT Personal 智能体提交。
@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 →

Copy link
Copy Markdown
Contributor Author

由 LW 授权的 ChatGPT Personal 智能体提交。

操作及读回记录:已在本人 fork MatrixAdventurer/matrixone 创建独立分支 fix/30451-restart-query-context,以已验证的固定提交 1c5bc4a36d0362b5a0ffe6c257ec9031fe81b028 提交本 PR。已将本 PR 指派给 XuPeng-SH 并请求其审阅,两项读回确认成功;关联 Issue #30451 添加同一负责人并保留 matrix-meow。最终 diff 1 文件 +4/-0,正文逐字读回一致,mergeable=true(behind)。未执行合并、部署、关闭 Issue。测试和独立 Approve 证据见正文;上游完整 CI 仍待完成。

@MatrixAdventurer

Copy link
Copy Markdown
Contributor Author

接续读回确认(由LW授权的MOI智能体提交):当前 head dd791c5 的上游 CI 已全部完成,结论全绿:

  • CI Required ✅ success(2026-10-18 06:53:52 UTC,run 39102216795)
  • UT Test on Ubuntu/x86 ✅ success(06:53:50);"UT shard summary" 为 UT 主任务成功后的 || 预期路径,非失败、非阻塞
  • SCA Test on Linux/arm64 ✅ success(06:44:00)
  • CI preflight ✅ success(05:56:38)
  • 其余 Compose / Upgrade / Coverage / Darwin 等岗位按路径过滤自动 skipped,必查项均已通过

head 其后无新提交,无人审阅前不做合并:本 PR 继续等待 @XuPeng-SH 审阅。按规则不合并、不关闭关联 Issue。

@XuPeng-SH

XuPeng-SH commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

mo-bot review · mo-bot-xupeng · done

Commit: dd791c5ad72a1c028932b42daea5913d627eb089

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH 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.

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

Commit: dd791c5ad72a1c028932b42daea5913d627eb089

Assessment: approve

Reviewed the complete four-line change and lifecycle owners. The restarted generation receives a fresh SQL deadline after admission completes; existing closures use the reassigned context, cancellation remains correctly owned, and all assertions are preserved. No actionable findings remain.

Model: gpt-6-astra / xhigh

Session: 01a14d34-4e51-79a3-a62d-6c9c16279dc8 · slot 0 · generation 0

Validation:

  • Traced context capture, cluster admission/release, restart failure and SQL cleanup paths. No production behavior, fixture or synchronization mechanism changes.

  • Reconciled successful exact-head Ubuntu UT and Linux/arm64 SCA status records. The repository test runner includes the affected package.

  • Verified the target file matches the author-reported tested product commit and SHA256. Intervening base changes do not affect the reviewed timing contract.

  • Static reconciliation passed: clean exact HEAD, matching patch and git diff --check. review-check.log and review-evidence.json match checks/1792313032587577210-3.json, exit 0, in the assigned attempt directory.

Limitations:

  • No local Go tests were executed. Author-reported contention, package and race runs lack retained raw logs in the supplied bundle; CI evidence contains status records.

  • The full linked issue was not supplied. Approval covers this context-lifetime fix, not closure of the broader CI issue.

@mergify mergify Bot added the queued label Oct 18, 2026
@mergify

mergify Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-18 08:44 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • ✅ Checks passed · in-place
  • ✅ Merged — 2026-10-18 10:39 UTC · at adbdd5c718baca6e4c054194f888b48a4f84a0a2 · squash

This pull request spent 1 hour 55 minutes 6 seconds in the queue, including 1 hour 1 minute 47 seconds running CI.

Required conditions to merge

XuPeng-SH added a commit that referenced this pull request Oct 18, 2026
## 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 #441.

Original failure: [PR #30116 UT
job](https://github.com/matrixorigin/matrixone/actions/runs/39092247053/job/117571304261).

## What this PR does / why we need it:

Full-cluster `Close → Start` released the port-range file lock between
generations, allowing another constructor to acquire the original range
and make restart fail. Add `Cluster.Stop()` through the existing
dependency-aware shutdown: release completed admission and retain the
port lease; final `Close` releases it. Incomplete cleanup retains its
owners and dependencies. Migrate intermediate shutdowns in the ten
restart consumer files, retaining final cleanup and recovery oracles. No
new lifecycle state, allocator, retry or background work is introduced.

Rebased onto main `799523418e9f`, preserving #30517's fresh query
context after the two-CN restart alongside `Stop`.

Also fix the `TestSnapshotMeta` failure from this PR's [Ubuntu UT
job](https://github.com/matrixorigin/matrixone/actions/runs/39099178213/job/117591966537).
The #30381 optimization installed snapshots dated one second in the past
after GC had already reclaimed older objects. Use a fresh timestamp
after the existing GC-disable step and keep ten ordered nanosecond
offsets. All metadata, checkpoint, restart and `DoCheck` assertions
remain; no sleeps, new fixture or production-GC changes are added. A
controlled historical-time reproduction fails with three extra old
system-table objects; the current-time control passes.

Validation on Go 1.27.1, macOS/arm64, repository CGo runner:

- Fresh complete `pkg/embed` normal and race suites: 131 test roots /
457 named passes in each mode, plus two existing skips.
- TAE owning package in CI short/tagged configuration: 265 roots / 298
named passes, plus the existing `TestUpdate` skip. Exact
`TestSnapshotMeta` passes ordinary normal and CI-mode `-short
-tags=matrixone_test -race`; all 17 adaptive race repetitions pass.
- Fresh complete multicn normal suite and exact
`TestViewDescriptionTwoCN` race pass, covering the rebased context
handling and retained port lease together.
- Previously validated unchanged migrated consumers (Arrow
persistence/rollout, MEDIUMINT, AUTO_ID_CACHE reconfiguration, defaults
persistence and accepted-commit recovery) retain normal/race evidence.
Original deterministic real-flock, cleanup/admission stress and
old-behavior negative control remain applicable.
- Incremental gofmt, vet, pinned molint and configured golangci-lint
over all six affected packages: zero issues.

Existing external-MySQL and per-service CN-restart skips in embed, and
the existing `TestUpdate` skip in TAE, remain unchanged. No changed
target scenario is skipped.

Runtime cost is confined to the original embedded lifecycle change:
stopped clusters retain their existing port lease until final `Close`.
Query execution gains no work. The fixture correction retains one clock
read and ten additions. GitHub CI for the updated revision remains
pending.

This branch was previously deployed

1 inactive deployment
ci — 730cd366 Deployed Oct 18, 2026 by mergify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working kind/test-ci size/XS Denotes a PR that changes [1, 9] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants