Skip to content

perf(test): reduce race UT work and close lifecycle regressions - #30277

Merged
XuPeng-SH merged 12 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/ut-race-next-20261015
Oct 15, 2026
Merged

XuPeng-SH merged 12 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/ut-race-next-20261015

Conversation

@XuPeng-SH

@XuPeng-SH XuPeng-SH commented Oct 15, 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:

Fixes #30232.
Fixes #30243.
Related to #29562 (the existing UT performance tracking issue is closed; this is a follow-up).

What this PR does / why we need it:

Reduce work inside the existing race UT execution path, preserving the same runner, test roots, CN topology, assertions, race instrumentation, coverage and BVT selection. Reuse the existing Go package scheduler and cluster-admission owner; no new worker pools are introduced.

Design and implementation

  • Constant folding: reuse a successful whole-subtree spatial-capability scan during recursive folding. Keep both existing folding owners, their guard placement, spatial admission requirements, prepared-expression behavior and child evaluation order. No persistent cache or mutable cross-query state.
  • CN startup: enqueue the initial heartbeat through the existing serial heartbeat owner after command targets have been constructed. Cancellation is checked before sending queued work. Frontend readiness remains governed by its existing owner.
  • Mock cluster teardown tests: use private namespaces of the existing admission manager. These mocks start no real services and should not reserve the real cluster admission slots. Real file locks, lease ownership and release semantics remain tested; actual clusters retain the runner admission mechanism.
  • Object metadata: empty/all-NULL batches contribute no NDV, so skip their dense HLL allocation/scan while preserving NULL counts, zone maps and sketches from preceding non-NULL batches. Remove unused pkData retention and its unused getter: Bloom filters still consume the current PK vector immediately and PK NDV still uses row count. This state was never serialized; no disk format/version or old-data reader changes.
  • Wide DDL: reuse the existing Unicode SimpleFold key implementation for linear duplicate-column detection, retaining EqualFold equivalence and the existing error order. Build the legacy 4098-column/two-partition fixture from a minimal SQL-derived template with the original column attributes. Keep its actual width, rows, COPY, rollback, rejection/error-code and cleanup assertions. Existing legal CREATE boundary UT/BVT remain intact.
  • [Bug]: CI flaky candidate: all_consumers_skipped races scheduler completion #30232: observe durable broadcast-consumer retirement even when scheduler completion is already ready; retain the final scheduler result. The old late-observation oracle failed 4/10 controlled runs; the corrected test passed 100 rounds.
  • [Bug]: race UT TestIssue4007 intermittently fails remote lock retry #30243: use the existing RPC filter to select both retry-before-keeper and keeper-before-Lock-handler schedules. Preserve successful same-txn retry before invalidation; after authoritative keeper rejection, assert fencing, release old intents, and verify fresh-txn recovery. The old same-txn-success oracle failed 3/3 deterministic race runs. Production fencing is unchanged. Retire fixture tables through their existing lifecycle owner.
  • Tighten existing sink/pipeline tests to cover accepted work queued before failure, exactly once completion, cleanup and original-error preservation. Remove an unnecessary fixed startup sleep.

Implementation and test counts are recorded in the PR diff; no experiment artifacts are included. For the eight retained commits: implementation 11 files, +103/-79; tests 15 files, +488/-198. No documentation or experiment files are committed; moving the fold helper is not counted as a cleanup benefit.

Measured local results and limits

Controlled sequential arms used Linux amd64, Go 1.27.1, GCC 14.2, identical source/native inputs within each pair, GOMAXPROCS=2 per test process, an eight-CPU quota, 16 GiB aggregate memory limit and no swap. These are staged measurements at base 501c85ecdd6eee0195172743c6d8aaf125cb252d, before the final four-commit main rebase; they are not exact-head whole-CI measurements.

Scope Wall before / after Resource result
Full embedded package, same 406 PASS + 2 existing SKIP terminals 204.15 / 177.18 s Integrated aggregate PSS about -15%; CPU about +1.2%; peak PSS about +8.5%
Unchanged large-OR SQL integration scenario 36.16 / 15.33 s CPU 38.37 / 13.64 s; peak PSS about -6%
NULL-sketch change, unchanged wide SQL scenario (reverse-order pair) 54.27 / 50.16 s CPU 64.73 / 57.77 s; peak PSS about -5.7%
Additional wide-template/linear-validation change (reverse-order pair) 49.12 / 45.49 s CPU 56.93 / 50.04 s; integrated PSS about -8%; peak PSS about +7.8%

