postgresql/src/backend
Thomas Munro 7718a99203 Fix race in dsm_unpin_segment() when handles are reused.
Teach dsm_unpin_segment() to skip segments that are in the process
of being destroyed by another backend, when searching for a handle.
Such a segment cannot possibly be the one we are looking for, even
if its handle matches.  Another slot might hold a recently created
segment that has the same handle value by coincidence, and we need
to keep searching for that one.

The bug caused rare "cannot unpin a segment that is not pinned"
errors on 10 and 11.  Similar to commit 6c0fb941 for dsm_attach().

Back-patch to 10, where dsm_unpin_segment() landed.

Author: Thomas Munro
Reported-by: Justin Pryzby
Tested-by: Justin Pryzby (along with other recent DSA/DSM fixes)
Discussion: https://postgr.es/m/20190216023854.GF30291@telsasoft.com
2019-02-18 10:02:37 +13:00
..
access Adjust error message 2019-02-11 10:33:53 +01:00
bootstrap Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
catalog Keep perl style checker happy 2019-02-05 15:18:38 -05:00
commands Fix CREATE VIEW to allow zero-column views. 2019-02-17 12:37:32 -05:00
executor Fix outdated comment 2019-01-19 09:36:36 +01:00
foreign Abstract logic to allow for multiple kinds of child rels. 2017-04-03 22:41:31 -04:00
lib Rename rbtree.c functions to use "rbt" prefix not "rb" prefix. 2018-11-06 13:25:24 -05:00
libpq Don't set PAM_RHOST for Unix sockets. 2018-11-28 14:15:00 +13:00
main Install Windows crash dump handler before all else. 2017-11-12 14:31:04 -08:00
nodes Add stack depth checks to key recursive functions in backend/nodes/*.c. 2018-12-10 11:12:43 -05:00
optimizer Call set_rel_pathlist_hook before generate_gather_paths, not after. 2019-02-09 11:41:09 -05:00
parser Fix support for CREATE TABLE IF NOT EXISTS AS EXECUTE 2019-02-15 17:12:36 +09:00
po Translation updates 2019-02-11 14:25:01 +01:00
port Pad semaphores to avoid false sharing. 2018-07-25 11:00:53 +12:00
postmaster Fix typos in documentation and for one wait event 2019-01-15 08:47:14 +09:00
regex Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
replication Relax overly strict assertion 2019-02-12 18:42:37 -03:00
rewrite Fix set of NLS translation issues 2018-08-21 15:17:38 +09:00
snowball Initial pgindent run with pg_bsd_indent version 2.0. 2017-06-21 14:39:04 -04:00
statistics Fix bogus code for extracting extended-statistics data from syscache. 2018-05-02 12:22:48 -04:00
storage Fix race in dsm_unpin_segment() when handles are reused. 2019-02-18 10:02:37 +13:00
tcop Allow UNLISTEN in hot-standby mode. 2019-01-25 21:14:31 -05:00
tsearch Make ts_locale.c's character-type functions cope with UTF-16. 2018-11-03 13:56:10 -04:00
utils Fix rare dsa_allocate() failures due to freepage.c corruption. 2019-02-13 13:32:05 +13:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
common.mk Add ICU_CFLAGS to global CPPFLAGS 2017-06-12 15:57:22 -04:00
Makefile Fix make rules that generate multiple output files. 2018-03-23 13:45:38 -04:00
nls.mk Translation updates 2018-05-07 11:59:42 -04:00