diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 1999-09-18 19:08:25 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 1999-09-18 19:08:25 +0000 |
commit | bd272cace63effa23d68a6b344a07e326b6a41e2 (patch) | |
tree | 3026c545c238bd38eadc7fb1fac89d636cf51673 /src/backend/executor/execUtils.c | |
parent | 6c86fd5ba49bc03949ea1c788023f39da9c0b9fe (diff) | |
download | postgresql-bd272cace63effa23d68a6b344a07e326b6a41e2.tar.gz postgresql-bd272cace63effa23d68a6b344a07e326b6a41e2.zip |
Mega-commit to make heap_open/heap_openr/heap_close take an
additional argument specifying the kind of lock to acquire/release (or
'NoLock' to do no lock processing). Ensure that all relations are locked
with some appropriate lock level before being examined --- this ensures
that relevant shared-inval messages have been processed and should prevent
problems caused by concurrent VACUUM. Fix several bugs having to do with
mismatched increment/decrement of relation ref count and mismatched
heap_open/close (which amounts to the same thing). A bogus ref count on
a relation doesn't matter much *unless* a SI Inval message happens to
arrive at the wrong time, which is probably why we got away with this
sloppiness for so long. Repair missing grab of AccessExclusiveLock in
DROP TABLE, ALTER/RENAME TABLE, etc, as noted by Hiroshi.
Recommend 'make clean all' after pulling this update; I modified the
Relation struct layout slightly.
Will post further discussion to pghackers list shortly.
Diffstat (limited to 'src/backend/executor/execUtils.c')
-rw-r--r-- | src/backend/executor/execUtils.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/backend/executor/execUtils.c b/src/backend/executor/execUtils.c index 4bacf3f7bdb..197995c3462 100644 --- a/src/backend/executor/execUtils.c +++ b/src/backend/executor/execUtils.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.48 1999/07/16 04:58:47 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.49 1999/09/18 19:06:48 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -772,7 +772,7 @@ ExecOpenIndices(Oid resultRelationOid, * open pg_index * ---------------- */ - indexRd = heap_openr(IndexRelationName); + indexRd = heap_openr(IndexRelationName, AccessShareLock); /* ---------------- * form a scan key @@ -856,7 +856,7 @@ ExecOpenIndices(Oid resultRelationOid, * ---------------- */ heap_endscan(indexSd); - heap_close(indexRd); + heap_close(indexRd, AccessShareLock); /* ---------------- * Now that we've collected the index information into three @@ -913,7 +913,7 @@ ExecOpenIndices(Oid resultRelationOid, /* * Hack for not btree and hash indices: they use relation - * level exclusive locking on updation (i.e. - they are + * level exclusive locking on update (i.e. - they are * not ready for MVCC) and so we have to exclusively lock * indices here to prevent deadlocks if we will scan them * - index_beginscan places AccessShareLock, indices @@ -1010,7 +1010,7 @@ ExecCloseIndices(RelationInfo *resultRelationInfo) continue; /* - * Notes in ExecOpenIndices. + * See notes in ExecOpenIndices. */ if (relationDescs[i]->rd_rel->relam != BTREE_AM_OID && relationDescs[i]->rd_rel->relam != HASH_AM_OID) |