Add slotsync skip statistics.
authorAmit Kapila <akapila@postgresql.org>
Tue, 25 Nov 2025 06:47:49 +0000 (06:47 +0000)
committerAmit Kapila <akapila@postgresql.org>
Tue, 25 Nov 2025 07:06:02 +0000 (07:06 +0000)
commit76b78721ca49c16dfcbfbd2f4f87fcdb2db2bbb6
treebf239b845d97ce9385c6d7b03b8ba52e035895c3
parentc581c9a7ac2af2c75567013f25125bd294d49ff2
Add slotsync skip statistics.

This patch adds two new columns to the pg_stat_replication_slots view:
slotsync_skip_count - the total number of times a slotsync operation was
skipped.
slotsync_skip_at - the timestamp of the most recent skip.

These additions provide better visibility into replication slot
synchronization behavior.

A future patch will introduce the slotsync_skip_reason column in
pg_replication_slots to capture the reason for skip.

Author: Shlok Kyal <shlok.kyal.oss@gmail.com>
Reviewed-by: shveta malik <shveta.malik@gmail.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Ashutosh Sharma <ashu.coek88@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Discussion: https://postgr.es/m/CAE9k0PkhfKrTEAsGz4DjOhEj1nQ+hbQVfvWUxNacD38ibW3a1g@mail.gmail.com
contrib/test_decoding/expected/stats.out
doc/src/sgml/monitoring.sgml
src/backend/catalog/system_views.sql
src/backend/replication/logical/slotsync.c
src/backend/utils/activity/pgstat_replslot.c
src/backend/utils/adt/pgstatfuncs.c
src/include/catalog/catversion.h
src/include/catalog/pg_proc.dat
src/include/pgstat.h
src/test/recovery/t/040_standby_failover_slots_sync.pl
src/test/regress/expected/rules.out