postgresql/src/backend
Tom Lane 8f0de712c3 Don't ignore locktable-full failures in StandbyAcquireAccessExclusiveLock.
Commit 37c54863c removed the code in StandbyAcquireAccessExclusiveLock
that checked the return value of LockAcquireExtended.  That created a
bug, because it's still passing reportMemoryError = false to
LockAcquireExtended, meaning that LOCKACQUIRE_NOT_AVAIL will be returned
if we're out of shared memory for the lock table.

In such a situation, the startup process would believe it had acquired an
exclusive lock even though it hadn't, with potentially dire consequences.

To fix, just drop the use of reportMemoryError = false, which allows us
to simplify the call into a plain LockAcquire().  It's unclear that the
locktable-full situation arises often enough that it's worth having a
better recovery method than crash-and-restart.  (I strongly suspect that
the only reason the code path existed at all was that it was relatively
simple to do in the pre-37c54863c implementation.  But now it's not.)

LockAcquireExtended's reportMemoryError parameter is now dead code and
could be removed.  I refrained from doing so, however, because there
was some interest in resurrecting the behavior if we do get reports of
locktable-full failures in the field.  Also, it seems unwise to remove
the parameter concurrently with shipping commit f868a8143, which added a
parameter; if there are any third-party callers of LockAcquireExtended,
we want them to get a wrong-number-of-parameters compile error rather
than a possibly-silent misinterpretation of its last parameter.

Back-patch to 9.6 where the bug was introduced.

Discussion: https://postgr.es/m/6202.1536359835@sss.pgh.pa.us
2018-09-19 12:43:51 -04:00
..
access Add support for nearest-neighbor (KNN) searches to SP-GiST 2018-09-19 01:54:10 +03:00
bootstrap Install a check for mis-linking of src/port and src/common functions. 2018-09-09 12:23:23 -04:00
catalog Refactor routines for subscription and publication lookups 2018-09-18 12:00:18 +09:00
commands Fix ALTER/TYPE on columns referenced by FKs in partitioned tables 2018-09-14 13:41:20 -03:00
executor Fix parsetree representation of XMLTABLE(XMLNAMESPACES(DEFAULT ...)). 2018-09-17 13:16:32 -04:00
foreign
jit In v11, disable JIT by default (it's still enabled by default in HEAD). 2018-09-15 17:24:35 -04:00
lib doc: Update redirecting links 2018-07-16 10:48:05 +02:00
libpq Minor cleanup/future-proofing for pg_saslprep(). 2018-09-08 18:20:36 -04:00
main
nodes Add a debugging option to stress-test outfuncs.c and readfuncs.c. 2018-09-18 17:11:54 -04:00
optimizer Fix some minor issues exposed by outfuncs/readfuncs testing. 2018-09-18 15:08:28 -04:00
parser Add a debugging option to stress-test outfuncs.c and readfuncs.c. 2018-09-18 17:11:54 -04:00
partitioning Remove duplicated words split across lines in comments 2018-09-08 12:24:19 -07:00
po
port Refactor dlopen() support 2018-09-06 11:33:04 +02:00
postmaster Refactor dlopen() support 2018-09-06 11:33:04 +02:00
regex
replication Improve some error message strings and errcodes 2018-09-04 11:06:04 -07:00
rewrite Fix some minor issues exposed by outfuncs/readfuncs testing. 2018-09-18 15:08:28 -04:00
snowball
statistics Fix typos. 2018-08-27 09:32:59 +12:00
storage Don't ignore locktable-full failures in StandbyAcquireAccessExclusiveLock. 2018-09-19 12:43:51 -04:00
tcop Add a debugging option to stress-test outfuncs.c and readfuncs.c. 2018-09-18 17:11:54 -04:00
tsearch Hand code string to integer conversion for performance. 2018-07-22 14:58:23 -07:00
utils Add support for nearest-neighbor (KNN) searches to SP-GiST 2018-09-19 01:54:10 +03:00
.gitignore
common.mk
Makefile Refactor dlopen() support 2018-09-06 11:33:04 +02:00
nls.mk