Skip to content

test: reduce race UT fixture and admission work - #33313

Merged
XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
XuPeng-SH:test/main-race-fixture-cost
Nov 26, 2026
Merged

XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
XuPeng-SH:test/main-race-fixture-cost

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

What this PR does / why we need it:

Recent main-target race CI runs spend several minutes in the SQL integration stage. The previous balancing change keeps the four batches busy. This change reduces work inside the cases and preserves the existing schedule.

  • Share CTAS work for grouping expressions and CASE metadata, and share table/view publication for DECIMAL DIV expressions with identical input shape. The original requirements for per-column schema and wire types, rows, derived/CTE/view references, warnings and rollback still run. The object-creation counts for the grouped, CASE and DIV matrices fall from 48 to 24, 10 to 2, and 48 to 28 respectively.
  • Seed one table for the six narrowing ALTER spellings. Each checks the exact remaining row, both collations and absence of a replacement artifact before the next spelling can reuse it.
  • Use seven rows for the 2,048-term OR/IN cases. Keep exact fractional sums, boundary membership, duplicate matches, scenario switching, caching, prepared execution, EXPLAIN, NULL and cancellation recovery.
  • Replace one million host-dependent randomized throttle operations and unbounded rejection spins with a bounded concurrent acquire/release sequence. It checks saturation, every worker's successful re-acquisition and complete release. The separate rejection and stale-admission tests still run. This removes noisy expected retries at their source without changing application logging.

Validation uses Go 1.27.1, -race -short -tags matrixone_test, four batches selected by main's existing cost-based partitioner, two Go cores per binary, and an eight-CPU, 16 GiB no-swap cgroup. The throttle package passes race in full and the concurrent admission cases pass 50 repetitions. Incremental SCA for both changed packages reports zero issues.

Both SQL runs passed with identical terminal results for all 116 roots and 911 root/subtest outcomes (910 pass, one existing external-DSN skip).

Metric Base Candidate Change
Wall (s) 259.87 180.37 -30.6%
CPU (s) 788.25 696.58 -11.6%
Cgroup peak (GiB) 9.24 8.78 -4.9%
Max child RSS (GiB) 3.53 3.43 -3.0%
Process write (MiB) 676.80 606.48 -10.4%
Process read (MiB) 60.60 18.84 -68.9%
JSON report (MiB) 51.92 48.92 -5.8%
Changed case output (MiB) 2.30 1.61 -30.0%

This is one same-host A/B sample. The baseline started with some unrelated host load and cold I/O, so wall time and read bytes are especially sensitive to run order. This measures the affected SQL stage, not full CI. No CI schedule or production code is changed.

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

Copy link
Copy Markdown
Contributor

This pull request is merged.

@XuPeng-SH

XuPeng-SH commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor Author

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

Commit: 4b98b2edf96fb1d65dfc3a90b180a31df5edb1da

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

Assessment: approve

The test optimizations retain the affected concurrency, SQL result, metadata, and failure-atomicity checks while reusing fixtures and reducing setup work. No actionable findings remain.

Model: gpt-6.1-terra / max

Session: 01a216bc-adbc-7142-8f93-6b94a5827118 · slot 0 · generation 16

Validation:

  • The throttler package passed with -race -short, and the changed TestParallel passed 100 focused race repetitions. Logs and receipts are recorded in review-validation.json.

  • All four changed SQL integration roots passed with -race -short -tags matrixone_test against the embedded single-CN frontend; sqlintegration-race.log and checks/1795688838605668935-2.json.

  • An independent arithmetic check verified the revised OR aggregates and integer grouping expectations. Private-runtime preflight, native input provenance, and git diff --check passed.

Limitations:

  • The full SQL suite and the PR's reported before-and-after performance measurements were not independently repeated. The reported wall-time comparison is one author-run sample with acknowledged host-load and I/O differences.

  • The frozen CI snapshot showed the x86 UT job queued; it was not treated as a pass.

@XuPeng-SH
XuPeng-SH merged commit df5de14 into matrixorigin:main Nov 26, 2026
@XuPeng-SH
XuPeng-SH deleted the test/main-race-fixture-cost branch November 26, 2026 13:42
XuPeng-SH added a commit that referenced this pull request Nov 26, 2026
## What type of PR is this?

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

## Which issue(s) this PR fixes:

Related to #28933. Follow-up to #33313.

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

Three parts of race UT spend resources on fixture work that can be
reduced while keeping their behavioral checks:

- The S3-FIFO reference model still runs 80,000 seeded operations and
checks accounting and the full resident set after each one. It checks
the public membership API for the operated key and checks all resident
keys, their expected shard, and cardinality directly. This avoids
locking for each of the 400 possible keys.
- The index-file engine test writes 66 chunks. The test runs two real
INSERTs (65 + 1 chunks) against the same registered source and
transaction. The first crosses the table function's 64-row output
boundary and the second carries the short final chunk. Reconstruction,
cache, persistence, duplicate rejection and rollback, snapshot and
range-filter assertions remain. The existing table-function test
separately runs public Write across two INSERT statements and checks
IDs, exact bytes and CRC.
- Two publication tests capture the full catalog on failure before
engine teardown. The index replication test seeds the same 10 tuples
with one INSERT before replication begins. These tests retain engine
DEBUG and the iteration state, row, index and DDL assertions.

Local race A/B with Go 1.27.1, GOMAXPROCS=2 and disk-backed scratch:

| Test scope | Metric | Base | Candidate |
|---|---|---:|---:|
| S3-FIFO model | CPU | 8.83 s | 2.66 s |
| 3 affected engine tests | Wall | 19.52 s | 11.53 s |
| 3 affected engine tests | CPU | 11.51 s | 4.02 s |
| 3 affected engine tests | Process writes | 257 MiB | 21 MiB |
| 3 affected engine tests | Process peak RSS | 2.82 GiB | 0.84 GiB |

Each comparison is one local sample. Aggregate engine stdout was 2.70 MB
in the baseline and 2.37 MB in the final sample. An earlier candidate
sample was flat, so this comparison does not establish a stable
reduction in structured engine logging. The S3-FIFO model's sampled RSS
rose from 44.6 to 54.3 MiB. The engine result is scoped to the three
tests and does not measure the full CI job.

The full S3-FIFO package passed race. All three touched engine tests and
both neighboring index-file tests passed race with matrixone_test
enabled. The existing table-function split test passed all four subtests
in the same race mode. Incremental SCA passed for the changed packages.

This branch was successfully deployed

No deployments
ci — b8a6535c Deployed Nov 26, 2026 by XuPeng-SH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/enhancement kind/refactor Code refactor kind/test-ci size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants