Skip to content

Commit f5d2871

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/[email protected]
1 parent 913bbd8 commit f5d2871

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/backend/access/transam/xact.c

-7
Original file line numberDiff line numberDiff line change
@@ -816,13 +816,6 @@ 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-
826819
if (!IsParallelWorker())
827820
stmtStartTimestamp = GetCurrentTimestamp();
828821
else

src/backend/utils/adt/pgstatfuncs.c

+7-1
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,13 @@ pg_stat_get_activity(PG_FUNCTION_ARGS)
724724
else
725725
nulls[7] = true;
726726

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

0 commit comments

Comments
 (0)