Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit e819bbb

Browse files
committed
Remove use of pg_memory_is_all_zeros() in bufpage.c
After a closer lookup, this makes the all-zero check of the page more expensive, so let's remove the new function call in bufpage.c. The maths of the check were also incorrect, checking that the page was full of zeros only for the first 1kB. This brings back the code to the state it was at 49d6c7d. Per discussion with David Rowley and Bertrand Drouvot. Discussion: https://postgr.es/m/CAApHDvrXzPAr3FxoBuB7b3D-okNoNA2jxLun1rW8Yw5wkbqusw@mail.gmail.com
1 parent 07e9e28 commit e819bbb

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/backend/storage/page/bufpage.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,10 @@ PageIsVerifiedExtended(Page page, BlockNumber blkno, int flags)
8989
{
9090
PageHeader p = (PageHeader) page;
9191
size_t *pagebytes;
92+
int i;
9293
bool checksum_failure = false;
9394
bool header_sane = false;
95+
bool all_zeroes = false;
9496
uint16 checksum = 0;
9597

9698
/*
@@ -124,9 +126,18 @@ PageIsVerifiedExtended(Page page, BlockNumber blkno, int flags)
124126
}
125127

126128
/* Check all-zeroes case */
129+
all_zeroes = true;
127130
pagebytes = (size_t *) page;
131+
for (i = 0; i < (BLCKSZ / sizeof(size_t)); i++)
132+
{
133+
if (pagebytes[i] != 0)
134+
{
135+
all_zeroes = false;
136+
break;
137+
}
138+
}
128139

129-
if (pg_memory_is_all_zeros(pagebytes, (BLCKSZ / sizeof(size_t))))
140+
if (all_zeroes)
130141
return true;
131142

132143
/*

0 commit comments

Comments
 (0)