Skip to content

Commit b175bd5

Browse files
committed
pg_stat_activity: show NULL stmt start time for walsenders
Returning a non-NULL time is pointless, sinc a walsender is not a process that would be running normal transactions anyway, but the code was unintentionally exposing the process start time intermittently, which was not only bogus but it also confused monitoring systems looking for idle transactions. Fix by avoiding all updates in walsenders. Backpatch to 11, where walsenders started appearing in pg_stat_activity. Reported-by: Tomas Vondra Discussion: https://postgr.es/m/20191209234409.exe7osmyalwkt5j4@development
1 parent ce242ae commit b175bd5

File tree

1 file changed

+7
-0
lines changed
  • src/backend/access/transam

1 file changed

+7
-0
lines changed

src/backend/access/transam/xact.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,13 @@ GetCurrentTransactionStopTimestamp(void)
816816
void
817817
SetCurrentStatementStartTimestamp(void)
818818
{
819+
/*
820+
* Skip if on a walsender; this is not needed, and it confuses monitoring
821+
* if we publish non-NULL values.
822+
*/
823+
if (am_walsender)
824+
return;
825+
819826
if (!IsParallelWorker())
820827
stmtStartTimestamp = GetCurrentTimestamp();
821828
else

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