Change the relation_open protocol so that we obtain lock on a relation

Tom Lane <tgl@sss.pgh.pa.us>

Commit: 09d3670df3e4593be1d2299a62d982829016b847
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2006-07-31T20:09:10Z
Releases: 8.2.0
Change the relation_open protocol so that we obtain lock on a relation
(table or index) before trying to open its relcache entry.  This fixes
race conditions in which someone else commits a change to the relation's
catalog entries while we are in process of doing relcache load.  Problems
of that ilk have been reported sporadically for years, but it was not
really practical to fix until recently --- for instance, the recent
addition of WAL-log support for in-place updates helped.

Along the way, remove pg_am.amconcurrent: all AMs are now expected to support
concurrent update.

Files

PathChange+/−
contrib/userlock/user_locks.c modified +1 −2
doc/src/sgml/catalogs.sgml modified +1 −8
doc/src/sgml/indexam.sgml modified +13 −34
src/backend/access/gin/ginvacuum.c modified +9 −8
src/backend/access/gist/gistvacuum.c modified +7 −6
src/backend/access/heap/heapam.c modified +41 −25
src/backend/access/heap/tuptoaster.c modified +12 −19
src/backend/access/index/genam.c modified +4 −5
src/backend/access/index/indexam.c modified +30 −80
src/backend/bootstrap/bootstrap.c modified +4 −3
src/backend/catalog/catalog.c modified +72 −5
src/backend/catalog/heap.c modified +9 −22
src/backend/catalog/index.c modified +56 −83
src/backend/commands/cluster.c modified +6 −7
src/backend/commands/sequence.c modified +24 −21
src/backend/commands/tablecmds.c modified +5 −2
src/backend/commands/trigger.c modified +4 −10
src/backend/commands/typecmds.c modified +3 −1
src/backend/commands/vacuum.c modified +7 −10
src/backend/commands/vacuumlazy.c modified +2 −36
src/backend/executor/execUtils.c modified +4 −38
src/backend/executor/nodeBitmapIndexscan.c modified +9 −12
src/backend/executor/nodeIndexscan.c modified +9 −12
src/backend/optimizer/util/plancat.c modified +18 −9
src/backend/optimizer/util/relnode.c modified +2 −2
src/backend/postmaster/autovacuum.c modified +20 −30
src/backend/storage/large_object/inv_api.c modified +6 −6
src/backend/storage/lmgr/lmgr.c modified +167 −48
src/backend/storage/lmgr/lock.c modified +3 −8
src/backend/utils/cache/catcache.c modified +5 −10
src/backend/utils/cache/relcache.c modified +30 −32
src/include/access/genam.h modified +5 −6
src/include/access/relscan.h modified +1 −2
src/include/catalog/catalog.h modified +3 −1
src/include/catalog/catversion.h modified +2 −2
src/include/catalog/pg_am.h modified +20 −22
src/include/optimizer/plancat.h modified +2 −2
src/include/storage/lmgr.h modified +10 −4
src/include/storage/lock.h modified +1 −3
src/include/utils/relcache.h modified +2 −6