diff options
Diffstat (limited to 'src/backend/storage/buffer/bufmgr.c')
-rw-r--r-- | src/backend/storage/buffer/bufmgr.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 323382dcfa8..5cac8cd7389 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -770,7 +770,7 @@ ReadBuffer(Relation reln, BlockNumber blockNum) * In RBM_NORMAL mode, the page is read from disk, and the page header is * validated. An error is thrown if the page header is not valid. (But * note that an all-zero page is considered "valid"; see - * PageIsVerifiedExtended().) + * PageIsVerified().) * * RBM_ZERO_ON_ERROR is like the normal mode, but if the page header is not * valid, the page is zeroed instead of throwing an error. This is intended @@ -1569,6 +1569,8 @@ WaitReadBuffers(ReadBuffersOperation *operation) { BufferDesc *bufHdr; Block bufBlock; + bool verified; + bool checksum_failure; if (persistence == RELPERSISTENCE_TEMP) { @@ -1582,8 +1584,16 @@ WaitReadBuffers(ReadBuffersOperation *operation) } /* check for garbage data */ - if (!PageIsVerifiedExtended((Page) bufBlock, io_first_block + j, - PIV_LOG_WARNING | PIV_REPORT_STAT)) + verified = PageIsVerified((Page) bufBlock, io_first_block + j, + PIV_LOG_WARNING, &checksum_failure); + if (checksum_failure) + { + RelFileLocatorBackend rloc = operation->smgr->smgr_rlocator; + + pgstat_report_checksum_failures_in_db(rloc.locator.dbOid, 1); + } + + if (!verified) { if ((operation->flags & READ_BUFFERS_ZERO_ON_ERROR) || zero_damaged_pages) { |