postgresql/src
Michael Paquier d6e171fed6 Keep replication slot statistics on invalidation
The code path in charge of invalidating a replication slot includes a
call to pgstat_drop_replslot(), which would result in removing the
statistics of the slot once invalidated.  However, there is no need to
remove the statistics of an invalidated slot as one could still be
interested in looking at them to understand the activity of the slot
until its actual removal.

The initial design of the feature committed in be87200efd used the
approach to drop the slots, which is likely why the statistics were
still removed during the invalidation.

Another problem with this operation is that it was done without holding
ReplicationSlotAllocationLock, leaving it unprotected on concurrent
activity.  This part is arguably a bug, but that's a limited problem in
practice so no backpatch is done.

In passing, this commit adds a test to check this behavior.  The only
remaining code path where slot statistics are dropped now related to the
slot getting dropped.

Author: Bertrand Drouvot
Discussion: https://postgr.es/m/ZermH08Eq6YydHpO@ip-10-97-1-34.eu-west-3.compute.internal
2024-03-12 14:22:31 +09:00
..
backend Keep replication slot statistics on invalidation 2024-03-12 14:22:31 +09:00
bin Use printf's %m format instead of strerror(errno) in more places 2024-03-12 10:02:54 +09:00
common Use printf's %m format instead of strerror(errno) in more places 2024-03-12 10:02:54 +09:00
fe_utils Centralize logic for restoring errno in signal handlers. 2024-02-14 16:34:18 -06:00
include Improve support for ExplainOneQuery() hook 2024-03-11 08:40:40 +09:00
interfaces Use printf's %m format instead of strerror(errno) in more places 2024-03-12 10:02:54 +09:00
makefiles Remove AIX support 2024-02-28 15:17:23 +04:00
pl Redefine backend ID to be an index into the proc array 2024-03-03 19:37:28 +02:00
port Use printf's %m format instead of strerror(errno) in more places 2024-03-12 10:02:54 +09:00
template Remove AIX support 2024-02-28 15:17:23 +04:00
test Keep replication slot statistics on invalidation 2024-03-12 14:22:31 +09:00
timezone Update time zone data files to tzdata release 2024a. 2024-02-01 15:57:53 -05:00
tools Use printf's %m format instead of strerror(errno) in more places 2024-03-12 10:02:54 +09:00
tutorial Update copyright for 2024 2024-01-03 20:49:05 -05:00
.gitignore
DEVELOPERS
Makefile Remove distprep 2023-11-06 15:18:04 +01:00
Makefile.global.in Remove make function vpathsearch 2024-01-29 07:24:59 +01:00
Makefile.shlib Remove AIX support 2024-02-28 15:17:23 +04:00
meson.build Update copyright for 2024 2024-01-03 20:49:05 -05:00
nls-global.mk Remove distprep 2023-11-06 15:18:04 +01:00