Skip to content

fix: make View metadata migration idempotent - #29468

Merged
XuPeng-SH merged 4 commits into
matrixorigin:mainfrom
ck89119:issue-29007-main
Sep 29, 2026
Merged

XuPeng-SH merged 4 commits into
matrixorigin:mainfrom
ck89119:issue-29007-main

Conversation

@ck89119

@ck89119 ck89119 commented Sep 29, 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:

Related to #29007 and #26227; intentionally does not auto-close either issue.

This addresses a demonstrated migration-idempotency defect and adds lifecycle evidence under the merged on-demand architecture. The obsolete durable metadata recovery design is not reinstated; full mixed-binary activation remains outside this PR.

What this PR does / why we need it:

The 4.0.10 COLUMNS migration compares persisted rel_createsql with its exact template. Its private subscription-view CTE used SELECT mt.*, which CREATE VIEW correctly expanded and reformatted. Consequently, a successful migration persisted a definition unequal to its own readiness template and replay rebuilt the view.

  • Replace that private star with the eight fields actually consumed downstream. Keep authorization-before-APPLY, public column semantics, protocol 100 gating, and exact readiness checks unchanged.
  • Add 11 deterministic admission/readiness/failure scenarios and a real-engine regression: fail CREATE after the real DROP, verify rollback preserves V58, retry successfully, then replay with CREATE forbidden.
  • Extend the existing two-CN fixture with direct/nested Views, remote prepared SHOW, DESC/I_S/SELECT/CTAS after source-table restore, physical-source versus View identity checks, and same-UUID/same-directory restart.
  • Extend public SQL BVT and regenerate the three affected SHOW CREATE records with mo-tester.
  • Record rollout/rollback limits, Q1–Q3 review, acceptance mapping, and remaining evidence gaps in the conformance record.

No new migration version, protocol, worker, cache, or activation state is introduced: already-upgraded templates remain semantically usable; replay of the existing migration converges to the new representation once.

Validation

Local macOS arm64, Go 1.26.4, worktree-built native libraries; CGo tests through mo-cgo-test:

  • Normal owning packages: ./pkg/util/sysview, ./pkg/bootstrap/versions/v4_0_10, ./pkg/tests/upgrade — PASS. Final helper revision revalidated with the entire upgrade package.
  • Exact TestViewDescriptionTwoCN race: measured 28.57s; adaptive N=1; final run 30.28s — PASS, process exit 0.
  • Changed production statement coverage: 1/1 (100%); full sysview package coverage is 69.0%, not claimed as 75% package coverage.
  • Matching gofmt/vet and golangci-lint 2.6.2 — PASS / 0 issues.
  • mo-tester normal comparison on the same service: view 42/42 ×3, SHOW 189/189 ×2, account 125 passed + 1 existing ignored ×2, zero failures. Generated results were reviewed; unrelated regeneration drift was excluded.
  • Immediate teardown checks found no test database/snapshot/accounts; the owned service was stopped.

Four existing upgrade-framework tests remain skipped by their original implementation; all changed named tests executed. Old templates on new binaries and injected protocol responses are not mixed-binary evidence. Full L/A/B rollout, B activation/rollback denial, late-incarnation races, and the complete restore/PITR matrix remain with the #29433 successor work, including #29440/#29443.

Self-review: no unresolved blockers for this bounded fix; not approval of the complete #29007 lifecycle or a v2 rollout.

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

@aptend aptend left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

在 exact head 8e4c339 审核了 COLUMNS 私有 CTE 投影、迁移精确 readiness/失败回滚与重放、订阅权限路径,以及跨 CN 恢复/重启和 BVT 预期。未发现本次有界修复的阻塞问题;复用了该 head 已完成的 UT、两 CN/BVT 与静态检查证据。此审批不代表 #29007 整体或后续 mixed-binary/v2 rollout 已完成。

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deep review at ea6f230 against base/merge-base d8152cb: no blocking finding for this bounded migration-idempotency fix.

Design: fix the template at its existing sysview owner; do not weaken exact readiness or modify the general CREATE VIEW star-freezing rule. Traced the eight projected fields into the subscription View consumer: authorization still uses the full table-function source before projection/APPLY, and all downstream identifiers remain available. Public column types and authorization are unchanged. No new migration version, metadata state machine or recovery worker is warranted for this representation repair; existing upgraded tenants remain semantically usable, and replay converges once.

QA: reviewed the admission matrix and real transactional DROP -> injected CREATE failure -> old-definition restoration -> successful retry -> replay with CREATE forbidden. The real-storage oracle closes the previous mock's circular assumption that CREATE persists its input exactly. Also checked direct/nested consumers, remote prepared SHOW after source replacement, unchanged View identity, CTAS, and same-directory/same-UUID restart with new service instances. Tests reuse existing fixtures and deterministic failure injection; cleanup/rows/statement owners and bounded contexts were traced. The added restart cost buys an actual persistence boundary, rather than duplicate happy-path coverage.

Evidence: reused the documented owning-package passes, focused two-CN race result and same-service repeated BVT comparisons/teardown, with current-head CI green. No fresh local cluster/race run is claimed. Source/docs diff-check passes; the full check reports only the three new native mo-tester result rows' trailing empty-field whitespace, not a source defect. Reviewed the SQL/golden changes separately from production and the conformance document. No material new hot-path work or performance claim.

There are no prior unresolved substantive inline requests on this PR. This approval does NOT close #29007/#26227, approve v2 activation, or turn simulated protocol responses/same-binary restart into mixed-binary evidence; those explicitly retained successor requirements remain outside this one-statement fix.

@mergify mergify Bot added the queued label Sep 29, 2026
@mergify

mergify Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-09-29 11:01 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🟠 Checks running · in-place
  • 🚫 Left the queue — 2026-09-29 11:04 UTC · at 91d195ba88d72bb2ab821ddb088ea1b9565f6b05

This pull request spent 2 minutes 58 seconds in the queue, with no time running CI.

Reason

Pull request #29468 has been dequeued

Pull request from fork cannot be queued. This pull request comes from a fork, and Mergify needs the author's permission to update its branch.

The author needs to enable "Allow edits from maintainers" on this pull request.

Hint

You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it.
If you do update this pull request, it will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue instead, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

Waiting for any of
  • check-neutral = CI Required
  • check-skipped = CI Required
  • check-success = CI Required
All conditions

Tick the box to put this pull request back in the merge queue (same as @mergifyio queue).

  • Requeue this pull request

This branch was previously deployed

1 inactive deployment
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/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.

5 participants