Skip to content

fix: consolidate stopped-upgrade cleanup and stabilize CI - #32307

Merged
XuPeng-SH merged 19 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/class-a-upgrade-32278
Nov 6, 2026
Merged

XuPeng-SH merged 19 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/class-a-upgrade-32278

Conversation

@XuPeng-SH

@XuPeng-SH XuPeng-SH commented Nov 6, 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:

Fixes #32288
Fixes #32297
Fixes #32298
Fixes #32321
Fixes #32260

Related to #32278. The separate view-refresh work in #29433 remains open.

What this PR does / why we need it:

Support a stopped 4.2 release upgraded directly to current main, including its existing data and snapshots.

  • Move historical orphan-grant cleanup into the existing 4.0.7 tenant upgrade and current system-view publication into the existing startup/admission owner. Remove the recurring per-CN repair loops. Current create, drop and restore paths retain their own catalog responsibilities.
  • Preserve the current physical-index filtering from main in TABLES, COLUMNS and PARTITIONS. The startup completion check includes PARTITIONS, so a missing or outdated system definition reaches the existing admission-gated reconciliation; the current state remains read-only and failures prevent ingress.
  • Stop creating retired transaction-trace tables on fresh clusters. Preserve existing 4.2 trace tables, data, protections and frozen historical upgrade entries.
  • Add a read-only 4.2 preflight for ambiguous snapshot ownership and CDC task inventory. Preserve explicit administrator decisions, exact-preimage checks and the CDC rejection when safe resumption cannot be established. Cancellation joins the tracked direct child, including the launch-to-PID-registration window; a winning atomic publication remains a complete file.
  • Read snapshot catalog rows in pages of 32 instead of 128 to fit legal wide names within the existing 4 MiB result limit. Decision-write and diagnostic batches remain 128. This can require roughly four times as many one-time page reads; it does not bound total engine memory.

Repair the CI tests at their actual synchronization and ownership boundaries:

  • Install each proxy Unlock fault injector before publishing its route. Keep the delegate immutable while synchronized controls simulate lost requests/responses; retain all five real-owner handoff/retry scenarios and exercise concurrent keeper-style bind reads.
  • Reuse the existing short-test heartbeat configuration for 13 rolling-restart scenarios and replace 11 busy-spins with waits on the original caller context. Production timing, allocator grace, error/state assertions and the fast negative restart case are preserved.
  • Join the pending-GC worker before asserting its final queue; retain both real batch ladders and prove the autonomous scheduler tick with controlled test-local file-service gates.
  • Fence the transfer test's pooled read after its successful commit. Identify CAS writers through their real SQL session and active transaction, with an unrelated transaction held as a control. Preserve affected-row, isolation, conflict and final-data assertions.
  • Replace CHECK's unrelated global allocator-zero precondition with the commit barrier. Keep a synthetic historical orphan present throughout the existing public CHECK cases to exercise that boundary.
  • Give Unicode scenario groups and independent cleanup operations bounded contexts. Start account workload timing after initial cleanup. Separate Scalar setup and concurrency exercise into fixed 60-second phases. This increases aggregate allowances; deadlines are never renewed within a running operation.
  • Give privilege-cache and Scalar child cases their own shared-fixture failure ownership. Cancel and join SQL actors before teardown, report cleanup errors, discard uncertain transaction connections and quarantine failed generations before the next case.
  • Consolidate final Scalar system-database cleanup at the group boundary while retaining each child's reset and failure ownership, all 16 semantic modes, and warm shared-cluster reuse. The full successful matrix issues 36 explicit source/peer DROP DATABASE calls instead of 64; the removed calls are normally redundant absent-database drops, not eliminated required teardown or measured WAL writes. Tenant source/account cleanup keeps its original 10/20-second limits.
  • Final system-database cleanup now uses independent 60-second budgets, matching the existing Scalar setup phase, instead of 10 seconds each: the final pair can consume at most 120 rather than 20 seconds. The next child's unchanged 60-second setup now owns the preceding nonempty database reset. Unknown or failed DROP results remain errors and quarantine the fixture; no destructive DDL is retried. This test policy does not fix the runner's storage latency or prove the historical timed-out request would finish within 60 seconds.
  • Retain LIKE's matching throwing-residual, disjoint nonthrowing control and planner guards, independently of statistics-driven predicate order.

Validation

  • Rebased on main bfbb2645c034 (includes fix: restrict direct access to physical index relations #32032). Incremental gofmt, tagged vet, pinned molint and golangci-lint passed across all 13 changed Go owners and the directly affected v1.2.0 upgrade package. Complete pkg/bootstrap and pkg/util/sysview race runs passed (84 and 43 top-level tests). Focused race exercises stale, missing and failed PARTITIONS checks, CN admission/ingress failure, current metadata and the frozen release PARTITIONS definition.
  • On a real local catalog, a fresh current PARTITIONS definition passed the completion check; installing the released 4.2.8 definition made it incomplete, and the existing startup owner replaced it once and left a second reconciliation as a no-op. The existing hidden-index access and tenant-upgrade SQL cases passed in normal and race modes; they exercise renamed backing indexes and TABLES/COLUMNS/PARTITIONS visibility. The Scalar cleanup root and all 16 scenarios passed race after rebase.
  • A fresh stopped 4.2.5 single-CN, two-tenant upgrade and clean restart passed with the rebuilt rebased binary. System and both tenant TABLES/COLUMNS/PARTITIONS definitions used the current physical-index predicate, ordinary indexed tables remained visible and backing index relations were hidden. Tenant identities, live rows and grants survived, orphan grants disappeared, recreated tables inherited no stale access, and decimal/bit/varchar defaults and values matched. This is a local single-CN result; its empty read-only cgroup mount does not validate cgroup monitoring.
  • The rebased pkg/vm/engine/disttae race run passed 734 top-level tests, including the PR's GC worker case after its interaction with fix: restrict direct access to physical index relations #32032; the v4.0.6 owner passed five. pkg/txn/trace has no direct test files.

The following broader validation was performed before rebasing onto #32032; it is retained with its original scope and is not a claim that the same full suites were rerun at the rebased head:

  • Complete lockservice normal and race runs each passed the same 690 named tests with no skips. Matched local race package time fell from 58.668 to 42.592 seconds (27.4%); the 13 rolling-restart bodies fell from 20.15 to 4.23 seconds. This is a local package measurement, not an end-to-end CI speedup. All 19 selected controls passed with coverage; all 14 rolling-restart controls also passed without short mode.
  • A controlled reintroduction of the live proxy-interface write made the original issue-named test fail under the race detector. Joining the keeper before canceling a pending restart made the context wait fail explicitly. Both are deliberate negative controls, not ordinary passing tests. All 18 measured-budget exact-test race stress commands passed (1,597 repetitions; each command selected one exact root).
  • Before this rebase, gofmt, diff checks, tagged vet and pinned selected-owner molint and golangci-lint passed across the 13 changed Go owner packages.
  • Complete pkg/tests/sqlintegration race: 104 top-level passes and one existing external-service skip. Complete pkg/embed race: 159 passes and two existing skips. The embed run includes the CI-named DataBranch case, failed-fixture controls and system/tenant predecessor-to-current COLUMNS crossing with restart.
  • All selected issues tests passed normal and race, including all 16 Scalar modes, both account roots, Unicode, AutoID and cleanup error/budget controls. Complete pkg/bootstrap/versions, pkg/bootstrap/versions/v4_0_7 and pkg/util/sysview race runs passed.
  • Final-source fault injection validated GC worker joins at both gates, privilege and Scalar failed-generation isolation, continuation after canceled AutoID rollback, account workload context ownership, and a controlled stale transfer read followed by the actual fence and correct pooled result. Injected failures remained test failures; they were not counted as passing normal cases.
  • A fresh released 4.2.5 single-CN, two-tenant stopped upgrade and clean restart passed using the rebuilt production-identical binary. Live IDs/grants and restricted-user reads survived, real orphan grants disappeared, recreated tables inherited no stale grant, and persisted decimal/bit/varchar defaults matched the new COLUMNS definition and stored data before and after restart. The release harness used an empty read-only cgroup mount; cgroup monitoring was not validated.
  • Earlier unchanged preflight evidence includes all 11 tests, deterministic cancellation timing and 20 repeated signal tests, plus Bash syntax, ShellCheck and Ruff checks.
  • Focused CAS/LIKE and CHECK/privilege normal tests passed. Measured-budget race repetitions passed for the exact affected roots: GC 3, SI 5, reverse/restart 3, transfer 4, pessimistic RC 5, LIKE 3, Unicode 6, AutoID 2, concurrent-account 4, refresh-account 5 and privilege 3. Other affected roots had N=1 from their measured duration and reuse their completed race results.
  • Scalar cleanup repair: normal and race passed all 16 original modes plus a real next shared-fixture consumer. Two matched-configuration race samples of the three-root group were 37.319/35.513 seconds before and 37.069/37.607 seconds after; no material local cost change was observed, and this is not a CI speedup claim. Four fake-clock cleanup cases passed, including 100 race repetitions. A controlled 20-second success fails with the old 10-second budget and succeeds with the selected policy; real-fixture probes cover an unselected root, tenant namespace ownership, system finalization, child failure, and final DROP errors before/after effects, preserving errors, independent cleanup and generation quarantine.
  • Independent gpt-6.1-terra / max design and final overall reviews passed for the complete PR, with the current rebase resolution and affected evidence reviewed alongside the previously reviewed unchanged closures.

Earlier author-reported validation used released 4.2.8 with historical snapshots/trace tables and 129 legal wide snapshots, including upgrade, interrupted recovery and restart. The author also reported 21 affected SQL/BVT scripts with 4,382 passes and 8 existing ignores. Those are historical reports, not fresh executions of this revision. Earlier CI covered all 20 changed result-file companion cases with zero failed/abnormal results and 8 existing ignores, before the latest main merges.

The supported transition excludes mixed-version operation, downgrade and upgrades from unreleased main catalogs. Preflight requires a MySQL-compatible client, jq, GNU coreutils and scratch disk proportional to the catalog, with source snapshot/branch writers drained. System-account and cluster snapshot/PITR restores with the incompatible old CDC watermark schema still fail before mutation. Production-scale memory and a real release-source multi-CN upgrade have not been measured.

Assigned-issue audit: #31239 was independently verified as already fixed by merged #31237. Historical #30985 and #29333 were closed as not planned because essential incident evidence is unavailable; no causal fix is claimed. The production COPY ALTER/HNSW concurrency issue #31611 remains open; this PR preserves its conflict protection.

The CI HAKeeper ReadIndex startup stalls and internal Scalar ALTER latency remain unexplained. These test fixes do not establish either primary liveness cause as resolved. CI on the rebased revision is pending.

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

Copy link
Copy Markdown
Contributor Author

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

Commit: f5cad34f844024acb840d0ad73cd9a5e1d867aea

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

Assessment: approve

Cleanup now uses existing tenant-upgrade and startup owners, removing resident repair workers while preserving released catalog definitions and historical trace data. The preflight reuses the existing decision publisher and validation. No actionable defects remain in the reviewed scope.

Model: gpt-6.1-sol / max

Session: 01a1a004-9884-72c0-ad39-f096c4209c4a · slot 1 · generation 0

Validation:

  • Locally passed all 8 preflight-script tests and bash syntax validation; exact-head receipts and retained logs are reconciled in validation-ledger.json.

  • Source audit passed: clean frozen head, complete 53-file delta, unchanged historical migration registrations and 4.0.7 offset, nine trace definitions matching released 4.2.8, and removed worker references absent.

  • Reviewed linked requirements, affected producers/consumers and removed test oracles; discussion-assessment.json covers both discussion keys.

  • Reused author-reported normal/race owner tests, released-4.2.8 upgrade/restore/restart and wide-snapshot recovery, and simulated two-CN recovery. The reported 4,382-pass BVT run predates the final page-size change; bootstrap and two-CN recovery reruns cover that delta.

Limitations:

  • Go/cluster checks were not independently rerun; author raw logs were not supplied. Relevant CI checks remain pending.

  • Real-release upgrade evidence uses one CN; two-CN coverage uses simulated older catalogs. Production-scale latency and total engine memory were not measured.

@XuPeng-SH

XuPeng-SH commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor Author

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

Commit: 440f9bf9bb06ff6fbba3b9fd3e72484c00bf7464

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: 440f9bf9bb06ff6fbba3b9fd3e72484c00bf7464

Assessment: approve

Cleanup reuses existing upgrade and startup owners, removing recurring repair state while preserving historical data and shared admission safeguards. Test repairs preserve behavioral assertions and fixture ownership. No actionable findings remain.

Model: gpt-6.1-sol / max

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

Validation:

  • Reviewed all 66 changed paths, affected consumers, 12 discussion entries and 11 linked issues; source unchanged.

  • All 11 exporter tests passed. Bash syntax, gofmt for 36 changed Go files, whitespace and source/release audits passed; receipts and logs reconciled in validation-review.json.

  • Nine trace definitions match released 4.2.5 and 4.2.8; historical migration registrations remain unchanged.

  • Qualified supplied normal/race/fault and upgrade/restart reports; independently reviewed the two-file Scalar repair. Frozen shared-build CI succeeded.

Limitations:

  • No independent Go, cluster or BVT execution; raw author runtime logs were unavailable.

  • Five frozen CI jobs remain incomplete. Historical BVT results are not current-head passes.

  • Released multi-CN upgrades and production resource costs remain unmeasured; historical HAKeeper and Scalar latency causes remain unexplained.

@XuPeng-SH

XuPeng-SH commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor Author

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

Commit: df8de7376c21435679b4d1e6fc87e11726ef1e7a

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

Assessment: approve

Cleanup reuses existing upgrade, startup and publication owners while preserving historical data and shared admission safeguards. Test repairs preserve behavioral assertions and fixture ownership. No actionable findings remain.

Model: gpt-6.1-sol / max

Session: 01a1a004-9884-72c0-ad39-f096c4209c4a · slot 1 · generation 0

Validation:

  • Reviewed all 66 changed paths, 14 discussion entries and 11 linked issues; source remains unchanged.

  • Passed 11 local exporter tests, Bash syntax, gofmt for 36 Go files, whitespace and source/release audits. All four receipts, including the corrected audit-probe diagnostic, are reconciled in validation-review.json.

  • Nine historical trace definitions match released 4.2.5/4.2.8; historical registrations and catalog offsets remain preserved.

  • Qualified author-reported rebased owner/race checks and released-4.2.5 single-CN, two-tenant upgrade/restart evidence.

Limitations:

  • No independent Go, cluster-upgrade or BVT execution; raw author runtime logs were unavailable.

  • Five frozen CI jobs remain incomplete. Pre-rebase suite and BVT results are historical.

  • Released multi-CN upgrades and production-scale costs remain unmeasured; historical HAKeeper/Scalar latency causes remain unexplained.

This branch was successfully deployed

No deployments
ci — cc890a23 Deployed Nov 6, 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/documentation Improvements or additions to documentation kind/enhancement kind/refactor Code refactor kind/test-ci size/XXL Denotes a PR that changes 2000+ lines

Projects

None yet

2 participants