postgresql/src
Tom Lane 66c2922e76 Take care to de-duplicate entries in standby.c's table of locks.
The RecoveryLockLists data structure, which tracks all exclusive
locks that the startup process is holding on behalf of transactions
being replayed, did not have any provision for avoiding duplicate
entries for the same lock.  Maybe that was okay when the code was
first written.  However, modern practice is for checkpoints to
write fresh lists of all active exclusive locks into the WAL.
Thus, an exclusive lock that survives across multiple checkpoints
causes bloat in standbys' startup processes.  If there are a lot
of such locks this can look like a memory leak, and it's even
possible to drive the startup process into a palloc failure from
an over-length List.

To fix, use a hash table instead of simple lists to track the
locks being held.  Allowing for dynahash overhead, this requires
a little more space per lock than the old way (although it's the
same size as what we were allocating prior to c6e0fe1f2).  It's
probably a shade slower too.  However, testing indicates that the
penalty is negligible on ordinary workloads, so let's make this
change to improve robustness in extreme cases.

Patch by me, per report from Dmitriy Kuzmin.  No back-patch
(for now anyway), since it seems that a significant improvement
would only occur in corner cases.

Discussion: https://postgr.es/m/CAHLDt=_ts0A7Agn=hCpUh+RCFkxd+G6uuT=kcTfqFtGur0dp=A@mail.gmail.com
2022-10-06 12:27:36 -04:00
..
backend Take care to de-duplicate entries in standby.c's table of locks. 2022-10-06 12:27:36 -04:00
bin Fix final compiler warning produced by -Wshadow=compatible-local 2022-10-06 10:19:36 +13:00
common Change some errdetail() to errdetail_internal() 2022-09-28 17:14:53 +02:00
fe_utils Revert 56-bit relfilenode change and follow-up commits. 2022-09-28 09:55:28 -04:00
include Introduce t_isalnum() to replace t_isalpha() || t_isdigit() tests. 2022-10-06 11:08:56 -04:00
interfaces meson: Add windows resource files 2022-10-05 09:56:05 -07:00
makefiles windows: remove date from version number in win32ver.rc 2022-09-26 11:38:02 -07:00
pl tests: Rename conflicting role names 2022-10-05 10:43:13 -07:00
port windows: Set UMDF_USING_NTSTATUS globally, include ntstatus.h 2022-09-28 21:59:15 -07:00
template
test Refactor TAP test authentication/001_password.pl 2022-10-06 09:45:18 +09:00
timezone meson: Add windows resource files 2022-10-05 09:56:05 -07:00
tools meson: Add windows resource files 2022-10-05 09:56:05 -07:00
tutorial
.gitignore
DEVELOPERS
Makefile
Makefile.global.in
Makefile.shlib
meson.build meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
nls-global.mk