Skip to content

test: reduce embedded SQL race fixture work on 4.2-dev - #33631

Merged
XuPeng-SH merged 1 commit into
matrixorigin:4.2-devfrom
XuPeng-SH:perf/4.2-race-fixture-cost
Dec 2, 2026
Merged

XuPeng-SH merged 1 commit into
matrixorigin:4.2-devfrom
XuPeng-SH:perf/4.2-race-fixture-cost

Conversation

@XuPeng-SH

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • Test and CI

Which issue(s) this PR fixes:

Related to #32744.

What this PR does / why we need it:

On the latest successful 4.2-dev UT Racing job reviewed, the two publication lock tests took 104 s and 85 s. A table metadata check took 635 s, including time spent acquiring the embedded cluster admission lock used by other test processes. The three successful jobs reviewed took 59–68 minutes. UT Racing #33520 · #32497 · #31979

  • Reduce nine embedded cluster starts to four across query plan, quota, executor and DDL metadata tests. Tests with special CN settings still own their clusters. The skewed plan workload still has 150,000 rows, and the pruning test still waits for each flushed object.
  • Cross the same publication lock thresholds with 20 fewer real tenants. Keep the real two-CN blocked target, unlocked gap, and named grantee checks. Create the ordinary tables in the repeated UPDATE suite once and reset the rows each case uses. Schema-altering cases own their tables.
  • Share one database across 17 table-level DIFF cases. The whole-database clone retains an independent source. Share the ancestor and source across the 12 PICK conflict cases and give each policy its own destination. All 12 execute separately and verify both the selected key and the unaffected keys. The short multi-block DIFF uses 40,960 rows. The full case retains 819,200.

Validation

Local serial comparison against 232d2dec6d, using prebuilt test binaries, the CI -short -race -tags matrixone_test settings and GOMAXPROCS=8. The seven groups below include process startup and teardown. Filesystem output is measured by Linux process I/O accounting and includes the test logs.

Selected tests Base wall time PR wall time
Publication lock boundaries 75.0 s 60.1 s
Cross-tenant branch quota 39.8 s 21.2 s
Single-CN query plans 63.6 s 35.6 s
DDL and table metadata 32.5 s 17.0 s
Transaction executor 38.0 s 15.0 s
Repeated UPDATE 29.8 s 24.8 s
File DIFF and PICK 49.1 s 54.4 s
Total 327.8 s 228.1 s

In this comparison wall time fell by 99.8 s (30.4%). CPU time went from 184.0 to 131.2 s and filesystem output from 211.7 to 147.0 MiB.

The combined file DIFF/PICK group took 5.2 s longer in this pair. Its first test database creation occurred 24.3 s after the first server log on the PR and 16.8 s on the base. PICK itself took 10.6 s on the PR and 14.2 s on the base.

The full DDL package, neighboring PICK and checkpoint regressions, two consecutive runs of both multi-CN publication tests, and independently selected plan, quota and conflict cases passed with the race detector. The non-short 819,200-row DIFF and 100,000-row CSV round trip also passed. Incremental golangci-lint reported zero issues.

The parallel CI job also includes build time and contention across packages. Its end-to-end improvement needs a new runner measurement.

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

@mergify

mergify Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

This pull request is merged.

@XuPeng-SH

XuPeng-SH commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor Author

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

Commit: f1251b4dfc51f239bc0e6e8eb1c25b6333362e76

"interrupted"

XuPeng-SH added a commit that referenced this pull request Dec 2, 2026
…33634)

## What type of PR is this?

- [x] Test and CI

## Why this change

Four successful UT Racing jobs targeting `main` showed repeated embedded
cluster bootstrap and expensive planner setup. One job started 157
embedded clusters. The recurring costs included starting a
race-instrumented process for each recursive CTE shape and creating a
new catalog for SQL tests that use the same cluster configuration. [UT
Racing run
46765442646](https://github.com/matrixorigin/matrixone/actions/runs/46765442646/job/143068002556)
· [UT Racing run
46722755645](https://github.com/matrixorigin/matrixone/actions/runs/46722755645/job/142913419828)

## What changed

- Run all 16 recursive CTE shapes and the same-context recovery sequence
in one child with a stack limit and deadline. Each independent shape
gets a fresh compiler context. Use the first generated column that
exceeds the expansion budget for the historical catalog test, and retain
both SELECT and UPDATE plan checks.
- Reuse the existing embedded fixtures for compatible SQL, inventory CAS
and multi-CN scenarios. Tests that restart services or change settings
retain dedicated clusters. Exercise publication lock escalation with the
smallest set of tenants that still proves the locked target and the
unlocked gap. Remove a view rebuild immediately before dropping its
tenant.
- Halve the set-operation input while retaining assertions on physical
owner placement, SQL results, remote failure, cancellation and recovery.
Use a real 4,093-node CTE plan for the result-metadata allocation check.
The 12-level benchmark remains available.

## Measurements

Local paired runs used the race detector. Timings below apply to the
named tests. The package groups run in parallel in CI, so measuring the
full-lane gain requires a comparable runner.

| Workload | Base | With this change |
| --- | ---: | ---: |
| Recursive CTE and generated-column tests, three cases | 71.5 s, 17
child processes | 6.5 s, 1 child process |
| Integer result-column metadata | 18.75 s | 2.06 s |
| Five embedded tests | 128.5 s, 5 cluster starts | 69.2 s, 3 cluster
starts |
| Full inventory CAS suite | 9 starts, 1,363 relation-create events | 7
starts, 1,025 events |
| Full multi-CN SQL integration package | 11 starts, 1,871
relation-create events | 9 starts, 1,533 events |
| Set membership owners, `GOMAXPROCS=8` | 28.4 s, 8 owners | 17.4 s, 8
owners |

For the set-operation tests at CI's `GOMAXPROCS=2`, the owner and
low-budget cases together took 44.4 s on base and 47.5 s with the
change. Both exercised two owners and had the same four CPU-dependent
subtest skips. The eight-owner run exercised all four witnesses. Catalog
event counts measure setup operations. Physical disk bytes were not
measured.

## Validation

- On the rebased head, all 22 targeted top-level tests across the seven
changed packages passed with `-race -short -tags matrixone_test
-count=1`.
- The full multi-CN package and all six inventory CAS tests passed on
both sides of the local comparison. Four embedded tests also passed
three times against a reused cluster.
- Forcing the planner to build the boolean-source graph in a local
negative control made the result-metadata test fail at 5,182 allocations
against its limit of 32.
- Incremental SCA reported zero issues across the seven packages. A
local attempt at all four CI SQL integration batches exceeded the
workstation's memory capacity and hit baseline timeouts. It is excluded
from the timing comparison.

The related change for `4.2-dev` is tracked separately. [4.2-dev PR
#33631](#33631)
@XuPeng-SH
XuPeng-SH merged commit a05d733 into matrixorigin:4.2-dev Dec 2, 2026
18 of 20 checks passed
@XuPeng-SH
XuPeng-SH deleted the perf/4.2-race-fixture-cost branch December 2, 2026 01:43

This branch was successfully deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

2 participants