From 3532513a54fc155c38c1fc8bfd150b5824f996d9 Mon Sep 17 00:00:00 2001 From: Daniel Gustafsson Date: Thu, 10 Sep 2026 10:39:36 +0200 Subject: [PATCH v15 9/9] Only log page zeroing when checksums aren't ignored When checksum failures are ignored, the page won't be zeroed on error even if zero_damaged_pages is set. Found via review by GPT-6. Author: Daniel Gustafsson Reviewed-by: tbd Discussion: https://postgr.es/m/.. Backpatch-through: 19 --- src/backend/storage/page/bufpage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/storage/page/bufpage.c b/src/backend/storage/page/bufpage.c index 8df74618fcd..e112782202c 100644 --- a/src/backend/storage/page/bufpage.c +++ b/src/backend/storage/page/bufpage.c @@ -160,7 +160,7 @@ PageIsVerified(PageData *page, BlockNumber blkno, int flags, bool *checksum_fail if ((flags & (PIV_LOG_WARNING | PIV_LOG_LOG)) != 0) ereport(flags & PIV_LOG_WARNING ? WARNING : LOG, (errcode(ERRCODE_DATA_CORRUPTED), - (flags & PIV_ZERO_BUFFERS_ON_ERROR) ? + ((flags & PIV_ZERO_BUFFERS_ON_ERROR) && (flags & ~PIV_IGNORE_CHECKSUM_FAILURE)) ? errmsg("page verification failed, calculated checksum %u but expected %u, buffer will be zeroed", checksum, p->pd_checksum) : errmsg("page verification failed, calculated checksum %u but expected %u", -- 2.39.3 (Apple Git-146)