Skip to content

refactor(view): add inactive metadata lifecycle - #27370

Merged
mergify[bot] merged 21 commits into
matrixorigin:mainfrom
ck89119:issue-26227-lifecycle-main
Aug 22, 2026
Merged

mergify[bot] merged 21 commits into
matrixorigin:mainfrom
ck89119:issue-26227-lifecycle-main

Conversation

@ck89119

@ck89119 ck89119 commented Aug 20, 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:

issue #26227

What this PR does / why we need it:

This PR adds the inactive View metadata lifecycle layer on top of #27267.

It adds:

  • transactional dependency persistence and reverse-closure invalidation;
  • typed refresh failure classification;
  • bounded discovery, retry, lease, pagination, and generation state;
  • restore, PITR, snapshot, publication, subscription, and CTAS binding-context adapters;
  • identity-preserving authoritative regeneration.

Inactive boundary:

  • ViewMetadataRefreshEnabled is structurally fixed to false in this layer;
  • no capability heartbeat, HAKeeper propagation, MOCluster activation barrier, recovery worker, or public fail-closed behavior is included;
  • lifecycle-aware mutations record a durable REVALIDATE_REQUIRED marker in the caller transaction while activation is unavailable;
  • typed missing-table errors remain compatible during catalog upgrade;
  • a durable membership/capability epoch and admission fence is a prerequisite follow-up;
  • activation must land only after that prerequisite, so late old-CN joins, rollback, Proxy/CN cache skew, and transient membership cannot bypass revalidation.

This revision removes the incomplete local-cache-based capability barrier previously present in this PR. It does not claim rolling-upgrade activation safety.

Validation:

  • regenerated protobuf bindings with the repository generator and verified deterministic output;
  • passed full tests for pkg/hakeeper, pkg/logservice, pkg/clusterservice, pkg/sql/compile, and pkg/frontend on the final merged base;
  • passed full-package race tests for pkg/sql/compile and pkg/frontend before the final base merge;
  • passed go vet for the owning packages before the final base merge.

# Conflicts:
#	pkg/bootstrap/versions/v4_0_6/tenant_upgrade_list.go
#	pkg/bootstrap/versions/v4_0_6/upgrade_test.go
#	pkg/sql/plan/build_ddl.go
#	pkg/sql/plan/query_builder.go
#	pkg/sql/plan/view_dependency_test.go
#	pkg/sql/plan/view_regeneration.go

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

Deep re-review of exact head 1640da615924a32fb140e03ab164d5d3c17e6e77. I read the complete prior review/thread state, audited the full diff, and checked the increment after previously reviewed head 755a799882405d0595ee8310a339e2a912c4fb58. The recovery compiler now validates timestamp hints against live mo_snapshots, and the drop path correctly checks whether another snapshot retains the same timestamp. However, the new invalidation SQL cannot execute against the catalog schema, so the prior timestamp lifecycle issue is not closed; see the inline P1.

A temporary schema-contract regression reproduced the mismatch deterministically: when generated SQL contains d.snapshot_name, catalog.MoViewDependenciesDDL has no snapshot_name column. The test fails on this exact head. I removed the temporary test afterward.

Unmodified validation passed for full pkg/sql/compile, pkg/frontend, pkg/sql/plan, pkg/sql/util, and pkg/vm/process; focused view/snapshot race tests passed under -race -count=3; focused go vet and git diff --check passed. Current CI still contains failed PESSIMISTIC BVT and follow-on Coverage jobs even though the aggregate Summary is successful.

Comment thread pkg/sql/compile/view_metadata.go Resolved

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

Deep re-reviewed exact head e0706a4b9e5d2d69f2987b142912551754e9513e. I read the complete review/comment/thread history, inspected the increment after my previous reviewed head 1640da615924a32fb140e03ab164d5d3c17e6e77, and rechecked the full view-metadata lifecycle diff. The previous DROP SNAPSHOT blocker is closed: invalidation now derives the named-vs-timestamp distinction from the persisted snapshot_data schema, timestamp-only protobuf JSON omits ExtraInfo, named snapshots persist ExtraInfo.Name, and the generated recursive invalidation statement parses successfully without referring to a nonexistent catalog column. The last-snapshot-at-a-timestamp guard and recovery-time live-catalog validation remain intact.

