Partition maintenance and inherited tables leave served rows stale

未关闭
#55 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
postgresql, rust
领域
backend, databases

调研方向

Start by tracing the DDL trigger and subscription reread or stop behavior, then inspect how table reads are built and how live PostgreSQL tests are organized. Reproduce the listed partition operations and the INHERITS example. Done means clients receive current rows after supported partition changes, ordinary tables are read with FROM ONLY, and live tests cover each operation and an inheritance parent.

由索引模型根据 Issue 内容生成。

描述

Problem

A served table can gain or lose rows without any row change reaching the change feed. Clients keep a stale view until they reconnect.

  1. Partition maintenance. With publish_via_partition_root = true, a partitioned table is served under its root's name. Verified on PostgreSQL 17: these commands send nothing to the feed, although each one changes the root's rows.

    ALTER TABLE events ATTACH PARTITION events_feb FOR VALUES FROM ('2026-02-01') TO ('2026-03-01'); -- rows appear
    ALTER TABLE events DETACH PARTITION events_jan; -- rows disappear
    DROP TABLE events_jan;                           -- rows disappear
    TRUNCATE events_jan;                             -- rows disappear
    

    TRUNCATE events on the root is sent and stops the server. CREATE TABLE … PARTITION OF adds an empty partition and needs nothing.

  2. Plain inheritance (INHERITS). Reads of a parent table without ONLY include its child tables' rows. The WAL reports a child's changes under the child's own name, so subscriptions on the parent never see them.

    CREATE TABLE notes (id int8 PRIMARY KEY, body text);
    CREATE TABLE pinned_notes () INHERITS (notes);
    INSERT INTO pinned_notes VALUES (1, 'x');  -- served in `notes`, never updated
    

Expected behavior

The server never keeps serving rows the parent no longer has, or leaves out rows it now has:

  • For partition maintenance, the DDL trigger already fires on ATTACH, DETACH and DROP. The server should either re-read the affected subscriptions or stop, naming the change. Dropping old partitions is routine for retention, so re-reading is likely the better choice.
  • A TRUNCATE of a partition fires no DDL trigger, so it needs another signal (for example, a TRUNCATE trigger on the partitions that emits a WAL message), or a documented limitation.
  • For inheritance, an ordinary table (relkind = 'r') is read with FROM ONLY, so its rows match its own changes. Partitioned roots stay as they are, since ONLY on a partitioned root returns no rows.

Acceptance criteria

  • ATTACH (of a table with rows), DETACH and DROP of a partition of a served table don't leave clients stale.
  • A TRUNCATE of a partition is either handled or documented as unsupported.
  • CREATE TABLE … PARTITION OF keeps working without a restart.
  • Reads of an ordinary table use FROM ONLY, and a child table's rows no longer appear under its parent.
  • Live tests cover each partition operation and an inheritance parent.
主要语言
Rust
星标
129
派生
7
平均合并
1 天 19 小时
30 天内合并 PR
5

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

juspay/streamgres 的其他 Issue

查看 juspay/streamgres 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。