The wide tests also passed forward-order comparisons; those controls had larger wall-time variance and are not used as the conservative estimate. These overlapping staged results must not be summed into an end-to-end CI saving. Whole-CI peak-memory reduction and the ten-minute CI target remain unproven.

Validation

Before rebase:

  • Full planner normal and race: 15,414 PASS + 2 unchanged SKIP terminals each; configured incremental SCA PASS. Planner coverage 80,239/94,997 -> 80,240/94,997 statements, no unchanged-source-block coverage regression (prior normal/current race profiles).
  • Full plan/rule folding validation retained all prior terminal scenarios. Spatial distance families, invalid inactive branches and independent list-element admission are explicitly covered.
  • Full CN/compile normal and race: PASS; objectio/ioutil normal/race: 126 PASS each; admission race: PASS. Admission coverage union matches 100/110 statements in both arms. Objectio retained-block coverage is unchanged; removing dead code changes its aggregate 66.10247% to 66.10169% (both round to 66.10%).
  • [Bug]: race UT TestIssue4007 intermittently fails remote lock retry #30243: 50 race rounds / 150 named PASS terminals; related race regressions 15 PASS; full lockservice normal 870 PASS; configured incremental SCA 0 issues.
  • Actual ddl/table_column_limit.sql BVT comparison on an isolated current-code embedded instance: 34/34 statements PASS, zero ignored, twice on the same instance. ISCP readiness was observed before execution and database cleanup was asserted between and after rounds. Expected results were not regenerated.

Rebase and ordinary embedded package scheduling

Rebased onto main 83222fa8371007c7969d3aeca3ab8ced90695f4c; current head 26b298f88f8d17469d5e7c6cc7307cb831464610. Range-diff confirms all eight retained patches are unchanged by this rebase. The separate fulltext repair was removed following the merged rollback of #30189; the affected fulltext files match main.

The six ordinary embedded packages previously ran through go test -p 1. Use the existing Go scheduler with at most two test processes, GOMAXPROCS=2 each, and the existing two-slot cluster admission owner. The four-batch embedded groups still run at most two batches concurrently. Existing high-footprint/unknown-package classification forces serial execution; one/four-issue-batch defaults and explicit serial rollback remain available. Failure, cancellation and report ownership stay in the original driver. No cases, assertions, CN topology, coverage instrumentation or BVT selection are removed.

A sequential local pair on identical source/native inputs, with a four-CPU quota, 8 GiB memory cap and no swap, measured the complete six-package ordinary wave:

Metric Serial Two concurrent processes
Wall time 185.642 s 116.567 s (-37.2%)
CPU time 179.389 s 198.032 s (+10.4%)
Aggregate test-process peak PSS 2.169 GiB 3.180 GiB
Integrated PSS baseline +4.1%

Both arms retained the identical 163 named terminal outcomes (150 PASS, 13 existing SKIP). This improves wall time with a resource tradeoff; it does not demonstrate reduced whole-CI CPU or memory. Against the observed 500-second ordinary CI wave, proportional scaling suggests roughly three minutes saved, not yet verified in CI. Four concurrent processes were measured separately but are not adopted because of their larger memory peak. These results cannot be added to overlapping earlier measurements to claim the ten-minute target.

Validation:

  • On final rebased head: actual six-package Go race driver PASS, all six packages successful, 150 named PASS and 13 existing SKIP; terminal process exit 0.
  • On final rebased head: configured incremental SCA across all ten changed Go packages PASS, 0 issues, terminal exit 0.
  • On final rebased head: production mo-service build PASS, terminal exit 0; binary metadata records revision 26b298f88f8d17469d5e7c6cc7307cb831464610, vcs.modified=false.
  • Full optools race suite: 324 named PASS, zero failure/skip, terminal exit 0 before rebase; its source and this stage's patches are unchanged by the rebase. Existing tests cover defaults, serial rollback, unknown/high-footprint classification, admission settings and failure handling.
  • An initial local lint run hit its own 6 GiB scope limit (exit 137); rerunning with concurrency 1, GOMEMLIMIT=6 GiB and a 10 GiB scope passed. This was not a lint diagnostic.
  • A local MinIO executable on the root filesystem stalled while reading its own binary checksum. Both fresh measurement arms and actual-driver runs used a byte-identical copy on NVMe; the MinIO cases passed without skips or longer timeouts.
  • No new full BVT run is claimed for this scheduling-only stage; historical production-change BVT evidence is retained above.

Earlier full local race attempt (26b298f; historical failure)

The complete local race runner has been started on head 26b298f88f8d17469d5e7c6cc7307cb831464610, using the repository Make/runner entry point with no package filters or added skips. Native prerequisites completed and the light stage is running. It observed a local MinIO startup failure in pkg/sql/colexec/external/TestExternalArrowLoadFromLocalMinIOAndRejectsObjectChange (connection refused after the 15-second readiness budget; no MinIO log output). This full-run invocation omitted the previously validated byte-identical NVMe MinIO copy from PATH. A focused repeat on the same source/native inputs with that copy passed: named test 7.54 s, package 9.13 s, process exit 0. The root-filesystem checksum-read stall is consistent with earlier diagnosis but is not proved for this particular failure. The original full-run failure is retained; the full run remains pending and must not be reported as a clean PASS.

Local limits are eight CPU cores, 16 GiB memory and no swap within the test scope. The local invocation uses UT_PARALLEL=8, light parallelism 6 and inherited GOMAXPROCS=2; the referenced CI used UT_PARALLEL=6 without this explicit global GOMAXPROCS. Cache, host contention and these settings prevent claiming a directly comparable CI speedup from the local total alone. Whole-CI savings of ten minutes and reductions in total CPU/peak memory remain unproven.

The next investigation profiles actual repeated work and cluster lifecycle cost. Experimental fixture changes are kept outside the delivery tree until both their benefit and behavioral equivalence are established.

Review and outstanding scope

Whole-change self-review covers implementation, tests, ownership/cleanup, cancellation, Unicode equivalence, spatial capability preservation, persistence compatibility and hot-path cost. The merged fulltext rollback was inspected for interaction; the now-obsolete dependent repair was removed. No independent subagent review is claimed.

#30229 and #30209 remain open and are not fixed by this PR. Their causes have not been proved; no retries, longer waits, skips or weaker assertions are added to claim acceptance. Complete Coverage UT and full BVT suite results are not claimed. The later complete race execution and repaired report finalization are recorded below.

Local raw evidence, arm scripts, coverage comparisons, profiles and cgroup/PSS samples: /home/xupeng/ut-race-next-20261015/.

WAL recovery readiness (92bbd2b)

Reuse the existing client discovery policy to select a replica with a usable service address. Remove the fixed five-second delay and second gossip lookup: neither established stable leadership. The existing connection plus linearizable marker/lease reads remain the authority for replay readiness. The bounded discovery wait, cancellation, fencing, dirty-target rejection and WAL format remain unchanged. Shared discovery normalization is a pure helper used by public discovery and recovery; no worker, state machine, retry layer or configuration is added.

The two existing real recovery test roots previously took 27.65 + 15.52 seconds; candidate focused run took 2.55 + 0.52 seconds. This removes eight fixed waits (40 seconds in this local test scope), not a proven whole-CI saving. Existing test selection and assertions are unchanged.

Validation: full logservice normal and race each 582 named PASS; bootstrap recovery 11 race rounds PASS and dirty-target/fence recovery 57 race rounds PASS. Incremental configured SCA for pkg/logservice: 0 issues, exit 0. Those test runs used byte-identical candidate overlays except a subsequent local variable/private parameter rename from leaderServiceAddress to replicaServiceAddress; no behavior changed. No fresh full BVT is claimed for this stage.

Complete local race run: FAILED, follow-up in progress

The complete local make ut run on 26b298f ended with exit 2; it is not a complete-suite PASS. Its logservice code preceded the WAL optimization above. The external MinIO case failed with connection refused; a focused identical-source race rerun using the byte-identical NVMe MinIO executable passed (7.54 seconds). A slow root-filesystem executable checksum read is consistent with the environment evidence, but is not proven to have caused this exact failure.

A separate actual failure occurred in pkg/vm/engine/tae/db/test/Test_RWDB4: GetValueByFilter returned not found instead of the final value 99; cleanup then waited on replay/transaction completion for several minutes. The test-owned process was stopped with SIGQUIT to preserve goroutine stacks; remaining cases in that process were not executed. Root-cause investigation and a focused race reproduction are in progress. No attribution to this PR or clean main is claimed yet; no timeout increase, assertion weakening or case skip is used.

Replay heartbeat admission and full-run follow-up (d41d24d)

The RWDB4 failure above also reproduces with all changed Go files restored to clean main base 83222fa: final value lookup failed, followed by a 100-second test timeout. This establishes a baseline counterexample under this local two-worker configuration, not an assertion about a particular CI failure.

