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/backend/access/index/genam.c | |
parent | 4cd72b53b9975bab5f4ca0792cf4f54c84829404 (diff) | |
download | postgresql-09d3670df3e4593be1d2299a62d982829016b847.tar.gz postgresql-09d3670df3e4593be1d2299a62d982829016b847.zip |
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/backend/access/index/genam.c')
-rw-r--r-- | src/backend/access/index/genam.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/backend/access/index/genam.c b/src/backend/access/index/genam.c index 399386c8567..347d2b5365a 100644 --- a/src/backend/access/index/genam.c +++ b/src/backend/access/index/genam.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/index/genam.c,v 1.57 2006/07/03 22:45:37 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/access/index/genam.c,v 1.58 2006/07/31 20:08:59 tgl Exp $ * * NOTES * many of the old access method routines have been turned into @@ -87,7 +87,6 @@ RelationGetIndexScan(Relation indexRelation, scan->keyData = NULL; scan->is_multiscan = false; /* caller may change this */ - scan->have_lock = false; /* ditto */ scan->kill_prior_tuple = false; scan->ignore_killed_tuples = true; /* default setting */ @@ -182,7 +181,7 @@ systable_beginscan(Relation heapRelation, if (indexOK && !IgnoreSystemIndexes && !ReindexIsProcessingIndex(indexId)) - irel = index_open(indexId); + irel = index_open(indexId, AccessShareLock); else irel = NULL; @@ -207,7 +206,7 @@ systable_beginscan(Relation heapRelation, key[i].sk_attno = i + 1; } - sysscan->iscan = index_beginscan(heapRelation, irel, true, + sysscan->iscan = index_beginscan(heapRelation, irel, snapshot, nkeys, key); sysscan->scan = NULL; } @@ -253,7 +252,7 @@ systable_endscan(SysScanDesc sysscan) if (sysscan->irel) { index_endscan(sysscan->iscan); - index_close(sysscan->irel); + index_close(sysscan->irel, AccessShareLock); } else heap_endscan(sysscan->scan); |