Skip to content

test: shorten planner race critical path with bounded sharding - #31593

Merged
XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/ut-race-structural-20261028
Oct 28, 2026
Merged

XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/ut-race-structural-20261028

Conversation

@XuPeng-SH

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 #27705.

What this PR does / why we need it:

The planner race wave has a long serial tail: the existing process sharder can distribute only top-level tests, while all 37 expensive ALTER session cases were under one top-level test. Split the same cases and assertions across four roots so the existing two-process sharder can distribute them. Keep each root's subtests sequential because their fixtures use process-global runtime state. Use a test-owned directory for the planner debug output so concurrent processes do not write the same file.

Default to two planner processes only for the measured Linux UT_PARALLEL=8 configuration. An explicit one-slot heavy budget or one plan shard retains the serial default, and explicit PLAN_RACE_PARALLEL remains an override. The existing three-slot heavy/plan budget is unchanged. As with any process partition, incidental race interleavings between distinct top-level tests can differ; the single-process package race run remains a validation control.

A paired local heavy-plan run at the same base under cgroup limits of 8 CPUs and 16 GiB reduced the heavy/plan wave from 493s to 316s. The heavy packages had one slot instead of two and took longer (165s to 316s); the critical path still improved by 177s. Cgroup peak was 9.22 GiB versus 8.62 GiB, with no OOM or limit events; aggregate CPU rose from approximately 1,286s to 1,334s. These are one local pair, not a claim about complete IDC CI wall time or full-run cache pressure.

The actual JSON reports have identical run and terminal outcomes for all 21,057 comparable planner tests/subtests after normalizing the renamed root. All 37 ALTER cases ran exactly once, and no other top-level test was added, removed, or duplicated.

Validation:

  • Full make ut UT_PARALLEL=8 UT_SHARD=heavy-plan race wave in the bounded baseline and candidate scopes, including engine, heavy packages and planner.
  • Complete planner package in normal mode and CI-tagged single-process race mode.
  • Full optools normal package; race tests for configuration, failure, cancellation and report handling, including cancellation with both planner shards live.
  • Incremental molint, configured golangci-lint, and go vet for ./pkg/sql/plan and ./optools.
  • IDC CI and its complete-job timing remain 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 28, 2026 •

Copy link
Copy Markdown
Contributor Author

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

Commit: 4ac8c9527771dbba3b4b85faed6b40e9ec1fea06

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: 4ac8c9527771dbba3b4b85faed6b40e9ec1fea06

Assessment: approve

The bounded planner sharding change preserves all 37 ALTER cases and their assertions, retains process-budget controls, and correctly handles cancellation and reporting. No actionable findings remain.

Model: gpt-6-astra / xhigh

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

Validation:

  • Isolation preflight passed.

  • Focused configuration/cancellation and scheduler/report checks passed with race instrumentation.

  • The two-shard cancellation case passed 100 race-enabled iterations.

  • Source comparison confirmed exact fixture/assertion preservation and disjoint case coverage; formatting and diff checks passed.

  • Receipts and retained logs are reconciled in validation-summary.json. Both discussion entries are assessed in discussion-assessment.json. Source remains unchanged.

Limitations:

  • Full planner runs and performance measurements were author-reported; raw artifacts were not supplied and these runs were not independently repeated.

  • Principal CI checks were pending in the supplied snapshot.

@XuPeng-SH
XuPeng-SH merged commit 970dc9b into matrixorigin:main Oct 28, 2026
30 checks passed
@XuPeng-SH
XuPeng-SH deleted the codex/ut-race-structural-20261028 branch October 28, 2026 14:07
XuPeng-SH pushed a commit that referenced this pull request Oct 28, 2026
## What type of PR is this?

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

## Which issue(s) this PR fixes:

- #31326

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

Follow-up to merged #31387, which bounded bad-CSV planning probes,
suppressed speculative conversion reports and added cancellation. Its
256 KiB cap can also merge a valid long-record file into one effective
reader.

Keep 256 KiB as a soft stopping threshold and derive a checked hard
budget from the execution parser's record-size limit and CSV tokens. An
initial fragment and the next candidate can complete. Suffix probing and
optional verification share that byte allowance and at most 256 parser
calls.

When physical probing reaches the former cap, verify each proposed
boundary exactly from FileStartOff, including subsequent boundaries.
Reject unsafe multiline and BOM restart boundaries, retaining earlier
ranges and merging the tail. Each acquired stream closes before another
opens, with cancellation and close-error precedence preserved.

Validation at `3db81d9d8d19dbf7a93208ca4959fb6f93661f55` (Go 1.27.1,
darwin/arm64):

- Reproduced the equality regression before the repair: a 6143-byte BOM
field becomes 6140 bytes, and valid multiline CSV errors with 20301.
Verification now also starts when physical suffix input equals 256 KiB.
- Rerun at `192158edb79f3b8e6c1364303b4d2b7ab83b1490` after the first
rebase; reused after the final Python-only main update (Go, native and
test inputs unchanged): the complete external package and ten
strict-load SQL scenarios with `-vet=all`, including seven threshold
unit variants and three public equality scenarios. Exact serial/parallel
values, retained fanout and safe fallback are asserted.
- Configured incremental golangci-lint reports zero issues. Reused
pinned molint analysis (built with Go 1.27) exits 0 with an existing
unsafe-import diagnostic in untouched `reader_arrow_test.go`; that file
and the diagnostic's inputs match the frozen base. Independent
design/final review is reused for the identical complete PR patch; the
delivery artifact checks pass.
- [Earlier Linux/x64
CI](https://github.com/matrixorigin/matrixone/actions/runs/40643822237)
is green and is reused for unchanged paths. New-head Linux CI is
pending. No new race or throughput campaign was run for this sequential
threshold correction.

The authoritative `CSVConfigForLoad` mapping and main's parallel-worker
isolation remain integrated. The prior short-probe allocation diagnostic
was about 88 KiB, confirming the hard cap is not preallocated. The
earlier unrelated UT cleanup timeout is tracked in #31545.

CI refresh: the two PR commits were replayed onto official main
`8f9bcd29ed8c236ec55c13bb9b88267a3a2a79ea`. All five PR files and the
complete PR patch remain identical. [Run
40672111550](https://github.com/matrixorigin/matrixone/actions/runs/40672111550/job/122761716321)
failed when the single planner race process reached its cumulative
40-minute package timeout; the active case had just started, and no race
report or compilation failure was logged. Main now includes #31593's
bounded planner scheduling change. This authorized rebase triggers new
CI with that change; it does not establish that the timeout is fixed.
The superseded run is not rerun.

Verification may reread a prefix. Its shared hard cap is about 384 MiB
per attempt with the default record limit; distant targets or prefixes
with many short records can still reduce fanout. No throughput
improvement percentage is claimed. The issue remains open for reporter
verification after merge.

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/enhancement kind/test-ci size/S Denotes a PR that changes [10,99] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants