Skip to content

Commit 8de3b68

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 pg10: previously I misidentified the branches that show auxiliary processes in pg_stat_activity. Reported-by: Tomas Vondra Discussion: https://postgr.es/m/20191209234409.exe7osmyalwkt5j4@development
1 parent 66fd0ad commit 8de3b68

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
@@ -758,6 +758,13 @@ GetCurrentTransactionStopTimestamp(void)
758758
void
759759
SetCurrentStatementStartTimestamp(void)
760760
{
761+
/*
762+
* Skip if on a walsender; this is not needed, and it confuses monitoring
763+
* if we publish non-NULL values.
764+
*/
765+
if (am_walsender)
766+
return;
767+
761768
if (!IsParallelWorker())
762769
stmtStartTimestamp = GetCurrentTimestamp();
763770
else

0 commit comments

Comments
 (0)