postgresql/src
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
..
backend Don't ignore locktable-full failures in StandbyAcquireAccessExclusiveLock. 2018-09-19 12:43:51 -04:00
bin Remove dead code from pop_next_work_item(). 2018-09-17 12:43:07 -04:00
common Allow concurrent-safe open() and fopen() in frontend code for Windows 2018-09-14 10:04:14 +09:00
fe_utils Fix lexing of standard multi-character operators in edge cases. 2018-08-23 21:42:40 +01:00
include Add support for nearest-neighbor (KNN) searches to SP-GiST 2018-09-19 01:54:10 +03:00
interfaces Attempt to identify system timezone by reading /etc/localtime symlink. 2018-09-13 12:36:21 -04:00
makefiles Refactor installation of extension headers. 2018-09-07 14:19:14 +01:00
pl Fix out-of-tree build for transform modules. 2018-09-16 18:46:45 +01:00
port Fix inconsistent argument naming. 2018-09-06 11:14:22 -04:00
template
test Add support for nearest-neighbor (KNN) searches to SP-GiST 2018-09-19 01:54:10 +03:00
timezone Update time zone data files to tzdata release 2018e. 2018-05-09 13:56:22 -04:00
tools Fix out-of-tree build for transform modules. 2018-09-16 18:46:45 +01:00
tutorial Deduplicate "invalid input syntax" messages for various types. 2018-07-22 14:58:01 -07:00
.gitignore
DEVELOPERS
Makefile Fix partial-build problems introduced by having more generated headers. 2018-04-09 16:42:10 -04:00
Makefile.global.in Ensure we build generated headers at the start of some more cases. 2018-07-30 18:04:39 -04:00
Makefile.shlib Use -Bsymbolic for shared libraries on HP-UX and Solaris. 2018-09-10 22:22:12 -04:00
nls-global.mk