pgsql: Add a view to show the stats of subscription workers. - Mailing list pgsql-committers

From Amit Kapila
Subject pgsql: Add a view to show the stats of subscription workers.
Date
Msg-id E1mrtvV-0002Gz-73@gemulon.postgresql.org
Whole thread Raw
Responses Re: pgsql: Add a view to show the stats of subscription workers.  (Amit Kapila <amit.kapila16@gmail.com>)
List 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(-)


pgsql-committers by date:

Previous
From: Michael Paquier
Date:
Subject: pgsql: Fix typos
Next
From: Michael Paquier
Date:
Subject: pgsql: Fix flags of some GUCs and improve some descriptions