提交 d8b04d5f 编写于 作者: T Tom Lane

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
上级 70d75697
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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, ...@@ -352,7 +352,9 @@ ReadBuffer_common(SMgrRelation smgr, bool isLocalBuf, BlockNumber blockNum,
if (zeroPage) if (zeroPage)
MemSet((char *) bufBlock, 0, BLCKSZ); MemSet((char *) bufBlock, 0, BLCKSZ);
else else
{
smgrread(smgr, blockNum, (char *) bufBlock); smgrread(smgr, blockNum, (char *) bufBlock);
/* check for garbage data */ /* check for garbage data */
if (!PageHeaderIsValid((PageHeader) bufBlock)) if (!PageHeaderIsValid((PageHeader) bufBlock))
{ {
...@@ -376,6 +378,7 @@ ReadBuffer_common(SMgrRelation smgr, bool isLocalBuf, BlockNumber blockNum, ...@@ -376,6 +378,7 @@ ReadBuffer_common(SMgrRelation smgr, bool isLocalBuf, BlockNumber blockNum,
smgr->smgr_rnode.relNode))); smgr->smgr_rnode.relNode)));
} }
} }
}
if (isLocalBuf) if (isLocalBuf)
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册