]> granicus.if.org Git - postgresql/commitdiff
Reset all database-level stats in pgstat_recv_resetcounter().
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 12 Dec 2010 20:09:53 +0000 (15:09 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 12 Dec 2010 20:09:53 +0000 (15:09 -0500)
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.

src/backend/postmaster/pgstat.c

index c3c136a16124edd7c46a615ec6af7b27d4cc7bb4..856daa721d32e1e0931fbc4b300b0ce4b33ead87 100644 (file)
@@ -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);