In ReadOrZeroBuffer (and related entry points), don't bother to call

PageHeaderIsValid when we zero the buffer instead of reading the page in.
The actual performance improvement is probably marginal since this function
isn't very heavily used, but a cycle saved is a cycle earned.

Zdenek Kotala
This commit is contained in:
Tom Lane 2008-08-05 15:09:04 +00:00
parent 70d756970b
commit d8b04d5fac

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.235 2008/08/01 13:16:08 alvherre Exp $
* $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.236 2008/08/05 15:09:04 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -352,7 +352,9 @@ ReadBuffer_common(SMgrRelation smgr, bool isLocalBuf, BlockNumber blockNum,
if (zeroPage)
MemSet((char *) bufBlock, 0, BLCKSZ);
else
{
smgrread(smgr, blockNum, (char *) bufBlock);
/* check for garbage data */
if (!PageHeaderIsValid((PageHeader) bufBlock))
{
@ -376,6 +378,7 @@ ReadBuffer_common(SMgrRelation smgr, bool isLocalBuf, BlockNumber blockNum,
smgr->smgr_rnode.relNode)));
}
}
}
if (isLocalBuf)
{