mirror of
https://github.com/postgres/postgres.git
synced 2025-07-11 10:01:57 +03:00
pgstat: Prepare to use mechanism for truncated rels also for droppped rels.
The upcoming shared memory stats patch drops stats for dropped objects in a transactional manner, rather than removing them later as part of vacuum. This means that stats for DROP inside a transaction needs to handle aborted (sub-)transactions similar to TRUNCATE: The stats up to the DROP should be restored. Rename the existing infrastructure in preparation. Author: Andres Freund <andres@anarazel.de> Discussion: https://postgr.es/m/20210405092914.mmxqe7j56lsjfsej@alap3.anarazel.de
This commit is contained in:
@ -123,7 +123,7 @@ typedef struct PgStat_TableCounts
|
||||
PgStat_Counter t_tuples_updated;
|
||||
PgStat_Counter t_tuples_deleted;
|
||||
PgStat_Counter t_tuples_hot_updated;
|
||||
bool t_truncated;
|
||||
bool t_truncdropped;
|
||||
|
||||
PgStat_Counter t_delta_live_tuples;
|
||||
PgStat_Counter t_delta_dead_tuples;
|
||||
@ -186,10 +186,12 @@ typedef struct PgStat_TableXactStatus
|
||||
PgStat_Counter tuples_inserted; /* tuples inserted in (sub)xact */
|
||||
PgStat_Counter tuples_updated; /* tuples updated in (sub)xact */
|
||||
PgStat_Counter tuples_deleted; /* tuples deleted in (sub)xact */
|
||||
bool truncated; /* relation truncated in this (sub)xact */
|
||||
PgStat_Counter inserted_pre_trunc; /* tuples inserted prior to truncate */
|
||||
PgStat_Counter updated_pre_trunc; /* tuples updated prior to truncate */
|
||||
PgStat_Counter deleted_pre_trunc; /* tuples deleted prior to truncate */
|
||||
bool truncdropped; /* relation truncated/dropped in this
|
||||
* (sub)xact */
|
||||
/* tuples i/u/d prior to truncate/drop */
|
||||
PgStat_Counter inserted_pre_truncdrop;
|
||||
PgStat_Counter updated_pre_truncdrop;
|
||||
PgStat_Counter deleted_pre_truncdrop;
|
||||
int nest_level; /* subtransaction nest level */
|
||||
/* links to other structs for same relation: */
|
||||
struct PgStat_TableXactStatus *upper; /* next higher subxact if any */
|
||||
|
Reference in New Issue
Block a user