pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Make walsenders show their replication commands in pg_stat_activ
5+ messages / 1 participants
[nested] [flat]

* pgsql: Make walsenders show their replication commands in pg_stat_activ
@ 2020-09-14 16:35  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 5+ messages in thread

From: Tom Lane @ 2020-09-14 16:35 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Make walsenders show their replication commands in pg_stat_activity.

A walsender process that has executed a SQL command left the text of
that command in pg_stat_activity.query indefinitely, which is quite
confusing if it's in RUNNING state but not doing that query.  An easy
and useful fix is to treat replication commands as if they were SQL
queries, and show them in pg_stat_activity according to the same rules
as for regular queries.  While we're at it, it seems also sensible to
set debug_query_string, allowing error logging and debugging to see
the replication command.

While here, clean up assorted silliness in exec_replication_command:

* The SQLCmd path failed to restore CurrentMemoryContext to the caller's
value, and failed to delete the temp context created in this routine.
It's only through great good fortune that these oversights did not
result in long-term memory leaks or other problems.  It seems cleaner
to code SQLCmd as a separate early-exit path, so do it like that.

* Remove useless duplicate call of SnapBuildClearExportedSnapshot().

* replication_scanner_finish() was never called.

None of those things are significant enough to merit a backpatch,
so this is for HEAD only.

Discussion: https://postgr.es/m/880181.1600026471@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/f560209c6e99e000f3f6c972f34f1d9dc3857f25

Modified Files
--------------
src/backend/replication/walsender.c | 62 ++++++++++++++++++++-----------------
1 file changed, 34 insertions(+), 28 deletions(-)



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* pgsql: Make walsenders show their replication commands in pg_stat_activ
@ 2021-06-25 14:46  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 5+ messages in thread

From: Tom Lane @ 2021-06-25 14:46 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Make walsenders show their replication commands in pg_stat_activity.

A walsender process that has executed a SQL command left the text of
that command in pg_stat_activity.query indefinitely, which is quite
confusing if it's in RUNNING state but not doing that query.  An easy
and useful fix is to treat replication commands as if they were SQL
queries, and show them in pg_stat_activity according to the same rules
as for regular queries.  While we're at it, it seems also sensible to
set debug_query_string, allowing error logging and debugging to see
the replication command.

While here, clean up assorted silliness in exec_replication_command:
* Clean up SQLCmd code path, and fix its only-accidentally-not-buggy
  memory management.
* Remove useless duplicate call of SnapBuildClearExportedSnapshot().
* replication_scanner_finish() was never called.

Back-patch of commit f560209c6 into v10-v13.  I'd originally felt
that this didn't merit back-patching, but subsequent confusion
while debugging walsender problems suggests that it'll be useful.
Also, the original commit has now aged long enough to provide some
comfort that it won't cause problems.

Discussion: https://postgr.es/m/2673480.1624557299@sss.pgh.pa.us
Discussion: https://postgr.es/m/880181.1600026471@sss.pgh.pa.us

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/c39983600b284466692f39355536158770527e2f

Modified Files
--------------
src/backend/replication/walsender.c | 66 ++++++++++++++++++++-----------------
1 file changed, 36 insertions(+), 30 deletions(-)



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* pgsql: Make walsenders show their replication commands in pg_stat_activ
@ 2021-06-25 14:46  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 5+ messages in thread

From: Tom Lane @ 2021-06-25 14:46 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Make walsenders show their replication commands in pg_stat_activity.

A walsender process that has executed a SQL command left the text of
that command in pg_stat_activity.query indefinitely, which is quite
confusing if it's in RUNNING state but not doing that query.  An easy
and useful fix is to treat replication commands as if they were SQL
queries, and show them in pg_stat_activity according to the same rules
as for regular queries.  While we're at it, it seems also sensible to
set debug_query_string, allowing error logging and debugging to see
the replication command.

While here, clean up assorted silliness in exec_replication_command:
* Clean up SQLCmd code path, and fix its only-accidentally-not-buggy
  memory management.
* Remove useless duplicate call of SnapBuildClearExportedSnapshot().
* replication_scanner_finish() was never called.

Back-patch of commit f560209c6 into v10-v13.  I'd originally felt
that this didn't merit back-patching, but subsequent confusion
while debugging walsender problems suggests that it'll be useful.
Also, the original commit has now aged long enough to provide some
comfort that it won't cause problems.

