[Bug] REINDEX DATABASE CONCURRENTLY breaks temporary PAX tables created with ON COMMIT DELETE ROWS
维护者通常 3 天内回复
还没有人认领这个 Issue。
评估
调研方向
Start with the reproduction in the issue, then read how the aux table is created in pax_aux_table.cc and how ON COMMIT DELETE ROWS truncation reaches heap_truncate_one_rel through CPaxNontransactionalTruncateTable. FindAuxIndexOid and the check at pax_manifest.cc:753 explain why the leftover _ccnew index breaks later inserts. Done means REINDEX DATABASE CONCURRENTLY leaves the temporary PAX table usable, with a regression test covering it.
由索引模型根据 Issue 内容生成。
描述
Apache Cloudberry version
main
What happened
Reproduce:
CREATE TEMP TABLE p(a int) USING pax ON COMMIT DELETE ROWS DISTRIBUTED BY (a);
REINDEX DATABASE CONCURRENTLY <current_database>;
-- ERROR: index "pg_pax_blocks_<oid>_idx_ccnew" already contains data (nbtsort.c:327)
INSERT INTO p VALUES (1);
-- ERROR: .../pax_manifest.cc:753 C ERROR detail: (PG message: unexpected number of index of aux table: 2)
After this, every INSERT into p fails for the rest of the session.
Expected: REINDEX succeeds and the table stays usable, as it does with a non-concurrent REINDEX DATABASE, a plain PAX table, a temporary PAX table without ON COMMIT DELETE ROWS, or a heap table with ON COMMIT
DELETE ROWS.
Cause (from reading the code):
- The aux table of a temporary PAX table is created as permanent (pax_aux_table.cc). PostgreSQL's rule of never reindexing temporary relations concurrently therefore doesn't apply, and the aux index is rebuilt
concurrently. - Between the concurrent reindex's transactions, the ON COMMIT DELETE ROWS truncation (CPaxNontransactionalTruncateTable, which calls heap_truncate_one_rel) re-initializes every index on the aux table,
including the unbuilt _ccnew index. The build step then fails. - The failed reindex leaves _ccnew behind. FindAuxIndexOid counts invalid indexes too, so every later write fails.
What you think should happen instead
No response
How to reproduce
CREATE TEMP TABLE p(a int) USING pax ON COMMIT DELETE ROWS DISTRIBUTED BY (a);
REINDEX DATABASE CONCURRENTLY <current_database>;
-- ERROR: index "pg_pax_blocks_<oid>_idx_ccnew" already contains data (nbtsort.c:327)
INSERT INTO p VALUES (1);
-- ERROR: .../pax_manifest.cc:753 C ERROR detail: (PG message: unexpected number of index of aux table: 2)
After this, every INSERT into p fails for the rest of the session.
Operating System
any
Anything else
No response
Are you willing to submit PR?
- Yes, I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct.
- 主要语言
- C
- 星标
- 1.4k
- 派生
- 260
- 平均合并
- 4 天 19 小时
- 30 天内合并 PR
- 54
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
apache/cloudberry 的其他 Issue
-
[Bug] Expand fails to recognize user-defined tablespaces可能已有人在做 @nix-oss 于 59 天前认领。 未关闭type: Bug
难度 2/5 1-3 小时 新手友好度 76/100
apache/cloudberry#1885 · 2 个 reaction ·
维护者通常 3 天内回复
-
gpexpand first stage fails: 'SyncPackages' object has no attribute 'ret' (extension sync never runs; regression)可能已有人在做 @talmacschen-arch 于 120 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 86/100
apache/cloudberry#1825 ·
维护者通常 3 天内回复
-
type: Bug
难度 3/5 半天 新手友好度 58/100
apache/cloudberry#2137 ·
维护者通常 3 天内回复
-
type: Proposal
难度 4/5 3-5 天 新手友好度 22/100
apache/cloudberry#2136 · 1 条评论 ·
维护者通常 3 天内回复
-
type: Bug
难度 4/5 3-5 天 新手友好度 30/100
apache/cloudberry#2135 ·
维护者通常 3 天内回复
查看 apache/cloudberry 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 66/100
FujiNetWIFI/fujinet-lib#186 ·
维护者通常 1 天内回复
-
VIEW_TYPE set for computer players可能已有人在做 @Loobinex 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
-
bug
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 2 天内回复
-
bug
难度 2/5 1 小时以内 新手友好度 78/100
brunodev85/winlator-app#90 ·