mirror of
https://github.com/postgres/postgres.git
synced 2025-10-27 00:12:01 +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:
@@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/access/heapam.h,v 1.123 2007/04/08 01:26:33 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/include/access/heapam.h,v 1.124 2007/05/27 03:50:39 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -147,10 +147,10 @@ extern HeapTuple heap_getnext(HeapScanDesc scan, ScanDirection direction);
|
||||
|
||||
extern bool heap_fetch(Relation relation, Snapshot snapshot,
|
||||
HeapTuple tuple, Buffer *userbuf, bool keep_buf,
|
||||
PgStat_Info *pgstat_info);
|
||||
Relation stats_relation);
|
||||
extern bool heap_release_fetch(Relation relation, Snapshot snapshot,
|
||||
HeapTuple tuple, Buffer *userbuf, bool keep_buf,
|
||||
PgStat_Info *pgstat_info);
|
||||
Relation stats_relation);
|
||||
|
||||
extern void heap_get_latest_tid(Relation relation, Snapshot snapshot,
|
||||
ItemPointer tid);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/access/relscan.h,v 1.52 2007/01/20 18:43:35 neilc Exp $
|
||||
* $PostgreSQL: pgsql/src/include/access/relscan.h,v 1.53 2007/05/27 03:50:39 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -37,8 +37,6 @@ typedef struct HeapScanDescData
|
||||
/* NB: if rs_cbuf is not InvalidBuffer, we hold a pin on that buffer */
|
||||
ItemPointerData rs_mctid; /* marked scan position, if any */
|
||||
|
||||
PgStat_Info rs_pgstat_info; /* statistics collector hook */
|
||||
|
||||
/* these fields only used in page-at-a-time mode */
|
||||
int rs_cindex; /* current tuple's index in vistuples */
|
||||
int rs_mindex; /* marked tuple's saved index */
|
||||
@@ -78,8 +76,6 @@ typedef struct IndexScanDescData
|
||||
HeapTupleData xs_ctup; /* current heap tuple, if any */
|
||||
Buffer xs_cbuf; /* current heap buffer in scan, if any */
|
||||
/* NB: if xs_cbuf is not InvalidBuffer, we hold a pin on that buffer */
|
||||
|
||||
PgStat_Info xs_pgstat_info; /* statistics collector hook */
|
||||
} IndexScanDescData;
|
||||
|
||||
typedef IndexScanDescData *IndexScanDesc;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/access/twophase_rmgr.h,v 1.4 2007/01/05 22:19:51 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/include/access/twophase_rmgr.h,v 1.5 2007/05/27 03:50:39 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -26,7 +26,8 @@ typedef uint8 TwoPhaseRmgrId;
|
||||
#define TWOPHASE_RM_INVAL_ID 2
|
||||
#define TWOPHASE_RM_FLATFILES_ID 3
|
||||
#define TWOPHASE_RM_NOTIFY_ID 4
|
||||
#define TWOPHASE_RM_MAX_ID TWOPHASE_RM_NOTIFY_ID
|
||||
#define TWOPHASE_RM_PGSTAT_ID 5
|
||||
#define TWOPHASE_RM_MAX_ID TWOPHASE_RM_PGSTAT_ID
|
||||
|
||||
extern const TwoPhaseCallback twophase_recover_callbacks[];
|
||||
extern const TwoPhaseCallback twophase_postcommit_callbacks[];
|
||||
|
||||
Reference in New Issue
Block a user