aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2020-01-08 14:33:49 -0300
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2020-01-08 14:33:49 -0300
commitf5d28710c707ad602cd869602e092cc9d538cbb9 (patch)
tree816bbbcb06ed70357a2fa377e09a23f325dadfd8
parent913bbd88dc6b859c70ebb48107b38d693c4c6673 (diff)
downloadpostgresql-f5d28710c707ad602cd869602e092cc9d538cbb9.tar.gz
postgresql-f5d28710c707ad602cd869602e092cc9d538cbb9.zip
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
-rw-r--r--src/backend/access/transam/xact.c7
-rw-r--r--src/backend/utils/adt/pgstatfuncs.c8
2 files changed, 7 insertions, 8 deletions
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index cbc35454a7e..017f03b6d8c 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -816,13 +816,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 99554c4d7bb..3dbf6048acb 100644
--- a/src/backend/utils/adt/pgstatfuncs.c
+++ b/src/backend/utils/adt/pgstatfuncs.c
@@ -724,7 +724,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;