Skip to content

[Subtask]: Approve the on-demand View metadata contract and consumer migration design #29436

Closed

Description

@ck89119

Parent Issue

Parent issue: #29433

Detail of Subtask

Phase S1. Depends on: None; this is the mandatory design gate for the series.

Produce the implementation-gating, versioned design for the on-demand direction selected in #29433. This task decides the remaining contracts; it is not permission to implement the old durable-refresh activation plan.

Deliverables:

  • A tracked CLAUDE_*.md design document, exact reviewed revision, decision log, and approval record. Cover the complete series, not only one planner helper.
  • A consumer map for view TableDef.Cols/mo_columns: query result descriptors, nested views, CTAS/default provenance, DESC/SHOW, information_schema, subscription metadata, prepared/cached/cursor paths, COM_FIELD_LIST and dump/introspection paths where supported. Classify each field as authoritative definition state, derivable output, or compatibility-only data.
  • Resolve direct SELECT-from-mo_catalog.mo_columns semantics explicitly. Prefer one on-demand authority for public introspection, but do not silently downgrade an existing raw-catalog freshness contract. Choose an adapter/virtualization boundary or an explicitly approved compatibility contract before implementation.
  • Specify snapshot visibility (including own-transaction DDL), saved creation environment, frozen star expansion, explicit names, object recreation, invalid-view behavior for single-object and bulk reads, and nested-view cycle/depth handling.
  • Define authorization/tenant/subscription/historical-snapshot behavior and legacy-view handling when environment fields or stabilized star lists are missing. Do not reconstruct lost historical semantics by guessing.
  • Define rollout/mixed-version/rollback boundaries and inventory shared admission/fence users that must survive refresh retirement. Set numeric resource/performance acceptance budgets and representative benchmark cases before performance claims are made.
  • Reconcile the freshness invariant with [Bug]: View metadata stays stale after source column type changes #26227 and identify which portions of [Subtask]: Implement durable View metadata generations and recovery #29005/[Subtask]: Validate and harden on-demand View metadata execution and plan reuse #29006/[Subtask]: Activate and validate the View metadata lifecycle #29007 are superseded, retained, or require owner coordination. Closing or rewriting those issues is a separate explicit action.

Acceptance criteria:

  • For the same visible schema snapshot and binding context, all consumers use one authoritative output-schema inference contract, with documented surface-specific presentation rules.
  • Reads neither execute the view data query nor persist/queue refresh work; cache eviction must not change results.
  • Raw-catalog compatibility, invalid-view handling, security, legacy definitions, and mixed-version operation have no unresolved blocking decisions.
  • Compare on-demand derivation, synchronous maintenance, and durable asynchronous refresh; document accepted costs rather than assuming on-demand is universally faster.
  • Subsequent production changes remain blocked until the exact design revision is approved.

Describe implementation you've considered

Separate persisted view identity/definition/creation context from derived output metadata. Reuse the existing output-provenance contract from #26226/#26232 and inspect RegenerateViewDefinition/genViewTableDef rather than inventing a second inference algorithm. An issue roadmap is not the approved implementation design.

Additional information

Inspect pkg/sql/plan/view_regeneration.go, build_ddl.go, output_column_provenance.go, query_builder.go, pkg/sql/plan/build_show.go, pkg/util/sysview/predefined.go, and frontend catalog/plan-cache consumers. The original stale-metadata reproduction is recorded in #26227; this planning task has not rerun it at the current head.

Planning baseline: b9013dc6bb058ec74935a62ac3a35f57d13c2f98. This issue records future work, not completed implementation or fresh test evidence. All production work is subject to the approved versioned design from S1. Ordinary views only; materialized-view refresh and unrelated SQL compatibility work are out of scope.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions