From: Amit Kapila <akapila@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Add a view to show the stats of subscription workers.
Date: Tue, 30 Nov 2021 03:35:29 +0000
Message-ID: <E1mrtvV-0002Gz-73@gemulon.postgresql.org> (raw)
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(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: akapila@postgresql.org
Subject: Re: pgsql: Add a view to show the stats of subscription workers.
In-Reply-To: <E1mrtvV-0002Gz-73@gemulon.postgresql.org>
References: <E1mrtvV-0002Gz-73@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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