Root cause: replay/readonly modes already mark local heartbeats as skipped, and completion refuses to advance their committed frontier, but the existing two-millisecond cron producer still submitted them through the commit pipeline. With two apply workers and the existing injected 0–9ms commit delays, this creates expanding useless heartbeat traffic ahead of replay commits. This is queue overload; a shared-pool deadlock is not claimed. Closing the engine waits for the in-flight replay commit while the fault remains enabled.

The existing heartbeat owner now checks its authoritative skip flag before creating/enqueuing work. No extra pool, worker, state, timer or retry is introduced. Write-mode behavior is retained, including the completion-side check for a heartbeat admitted before a mode transition. A small direct frontier test covers that in-flight readonly/replay/write boundary. The existing real RWDB4 test explicitly uses two apply workers even on a large host, preserves all 100 updates and the final-value assertion, and registers cleanup so fault removal precedes replay-engine close. Its unused wait group/commented remnants are removed. No persistence or SQL protocol changes.

Validation on the final implementation:

  • Exact RWDB4: 25 race rounds PASS, package 29.448s; first strengthened-test duration 1.20s gives floor(30/1.20)=25 rounds.
  • Reverse control: same strengthened test, only production guard removed -> FAIL in 4.57s (expected99, actualnil); teardown completes after fault removal. The test catches the missing fix without merely timing out.
  • Complete TAE db integration package: 299 named PASS normal (46.774s), 299 PASS race (68.380s), no skip/fail.
  • Complete txnbase final version: 50 named PASS normal and 50 PASS race, no skip/fail; includes the in-flight heartbeat mode-boundary test.
  • Parent db package: 4 PASS normal and 4 PASS race, no skip/fail. Integration coverage includes replay promotion, write/replay transitions and cancellation rollback.
  • Configured incremental SCA for both changed packages: 0 issues, terminal exit0. Final subsequent edit only removes two blank lines from RWDB4; semantic evidence is unchanged.
  • No fresh full BVT or whole-CI performance saving is claimed for this stage. Existing regressions are strengthened rather than replaced with a smaller simulated path.

The subsequent complete local race execution on d41d24d has finished; its exact terminal outcomes and report-finalization repair are recorded below. Earlier failures remain recorded. Whole-CI ten-minute saving and lower total CPU/memory remain unproven.

Report executable ownership and completed local execution (ae24f30)

The complete local make ut on d41d24d executed all Go test stages successfully: 75,212 named PASS, 73 named SKIP, 457 package PASS, 80 no-test/package SKIP, zero test failures, UT_TEST_STATUS=0. No additional test filters or skips were introduced. Measured wall time was 2,088.4s (34m48s), total CPU 4,689.2s, aggregate peak PSS 6.32GiB, cgroup peak 9.43GiB, no OOM. These are local totals, not a same-environment CI speedup.

The original Make invocation nevertheless exited 2 because the pinned analyzer had installed successfully outside PATH and the report step invoked its bare name (analysis exit127). This original failure is retained. The existing installer now returns its installed executable path and the existing summary caller invokes that exact quoted path, also preventing a stale PATH executable from shadowing it. Existing version checks and retry policy remain authoritative. No new state, wrapper framework or production execution path.

Validation of this report-only follow-up: complete optools normal and race each 330 named PASS; configured incremental SCA zero issues; shell syntax/gofmt/diff checks pass. The same new integration regression with the two old shell files fails as expected for missing/stale executables. It exercises the actual summary entry and covers GOBIN/GOPATH, spaces, stale PATH, analyzer failure and Go-test failure. Re-executing the actual repaired summary against the preserved complete raw report and original successful Go status ended exit0 with UNIT TESTING SUCCEEDED !!!. This proves complete Go execution plus repaired finalization; it does not claim a fresh monolithic make ut exit0 on ae24f30.

A same-machine baseline/PR comparison of the dominant issues+embedded stages is being prepared using two actual source checkouts, verified native artifacts, identical warm compilation, eight CPU/16GiB/no-swap limits, and sequential measurement arms. No GOFLAGS overlays or reduced case selection are used. Results pending. The six-package parallel optimization separately increased CPU about10% and peak PSS from2.17 to3.18GiB; whole-run resource reduction remains unproven.

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

Copy link
Copy Markdown
Contributor Author

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

Commit: 3ee0334f84d324c1bbbd519adcddacde3e0f77b5

"interrupted"

XuPeng-SH added a commit that referenced this pull request Oct 15, 2026
## 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 #30164 — the original performance issue addressed by #30189.

Reverts #30189 (`461bc8e34920959e5fc141e3d1b37673a90894e1`). This
rollback restores compilation and the previous covered-score TopK
behavior; it does **not** fix #30164. Keep #30164 open for the coherent
follow-up optimization.

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

