postgresql/src/backend
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
..
access Update obsolete index scan TID comments. 2024-03-11 18:07:10 -04:00
archive Add macro for customizing an archiving WARNING message. 2024-03-04 15:41:42 -06:00
backup Fix pgindent damage. 2024-03-04 14:37:35 -05:00
bootstrap Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
catalog Catalog changes preparing for builtin collation provider. 2024-03-09 14:48:18 -08:00
commands Improve support for ExplainOneQuery() hook 2024-03-11 08:40:40 +09:00
executor Fix incorrect accessing of pfree'd memory in Memoize 2024-03-11 18:19:56 +13:00
foreign Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
jit Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
lib Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
libpq Cope with a deficiency in OpenSSL 3.x's error reporting. 2024-03-07 19:38:17 -05:00
main Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
nodes Fix description and grouping of RangeTblEntry.inh 2024-03-07 12:13:09 +01:00
optimizer Revert "Fix parallel-safety check of expressions and predicate for index builds" 2024-03-07 08:30:35 +09:00
parser Add support for DEFAULT in ALTER TABLE .. SET ACCESS METHOD 2024-03-08 09:31:52 +09:00
partitioning Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
po Update copyright for 2024 2024-01-03 20:49:05 -05:00
port Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
postmaster Use printf's %m format instead of strerror(errno) in more places 2024-03-12 10:02:54 +09:00
regex Update copyright for 2024 2024-01-03 20:49:05 -05:00
replication Keep replication slot statistics on invalidation 2024-03-12 14:22:31 +09:00
rewrite Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
snowball Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
statistics Fix incorrectly reported stats kind in "can't happen" ERROR 2024-03-05 16:17:02 +13:00
storage Don't destroy SMgrRelations at relcache invalidation 2024-03-11 09:08:02 +02:00
tcop Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
tsearch Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
utils Use printf's %m format instead of strerror(errno) in more places 2024-03-12 10:02:54 +09:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
common.mk Blind attempt to fix LLVM dependency in the backend 2022-09-15 10:53:48 +07:00
Makefile Remove AIX support 2024-02-28 15:17:23 +04:00
meson.build Remove AIX support 2024-02-28 15:17:23 +04:00
nls.mk Remove distprep 2023-11-06 15:18:04 +01:00