pgsql: Add a view to show the stats of subscription workers.

From: Amit Kapila <akapila(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Add a view to show the stats of subscription workers.
Date: 2021-11-30 03:35:29
Message-ID: E1mrtvV-0002Gz-73@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Add a view to show the stats of subscription workers.

This commit adds a new system view pg_stat_subscription_workers, that
shows information about any errors which occur during the application of
logical replication changes as well as during performing initial table
synchronization. The subscription statistics entries are removed when the
corresponding subscription is removed.

It also adds an SQL function pg_stat_reset_subscription_worker() to reset
single subscription errors.

The contents of this view can be used by an upcoming patch that skips the
particular transaction that conflicts with the existing data on the
subscriber.

This view can be extended in the future to track other xact related
statistics like the number of xacts committed/aborted for subscription
workers.

Author: Masahiko Sawada
Reviewed-by: Greg Nancarrow, Hou Zhijie, Tang Haiying, Vignesh C, Dilip Kumar, Takamichi Osumi, Amit Kapila
Discussion: https://postgr.es/m/CAD21AoDeScrsHhLyEPYqN3sydg6PxAPVBboK=30xJfUVihNZDA@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/8d74fc96db5fd547e077bf9bf4c3b67f821d71cd

Modified Files
--------------
doc/src/sgml/monitoring.sgml | 157 +++++++++++
src/backend/catalog/system_functions.sql | 4 +
src/backend/catalog/system_views.sql | 23 ++
src/backend/commands/subscriptioncmds.c | 16 +-
src/backend/postmaster/pgstat.c | 409 +++++++++++++++++++++++++++-
src/backend/replication/logical/worker.c | 54 +++-
src/backend/utils/adt/pgstatfuncs.c | 128 ++++++++-
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_proc.dat | 18 ++
src/include/pgstat.h | 109 +++++++-
src/test/regress/expected/rules.out | 18 ++
src/test/subscription/t/026_worker_stats.pl | 154 +++++++++++
src/tools/pgindent/typedefs.list | 4 +
13 files changed, 1069 insertions(+), 27 deletions(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2021-11-30 05:46:57 pgsql: Fix flags of some GUCs and improve some descriptions
Previous Message Michael Paquier 2021-11-30 02:09:06 pgsql: Fix typos