Skip to content

perf: reduce race UT fixture costs and quadratic dedup work - #30381

Merged
XuPeng-SH merged 22 commits into
mainfrom
codex/ut-race-critical-path-20261016
Oct 16, 2026
Merged

XuPeng-SH merged 22 commits into
mainfrom
codex/ut-race-critical-path-20261016

Conversation

@XuPeng-SH

@XuPeng-SH XuPeng-SH commented Oct 16, 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 #29562 (continued work after the original issue was closed; this PR does not claim the 600-second CI target).

Fixes #30392.

What this PR does / why we need it:

Reduce repeated fixture work and quadratic operations exercised by race UT, while preserving actual SQL behavior, transaction visibility, failure paths and case isolation. Rebased onto main 6b081a1fcf. The follow-up changes previously pushed separately are now included in this PR. Historical validation entries below identify their original tested revisions.

Implementation and responsibility

  • GC checkpoint checking no longer waits for a watermark while holding the mutation lock needed to publish that watermark. Validate the currently published state through the existing owner.
  • Reuse the canonical SQL fixture and its failure cleanup for the large-OR regression. Preserve its 23,790 rows, 2,048 terms, prepared/cache/NULL/cancellation assertions; remove the redundant private cluster lifecycle.
  • Keep workspace delete membership local to txnTable.contains. Index only when both sides exceed 32 live rows, bound the index by the smaller input, and preserve exact RowID identity and NULL marking. No index survives a call.
  • Match replacement column IDs through a local exact-name map over the existing relation definitions instead of a nested scan. Preserve origin-case fallback, missing names and error-before-mutation behavior.
  • For persisted variable-length PK dedup, retain the existing block/operator/MVCC ownership. After 32 unresolved probes, build a block-local bucket index bounded by block rows. Hash at most 16 bytes from each edge, compare complete bytes before loading MVCC, and retain reverse row/version order. Preserve abort, missing timestamp, uncommitted row, inclusive time-window and WW conflict policy. No retained key copies or global cache.
  • Resolve planner mock variables on demand rather than recreating an entire map and decimal value for each read. Preserve dynamic SQL mode and override hooks; explicitly cover the real planner's default/error fallback.
  • Configure metrics tests through the configuration consumed by InitMetric; the old 30ms setter was overwritten by the default 15-second interval. Preserve real asynchronous gather, SQL export and HTTP checks. Drive the existing on-heap metrics test through the real periodic task with a virtual clock. Restore the readiness callback in the existing serialized fixture, close the HTTP response, cancel test work, and stop the existing ticker on exit.
  • Remove the unused production MockCleaner and its self-tests; exercise the actual GC queue/lifecycle instead. Require observed replay faults, checkpoint progress and recovered PITR state before accepting recovery tests. Trim redundant spill input while retaining the spill boundary and outcomes.

Diff accounting against current main: implementation +222/-323 (net -101), tests +1,494/-854 (net +640), documentation 0; total net +539. New test lines assert real boundaries and independent oracles rather than counting as a cleanup benefit.

No storage/catalog/wire format changes. No new scheduler, worker pool, process-wide cache, compatibility branch or fixture state machine.

Review follow-up: replay ID watermark regression

Fixed in 6b5dde417e. The review finding is valid: checkpoint replay workers can publish recovered table IDs concurrently, but the old Load / compare / Store sequence could lower the allocator watermark. Restoring table 1001 before the worker for table 1000 finished could leave the watermark at 1000, making the next local table ID collide.

The existing IdAllocator now owns a CAS-based AdvanceTo operation. All four replay ID methods (database, table, object, block) use that primitive. SetStart keeps its absolute initialization/reset semantics, and ordinary allocation retains its existing single atomic increment. No new state, locks, waits, persistence fields, DDL retries or timeout increases. The PITR fixture requires successful creation before dereferencing the relation and rolls back a failed creation; every recovery/retention assertion remains.

Validation for this follow-up:

  • Original allocator: the new concurrent invariant test failed 19/20 race repetitions; table, database, object and block variants all reproduced a lost watermark.
  • An old-allocator control using a diagnostic-only PITR test overlay reproduced allocator=1000 existing_table_id=1001, followed by ExpectedDup (one failing recovery out of 25). The diagnostic overlay is not committed.
  • Fixed allocator: TestReplayIDAllocatorMonotonic passed 50 race repetitions; unmodified TestPitrMeta passed 25 race repetitions, including all post-restart assertions.
  • Complete pkg/vm/engine/tae/common, pkg/vm/engine/tae/catalog and pkg/vm/engine/tae/db/test owners passed normal and race runs on this follow-up. go vet and incremental golangci-lint passed with 0 issues.

The replay/fixture failure is reproduced; a user-facing SQL incident is not claimed. The nine-package checkpoint below explicitly refers to the earlier head; this follow-up revalidates the changed allocator/recovery owners.

Local performance evidence

These are sequential local comparisons recorded before the last rebase, not matched CI-runner measurements. They must not be added together as a whole-CI saving; some cases belong to the same package.

Scope Before After
TAE DB package, race 78.0s 68.1s
Large OR plus adjacent SQL tests, race 32.8s 21.3s
Wide-column public SQL case, race 36.7–45.2s 29.1s
Planner package, race 73.2s 70.1s
Metrics package, race 20.65s 6.68s

Planner peak PSS fell about 9%. Metrics CPU stayed approximately flat, peak PSS fell slightly, and memory-time area fell about 69%. Full SQL integration wall time was approximately unchanged (~201s) in the reverse-order comparison; memory peaks did not improve universally.

Tradeoffs: the byte-dedup operator adds about 20ns and one small allocation in the point-probe microbenchmark. The adaptive index adds bounded temporary memory, and deliberately colliding buckets can retain linear scans. Long-key misses and deliberate collisions were measured; the implementation does not claim every input is faster. Full-key hashing was rejected after a 32KB cold-miss regression.

Validation

On rebased head cb3b72892f, fresh sequential normal UT and race UT both passed all nine affected packages, with 20,396 passing test/subtest outcomes in each mode and zero failures. Whole SQL integration passed all 298 outcomes in both modes. go vet passed and incremental golangci-lint reported 0 issues.

The tested owners are pkg/sql/colexec/group, pkg/sql/compile, pkg/sql/plan, pkg/tests/sqlintegration, pkg/util/metric/mometric, pkg/vm/engine/tae/db/gc/v3, pkg/vm/engine/tae/db/test, pkg/vm/engine/tae/tables, and pkg/vm/engine/tae/txn/txnimpl.

Both test modes used -mod=readonly -vet=off -short -tags matrixone_test -p=1 -count=1 -timeout=10m; the race mode additionally used -race. Static checks used go vet -mod=readonly and golangci-lint run --concurrency=1 --timeout=10m -c .golangci.yml --new-from-rev=origin/main over those owners. Native libraries and CGo include/link paths matched this worktree.

  • Original and optimized implementations both pass the same byte-dedup counterexamples: reverse version order, strict/incremental missing timestamps, abort/uncommitted rows, time-window boundaries, WW/error precedence, zero metadata loads on misses, deliberate bucket collisions, constant/NULL logical rows, selected probes and prefilled RowIDs across 10 registered variable-length types.
  • Workspace tests use an independent scalar membership oracle and cover thresholds, asymmetric inputs, duplicate/unsorted deletes, object/block identity, NULLs, repeated calls and later workspace appends. Benchmarks restore both RowID contents and the NULL mask each iteration.
  • The original metrics binary reproduces the shuffled nil readiness-callback panic. The fixed package passes three shuffled race repetitions; identical original outcomes are retained. Metrics production coverage increased from 575 to 578 statements with no previously covered block lost.
  • Planner retains all 15,814 original test outcomes. Unchanged production covered-statement count is preserved; one canceled-request statement swaps between two legal ready-select paths, so the exact hit sets are not claimed identical.
  • Whole SQL integration passed all 298 outcomes before the final rebase, including real COPY/ALTER, OR, transaction/rollback and cancellation paths.

This PR does not claim a full-repository UT/BVT pass or ten minutes of CI savings. Full mo-tester BVT was not run in this iteration; real public SQL integration and the affected owners are the local acceptance scope.

Latest follow-up: bounded issues scheduling, fixture quality and CI race

  • Use the existing issues dispatcher with 8 partitions, 4 process slots and 2 Go execution threads per child on Linux runners requesting at least 8 tasks. Preserve smaller-budget/platform defaults and explicit serial rollback. Remove the experimental early-planner branch; existing planner lifecycle remains authoritative.
  • Fix [Bug]: MemoryFS listing deadlocks when its consumer deletes or writes files #30392: MemoryFS.List takes the existing O(1) copy-on-write B-tree snapshot and releases locks before consumer callbacks, allowing the actual export merge consumer to delete uploaded source files without self-deadlocking. No file payload copy or persistence change.
  • Preserve complete export success, lookup failure and upload failure contracts while using virtual time for real retry/deadline paths. Export/db production coverage blocks increased from 503 to 505 with no original covered block lost. Strengthen complete row-deletion and CSV retention oracles; replace quadratic spill multiset matching with sorting an owned result copy; avoid unnecessary fixture scanner allocations while retaining the same full SQL-file scope.
  • Fix the race reported by CI job 116865176619: faultMap.run writes a live fault entry's hit count while GETCOUNT reads it in its caller. Use atomic count publication/observation; the result of the same increment drives unchanged frequency/skip selection. Keep TestSnapshotGC's actual replay-hit assertion.

Validation: the new public concurrent GETCOUNT regression reproduces the original fault.go:144/172 race before the fix. Fixed regression passed 100 race repetitions; the complete fault owner passed race, vet and incremental golangci-lint (0 issues). TestSnapshotGC passed its initial race run and 22 consecutive race repetitions (28.85 seconds), retaining the real asynchronous replay-hit assertion. Scheduler owner passed complete normal/race runs, vet and incremental lint. On the rebased main, all 1,568 issues test/subtest outcomes passed under race in 247.8 seconds with 6.24 GiB peak PSS and no OOM in a 12 GiB/no-swap limit.

Matched local issues A/B: 365.25 -> 244.03 seconds (33% lower), identical test outcomes. This is a stage result, not a measured whole-CI saving. The previous CI used the old two-slot policy; its UT step took 74m29s, with approximately 20m30s light, 16m50s issues and 23m embedded. No claim that this follow-up alone solves the whole CI critical path or achieves the ten-minute target.

Post-rebase local acceptance (ce4a56397e)

Base: main 6b081a1fcf. Full make ut UT_PARALLEL=8 passed with Go 1.27.1, CPU/native libraries, matrixone_test, -short and -race: 77,134 test/subtest passes, 79 skips, zero failures, exit 0, total wall time 29m38s including local prerequisites and reporting. No new skip was added.

Incremental formatting, Shell syntax, go vet and golangci-lint passed across all changed owners (20 original owners plus the CN owner follow-up); lint reported 0 issues. The full-run discovery also fixed two test-isolation defects: Make defaults now ignore the parent UT_PARALLEL override, with an eight-task parent always modeled; the CN memory-limit test establishes and restores its own runtime limit and verifies that querying leaves it unchanged. The latter passed 10 race repetitions with GOMEMLIMIT=6GiB before the clean full run. The interrupted first attempt is not counted as a pass.

Resource boundary: one 8-CPU/16-GiB scope, swap disabled. Peak aggregate PSS 6.21 GiB, cgroup peak 9.16 GiB including file cache; no limit-hit/OOM/OOM-kill events and no remaining test-scope processes after completion. These are local validation results, not a CI time-saving claim.

@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 16, 2026 •

Copy link
Copy Markdown
Contributor Author

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

Commit: cb3b72892ffabfea5d9914cf9cfc862795863024

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: cb3b72892ffabfea5d9914cf9cfc862795863024

Assessment: request_changes

Reviewed the complete 25-file delta. The local indexes and existing lifecycle ownership are reasonable, but the strengthened PITR recovery test has a reproducible validation failure.

Model: gpt-6-astra / xhigh

Session: 01a13dcf-1586-7a01-9000-d45e20995cf8 · slot 1 · generation 1

  • P2 pkg/vm/engine/tae/db/test/db_test.go:8355: Validation requirement: repeating TestPitrMeta under -race after the new forced checkpoint/restart can leave the table allocator at 1000 while the catalog already contains table 1001.
    Impact: CreateRelation2 returns ExpectedDup, then rel5.ID() panics before the post-restart PITR assertions execute. Resolve the replay-ID collision or fixture allocation contract, require successful creation before dereferencing rel5, and pass the repeated recovery check without weakening its assertions.
    Evidence: The exact-head run with -race -count=11 -run '^TestPitrMeta$' failed on iteration six at lines 8388/8390. stress-TestPitrMeta.jsonl and checks/1792133529467900804-353.json retain the failure and exit 1. A logging-only overlay reproduced the allocator/catalog mismatch and panic. The merge-base control passed 11 iterations, but three returned before restart. The allocator code is unchanged; this finding concerns the strengthened test's unmet validation contract, not a newly introduced production allocator defect.

