]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Make StandbyAcquireAccessExclusiveLock() more resilent with OOMs
authorMichael Paquier <michael@paquier.xyz>
Sat, 20 Jun 2026 06:00:40 +0000 (15:00 +0900)
committerMichael Paquier <michael@paquier.xyz>
Sat, 20 Jun 2026 06:00:40 +0000 (15:00 +0900)
commitb85f9c00fb8822eb2142c347ce529f651dbef178
tree0cb591dfde8d342425c78725dfdf2bf257c0a5c8
parentf25a07b2d94c8028129e260b49b90eaff266bd3a
Make StandbyAcquireAccessExclusiveLock() more resilent with OOMs

In StandbyReleaseXidEntryLocks, a failure in acquiring a lock with
LockAcquire() due to an out-of-memory problem would lead to an
inconsistency with the lock state cached in the startup process,
impacting the list of RecoveryLockXidEntrys.  The code is updated here
so as the cached state is updated once the lock is acquired.

This problem is unlikely going to happen in practice.  Even if it were
to show up, it would translate to a LOG message for non-assert builds
(assertion failure otherwise), so no backpatch is done.  This commit is
in the same spirit as 29fb598b9cad, with a problem emulated by injecting
random failures for allocations.

Reported-by: Alexander Lakhin <exclusion@gmail.com>
Author: Matthias van de Meent <boekewurm+postgres@gmail.com>
Discussion: https://postgr.es/m/e77acaac-a1b3-40b3-99ee-5769b4e453e4@gmail.com
src/backend/storage/ipc/standby.c