aboutsummaryrefslogtreecommitdiff
path: root/src/backend/storage/buffer/bufmgr.c
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2025-03-30 16:10:51 -0400
committerAndres Freund <andres@anarazel.de>2025-03-30 16:27:10 -0400
commitd445990adc419f435360f0dcd91c05c082f5fa3f (patch)
tree9493349a1b20d78e495e277068a8d820188448ad /src/backend/storage/buffer/bufmgr.c
parentb96d3c389755fc5d20f4a5b9ded58b68541b8ba3 (diff)
downloadpostgresql-d445990adc419f435360f0dcd91c05c082f5fa3f.tar.gz
postgresql-d445990adc419f435360f0dcd91c05c082f5fa3f.zip
Let caller of PageIsVerified() control ignore_checksum_failure
For AIO the completion of a read into shared buffers (i.e. verifying the page including the checksum, updating the BufferDesc to reflect the IO) can happen in a different backend than the backend that started the IO. As ignore_checksum_failure can differ between backends, we need to allow the caller of PageIsVerified() control whether to ignore checksum failures. The commit leaves a gap in the PIV_* values, as an upcoming commit, which depends on this commit, will add PIV_LOG_LOG, which better fits just after PIV_LOG_WARNING. Reviewed-by: Noah Misch <noah@leadboat.com> Discussion: https://postgr.es/m/20250329212929.a6.nmisch@google.com
Diffstat (limited to 'src/backend/storage/buffer/bufmgr.c')
-rw-r--r--src/backend/storage/buffer/bufmgr.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c
index 16b5b69efda..3b66c5c6b4c 100644
--- a/src/backend/storage/buffer/bufmgr.c
+++ b/src/backend/storage/buffer/bufmgr.c
@@ -1569,6 +1569,7 @@ WaitReadBuffers(ReadBuffersOperation *operation)
{
BufferDesc *bufHdr;
Block bufBlock;
+ int piv_flags;
bool verified;
bool checksum_failure;
@@ -1584,8 +1585,11 @@ WaitReadBuffers(ReadBuffersOperation *operation)
}
/* check for garbage data */
+ piv_flags = PIV_LOG_WARNING;
+ if (ignore_checksum_failure)
+ piv_flags |= PIV_IGNORE_CHECKSUM_FAILURE;
verified = PageIsVerified((Page) bufBlock, io_first_block + j,
- PIV_LOG_WARNING, &checksum_failure);
+ piv_flags, &checksum_failure);
if (checksum_failure)
{
RelFileLocatorBackend rloc = operation->smgr->smgr_rlocator;