Validation on this exact worktree: full pkg/sql/compile, pkg/frontend, pkg/sql/plan, pkg/sql/util, and pkg/vm/process tests; focused snapshot/recovery race tests with -count=3; focused persisted-JSON/generator counterexamples; go vet; and git diff --check all pass. No remaining blocking correctness or lifecycle issue found.

@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 re-reviewed exact head 0a3caff. I reused the already-reviewed closure through e0706a4, rechecked both prior snapshot blockers, audited the full current lifecycle/ownership/wait-for graph, and reviewed the increment: the only PR-owned production changes after that approval are test seams for the inactive gate/budget plus expanded lifecycle coverage; the two main merges do not rewrite lifecycle production code. The hard-false public/internal gates keep recovery inactive, while current mutations durably mark revalidation in their caller transaction; CTAS/subscription binding changes restore scoped compiler state. No blocking correctness, resource-lifecycle, concurrency, or unbounded-memory issue found. Local validation passed: full tests for sql/compile, frontend, sql/plan, sql/util, and vm/process; go vet; focused lifecycle/CTAS/subscription tests under -race -count=3; and git diff --check.

@mergify

mergify Bot commented Aug 22, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-08-22 00:57 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • ❌ Checks failed · in-place
  • 🚫 Left the queue — 2026-08-22 01:32 UTC · at c2ead822a00a3ecbd8b1953159124cd8bf0fc0f6

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

Waiting for
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone CI / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI / UT Test on Ubuntu/x86
    • check-success = Matrixone CI / UT Test on Ubuntu/x86
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone CI / SCA Test on Linux/arm64
    • check-skipped = Matrixone CI / SCA Test on Linux/arm64
    • check-success = Matrixone CI / SCA Test on Linux/arm64
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone Utils CI / Coverage
    • check-skipped = Matrixone Utils CI / Coverage
    • check-success = Matrixone Utils CI / Coverage
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-skipped = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-success = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
    • check-success = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
All conditions
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone CI / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI / UT Test on Ubuntu/x86
    • check-success = Matrixone CI / UT Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone CI / SCA Test on Linux/arm64
    • check-skipped = Matrixone CI / SCA Test on Linux/arm64
    • check-success = Matrixone CI / SCA Test on Linux/arm64
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone Utils CI / Coverage
    • check-skipped = Matrixone Utils CI / Coverage
    • check-success = Matrixone Utils CI / Coverage
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-skipped = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-success = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
    • check-success = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
  • #review-threads-unresolved = 0 [🛡 GitHub branch protection]
  • github-review-approved [🛡 GitHub branch protection]

Reason

The merge conditions cannot be satisfied due to failing checks

Failing checks:

Hint

You may have to fix your CI before adding the pull request to the queue again.
If you update this pull request, to fix the CI, 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.

Requeued — the merge queue status continues in this comment ↓.

@mergify

mergify Bot commented Aug 22, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-08-22 06:03 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • ✅ Checks skipped · PR is already up-to-date
  • ✅ Merged — 2026-08-22 06:04 UTC · at 69d4f1a1e855a749ca6399689bde2d0b9a4bfd11 · squash

This pull request spent 34 seconds in the queue, including 2 seconds running CI.

Required conditions to merge
  • #review-threads-unresolved = 0 [🛡 GitHub branch protection]
  • github-review-approved [🛡 GitHub branch protection]
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / UT Test on Ubuntu/x86
    • check-neutral = Matrixone CI / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI / UT Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / SCA Test on Linux/arm64
    • check-neutral = Matrixone CI / SCA Test on Linux/arm64
    • check-skipped = Matrixone CI / SCA Test on Linux/arm64
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Utils CI / Coverage
    • check-neutral = Matrixone Utils CI / Coverage
    • check-skipped = Matrixone Utils CI / Coverage
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-neutral = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-skipped = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
    • check-neutral = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)

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/refactor Code refactor size/XXL Denotes a PR that changes 2000+ lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants