Skip to content

fix(ci): repair shared UT lifecycle and trim redundant fixtures - #31933

Merged
XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/ci-ut-systemic-20261030
Oct 30, 2026
Merged

XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/ci-ut-systemic-20261030

Conversation

@XuPeng-SH

@XuPeng-SH XuPeng-SH commented Oct 30, 2026 •

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:

Refs #29249
Refs #31744 (current-main regression validation; not a new snapshot/frontier fix)

What this PR does / why we need it:

Repair shared ownership and test-cost problems identified while investigating 20 failed race/coverage jobs. Five coverage failures exhausted upgrade tests' 180/300-second workload deadlines while still waiting for runner-wide cluster admission. Other jobs exposed an actual statement-profile race, nondeterministic canceled Raft reads, and avoidable shell/GC fixture work.

  • Protect the SQL-source status getter with the existing statement-profile mutex, matching execution and reset. No second synchronization owner.
  • Reuse the existing recovery starter for CrossTarget and all COLUMNS/CDC staged upgrades. Preserve their original cumulative 3/5/10-minute workload budgets while excluding admission/startup time, including deliberately failed startup. Refresh each generation's SQL context; stop and join asynchronous startup on early failure before timer cleanup. Preserve global test timeouts and all manual-rejection, ablation, rollback, fencing, tenant, CDC and restart assertions.
  • Reject already-canceled logservice reads before admission/retry using the existing Dragonboat cancellation sentinel. Preserve missing/expired-deadline error precedence and completed-versus-canceled in-flight behavior. Check full and projected reads independently, including deadline controls.
  • Remove obsolete repair-walker waits and duplicate readbacks. The walker was removed upstream; versioned entries own convergence. These three static sleep sites formerly add 16 seconds over the selected seven upgrade scenarios. This is removed explicit waiting, not a measured whole-CI speedup.
  • Reduce timeout/cancellation mock-package staging without removing the timeout, TERM-to-KILL grace, process ownership, pool or drain-outcome assertions. Keep independent scenarios where mutable upgrade state or cancellation outcome differs.
  • Replace the legacy upgrade-GC test's 10ms ticker/5-second polling race with a synchronous call to the same registered collector owner. Preserve real registration and filesystem deletion, and additionally verify a recent neighbor is retained. The small explicit test seam adds no automatic runtime work.

Latest rebase