The original issue #30164 reports an unused relevance-score Sort below
an explicit vector-distance or other-key ordering. PR #30189 attempted
to eliminate that work.

Fully revert #30189 to restore the previous fulltext planning
implementation while its integration problems are addressed separately.
The original performance requirement remains tracked in #30164.

The verified main head fails planner UT compilation because one call to
`tryApplyCoveredFulltext2` omitted its newly added `orderOverwritten`
parameter. After fixing only that test call in an isolated main-source
view, the existing score-alias LIMIT and LIMIT+OFFSET tests also fail:
implicit-sort removal leaves the existing covered TopK consumer
expecting the old intermediate-sort shape, so candidate LIMIT pushdown
is lost.

This is an exact `git revert` of the main commit, with no independent
optimization, test relaxation or additional production branch. `git diff
b5a4d5c HEAD` is empty: the resulting
tracked tree exactly matches the parent of #30189. The tradeoff is
restoration of the previous redundant implicit relevance sorts and their
CPU/memory cost. The optimization can be reintroduced after its
consumers and existing regression tests are integrated coherently.

### Verification of the revert commit

Revert head: `1e3233159a0e36a7005d52fade502404047b40f5`, based on
verified main `461bc8e34920959e5fc141e3d1b37673a90894e1`.

- **Exact source equivalence:** revert HEAD and pre-#30189 commit
`b5a4d5c7958fe921288f73083eab74dd5609f85e` both have tree
`21876c5e13bae15fc12727b8efc211564a96d137`. Their complete tracked-tree
diff is empty. No extra fix is included.
- **Test compilation:** repository CGo wrapper, `-run '^$' -count=1`,
`pkg/sql/plan`, `pkg/sql/compile`, `pkg/cnservice`: PASS, exit 0. This
intentionally proves compilation only, not execution of those entire
suites. The missing-argument error is gone.
- **Related race UT:** existing covered-fulltext snapshot and
score-limit tests: 19 named PASS terminals, exit 0. Score-alias LIMIT
and LIMIT+OFFSET retain their original positive assertions.
- **Complete owning planner race UT:** CGo wrapper, `-short -race
-count=1 -timeout=12m -p=2 ./pkg/sql/plan`: PASS, 15,404 named passes, 2
existing skips, zero failures, 99.809 s. Linux amd64 / Go 1.27.1 /
GOMAXPROCS=2.
- **Actual service build:** `go build -mod=readonly -p=2 -ldflags=-w
./cmd/mo-service`: PASS, exit 0; resulting ELF and native-library
resolution checked. Native source inputs match the already validated
artifacts; no native source changes are included.
- **Incremental configured SCA:** PASS, 0 issues, exit 0; `golangci-lint
run --new-from-rev=461bc8e34920959e5fc141e3d1b37673a90894e1
./pkg/sql/plan`.
- `git diff --check`: PASS; worktree clean. No full-repository
UT/Coverage/BVT execution is claimed.

Local evidence: `/home/xupeng/ut-race-next-20261015/revert-pr-*` (raw
JSON, build/static logs, command scripts and tree/binary fingerprints).
Verification above was performed after opening this revert PR as
requested.

The separate optimization PR #30277 is not part of this revert diff.
@XuPeng-SH
XuPeng-SH force-pushed the codex/ut-race-next-20261015 branch from 3ee0334 to acc293f Compare October 15, 2026 08:56
@XuPeng-SH

XuPeng-SH commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor Author

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

Commit: acc293f592e20251a8985a394f8d8e0456dc06a9

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

Assessment: approve

Reviewed the complete 22-file delta, callers, ownership, compatibility, performance effects and test contracts. The optimizations reuse existing owners and preserve admission, persistence and lifecycle invariants. No actionable defects remain.

Model: gpt-6-astra / xhigh

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

Validation:

  • Exact-head normal checks passed across seven owning packages: 20,075 named PASS results and two existing skips.

  • Focused race checks passed across eight packages: 161 named PASS results, including persisted metadata and the real wide-column SQL integration scenario.

  • Full CN and admission race packages passed with 318 and 25 named PASS results respectively.

  • Eleven individually selected lifecycle tests passed adaptive race stress: 1,919 named PASS results. Supplemental schedule checks also passed.

  • Verified clean source, formatting, native-build provenance, command/source/exit receipts and retained logs. Evidence and complete review: /home/xupeng/.local/state/mo-bot/jobs/56e13de61152d092e3e0d2f2/attempt-1/evidence-audit.json and review-report.md.

