Clear I/O timing counters after sending them to the stats collector.

This oversight caused the reported times to accumulate in an O(N^2)
fashion the longer a backend runs.
This commit is contained in:
Tom Lane 2012-04-28 15:11:13 -04:00
parent 05dd9fb18d
commit cdbad241f4

View file

@ -784,8 +784,8 @@ pgstat_send_tabstat(PgStat_MsgTabstat *tsmsg)
return;
/*
* Report accumulated xact commit/rollback and I/O timings whenever we send
* a normal tabstat message
* Report and reset accumulated xact commit/rollback and I/O timings
* whenever we send a normal tabstat message
*/
if (OidIsValid(tsmsg->m_databaseid))
{
@ -795,6 +795,8 @@ pgstat_send_tabstat(PgStat_MsgTabstat *tsmsg)
tsmsg->m_block_time_write = pgStatBlockTimeWrite;
pgStatXactCommit = 0;
pgStatXactRollback = 0;
pgStatBlockTimeRead = 0;
pgStatBlockTimeWrite = 0;
}
else
{