Validation:

  • All nine affected packages passed normal tests. Metrics, GC v3, TAE DB and SQL integration passed complete race runs. Public SQL integration recorded 298 passing test/subtest outcomes.

  • Focused repetitions passed for metrics, GC queue/lock checks, snapshot recovery, ISCP recovery and large-OR fixture reuse. Shuffled metrics execution exercised callback restoration. PITR repetition failed as detailed above.

  • Deduplication oracles passed against candidate and merge-base implementations. Benchmark medians: 1024-key byte dedup 11.03 ms → 0.446 ms; 4096×4096 workspace filtering 52.20 ms → 0.147 ms. Point byte probes increased 232.5 ns → 260.4 ns, adding one allocation and 80 bytes.

  • Built compatible native prerequisites through make cgo and used mo-cgo-test with the supplied isolation executor. Receipts, source fingerprints and logs were reconciled in /home/xupeng/.local/state/mo-bot/jobs/67ad8e8691241ed39f18374a/attempt-1/evidence-audit.json; input-provenance.json verifies native inputs and diagnostic overlays. Assigned source remained clean.

Limitations:

  • Frozen CI was pending; local_validation supplied no retained author artifacts. Pre-rebase performance claims were not accepted as current-head verification.

  • Full-repository tests and mo-tester BVT were not run. Issue #29562's body was not supplied; assessment follows the documented PR contract, which excludes the 600-second CI target.

@XuPeng-SH

XuPeng-SH commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor Author

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

Commit: 6b5dde417e7e872992c3adfa8187d4c1626c5951

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: 6b5dde417e7e872992c3adfa8187d4c1626c5951

Assessment: approve

Reviewed the complete 28-file delta and affected callers. The design keeps transient indexes and cleanup with existing owners, preserves deduplication semantics, and restores monotonic replay-ID advancement without changing ordinary allocation. The earlier PITR validation failure is resolved. No actionable findings remain.

Model: gpt-6-astra / xhigh

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

Validation:

  • Current-head common, catalog and TAE DB packages passed normal tests. Those packages and SQL integration passed complete race runs, including 298 passing SQL test/subtest outcomes. The preexisting TestUpdate skip remains unchanged.

  • TestReplayIDAllocatorMonotonic passed 100 race-enabled repetitions; TestPitrMeta passed all 11 repetitions covering the previous failure window. Replacing only the allocator implementation with its prior version made the new regression test fail as expected.

  • Independently reconciled 28 retained command/source/exit receipts and corresponding logs. Verified the four-file follow-up before reusing unchanged optimization, fixture, GC, metrics, scalar-oracle and benchmark evidence; reran recovery-sensitive validation on the current head.

  • Retained benchmark medians show 1024-key byte dedup improving from 11.03 ms to 0.446 ms and 4096×4096 workspace filtering from 52.20 ms to 0.147 ms. Accepted costs include transient index memory and point probes increasing from 232.5 ns to 260.4 ns, with one additional 80-byte allocation.

  • Isolation preflight, repository-owned native provenance verification and git diff --check passed. Assigned source and diagnostic checkout remained clean.

  • Receipts and retained logs are reconciled in /home/xupeng/.local/state/mo-bot/jobs/c545f84ff8e248e636a46a25/attempt-1/current-evidence-audit.json and retained-evidence-audit.json. review-notes.json records all behavioral closures and accepted tradeoffs.

Limitations:

  • Frozen CI was pending and local_validation contained no author artifact inventory. No full-repository test suite or mo-tester BVT run is claimed.

  • Linked issue #29562's body was not supplied. This assessment follows the documented PR scope, which excludes the 600-second CI target; no total CI-runtime or end-to-end SQL throughput improvement is claimed.

@XuPeng-SH

XuPeng-SH commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor Author

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

Commit: 376842fa7f333331ce3d48619bcc1703739d1e19

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: 376842fa7f333331ce3d48619bcc1703739d1e19

Assessment: approve

Reviewed the complete 42-file delta and affected callers. No actionable findings remain. The design preserves existing responsibility owners, uses bounded temporary indexes, fixes reentrant listing and counter synchronization, and strengthens recovery tests. The previous PITR allocator finding is resolved.

Model: gpt-6-astra / xhigh

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

Validation:

  • Independently reconciled 20 retained command/source/exit receipts with log hashes, selections and outcomes. Evidence covers 20 packages normally, 12 under race, affected public SQL and recovery paths, focused repetitions, vet and expected failing base controls.

  • All 42 PR files and build/module inputs match the retained tested revision. The seven intervening upstream changes were assessed for semantic relevance; product tests were reused, not rerun or represented as fresh-head execution.

  • Separately reconciled historical recovery evidence: 100 allocator race repetitions and 11 PITR recovery repetitions passed; old allocator and PITR failures remain distinguished from successful checks.

  • Matched benchmark medians: byte dedup 1024×1024 improved from 10.905 ms to 0.407 ms; workspace filtering 4096×4096 improved from 52.325 ms to 0.141 ms. Point dedup added approximately 45 ns and 80 bytes per call. Bounded transient-memory costs are accepted.

  • Current native-provenance verification, pinned BTree dependency checksum, source-cleanliness and diff checks passed. Evidence and review notes are indexed in /home/xupeng/.local/state/mo-bot/jobs/4aad3e50d1df4e8f830edf47/attempt-1/final-evidence-manifest.json. Final audit receipt: checks/1792149883866523361-4.json, exit 0.

