Skip to content

ci: reduce race UT work and harden fixture retirement - #32872

Merged
XuPeng-SH merged 3 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/issue-32745-ut-race-20261118
Nov 18, 2026
Merged

XuPeng-SH merged 3 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/issue-32745-ut-race-20261118

Conversation

@XuPeng-SH

@XuPeng-SH XuPeng-SH commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • Improvement
  • Test and CI

Which issue(s) this PR fixes:

Refs #32745 (FLAKY-001). The issue is a long-lived tracker and should remain open.

What this PR does / why we need it:

Reduce repeated race-test cluster setup and large query construction while retaining the distinct contracts:

  • Reuse one dedicated cluster for five compatible inventory CAS cases; verify each case's database, catalog table and writer transactions are retired before the next one. Keep restart and topology-sensitive cases separate.
  • Run one complete same-row-count collation repair, then verify each other field corruption using the real upgrade predicate and an independently rolled-back transaction. Keep the other repair and retry cases.
  • Keep real 256-branch planner boundary witnesses, but test budget reuse and case-insensitive admission without repeatedly building equivalent wide plans. Check that separate builds obtain a fresh budget and enumerate their own metadata.
  • Preserve all 24 strict CTAS error, alias-reuse and cleanup cases. For each successful mode and table type, keep the standalone constant expression and use one CTAS to evaluate five runtime expressions, independently checking which row is NULL.
  • Close and join the disk-cache download writer before cache and temporary-directory cleanup; add an abandoned-fill regression witness for FLAKY-001.
  • Identify final CN admission withdrawal errors without changing their underlying errors.Is identity. When the CDC test explicitly discards an entire old test topology, proceed after a withdrawal timeout only if all owners, including its HAKeeper, are completely released and the error tree contains no other error. Log the diagnostic; ordinary CN and shared-fixture close behavior remains strict.

Validation (Linux, Go 1.27.1, -race -short -tags matrixone_test, GOMAXPROCS=2):

  • Full pkg/tests/sqlintegration, pkg/fileservice, pkg/cnservice, and pkg/embed race packages passed. The first full embed run failed in an unrelated allocation-headroom case while other work was running; that case passed on the base and the complete package passed on retry without concurrent static analysis. The subscription-statistics planner race suite and the full CTAS root passed. Production collation upgrade/check tests passed under race.
  • The reported cache cancellation test and the cleanup witness each passed 100 race repetitions. Removing the join made the witness fail in 8 of 10 runs. A CTAS mutation that preserved the NULL count but placed it on the wrong row was also detected. Both mutations were restored.
  • Repository static-check-selected passed for pkg/fileservice, pkg/tests/sqlintegration, pkg/sql/plan, pkg/tests/issues, pkg/cnservice, and pkg/embed (molint and golangci-lint, 0 issues); gofmt was clean.

Local performance observations (not predicted whole-CI savings):

  • Selected SQL cases took 56.54s and 56.43s at the base versus 27.71s for the final change, serially. One full-package four-worker comparison passed on both sides: wall 327.1s → 268.0s, aggregate process CPU 796.1s → 741.0s, block writes 667.5 → 614.0 MiB and block reads 19.4 → 38.9 MiB. The runs had the same 898 terminal test outcomes after mapping the renamed CAS cases. Single-process peak RSS ranged 2161–3831 → 1997–3926 MiB, not a simultaneous aggregate peak. Host load, cluster starts, page cache and the CI wrapper differ; a single pair cannot establish a causal CI-wide or total-resource change.
  • The two changed planner roots took 9.24s at the base versus 3.14s for the final version in a broader local suite. In a prebuilt same-host CTAS ABBA run, all four passed: base wall 25.90s/17.33s and process CPU 19.89s/17.26s; candidate wall 13.50s/14.06s and CPU 12.99s/13.81s. Base block writes were 19.44/14.44 MiB and candidate writes 11.98/12.25 MiB. The historical main job placed these cases on critical shards, but a full CI batch A/B has not been run.

Design and review: gpt-6.2-sol, xhigh. Full CI remains pending.

The CI failure in the old head occurred during shutdown of a previous single-CN fixture: its final admission withdrawal timed out while HAKeeper Raft proposals were timing out. The scoped discard avoids failing the next unrelated test after complete local topology destruction; it does not establish or repair the underlying Raft stall. The original CI job was re-run to collect independent evidence.

@XuPeng-SH XuPeng-SH changed the title test: reduce race UT setup and join cache fills test: reduce race UT work and join cache fills Nov 17, 2026
@XuPeng-SH
XuPeng-SH marked this pull request as ready for review November 17, 2026 20:31
@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 17, 2026 •

Copy link
Copy Markdown
Contributor

This pull request is merged.

@XuPeng-SH

XuPeng-SH commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor Author

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

Commit: 369ce844cb097599f138222cfe98975f3e18d408

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: 369ce844cb097599f138222cfe98975f3e18d408

Assessment: approve

