Skip to content

[Bug]: guard persisted SQL and expressions across rolling protocol downgrade #28883

Open

Description

@XuPeng-SH

Problem

The IP-function compatibility change in #28800 protects transient distributed
pipelines, and its writer-side admission now protects catalog-bound
DEFAULT, GENERATED, CHECK, and ON UPDATE plan expressions while the
deployment common protocol is below v71. Two persisted paths still need a
deployment-level contract beyond that PR:

  1. A VIEW stores SQL rather than the bound plan.Expr; an old CN can later
    rebind the SQL locally and execute the pre-v71 IP semantics.
  2. A CN that is downgraded or reintroduced after the common protocol was
    raised can read an already-persisted expression locally without crossing
    the remote pipeline admission gate.

The same issue applies to any future catalog consumer that evaluates persisted
SQL/expressions locally.

Reproduction shape

During a rolling upgrade, create a persisted expression such as

CREATE TABLE t (
  n DOUBLE,
  ip VARCHAR(32) GENERATED ALWAYS AS (INET_NTOA(n)) STORED,
  CHECK (INET_NTOA(n) <> '')
);

or a view using INET_NTOA/INET6_ATON. If an older CN is allowed to read or
execute the catalog object after the newer protocol has been advertised, the
old registry either cannot decode a new overload or silently applies the old
meaning of an existing overload. This is a deployment admission/lifecycle
gap, not a per-row executor failure.

Required direction

Define one deployment-managed catalog-expression compatibility contract and
apply it to all persisted SQL and bound-expression readers/writers:

  • do not raise the common protocol until every catalog reader is upgraded;
  • reject CREATE/ALTER/VIEW publication and old-reader re-entry while the
    contract is below the expression's required version;
  • keep the check at the final catalog publication/read admission boundary, so
    CREATE LIKE/COPY, ALTER replacement, restored metadata, and reattached CNs
    cannot bypass it;
  • add a two-generation rolling-upgrade test covering an old reader, a new
    writer, a downgrade/rejoin, and the unchanged catalog/data on rejection.

This is intentionally separate from #28800's transient remote-pipeline fence;
that PR now has the minimal writer guard for bound table expressions, but a
shared catalog admission contract is needed for arbitrary old-reader
re-entry and SQL-backed views.

Activity

  1. self-assigned this
    on Sep 14, 2026
  2. Ariznawlll commented on Sep 24, 2026

    @Ariznawlll
    Collaborator

    测试版本

    原问题验证

    当前 main 尚不能执行 issue 要求的“两代 CN 滚动降级 + 持久化 SQL/expression 写入与读取保护”端到端验收。#29060 合入的是 control-plane barrier 的内部消费者和控制契约,但 PR 明确保留以下限制:

    因此 current main 没有可从产品入口激活并完成该协议的完整业务路径,无法据此证明滚动升级/降级验收项已经实现。

    正常场景覆盖

    #29060 的 HAKeeper、PB、LogService、CN 和 Proxy 包级测试可验证已合入的 barrier 内部状态机、snapshot recovery、participant observation 和 capability arbitration;这些结果说明底层契约可用,但不等于 issue 的产品级滚动验收完成。

    异常与边界覆盖

    • 旧 CN 重入、协议 floor 降级、持久化 SQL/expression 跨代读取均要求真实 producer 和 activation path。
    • 当前无法从公开入口构造 generation activation,也无法让 MetadataReadsEnabled 进入启用态。
    • 若只运行内部 UT,会绕过 issue 要验证的真实部署和混合版本边界,产生伪通过。

    白盒验证

    #29060 的说明明确界定了实现边界:该 PR 实现 internal consumers/control contracts,不提供 synthetic business completion;view lifecycle runtime-disabled,后续 producer 工作仍归 #29005/#29006。因此 issue 的端到端验收依赖尚未完成。

    回归测试

    暂不加入 MOTR。需要先完成并开放 activation/producer 路径,再在两代二进制的滚动环境中增加 upgrade、downgrade、旧 CN 重入、持久化表达式读取和拒绝写入的回归。

    测试证据

    测试结论

    测试不通过。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions