diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2006-07-31 20:09:10 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2006-07-31 20:09:10 +0000 |
commit | 09d3670df3e4593be1d2299a62d982829016b847 (patch) | |
tree | 7a62e91c1cf595d0334dd2c196d1c79835cc267b /src/include/access/genam.h | |
parent | 4cd72b53b9975bab5f4ca0792cf4f54c84829404 (diff) |
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.
Diffstat (limited to 'src/include/access/genam.h')
-rw-r--r-- | src/include/access/genam.h | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/include/access/genam.h b/src/include/access/genam.h index 9cd9162c26b..ddad1745279 100644 --- a/src/include/access/genam.h +++ b/src/include/access/genam.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/access/genam.h,v 1.64 2006/07/13 17:47:01 momjian Exp $ + * $PostgreSQL: pgsql/src/include/access/genam.h,v 1.65 2006/07/31 20:09:05 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -17,6 +17,7 @@ #include "access/relscan.h" #include "access/sdir.h" #include "nodes/primnodes.h" +#include "storage/lock.h" /* * Struct for statistics returned by ambuild @@ -84,9 +85,9 @@ typedef SysScanDescData *SysScanDesc; /* * generalized index_ interface routines (in indexam.c) */ -extern Relation index_open(Oid relationId); -extern Relation index_openrv(const RangeVar *relation); -extern void index_close(Relation relation); +extern Relation index_open(Oid relationId, LOCKMODE lockmode); +extern void index_close(Relation relation, LOCKMODE lockmode); + extern bool index_insert(Relation indexRelation, Datum *values, bool *isnull, ItemPointer heap_t_ctid, @@ -95,11 +96,9 @@ extern bool index_insert(Relation indexRelation, extern IndexScanDesc index_beginscan(Relation heapRelation, Relation indexRelation, - bool need_index_lock, Snapshot snapshot, int nkeys, ScanKey key); extern IndexScanDesc index_beginscan_multi(Relation indexRelation, - bool need_index_lock, Snapshot snapshot, int nkeys, ScanKey key); extern void index_rescan(IndexScanDesc scan, ScanKey key); |