postgresql/src/backend/utils
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
..
adt Further fixes for quoted-list GUC values in pg_dump and ruleutils.c. 2018-07-31 13:00:14 -04:00
cache Handle parallel index builds on mapped relations. 2018-08-10 13:01:34 -07:00
error Update copyright for 2018 2018-01-02 23:30:12 -05:00
fmgr Post-feature-freeze pgindent run. 2018-04-26 14:47:16 -04:00
hash Allow memory contexts to have both fixed and variable ident strings. 2018-03-27 16:46:51 -04:00
init Use a ResourceOwner to track buffer pins in all cases. 2018-07-18 12:15:16 -04:00
mb Avoid use of unportable hex constant in convutils.pm 2018-05-27 10:41:19 -04:00
misc Add ssl_library preset parameter 2018-07-30 13:46:27 +02:00
mmgr Fix more wrong paths in header comments 2018-07-11 17:57:04 +03:00
resowner Use a ResourceOwner to track buffer pins in all cases. 2018-07-18 12:15:16 -04:00
sort Fix more wrong paths in header comments 2018-07-11 17:57:04 +03:00
time Fix misc typos, mostly in comments. 2018-07-18 16:17:32 +03:00
.gitignore Rearrange makefile rules for running Gen_fmgrtab.pl. 2018-05-03 17:54:18 -04:00
errcodes.txt Make new error code name match SQL standard more closely 2018-06-11 11:15:28 -04:00
Gen_dummy_probes.pl Clean up some perlcritic warnings 2018-05-07 15:35:32 -04:00
Gen_dummy_probes.sed Update copyright for 2018 2018-01-02 23:30:12 -05:00
Gen_fmgrtab.pl Assorted minor cleanups for bootstrap-data Perl scripts. 2018-05-19 16:04:47 -04:00
generate-errcodes.pl Update copyright for 2018 2018-01-02 23:30:12 -05:00
Makefile Suppress compiler warnings when building with --enable-dtrace. 2018-05-07 13:44:09 -04:00
probes.d Support parallel btree index builds. 2018-02-02 13:32:44 -05:00