Skip to content

test: reduce publication and snapshot race fixture work - #33584

Merged
XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
XuPeng-SH:perf/main-race-ut-fixture-work
Dec 1, 2026
Merged

XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
XuPeng-SH:perf/main-race-ut-fixture-work

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 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 and sample 2. 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.

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

Copy link
Copy Markdown
Contributor Author

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

Commit: 0d86a089682a6e9cc019031191419e7393c862e2

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: 0d86a089682a6e9cc019031191419e7393c862e2

Assessment: approve

The test-only consolidation reuses fixtures while retaining the lock, restore, metadata, and authorization assertions reviewed. The multi-tenant cluster restore remains covered. No actionable defects were found.

Model: gpt-6.1-terra / max

Session: 01a22af4-cf2a-7f70-88e4-931bbf57d739 · slot 2 · generation 14

Validation:

  • Preflight passed. Native build provenance matched 195 source inputs and seven retained artifacts.

  • All four changed test roots passed with -race -short -tags matrixone_test. The successful receipt is checks/1796113045837555797-3.json, with output in selected-race-retry.stdout.log.

  • git diff --check passed for the assigned base and head; receipt checks/1796113235013737525-3.json.

  • All three discussion items were recorded in discussion-assessment.json.

Limitations:

  • The first race run timed out during dependency download, compilation, and initial test execution; the subsequent run passed.

  • The author's paired performance comparison was not independently reproduced and does not establish an overall CI critical-path improvement.

@XuPeng-SH
XuPeng-SH merged commit 15fb499 into matrixorigin:main Dec 1, 2026
4 of 6 checks passed
@XuPeng-SH
XuPeng-SH deleted the perf/main-race-ut-fixture-work branch December 1, 2026 10:00
XuPeng-SH added a commit that referenced this pull request Dec 1, 2026
## What type of PR is this?

- [x] Test and CI

## Which issue(s) this PR fixes:

Related to #32745 (race UT and flaky-test tracker). Follows #33584.

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

Reduce repeated fixture work, data volume, I/O, and fixed waits across
nine race UT cases.

- Share two snapshot/restore rounds between publications of the same
data shape. Keep independent no-publication controls and check every
publication and subscription after each restore, including access denial
after an excluded name is reused.
- Reclaim the obsolete branch-copy and dropped truncate-probe files
together. Keep the real flush, L0 merge, physical reclamation, restart,
and exact post-restart rows.
- Reduce the multi-CN Top and bulk-write fixtures while still exercising
remote Merge Top, the auto-increment cache boundary, workspace object
writes, and ADD/DROP PRIMARY KEY copy.
- Batch LIKE test inserts with bound binary values and reuse exact scan
results across temporal index checks. Keep the NULL and malformed-byte
cases, plan checks, clock transitions, and text/binary prepared
execution.
- Run three independent managed-LSN blackholes concurrently. Join the
real GC timeout and recovery drains, and use one observation window for
the parked Close test. Release and join workers on assertion failure.

## Validation

- Local Go race tests passed for 18 selected test roots across embed,
DML, issues, SQL integration, logservice, and disttae. The four disttae
roots ran three times.
- Repository incremental SCA for the six affected packages, gofmt, and
`git diff --check` passed.

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