Skip to content

Commit c5aad8d

Browse files
committed
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 641912b, which added the "force" flag. That was back in 8.3, so back-patch to all supported versions.
1 parent 072521b commit c5aad8d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/backend/postmaster/pgstat.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -686,8 +686,8 @@ pgstat_report_stat(bool force)
686686
int i;
687687

688688
/* Don't expend a clock check if nothing to do */
689-
if ((pgStatTabList == NULL || pgStatTabList->tsa_used == 0)
690-
&& !have_function_stats)
689+
if ((pgStatTabList == NULL || pgStatTabList->tsa_used == 0) &&
690+
!have_function_stats && !force)
691691
return;
692692

693693
/*

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy