aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/nodeMemoize.c
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2024-03-11 10:25:01 +0900
committerMichael Paquier <michael@paquier.xyz>2024-03-11 10:25:01 +0900
commitb36fbd9f8da140f5b0ef9f7daa6b3cb4cae8a69b (patch)
treeb683479bebd995147c277e8c62ab47367ba77421 /src/backend/executor/nodeMemoize.c
parentf500ba07fa9d00eaa2d26ea66401e62f950163ae (diff)
downloadpostgresql-b36fbd9f8da140f5b0ef9f7daa6b3cb4cae8a69b.tar.gz
postgresql-b36fbd9f8da140f5b0ef9f7daa6b3cb4cae8a69b.zip
Improve consistency of replication slot statistics
The replication slot stats stored in shared memory rely on an internal index number. Both pgstat_reset_replslot() and pgstat_fetch_replslot() lacked some LWLock protections with ReplicationSlotControlLock while operating on these index numbers. This issue could cause these two functions to potentially operate on incorrect slots when taken in isolation in the event of slots dropped and/or re-created concurrently. Note that pg_stat_get_replication_slot() is called once per slot when querying pg_stat_replication_slots, meaning that the stats are retrieved across multiple ReplicationSlotControlLock acquisitions. So, while this commit improves more consistency, it may still be possible that statistics are not completely consistent for a single scan of pg_stat_replication_slots under concurrent replication slot drop or creation activity. The issue should unlikely be a problem in practice, causing the report of inconsistent stats or or the stats reset of an incorrect slot, so no backpatch is done. Author: Bertrand Drouvot Reviewed-by: Heikki Linnakangas, Shveta Malik, Michael Paquier Discussion: https://postgr.es/m/ZeGq1HDWFfLkjh4o@ip-10-97-1-34.eu-west-3.compute.internal
Diffstat (limited to 'src/backend/executor/nodeMemoize.c')
0 files changed, 0 insertions, 0 deletions