Limitations:

  • Frozen CI remained incomplete. No complete-repository race, coverage or full BVT result is claimed.

  • Author raw artifacts were unavailable; staged performance measurements were not independently verified. Whole-CI savings and peak-memory improvements remain unproven.

  • Linked issue bodies were not supplied; their contracts were assessed from the frozen PR description and corresponding implementation/tests.

Reuse a successful whole-subtree admission check during recursive folding without changing the original guard or evaluation order. Preserve independent checks for list siblings and cover spatial parents, inactive invalid branches, and mixed lists.

Validated full planner and rule UTs with race and coverage, incremental SCA, and unchanged real SQL integration scenarios. The large OR race case drops from 34.94s to 14.11s; mapped existing coverage blocks do not regress.

@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: d41d24dfe19bc40d4fec8c80a8e0246c95078f24

Assessment: approve

Reviewed the complete 31-file delta, callers, lifecycle contracts, tests and frozen discussion. The design removes redundant work within existing owners while preserving metadata semantics, recovery fencing and completion-side guards. Shared helpers and established scheduling mechanisms avoid duplicate state machines. No actionable correctness, compatibility or design defect remains.

Model: gpt-6-astra / xhigh

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

Validation:

  • Current-head logservice, txnbase, TAE db and db/test packages passed normal and race runs: 934 named test passes and one preexisting TestUpdate skip in each run. The real wide-table SQL integration test also passed under race detection.

  • Additional race stress passed 11 WAL bootstrap rounds, 57 dirty-destination/fencing rounds and 28 Test_RWDB4 rounds. Removing only the heartbeat admission guard through a diagnostic overlay reproduced the expected regression; the unchanged candidate passed.

  • Independently reconciled 18 retained same-PR checks against commands, source fingerprints, exit receipts and logs. Verified unchanged inputs and intervening dependency changes before reusing planner, metadata, CN, lockservice, admission, lifecycle and scheduling coverage.

  • Preflight passed. Native provenance matched 192 current inputs and 52 artifacts through the repository build owner. Tests used assigned caches and the supplied isolated executor. Formatting, Bash syntax, diff and clean-source checks passed.

  • Detailed review and command/log/receipt audits are retained in /home/xupeng/.local/state/mo-bot/jobs/204812297fcf482e60de8deb/attempt-1/review-report.md, evidence-audit.json and reused-evidence.json.

Limitations:

  • Incremental lint stopped before analysis because its binary used Go 1.26 while the target requires Go 1.27.1. This is a tooling limitation, not a passing static-analysis result.

  • No complete current-head repository CI/BVT/coverage pass is claimed. Frozen substantive CI was pending; the author's earlier failed full run remains failed. Retained short-mode and unavailable-MinIO skips remain explicit.

  • Source analysis supports reduced scans, allocations and fixed waits. Two-package scheduling can increase concurrent resource use. Author benchmark artifacts were unavailable, so reported timings and whole-CI savings were not independently verified.

  • Linked issue bodies were not supplied; contracts were assessed from frozen discussion and corresponding tests. Issues #30229 and #30209 remain outside the claimed fixes.

@XuPeng-SH

XuPeng-SH commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor Author

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

Commit: ae24f3038819fc6f171a6373c0b91d7378231d4e

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

Assessment: approve

Reviewed the complete 33-file delta, callers, lifecycle contracts and tests. The changes remove redundant work within existing owners, preserve admission and persistence semantics, and correctly invoke the installed analyzer. No actionable defect remains.

Model: gpt-6-astra / xhigh

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

Validation:

  • Current-head optools normal and race suites each passed 330 named tests with no failures or skips, covering analyzer selection, stale PATH, error propagation and scheduling controls.

  • Independently reconciled 24 retained same-PR checks against source differences, commands, exit receipts and logs. Coverage includes planner, metadata, CN, lockservice, admission, compile lifecycle, embedded scheduling and real wide-table SQL.

  • Retained logservice/txnbase/TAE normal and race runs each recorded 934 named passes and one existing skip. WAL bootstrap/fencing and RWDB4 race stress passed; removing only the heartbeat admission guard reproduced the expected regression.

  • Verified 192 matching native inputs, 52 artifact hashes, successful preflight, Bash syntax, Go formatting, diff checks and unchanged source.

  • Evidence manifests and review details are retained under /home/xupeng/.local/state/mo-bot/jobs/1631746d3dffaa18687df461/attempt-1 in evidence-audit.json, reused-evidence.json and review-report.json.

Limitations:

  • Frozen substantive CI was incomplete. No independent complete-repository make ut, coverage or full BVT pass is claimed. Retained short-mode skips and unavailable-MinIO coverage remain explicit.

  • Source analysis supports fewer scans, allocations and fixed waits. Two-package scheduling increases concurrent resource use; the author reports approximately 10% more CPU and peak PSS increasing from 2.17 to 3.18 GiB. Raw author artifacts were unavailable, so these measurements and whole-CI savings were not independently verified.

  • Linked issue bodies were absent; contracts were assessed from the frozen PR description and corresponding tests. Issues #30229 and #30209 remain outside the claimed fixes.

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

Reviewed PR #30277 at ae24f3038819fc6f171a6373c0b91d7378231d4e, using merge base 83222fa8371007c7969d3aeca3ab8ced90695f4c. No confirmed actionable findings; APPROVE.

Inspected the complete 33-file diff and relevant callers/tests: both constant-folding owners and spatial capability traversal; Unicode duplicate-column equivalence; NULL/NDV metadata and writer ownership; CN initialization, heartbeat cancellation and command delivery; WAL discovery, connection and linearizable recovery-state checks; transaction heartbeat mode transitions; cluster admission and package scheduling; lock retry/fencing and asynchronous cleanup regressions. The prepared origin/main is ahead of this PR; its merge base matches the supplied base, and overlapping planner changes were checked. No source code was modified.

Independent validation on this head: go test ./optools -run 'Test(UTSummaryUsesInstalledAnalyzer|InstallGoUTAnalysis|MakeUTProcessPoolConfiguration|EmbeddedAuditedBatchScopeAndFailure)' -count=1 -timeout=120s passed (52.935s). This exercises analyzer selection/error propagation and scheduling/admission controls. git diff --check passed and the source working tree is clean.

The supplied GitHub snapshot contains 38 completed checks: 21 success, 15 skipped, 2 neutral; CI Required succeeded. Mergeability is reported as mergeable/behind. Historical reviews, inline comments and PR conversation contain no previous review from iamlinjunhong, so this is a first review for that reviewer. Other reviewers' conclusions were not used as independent validation. Production packages, full race/BVT suites and performance measurements were assessed from code and supplied CI information; they were not independently rerun or benchmarked locally.

