From: Tom Lane Date: Sun, 12 Dec 2010 20:09:53 +0000 (-0500) Subject: Reset all database-level stats in pgstat_recv_resetcounter(). X-Git-Tag: REL9_1_ALPHA3~68 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0c90442355fbbe785740669f63141f24674c8958;p=postgresql 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. --- diff --git a/src/backend/postmaster/pgstat.c b/src/backend/postmaster/pgstat.c index c3c136a161..856daa721d 100644 --- a/src/backend/postmaster/pgstat.c +++ b/src/backend/postmaster/pgstat.c @@ -4006,10 +4006,21 @@ pgstat_recv_resetcounter(PgStat_MsgResetcounter *msg, int len) dbentry->tables = NULL; dbentry->functions = NULL; + + /* + * Reset database-level stats too. This should match the initialization + * code in pgstat_get_db_entry(). + */ dbentry->n_xact_commit = 0; dbentry->n_xact_rollback = 0; dbentry->n_blocks_fetched = 0; dbentry->n_blocks_hit = 0; + dbentry->n_tuples_returned = 0; + dbentry->n_tuples_fetched = 0; + dbentry->n_tuples_inserted = 0; + dbentry->n_tuples_updated = 0; + dbentry->n_tuples_deleted = 0; + dbentry->last_autovac_time = 0; memset(&hash_ctl, 0, sizeof(hash_ctl)); hash_ctl.keysize = sizeof(Oid);