Rebased onto main c42cf40214 (including #31489 and #31819). The overlapping recovery test retains both failed-start and canceled-start budget checks; all other PR-touched files are unchanged from the previous head.

Local validation on this rebase: TestCrossTargetUpgradeRecovery and all seven TestRecoveryClusterStartupBudget cases pass with -race; embed go vet, pinned molint, incremental golangci-lint (0 issues), Go formatting, and diff checks pass. Earlier validation and patch hashes below refer to the previous base.

Scheduling-preview and cancellation follow-up after rebase

Rebased onto main d1594899b7381c5f0d44fa4590d21da1b09fa109; range-diff and byte comparison confirm that the rebase replay preserved the original PR patch before the two intentional test corrections below.

The CI pool-resolution test raced a stage-specific assertion against the production preview's 100 ms end-to-end deadline. It now enters the resolver under a caller-owned context, confirms entry before canceling, and checks exact cancellation identity and stage attribution. The production-wrapper constant remains 100 ms; its separate blocked-discovery test checks bounded completion within 1 second, rather than asserting exact elapsed time. Cleanup has a test-owned emergency release and joins the worker before closing the session/mocks, so losing the caller context fails without hanging cleanup.

The HAKeeper cancellation control also now owns a separate valid deadline instead of inheriting a short budget already consumed by preceding real reads. Missing-deadline and expired-deadline sentinels remain distinct. Neither correction changes production timeout or read behavior.

Controlled overlays reproduce the earlier-expiry failures of both old tests. A lost-context mutation makes the revised preview test fail at its watchdog and exit cleanly. These expected failures are sensitivity/cleanup evidence, not passing UTs or proof of the remote runner's precise scheduling cause.

Previous-base validation (d1594899b7):

  • Full normal packages (-short): embed PASS (358.220s; all nine changed cases executed), logservice PASS (63.811s; no skips), fileservice PASS (66.275s), and process PASS. Embed retains two unrelated skips (external MySQL CDC configuration and unconditional restart skip); fileservice retains six environmental/opt-in skips. Named optools, frontend and registered-GC consumers pass normal mode.
  • Both corrected tests pass 100 race repetitions each. Current-base process package, frontend/GC consumers, vector/BatchSet controls and the two-CN CrossTarget SQL/upgrade/restart scenario pass race checks.
  • Current full frontend/logservice/vector/batch package checks pass gofmt, vet, pinned molint and configured golangci-lint 2.14.0 (0 issues). No diff-filtered lint findings were omitted.
  • Independent gpt-6.1-terra / max design and overall review: PASS, no unresolved material blocker. Complete base-to-final-content patch SHA-256: 1f828f1191acace7b48ce005cc40196702ae984b0ad964b360ff59c561b765bf.

Earlier normal embed results below are author-reported historical evidence. Complete original-head ARM64 SCA (molint and golangci-lint over ./...) and original-head race package/checkpoint results are retained and reused only for semantically unchanged closures; the original UT job itself failed at the preview assertion. Raw UT JSON was truncated by the artifact producer; all eight embed batch completions are separately proven by the complete checkpoint log. New-base vector copy changes and the current frontend/read controls are validated separately.

Historical author-reported validation on main base 75e3964473

  • Full pkg/embed normal package: PASS, 463.046s. Focused recovery/CDC native scenarios and fake-clock error/retry/cancellation controls pass; affected asynchronous recovery scenarios under race: PASS, 163.449s.
  • Full pkg/vm/process, pkg/logservice, and optools race checks pass (2.284s, 67.666s and 30.020s respectively). Profile concurrent set/get/clear: 100 race rounds pass. Canceled-read regression: 100 race rounds pass before the final error-precedence refinement; the final complete logservice race run includes that refinement and its deadline controls.
  • Reported SQL integration/publication, PK reconnect, view-description and multi-CN index-rebuild consumers pass under race: 71.231s / 13.893s / 28.924s / 42.947s. Current-main EXPLAIN scheduling and LAG/LEAD rebuild controls also pass under race; their historical failures do not justify weakening assertions or importing unrelated feature changes.
  • Registered legacy GC and file-service GC/close neighbors pass under race. The exact legacy-GC case passes 100 race rounds (8.245s). A temporary registration mutation makes the real deletion assertion fail, confirming retained sensitivity.
  • Two temporary overlay probes force early failure after upgrade entry: both terminate with the expected test failure, release admission/ports, and report no data race or hang. Expected failures are negative-control evidence, not ordinary green tests.
  • Incremental gofmt, go vet, and configured golangci-lint over all six changed packages pass; lint reports zero new issues. Actual gpt-6.1-terra / max design and overall review performed.

The frozen historical jobs are dispositioned below. Passing current-main controls do not prove that every historical load-related timeout has been eliminated. One job failed downloading Go before tests; JSON assertions exist only on its feature branch. There is no claim to fix those through unrelated kernel changes. No real long-admission-queue capacity benchmark or whole-CI speedup is claimed; admission isolation and the global timeout remain authoritative. New remote CI is pending.

All 20 historical failed-job dispositions
Job Findings and disposition
JSON conditional branches Branch-specific planner feature assertions; no same-named main test. No unrelated feature imported.
Prepared EXPLAIN Current-main normal and race controls pass unchanged.
CrossTarget admission Shared recovery-budget correction.
ENUM/SET racing Current-main native control and owning embed package pass; historical assertion was truncated.
LAG/LEAD rebuild Current-main normal and race controls pass unchanged.
Timeout harness + scalar refresh Trimmed harness setup; current-main scalar/tenant control passes. Heartbeat-load cause not established.
Index rebuild + view description Both current-main native race consumers pass; historical heartbeat stalls not independently reproduced.
Interrupted COLUMNS admission Shared recovery-budget correction; interrupted-route assertions retained.
Manual COLUMNS admission Shared budget and failed-start accounting; rejection/remedy retained.
Go setup download Infrastructure download timed out before UT; no source workaround.
HAKeeper cadence Compatible pre-admission cancellation correction and independent read/deadline assertions.
Cancellation harness + view Trimmed harness setup; current-main view race control passes. No claim that this proves a runner-load fix.
CDC cleanup Full current-main embed package passes; historical heartbeat/cleanup stall not independently reproduced.
ENUM/SET coverage Same feature-branch occurrence as racing; current-main native/owning-package controls pass.
Publication status race Shared statement-profile mutex fix; publication consumer passes race.
Forward-create replacement Current-main normal native control passes unchanged; no speculative heartbeat workaround.
GC and other embed failures Synchronous registered-GC correction; owning embed passes prepared-time, roles, catalog, CDC and bulk-write neighbors.
JSON + PK reconnect JSON branch-specific; current-main PK reconnect race control passes with existing snapshot/frontier assertions.
CrossTarget admission (second) Same shared recovery-budget correction.
No-entry COLUMNS admission Same shared budget correction; negative/positive across-generation controls retained.

Relationship to the owner's other open CI issues: this PR does not close the remaining assigned flaky-test reports. #31744 names the PK reconnect case present in the 20-job sample; its current-main race validation passed, but the snapshot/frontier repair is not introduced by this diff. #31781 includes a separate snapshot-replay context shared across subtests and quoted-default cleanup timeouts; changing upgrade-startup budget ownership does not fix either mechanism. #31790 concerns flush-to-DUMP visibility, #31696 cross-CN DDL visibility, #31545 DROP cleanup, #31491 retired-owner route convergence, and #30985 hotfix timeout/diagnostic publication. Those require their own causal closure; none is claimed resolved or automatically closed here.

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

@XuPeng-SH

XuPeng-SH commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor Author

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

Commit: 1178abc5e9194cef2d5071996db1411f0318dd99

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: 1178abc5e9194cef2d5071996db1411f0318dd99

Assessment: approve

The locking and cancellation fixes preserve existing contracts, and the fixture reductions retain upgrade, GC, and cleanup assertions. No actionable findings remain.

Model: gpt-6-astra / xhigh

Session: 01a1869d-820c-7212-9788-aecfb86a4141 · slot 0 · generation 2

Validation:

  • All six affected packages passed in normal mode.

  • Process and logservice packages passed under race detection; focused scheduler, GC, profile, cancellation, and upgrade lifecycle race checks passed.

  • Native provenance verified; all 12,939 exported source blobs matched the frozen head before and after testing. Original checkout remains clean.

  • Receipts and retained logs reconciled in validation-evidence.json; discussion-assessment.json covers both discussion entries.

Limitations:

  • Validation used Linux/amd64 CPU short mode with existing external-service and OOM skips. No changed focused test was skipped.

  • Frozen CI was pending; repository-wide coverage and throughput were not independently validated.

@XuPeng-SH

XuPeng-SH commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor Author

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

Commit: ccce9798d2a160279be37ce58da4334578e4295d

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: ccce9798d2a160279be37ce58da4334578e4295d

Assessment: approve

The locking, cancellation and lifecycle fixes preserve existing contracts. Fixture reductions retain meaningful upgrade, cleanup and GC assertions. No actionable findings remain.

Model: gpt-6-astra / xhigh

Session: 01a1869d-820c-7212-9788-aecfb86a4141 · slot 0 · generation 2

Validation:

  • Full frontend normal and logservice race suites passed.

  • Pool-resolution cancellation passed 100 race iterations.

  • Focused shell-harness, statement-profile, registered GC, upgrade recovery, CDC task-survival and startup-budget race checks passed.

  • Prior receipts and retained logs were reconciled; current-base author evidence matched the frozen patch hash.

  • Native provenance and all 12,939 exported source blobs verified; original checkout remains unchanged.

  • Saved review-plan.md, discussion-assessment.json and validation-evidence.json in attempt-2; all four discussion keys accounted for.

Limitations:

  • Local validation used Linux/amd64 CPU short mode. The frontend suite retained the existing TestRuleCacheDoubleCheckLocking skip; no changed focused test was skipped.

  • Frozen CI remained incomplete. Repository-wide coverage and whole-CI performance were not independently validated.

@XuPeng-SH

XuPeng-SH commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor Author

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

Commit: 8a802670d8ec410da2b37ebe2b9342d7f6be14fc

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: 8a802670d8ec410da2b37ebe2b9342d7f6be14fc

Assessment: approve

The locking, cancellation and fixture changes preserve their contracts and regression assertions. No actionable findings remain.

Model: gpt-6-astra / xhigh

Session: 01a1869d-820c-7212-9788-aecfb86a4141 · slot 0 · generation 2

Validation:

  • All nine selected embed tests, including seven startup-budget subtests, passed with race detection; no skips; 182.569 seconds.

  • Reconciled prior normal/race evidence with receipts and retained logs, reusing it only for unchanged behavioral paths.

  • Native provenance, formatting and diff-whitespace checks passed; all 12,948 exported source blobs verified and original checkout unchanged.

  • Saved review-plan.md, discussion-assessment.json and validation-evidence.json; all six discussion keys accounted for.

Limitations:

  • Local execution used Linux/amd64 CPU short mode.

  • Frozen CI remained incomplete; full coverage and whole-CI performance were not independently validated.

This branch was successfully deployed

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

Labels

kind/bug Something isn't working 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