mirror of
https://github.com/postgres/postgres.git
synced 2025-10-24 01:29:19 +03:00
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.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user