pgsql: Reconsider pg_stat_subscription_workers view.

From: Amit Kapila <akapila(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Reconsider pg_stat_subscription_workers view.
Date: 2022-03-01 01:00:05
Message-ID: E1nOqs0-000MbB-Mg@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2022-03-01 03:52:53 pgsql: Rework internal command generation of pg_rewind
Previous Message Tom Lane 2022-02-28 20:37:02 pgsql: Handle integer overflow in interval justification functions.