pgsql: Reconsider pg_stat_subscription_workers view. - Mailing list pgsql-committers

From Amit Kapila
Subject pgsql: Reconsider pg_stat_subscription_workers view.
Date
Msg-id E1nOqs0-000MbB-Mg@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Reconsider pg_stat_subscription_workers view.

It was decided (refer to the Discussion link below) that the stats
collector is not an appropriate place to store the error information of
subscription workers.

This patch changes the pg_stat_subscription_workers view (introduced by
commit 8d74fc96db) so that it stores only statistics counters:
apply_error_count and sync_error_count, and has one entry for
each subscription. The removed error information such as error-XID and
the error message would be stored in another way in the future which is
more reliable and persistent.

After removing these error details, there is no longer any relation
information, so the subscription statistics are now a cluster-wide
statistics.

The patch also changes the view name to pg_stat_subscription_stats since
the word "worker" is an implementation detail that we use one worker for
one tablesync and one apply.

Author: Masahiko Sawada, based on suggestions by Andres Freund
Reviewed-by: Peter Smith, Haiying Tang, Takamichi Osumi, Amit Kapila
Discussion: https://postgr.es/m/20220125063131.4cmvsxbz2tdg6g65@alap3.anarazel.de

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/7a85073290856554416353a89799a4c04d09b74b

Modified Files
--------------
doc/src/sgml/logical-replication.sgml       |   4 +-
doc/src/sgml/monitoring.sgml                |  99 +----
src/backend/catalog/system_functions.sql    |   4 +-
src/backend/catalog/system_views.sql        |  27 +-
src/backend/postmaster/pgstat.c             | 656 +++++++++++++---------------
src/backend/replication/logical/worker.c    |  44 +-
src/backend/utils/adt/pgstatfuncs.c         | 156 +++----
src/include/catalog/catversion.h            |   2 +-
src/include/catalog/pg_proc.dat             |  27 +-
src/include/pgstat.h                        | 129 ++----
src/test/regress/expected/rules.out         |  23 +-
src/test/subscription/t/026_stats.pl        | 102 +++++
src/test/subscription/t/026_worker_stats.pl | 165 -------
src/tools/pgindent/typedefs.list            |   8 +-
14 files changed, 582 insertions(+), 864 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Handle integer overflow in interval justification functions.
Next
From: Michael Paquier
Date:
Subject: pgsql: Rework internal command generation of pg_rewind