On Fri, Nov 01, 2024 at 08:21:50PM +1300, David Rowley wrote: > My vote is to just revert this usage of the function. Anything more > elaborate would need to check pointer alignment before using any types > larger than char. The previous code does not need to do that because > the page is going to be at least MAXALIGNed.
Fine, here you go. The attached reverts back this part in bufpage.c to what it was in 49d6c7d8daba. -- Michael
diff --git a/src/backend/storage/page/bufpage.c b/src/backend/storage/page/bufpage.c index 5ee1e58cd4..be6f1f62d2 100644 --- a/src/backend/storage/page/bufpage.c +++ b/src/backend/storage/page/bufpage.c @@ -89,8 +89,10 @@ PageIsVerifiedExtended(Page page, BlockNumber blkno, int flags) { PageHeader p = (PageHeader) page; size_t *pagebytes; + int i; bool checksum_failure = false; bool header_sane = false; + bool all_zeroes = false; uint16 checksum = 0; /* @@ -124,9 +126,18 @@ PageIsVerifiedExtended(Page page, BlockNumber blkno, int flags) } /* Check all-zeroes case */ + all_zeroes = true; pagebytes = (size_t *) page; + for (i = 0; i < (BLCKSZ / sizeof(size_t)); i++) + { + if (pagebytes[i] != 0) + { + all_zeroes = false; + break; + } + } - if (pg_memory_is_all_zeros(pagebytes, (BLCKSZ / sizeof(size_t)))) + if (all_zeroes) return true; /*
signature.asc
Description: PGP signature