From 09d3670df3e4593be1d2299a62d982829016b847 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 31 Jul 2006 20:09:10 +0000 Subject: 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. --- src/backend/bootstrap/bootstrap.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/backend/bootstrap/bootstrap.c') diff --git a/src/backend/bootstrap/bootstrap.c b/src/backend/bootstrap/bootstrap.c index 9399b6d052b..08189bf07b2 100644 --- a/src/backend/bootstrap/bootstrap.c +++ b/src/backend/bootstrap/bootstrap.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/bootstrap/bootstrap.c,v 1.222 2006/07/31 01:16:36 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/bootstrap/bootstrap.c,v 1.223 2006/07/31 20:09:00 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1239,12 +1239,13 @@ build_indices(void) Relation heap; Relation ind; + /* need not bother with locks during bootstrap */ heap = heap_open(ILHead->il_heap, NoLock); - ind = index_open(ILHead->il_ind); + ind = index_open(ILHead->il_ind, NoLock); index_build(heap, ind, ILHead->il_info, false); - index_close(ind); + index_close(ind, NoLock); heap_close(heap, NoLock); } } -- cgit v1.2.3