The patch joins the disk-cache fill before temporary-directory cleanup and removes repeated test setup while preserving the distinct planner, collation, CAS, and CTAS checks.

Model: gpt-6.2-sol / xhigh

Session: 01a1a004-90c3-73b1-acc9-3d4636452003 · slot 0 · generation 0

Validation:

  • Focused race checks passed across all four affected packages, including all five merged CAS cells, 24 strict CTAS cases, and 20 runtime CTAS expression checks.

  • All nine tests that use the download fixture passed together under race detection. The cancellation and abandoned-fill tests each passed 100 repetitions. Removing the join in a test overlay reproduced the abandoned-fill failure in 9 of 10 runs.

  • Preflight, gofmt, and diff whitespace checks passed. The commands, receipts, and retained logs are indexed in validation-report.json.

Limitations:

  • The broader local runs reached their suite timeouts in the unchanged TestLocalFS and TestInventoryCASRCTransfer cases. Focused reruns of the affected tests passed.

  • CI UT and SCA were pending in the frozen snapshot. Performance figures are author-reported.

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

Assessment: changes needed — original test coverage is reduced.

Static review of base 517e1695388cbaf1135238d5ab0c19a4556fb551 and head 369ce844cb097599f138222cfe98975f3e18d408 found these lost execution paths:

  1. Budget reuse across complete plans: the old test built two 129-branch plans with the same compiler context. The new test exercises 129 branches through a helper but builds only 2- and 3-branch complete plans. A budget leak confined to binding complete plans could therefore escape the new test. Old · New
  2. Mode 2 at the planner boundary: the old test built a complete 256-branch plan in both lower-case modes. At that size, the new mode-2 case calls the visibility helper rather than building the complete plan. It no longer checks mode-2 binding and scan counts at the boundary. New
  3. Collation repair: the old cases committed each of seven field corruptions and exercised the real tenant upgrade. The new cases run the full repair for one corruption; the other six check the upgrade predicate in rolled-back transactions, so those cases no longer verify that the real upgrade repairs their particular corrupted rows. Old · New
  4. Non-strict CTAS: five runtime expressions previously ran in separate two-column CTAS statements; they now run together in a six-column CTAS. The new row-specific NULL assertion is stronger, but it does not exercise the former individual statement shapes. The strict error cases and constant expression remain separate. Old · New

Please retain those end-to-end paths, or supply equivalent coverage of them, while optimizing elsewhere. Matching the mapped test-outcome count alone does not establish equivalent execution coverage.

Limits: This is a source-only review. I did not run the tests or mutations and am not asserting that any production defect currently exists. I have not exhaustively established whether other repository tests cover each omitted path.

@XuPeng-SH

XuPeng-SH commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor Author

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

Commit: 369ce844cb097599f138222cfe98975f3e18d408

New discussion was assessed; the previous review remains unchanged.

@XuPeng-SH XuPeng-SH changed the title test: reduce race UT work and join cache fills ci: reduce race UT work and harden fixture retirement Nov 18, 2026
@XuPeng-SH

XuPeng-SH commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

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

Commit: 2a50840e49dc2f80ec4c74da9a790abf4831ffdf

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: 2a50840e49dc2f80ec4c74da9a790abf4831ffdf

Assessment: approve

The disk-cache fixture now joins its writer before cleanup. The CDC test can proceed after a final withdrawal timeout only when the old cluster reports complete teardown and the close result contains no separate failure. The reduced test matrix preserves the distinct planner, collation repair, CAS isolation, and CTAS result and cleanup checks raised in the prior review.

Model: gpt-6.2-sol / xhigh

Session: 01a1a004-90c3-73b1-acc9-3d4636452003 · slot 0 · generation 0

Validation:

  • Focused race checks passed across six packages, including all five merged CAS cases, seven collation field cases, 24 strict CTAS cases, and 20 runtime CTAS expression checks. See focused.jsonl and receipt 1794965848653489940-2.json.

  • Seven additional race controls passed, including completed and incomplete close ownership, stale cleanup isolation, and end-to-end mode-2 subscription binding. See controls.jsonl and receipt 1794965860117032919-2.json.

  • Verified retained race evidence against unchanged disk-cache inputs. Both lifecycle tests passed 100 repetitions, and removing the join reproduced the regression in 9 of 10 runs. Preflight, frozen-source verification, gofmt, and diff whitespace checks passed. Receipts and logs are indexed in validation-report.json.

Limitations:

  • Full CI was pending in the frozen snapshot. The review did not rerun the full CI batch or reproduce the underlying HAKeeper Raft stall. Performance figures remain author-reported.

@XuPeng-SH
XuPeng-SH merged commit 5d63cf6 into matrixorigin:main Nov 18, 2026
@XuPeng-SH
XuPeng-SH deleted the codex/issue-32745-ut-race-20261118 branch November 18, 2026 03:00

This branch was previously deployed

1 inactive deployment
ci — 2a50840e Deployed Nov 18, 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/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.

3 participants