Skip to content

Commit 20c4df8

Browse files
committed
Reimplement nullification of walsender timestamp
Make the value null only at pg_stat_activity-output time, as suggested by Tom Lane, instead of messing with the internal state. This should appease buildfarm members with force_parallel_mode=regress, which are running parallel queries on logical replication walsenders. The fact that walsenders can run parallel queries should perhaps be studied more carefully, but for the moment let's get rid of the red blots in buildfarm. Backpatch to pg10, like the previous commit. Discussion: https://postgr.es/m/30804.1578438763@sss.pgh.pa.us
1 parent c24f3b7 commit 20c4df8

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/backend/access/transam/xact.c

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

src/backend/utils/adt/pgstatfuncs.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,13 @@ pg_stat_get_activity(PG_FUNCTION_ARGS)
726726
else
727727
nulls[7] = true;
728728

729-
if (beentry->st_xact_start_timestamp != 0)
729+
/*
730+
* Don't expose transaction time for walsenders; it confuses
731+
* monitoring, particularly because we don't keep the time up-to-
732+
* date.
733+
*/
734+
if (beentry->st_xact_start_timestamp != 0 &&
735+
beentry->st_backendType != B_WAL_SENDER)
730736
values[8] = TimestampTzGetDatum(beentry->st_xact_start_timestamp);
731737
else
732738
nulls[8] = true;

0 commit comments

Comments
 (0)