Limitations:

  • The frozen CI snapshot includes a failed Connector/J Pool Reset E2E without diagnostic output and pending checks. No green-CI claim or causal product defect is inferred from those statuses.

  • Four-cluster issues-stage timing and peak-memory figures remain author-reported. Full-repository UT and separate mo-tester BVT were not rerun; retained skips are not counted as passes.

  • Standalone linked-issue bodies were not supplied. Review follows their contracts stated in the frozen PR evidence and does not claim achievement of the ten-minute CI target.

@XuPeng-SH

XuPeng-SH commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor Author

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

Commit: ce4a56397e6e9c0deb8863482111e341a15abc84

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: ce4a56397e6e9c0deb8863482111e341a15abc84

Assessment: approve

Reviewed the complete 43-file delta and affected callers. The design preserves existing ownership, bounds temporary indexes, fixes synchronization defects, and strengthens recovery and test isolation. The previous PITR allocator concern is resolved. No actionable findings remain.

Model: gpt-6-astra / xhigh

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

Validation:

  • Current-head scheduler suites passed normally and under race: 338 test/subtest outcomes each with UT_PARALLEL=8. The memory-limit regression passed ten race repetitions with GOMEMLIMIT=1GiB.

  • Diagnostic overlays restoring the previous tests reproduced both inherited-environment failures. These expected control failures are distinguished from candidate passes.

  • Vet passed for both newly changed test owners. Formatting, diff checks, isolation preflight and repository-owned native provenance verification passed. Source remained unchanged.

  • Independently reconciled 20 retained receipts and logs covering 20 normal and 12 race package suites, including SQL and recovery paths. Verified 41 unchanged PR paths and assessed intervening upstream changes before reuse. Six historical recovery records separately substantiate allocator and PITR closure.

  • Retained benchmark medians show byte dedup improving from 10.905 ms to 0.407 ms and workspace filtering from 52.325 ms to 0.141 ms. Accepted costs include bounded temporary memory and approximately 45 ns plus 80 bytes for point dedup.

  • Evidence is indexed in /home/xupeng/.local/state/mo-bot/jobs/fd4f45f41d094ae74fa32926/attempt-1/final-evidence-manifest.json. Final audit receipt: checks/1792150747722971137-6.json, exit 0.

Limitations:

  • Frozen CI remains pending. Full-repository UT and separate mo-tester BVT were not run; retained skips are not counted as passes.

  • Four-cluster stage timing and peak-memory figures remain author-reported. No whole-CI speedup is independently established.

  • Standalone linked-issue bodies were not supplied. Assessment follows their contracts in the frozen PR evidence, which explicitly excludes the ten-minute CI target.

Copy link
Copy Markdown
Contributor Author

最近 24 小时合并项复核(main aa4b6eddfdad54d11be6fd75a5675eb9801f6690):发现受影响的 spill 成功路径 UT 依赖真实宿主磁盘空闲容量,已创建 #30450。

在约 8.8 GiB 空闲空间的文件系统上,自动 spill 预算按既有 16 GiB emergency headroom 策略得到 cap=1;Group 的四个根测试隔离重复 3 次均失败(12/12),Window 的多个正常 spill 场景也在同样 cap=1 下失败。仅在 Group 测试夹具中显式设置 bounded spill 预算的临时 overlay,使相同 12 次执行全部通过,原结果和清理断言保持。

这是已复现的测试夹具宿主容量依赖;没有把它归因于本 PR 新引入,也没有认定生产磁盘保护策略错误。本 PR 涉及的这几个 DISTINCT spill 回归,在修复夹具依赖前不能标为完整验证通过。详见 #30450 的命令、失败与对照数据。

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 — 5cf22a99 Deployed Oct 16, 2026 by XuPeng-SH
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/enhancement kind/refactor Code refactor kind/test-ci size/XL Denotes a PR that changes [1000, 1999] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: MemoryFS listing deadlocks when its consumer deletes or writes files

2 participants