[Bug] Mirrors crash during WAL replay when wal_compression is pglz/lz4
维护者通常 3 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 半天
- 新手友好度
- 58/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
调研方向
Start in RestoreBlockImage() in src/backend/access/transam/xlogreader.c (around line 2096), where zstd_decompress_backupblock() runs before the bimg_info method check. Compare it with XLogCompressBackupBlock() on the write side to see which methods write images. Done when pglz and lz4 images replay without error; reproduce with the SQL in the issue on a cluster with mirrors.
由索引模型根据 Issue 内容生成。
描述
Apache Cloudberry version
No response
What happened
Reproduce (on a cluster with mirrors):
CREATE TABLE w (a int, b text) DISTRIBUTED BY (a);
INSERT INTO w SELECT i, repeat('x', 100) FROM generate_series(1, 1000) i;
CHECKPOINT;
SET wal_compression = pglz;
UPDATE w SET b = 'y' WHERE a < 100;
Actual: the UPDATE succeeds, but all segment mirrors stop WAL replay and shut down, and FTS marks them down:
FATAL: invalid compressed image at 0/C7CFF070, block 0 (error computing decompression size)
LOG: startup process (PID ...) exited with exit code 1
LOG: shutting down due to startup process failure
gprecoverseg (incremental) reports success, but the mirrors replay the same WAL record and crash again. Only gprecoverseg -F (full recovery) brings them back.
Expected: the mirrors replay the WAL normally, as they do with SET wal_compression = zstd. With zstd, the same steps produce no errors.
Cause: in RestoreBlockImage() (src/backend/access/transam/xlogreader.c, around line 2096), every compressed page image is passed to zstd_decompress_backupblock() before the code checks bimg_info for the method
actually used. That zstd-only call dates from commit 60915ec6b2e ("Use zstd for wal_compression", 2020), when Greenplum always compressed WAL with zstd. Since the merges from PostgreSQL,
XLogCompressBackupBlock() writes images with the method chosen by wal_compression (pglz, lz4 or zstd), so pglz and lz4 images reach the zstd decoder and fail. A likely fix is to remove the unconditional zstd
call and rely on the per-method code that follows it.
Impact:
- A session-level SET wal_compression plus an ordinary write is enough. It leaves the cluster without mirror protection until an administrator runs a full recovery.
- Not verified: lz4 (expected to fail the same way, since the same code runs first), and whether a primary's own crash recovery also fails after replaying such a record.
What you think should happen instead
No response
How to reproduce
Reproduce (on a cluster with mirrors):
CREATE TABLE w (a int, b text) DISTRIBUTED BY (a);
INSERT INTO w SELECT i, repeat('x', 100) FROM generate_series(1, 1000) i;
CHECKPOINT;
SET wal_compression = pglz;
UPDATE w SET b = 'y' WHERE a < 100;
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
- 派生
- 262
- 平均合并
- 4 天 20 小时
- 30 天内合并 PR
- 57
环境准备
- 没有 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 于 121 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 86/100
apache/cloudberry#1825 ·
维护者通常 3 天内回复
-
Lance support: contrib/lance_fdw and the MCP server's Lance tools可能已有人在做 @MisterRaindrop 于 1 天前认领。 未关闭
apache/cloudberry#2139 · 已指派 1 人 ·
维护者通常 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 · 1 条评论 ·
维护者通常 3 天内回复
查看 apache/cloudberry 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 64/100
libsdl-org/SDL#16539 ·
维护者通常 1 天内回复
-
git-workflow task-4
难度 2/5 1-3 小时 新手友好度 66/100
-
bug
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 67/100
dosemu2/dosemu2#3178 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 1 天内回复