postgres.git / summary / log / commit / refs
commit da42b9f3ff4375972e535368e875ca0dbbdf322a
Author: Alvaro Herrera <alvherre@alvh.no-ip.org>
Date: Wed Jan 08 17:33:49 2020 +0000
First released in: 13.0, 10.12, 11.7, 12.2
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
src/backend/access/transam/xact.c | 7 -------
src/backend/utils/adt/pgstatfuncs.c | 8 +++++++-
2 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index 0dd6b82f99a..9b252213d95 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -758,13 +758,6 @@ GetCurrentTransactionStopTimestamp(void)
void
SetCurrentStatementStartTimestamp(void)
{
- /*
- * Skip if on a walsender; this is not needed, and it confuses monitoring
- * if we publish non-NULL values.
- */
- if (am_walsender)
- return;
-
if (!IsParallelWorker())
stmtStartTimestamp = GetCurrentTimestamp();
else
diff --git a/src/backend/utils/adt/pgstatfuncs.c b/src/backend/utils/adt/pgstatfuncs.c
index 20ce48b2d82..b764251d875 100644
--- a/src/backend/utils/adt/pgstatfuncs.c
+++ b/src/backend/utils/adt/pgstatfuncs.c
@@ -732,7 +732,13 @@ pg_stat_get_activity(PG_FUNCTION_ARGS)
else
nulls[7] = true;
- if (beentry->st_xact_start_timestamp != 0)
+ /*
+ * Don't expose transaction time for walsenders; it confuses
+ * monitoring, particularly because we don't keep the time up-to-
+ * date.
+ */
+ if (beentry->st_xact_start_timestamp != 0 &&
+ beentry->st_backendType != B_WAL_SENDER)
values[8] = TimestampTzGetDatum(beentry->st_xact_start_timestamp);
else
nulls[8] = true;
[parent: 0c046f816902]