@XuPeng-SH
XuPeng-SH merged commit 9149593 into matrixorigin:main Oct 15, 2026
@XuPeng-SH
XuPeng-SH deleted the codex/ut-race-next-20261015 branch October 15, 2026 16:46
XuPeng-SH added a commit that referenced this pull request Oct 16, 2026
…nization (#30334)

## What type of PR is this?

- [ ] API-change
- [x] BUG
- [x] Improvement
- [ ] Documentation
- [ ] Feature
- [x] Test and CI
- [x] Code Refactoring

## Which issue(s) this PR fixes:

Fixes #30291
Fixes #30324

Related investigation: #30309, #30322, #30323. **These three are not
fixed by this PR**: the original CI failures have not been reproduced or
sufficiently attributed. Additional process diagnostics are not
presented as a root-cause fix.

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

Reduce redundant race-test work and remove wall-clock assumptions while
preserving the behavior under test. This is a follow-up to merged
#30277; its savings are not counted again here.

### Implementation and test design

- Release frontend process/file-service fixtures on every test exit,
check protocol packet buffers directly, and replace redundant allocator
scans with complete byte verification.
- Replace the large PK-filter expectation matrix's diagnostic work with
direct, independent selection oracles. Preserve vector-print behavior in
explicit golden tests.
- Exercise append visibility at every prefix around bitmap word
boundaries with both 64- and 128-bit timestamps rather than growing
10,000 redundant MVCC nodes. Retain the aggregation spill boundary with
a smaller real fixture.
- Run scheduler harness cases concurrently only when they have isolated
temporary directories and no process-global environment mutation.
Preserve the process pool defaults, cancellation, cleanup and report
ownership. Include batched embedded reports in heartbeat monitoring and
collect bounded process diagnostics even when no Bash trace exists.
- Construct constant NULL vectors with the existing vector allocator
instead of constructing an unrelated Process and its file services.
Remove the unused helper.
- Give functional embedded task discovery an explicit one-second
test-only interval through the existing testing configuration owner.
Keep scenario overrides effective. Production timing, persistent formats
and mixed-version behavior are unchanged.
- In the CDC restart regression, capture the stopped daemon's task ID
and claim generation, then expire only that claim's heartbeat. The real
restarted runner must still claim the task and satisfy the original
durable-watermark and row-result assertions. The fixture no longer waits
for a production-length lease to expire.
- For #30291, use virtual time for the three related ISCP
drain/revalidation tests. Preserve deadline values, cancellation/error
assertions and first-lookup ordering; keep unrelated real workers
outside the virtual-time bubble.
- For #30324, establish the existing SYNCCOMMIT fence at four cross-CN
producer/consumer boundaries. Keep table-identity, foreign-key, row and
lineage assertions. The original CI stale-read flake was not
deterministically reproduced locally; the missing causal boundary is
addressed without changing production consistency semantics.

### Local measurements and limits

Measurements are sequential local comparisons, not promises about
whole-CI time:

| Scope | Before | After | Interpretation |
| --- | ---: | ---: | --- |
| Two public CDC lifecycle tests | 104.4 s | 36.4 s | About 68 s saved
across discovery and restart-fixture changes |
| Allocator owning-package sample | 30.9 s | 7.9 s | Retains all
allocation sizes and full-byte checks |
| Readutil owning-package sample | 18.7 s | 6.8 s | Independent
expected-selection checks |
| MVCC visibility sample | 17.0 s | 1.2 s | Same measured covered
blocks; explicit bitmap boundaries |
| Complete light-stage comparison | 410.2 s | 409.3 s | Wall time
essentially unchanged; CPU about 3.8% lower, PSS peak about 13.8% lower
|

Do not add these package timings together as CI critical-path savings. A
ten-minute whole-CI reduction has **not** been demonstrated.

A four-process issues/embedded experiment saved 4 min 39 s but increased
total CPU by 42% and PSS peak from 5.30 to 7.10 GiB. **That scheduler
change was rejected and is absent from this PR.** Its complete test
outcomes were identical, but its speedup is not claimed as a delivered
benefit.

The universal test-only one-second discovery setting has a cost: a
six-root control showed CPU 19.26 -> 21.59 CPU-seconds with essentially
unchanged wall time. This is a local tradeoff for faster functional
transitions, not evidence that all test workloads use less CPU.

### Validation

Completed locally before the final rebase:

- Owning-package normal/race tests and incremental configured vet/lint
for the changed closures, including frontend, allocator, readutil,
aggregation, MVCC, scheduler fixtures, ISCP and the constant-NULL
consumers.
- Full SQL integration package: 279 named passes in normal mode and the
same 279 in race mode after the CDC lease change.
- ISCP owning-package normal/race runs; a deliberate OS scheduling delay
reproduces the original pre-lookup timeout assumption and the
virtual-time treatment passes.
- Focused multi-CN replacement-revalidation regressions with the
original public SQL and metadata assertions.
- Complete light-stage comparison: all original named outcomes retained,
three added independent PK-filter test outcomes, unchanged skips.
Representative coverage-block comparisons retained for the rewritten
fixtures; this is not a claim of identical whole-repository coverage.
Two unrelated asynchronous frontend warning blocks differed across
coverage runs and are not hidden by padding tests.
- Real public SQL issues/embedded stage runs in the rejected concurrency
experiment retained all 2,663 named passes and 15 existing skips. This
validates those test outcomes, not the final default schedule's
performance.
- No new retries, enlarged failure timeouts, test skips, production
data-format changes or additional CI runners.

### Post-rebase validation

Rebased cleanly onto main `48dbe277b6`; final head `9fbf3952ea`. `git
range-diff` confirms all 12 patches are unchanged by the rebase.

- Passed native provenance verification using the controlled GCC
CPU-release profile.
- Passed `git diff --check`, shell syntax and gofmt checks.
- Passed `go vet -mod=readonly` and repository-configured incremental
golangci-lint across all 15 changed Go packages (`0 issues`).
- Passed the following real `go test -race -short -tags matrixone_test
-count=1` runs:

| Package / selection | Named passes | Existing skips | Package result |
| --- | ---: | ---: | --- |
| `optools` | 330 | 0 | pass |
| `pkg/frontend` | 5883 | 1 | pass |
| `pkg/sql/compile` | 3272 | 0 | pass |
| `pkg/tests/sqlintegration` | 282 | 0 | pass |
| `pkg/tests/issues` (focused #30324 regression) | 18 | 0 | pass |

These are executed results at the rebased head; the earlier measurements
retain their original pre-rebase provenance. No pending CI,
whole-workflow BVT, full-repository race run or whole-repository
coverage verdict is claimed.

This branch was previously deployed

1 inactive deployment
ci — db3056c6 Deployed Oct 15, 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]: race UT TestIssue4007 intermittently fails remote lock retry [Bug]: CI flaky candidate: all_consumers_skipped races scheduler completion

3 participants