Discussion: https://postgr.es/m/2673480.1624557299@sss.pgh.pa.us
Discussion: https://postgr.es/m/880181.1600026471@sss.pgh.pa.us

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/4040139f22b4d3a4c67a7517a01ffd03ff0c59f4

Modified Files
--------------
src/backend/replication/walsender.c | 66 ++++++++++++++++++++-----------------
1 file changed, 36 insertions(+), 30 deletions(-)



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* pgsql: Make walsenders show their replication commands in pg_stat_activ
@ 2021-06-25 14:46  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 5+ messages in thread

From: Tom Lane @ 2021-06-25 14:46 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Make walsenders show their replication commands in pg_stat_activity.

A walsender process that has executed a SQL command left the text of
that command in pg_stat_activity.query indefinitely, which is quite
confusing if it's in RUNNING state but not doing that query.  An easy
and useful fix is to treat replication commands as if they were SQL
queries, and show them in pg_stat_activity according to the same rules
as for regular queries.  While we're at it, it seems also sensible to
set debug_query_string, allowing error logging and debugging to see
the replication command.

While here, clean up assorted silliness in exec_replication_command:
* Clean up SQLCmd code path, and fix its only-accidentally-not-buggy
  memory management.
* Remove useless duplicate call of SnapBuildClearExportedSnapshot().
* replication_scanner_finish() was never called.

Back-patch of commit f560209c6 into v10-v13.  I'd originally felt
that this didn't merit back-patching, but subsequent confusion
while debugging walsender problems suggests that it'll be useful.
Also, the original commit has now aged long enough to provide some
comfort that it won't cause problems.

Discussion: https://postgr.es/m/2673480.1624557299@sss.pgh.pa.us
Discussion: https://postgr.es/m/880181.1600026471@sss.pgh.pa.us

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/4a20de9d9ed3e45e41cd0860573387e95132314d

Modified Files
--------------
src/backend/replication/walsender.c | 62 ++++++++++++++++++++-----------------
1 file changed, 34 insertions(+), 28 deletions(-)



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* pgsql: Make walsenders show their replication commands in pg_stat_activ
@ 2021-06-25 14:46  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 5+ messages in thread

From: Tom Lane @ 2021-06-25 14:46 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Make walsenders show their replication commands in pg_stat_activity.

A walsender process that has executed a SQL command left the text of
that command in pg_stat_activity.query indefinitely, which is quite
confusing if it's in RUNNING state but not doing that query.  An easy
and useful fix is to treat replication commands as if they were SQL
queries, and show them in pg_stat_activity according to the same rules
as for regular queries.  While we're at it, it seems also sensible to
set debug_query_string, allowing error logging and debugging to see
the replication command.

While here, clean up assorted silliness in exec_replication_command:
* Clean up SQLCmd code path, and fix its only-accidentally-not-buggy
  memory management.
* Remove useless duplicate call of SnapBuildClearExportedSnapshot().
* replication_scanner_finish() was never called.

Back-patch of commit f560209c6 into v10-v13.  I'd originally felt
that this didn't merit back-patching, but subsequent confusion
while debugging walsender problems suggests that it'll be useful.
Also, the original commit has now aged long enough to provide some
comfort that it won't cause problems.

Discussion: https://postgr.es/m/2673480.1624557299@sss.pgh.pa.us
Discussion: https://postgr.es/m/880181.1600026471@sss.pgh.pa.us

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/04a47605727753de40d5ecbc4f2e7dc38577a7c2

Modified Files
--------------
src/backend/replication/walsender.c | 66 ++++++++++++++++++++-----------------
1 file changed, 36 insertions(+), 30 deletions(-)



^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2021-06-25 14:46 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-09-14 16:35 pgsql: Make walsenders show their replication commands in pg_stat_activ Tom Lane <tgl@sss.pgh.pa.us>
2021-06-25 14:46 pgsql: Make walsenders show their replication commands in pg_stat_activ Tom Lane <tgl@sss.pgh.pa.us>
2021-06-25 14:46 pgsql: Make walsenders show their replication commands in pg_stat_activ Tom Lane <tgl@sss.pgh.pa.us>
2021-06-25 14:46 pgsql: Make walsenders show their replication commands in pg_stat_activ Tom Lane <tgl@sss.pgh.pa.us>
2021-06-25 14:46 pgsql: Make walsenders show their replication commands in pg_stat_activ Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox