Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 0c90442

Browse files
committed
Reset all database-level stats in pgstat_recv_resetcounter().
We were failing to zero out some pg_stat_database counters that have been added since the initial pgstats coding. This is a bug, but not back-patching the fix since changing this behavior in a minor release seems a cure worse than the disease. Report and patch by Tomas Vondra.
1 parent 5132ad8 commit 0c90442

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/backend/postmaster/pgstat.c

+11
Original file line numberDiff line numberDiff line change
@@ -4006,10 +4006,21 @@ pgstat_recv_resetcounter(PgStat_MsgResetcounter *msg, int len)
40064006

40074007
dbentry->tables = NULL;
40084008
dbentry->functions = NULL;
4009+
4010+
/*
4011+
* Reset database-level stats too. This should match the initialization
4012+
* code in pgstat_get_db_entry().
4013+
*/
40094014
dbentry->n_xact_commit = 0;
40104015
dbentry->n_xact_rollback = 0;
40114016
dbentry->n_blocks_fetched = 0;
40124017
dbentry->n_blocks_hit = 0;
4018+
dbentry->n_tuples_returned = 0;
4019+
dbentry->n_tuples_fetched = 0;
4020+
dbentry->n_tuples_inserted = 0;
4021+
dbentry->n_tuples_updated = 0;
4022+
dbentry->n_tuples_deleted = 0;
4023+
dbentry->last_autovac_time = 0;
40134024

40144025
memset(&hash_ctl, 0, sizeof(hash_ctl));
40154026
hash_ctl.keysize = sizeof(Oid);

0 commit comments

Comments
 (0)