Skip to content

test(embed): eliminate redundant branch clear race work - #33581

Merged
XuPeng-SH merged 1 commit into
matrixorigin:mainfrom
XuPeng-SH:perf/main-ut-race-fixtures
Dec 1, 2026
Merged

XuPeng-SH merged 1 commit into
matrixorigin:mainfrom
XuPeng-SH:perf/main-ut-race-fixtures

Conversation

@XuPeng-SH

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • Improvement
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

Related to #32745 (embedded fixture and suite timeout tracking) and #32003 (the branch-clear regression). This reduces test load. The timing comparison does not establish that a specific flake is fixed.

What this PR does / why we need it:

TestDataBranchAfterTableClear took 178–291 seconds in four successful main-target Ubuntu/x86 race UT jobs. Two embedded subtests replayed the complete distributed SQL fixtures and accounted for 76–136 seconds of that time. This PR removes those replays and their private SQL/result parser. The distributed files and golden results remain byte-for-byte unchanged. BVT group 1 executed both in a sampled run with 422 passing statements and zero skips.

The embedded race test retains the original merge/clear/PICK regression and the source/destination and physical lineage checks. It checks explicit-transaction TRUNCATE rejection, unchanged table identity after rollback, and protection snapshot removal through the existing source-TRUNCATE scenario. The inherited-update test uses three destination tables instead of six and verifies both outcomes for all three conflict policies. The keyed PICK fixture uses 8,194 rows instead of 32,768 and still crosses the 8,192-row input batch boundary, deleting the first key of the second batch and verifying both neighbors. The independent GC and restart tests are unchanged.

Validation

  • Linux/amd64, Go 1.27.1, -race -short -tags matrixone_test, four Go cores. The complete changed root and four related frontend roots passed, including transaction rejection, cleanup, conflict, and boundary assertions.
  • Before/after process measurements for the same race test on one host, without build time:
Metric Base Candidate Change
Wall time (s) 115.95 70.30 -39.4%
CPU time (s) 122.68 71.87 -41.4%
Process block writes (MiB) 52.39 37.43 -28.5%
Verbose log (MiB) 7.62 4.47 -41.3%
Peak RSS (GiB) 1.45 1.36 -6.1%

This is one sequential comparison (candidate first), using prebuilt race test binaries. The OS accounts block writes for the whole test process, including logs. Cached-read accounting depends on run order and is not used to claim a storage-read improvement.

  • Changed-package build, gofmt, go vet, repository molint and incremental golangci-lint passed. The BVT selection test passed under -race, and the current group 1 selector includes both unchanged SQL files.

Historical full CI timings provide the workload selection (run 1, run 2). Local A/B results describe the selected test, not the full CI critical path. Test-only changes use the UT CI scope. This PR does not change the runner, timeout, concurrency, or BVT assignment.

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

Copy link
Copy Markdown
Contributor

This pull request is merged.

@XuPeng-SH
XuPeng-SH merged commit 6674873 into matrixorigin:main Dec 1, 2026
20 of 22 checks passed
@XuPeng-SH
XuPeng-SH deleted the perf/main-ut-race-fixtures branch December 1, 2026 07:27
XuPeng-SH added a commit that referenced this pull request Dec 1, 2026
## What type of PR is this?

- [x] Improvement
- [x] Test and CI
- [x] Code Refactoring

## Which issue(s) this PR fixes:

Related to #32745 (embedded fixture and UT timeout tracking). Follow-up
to #33581. This reduces fixture work and makes no claim that a specific
flake is fixed.

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

Main-target Ubuntu race runs spend substantial time booting temporary
clusters and rebuilding publication and account catalogs. The suite can
exercise the same lock, restore and authorization outcomes with less
setup:

- Run the two publication lock scopes in one two-CN fixture. Seed five
ordered accounts before the covering-range phase, remove its restored
publications, then reuse the accounts for explicit-target locking.
Cluster starts fall from 2 to 1 and account creations from 13 to 8. The
four-row lock budget, hold/wait ordering, exact grants, retry error, and
unrelated account inside the requested key span are still asserted.
- Combine apostrophe, backslash and quoted database/publication
identifiers in one round-trip replay scenario. Keep two restore attempts
and exact comment/metadata assertions, and retain the distinct explicit
table, FK, case, empty grant and invalid-view scenarios.
- Restore one database snapshot for three distinct empty-table
publications. Both restore rounds still check each grant policy,
original subscription alias and table metadata, denial of access to
private data, and denial after reusing the old published name. This
removes two snapshots and four restore calls. Together the two
publication snapshot changes reduce database snapshots from 14 to 10 and
restore attempts from 28 to 20.
- Clean up the two temporary tenants as soon as the cross-account checks
finish. The subsequent distinct cluster restore still checks the system
database and collation behavior, while its trace shows only the system
catalog restored instead of three accounts.

### Validation

- `-race -short -tags matrixone_test` passed for the changed embedded
roots and SQL integration root, the neighboring publication lifecycle
root, and three related frontend tests. The final empty-table restore
test reran with the alias checks and cleanup budgets. `gofmt`, `go vet`,
and repo `static-check-selected` for both affected packages passed.
- A paired local run of the selected embedded race tests on Go
1.27.1/Linux amd64 took 118.72 s before and 95.16 s after (-19.8%). CPU
time was 146.11 s to 119.91 s (-17.9%). Process block writes, including
logs, were 108.87 MiB to 82.71 MiB (-24.0%). This comparison was taken
before the final alias oracle and timeout tightening, which were
verified separately.
- The SQL integration pair varied in wall time (70.52 to 76.47 s in the
broader pair, 47.36 to 29.30 s for the affected root in the
reverse-order control). The reproducible result is that two catalog
restores are skipped, confirmed by the before/after restore logs.

The historical Ubuntu race jobs are [sample
1](https://github.com/matrixorigin/matrixone/actions/runs/46577471337/job/142403778371)
and [sample
2](https://github.com/matrixorigin/matrixone/actions/runs/46578858399/job/142408193615).
The original lock roots could run in separate shards. The local serial
comparison measures selected work and does not establish the overall CI
critical path. No production code, BVT coverage or CI scheduling policy
changes.

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/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