postgresql/src
Michael Paquier 7b8c2de64e Fix race condition at backend exit when deleting element in syncrep queue
When a backend exits, it gets deleted from the syncrep queue if present.
The queue was checked without SyncRepLock taken in exclusive mode, so it
would have been possible for a backend to remove itself after a WAL
sender already did the job.  Fix this issue based on a suggestion from
Fujii Masao, by first checking the queue without the lock.  Then, if the
backend is present in the queue, take the lock and perform an additional
lookup check before doing the element deletion.

Author: Dongming Liu
Reviewed-by: Kyotaro Horiguchi, Fujii Masao, Michael Paquier
Discussion: https://postgr.es/m/a0806273-8bbb-43b3-bbe1-c45a58f6ae21.lingce.ldm@alibaba-inc.com
Backpatch-through: 9.4
2019-11-01 22:38:45 +09:00
..
backend Fix race condition at backend exit when deleting element in syncrep queue 2019-11-01 22:38:45 +09:00
bin pg_waldump: Fix --bkp-details to not issue spurious newlines for FPWs. 2019-10-29 22:53:30 -07:00
common In pg_log_generic(), be more paranoid about preserving errno. 2019-07-06 11:25:48 -04:00
fe_utils Fix parallel restore of FKs to partitioned tables 2019-10-17 09:58:01 +02:00
include For PowerPC instruction "addi", use constraint "b". 2019-10-18 20:20:31 -07:00
interfaces Get rid of useless/dangerous redefinition of bool in ECPG. 2019-10-25 12:17:41 -04:00
makefiles Select CFLAGS_SL at configure time, not in platform-specific Makefiles. 2019-10-21 12:32:35 -04:00
pl Translation updates 2019-09-29 23:57:17 +02:00
port Deal with yet another issue related to "Norwegian (Bokmål)" locale. 2019-10-21 14:18:16 -04:00
template Select CFLAGS_SL at configure time, not in platform-specific Makefiles. 2019-10-21 12:32:35 -04:00
test Handle empty-string edge cases correctly in strpos(). 2019-10-28 12:21:13 -04:00
timezone Update time zone data files to tzdata release 2019c. 2019-09-20 19:53:52 -04:00
tools Handle spaces in OpenSSL install location for MSVC 2019-10-04 15:39:27 -04:00
tutorial Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04: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 Select CFLAGS_SL at configure time, not in platform-specific Makefiles. 2019-10-21 12:32:35 -04:00
Makefile.shlib Ensure static libraries have correct mod time even if ranlib messes it up. 2018-11-29 15:53:44 -05:00
nls-global.mk NLS: Fix backend gettext triggers 2019-09-23 09:05:50 +02:00