mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
Fix up pgstats counting of live and dead tuples to recognize that committed
and aborted transactions have different effects; also teach it not to assume that prepared transactions are always committed. Along the way, simplify the pgstats API by tying counting directly to Relations; I cannot detect any redeeming social value in having stats pointers in HeapScanDesc and IndexScanDesc structures. And fix a few corner cases in which counts might be missed because the relation's pgstat_info pointer hadn't been set.
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.218 2007/05/02 23:34:48 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.219 2007/05/27 03:50:39 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -88,12 +88,6 @@ static bool IsForInput;
|
||||
/* local state for LockBufferForCleanup */
|
||||
static volatile BufferDesc *PinCountWaitBuf = NULL;
|
||||
|
||||
/*
|
||||
* Global statistics for the bgwriter. The contents of this variable
|
||||
* only makes sense in the bgwriter process.
|
||||
*/
|
||||
extern PgStat_MsgBgWriter BgWriterStats;
|
||||
|
||||
|
||||
static Buffer ReadBuffer_common(Relation reln, BlockNumber blockNum,
|
||||
bool zeroPage);
|
||||
@ -174,7 +168,7 @@ ReadBuffer_common(Relation reln, BlockNumber blockNum, bool zeroPage)
|
||||
if (isExtend)
|
||||
blockNum = smgrnblocks(reln->rd_smgr);
|
||||
|
||||
pgstat_count_buffer_read(&reln->pgstat_info, reln);
|
||||
pgstat_count_buffer_read(reln);
|
||||
|
||||
if (isLocalBuf)
|
||||
{
|
||||
@ -204,7 +198,7 @@ ReadBuffer_common(Relation reln, BlockNumber blockNum, bool zeroPage)
|
||||
if (!isExtend)
|
||||
{
|
||||
/* Just need to update stats before we exit */
|
||||
pgstat_count_buffer_hit(&reln->pgstat_info, reln);
|
||||
pgstat_count_buffer_hit(reln);
|
||||
|
||||
if (VacuumCostActive)
|
||||
VacuumCostBalance += VacuumCostPageHit;
|
||||
|
Reference in New Issue
Block a user