1
0
mirror of https://github.com/postgres/postgres.git synced 2026-10-23 13:29:09 +03:00

Don't log page zeroing when checksum failures are 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 <daniel@yesql.se>
Discussion: https://postgr.es/m/E15AC050-C4B5-488D-BB2D-3C7AC9F89EA8@yesql.se
Backpatch-through: 19
This commit is contained in:
Daniel Gustafsson
2026-09-14 15:33:24 +02:00
parent cffb4d8bd6
commit 6547a2f6cc

View File

@@ -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",