postgresql/src/backend/utils/cache
Peter Geoghegan 4974d7f87e Handle parallel index builds on mapped relations.
Commit 9da0cc3528, which introduced parallel CREATE INDEX, failed to
propagate relmapper.c backend local cache state to parallel worker
processes.  This could result in parallel index builds against mapped
catalog relations where the leader process (participating as a worker)
scans the new, pristine relfilenode, while worker processes scan the
obsolescent relfilenode.  When this happened, the final index structure
was typically not consistent with the owning table's structure.  The
final index structure could contain entries formed from both heap
relfilenodes.  Only rebuilds on mapped catalog relations that occur as
part of a VACUUM FULL or CLUSTER could become corrupt in practice, since
their mapped relation relfilenode swap is what allows the inconsistency
to arise.

On master, fix the problem by propagating the required relmapper.c
backend state as part of standard parallel initialization (Cf. commit
29d58fd3).  On v11, simply disallow builds against mapped catalog
relations by deeming them parallel unsafe.

Author: Peter Geoghegan
Reported-By: "death lock"
Reviewed-By: Tom Lane, Amit Kapila
Bug: #15309
Discussion: https://postgr.es/m/153329671686.1405.18298309097348420351@wrigleys.postgresql.org
Backpatch: 11-, where parallel CREATE INDEX was introduced.
2018-08-10 13:01:34 -07:00
..
attoptcache.c Update copyright for 2018 2018-01-02 23:30:12 -05:00
catcache.c Save a few bytes by removing useless last argument to SearchCatCacheList. 2018-01-29 15:13:17 -05:00
evtcache.c Update copyright for 2018 2018-01-02 23:30:12 -05:00
inval.c Fix bugs in vacuum of shared rels, by keeping their relcache entries current. 2018-06-12 11:13:21 -07:00
lsyscache.c Add prokind column, replacing proisagg and proiswindow 2018-03-02 13:48:33 -05:00
Makefile Reorganize partitioning code 2018-04-14 21:12:14 -03:00
partcache.c Fix some ill-chosen names for globally-visible partition support functions. 2018-06-13 13:18:02 -04:00
plancache.c Add plan_cache_mode setting 2018-07-16 13:35:41 +02:00
relcache.c Cosmetic improvements for faster column addition. 2018-06-27 08:16:13 +05:30
relfilenodemap.c Fix more wrong paths in header comments 2018-07-11 17:57:04 +03:00
relmapper.c Handle parallel index builds on mapped relations. 2018-08-10 13:01:34 -07:00
spccache.c Update copyright for 2018 2018-01-02 23:30:12 -05:00
syscache.c Save a few bytes by removing useless last argument to SearchCatCacheList. 2018-01-29 15:13:17 -05:00
ts_cache.c Rename MemoryContextCopySetIdentifier() for clarity 2018-04-06 12:37:54 -04:00
typcache.c Fix typo in comment 2018-03-29 11:42:32 +02:00