aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2013-02-07 14:44:00 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2013-02-07 14:44:00 -0500
commitc5aad8dc14d8ad9d7d55ee4a9b136b6273c7991a (patch)
tree3dfe75ed5685bf5702b0d09eaa5725d94c4043d7
parent072521b8c804cc15800e503244661d17c6202ccc (diff)
downloadpostgresql-c5aad8dc14d8ad9d7d55ee4a9b136b6273c7991a.tar.gz
postgresql-c5aad8dc14d8ad9d7d55ee4a9b136b6273c7991a.zip
Fix possible failure to send final transaction counts to stats collector.
Normally, we suppress sending a tabstats message to the collector unless there were some actual table stats to send. However, during backend exit we should force out the message if there are any transaction commit/abort counts to send, else the session's last few commit/abort counts will never get reported at all. We had logic for this, but the short-circuit test at the top of pgstat_report_stat() ignored the "force" flag, with the consequence that session-ending transactions that touched no database-local tables would not get counted. Seems to be an oversight in my commit 641912b4d17fd214a5e5bae4e7bb9ddbc28b144b, which added the "force" flag. That was back in 8.3, so back-patch to all supported versions.
-rw-r--r--src/backend/postmaster/pgstat.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/postmaster/pgstat.c b/src/backend/postmaster/pgstat.c
index d318db99137..9b92ebb5921 100644
--- a/src/backend/postmaster/pgstat.c
+++ b/src/backend/postmaster/pgstat.c
@@ -686,8 +686,8 @@ pgstat_report_stat(bool force)
int i;
/* Don't expend a clock check if nothing to do */
- if ((pgStatTabList == NULL || pgStatTabList->tsa_used == 0)
- && !have_function_stats)
+ if ((pgStatTabList == NULL || pgStatTabList->tsa_used == 0) &&
+ !have_function_stats && !force)
return;
/*