pgsql: Move the PredicateLockRelation() call from nodeSeqscan.c to heap - Mailing list pgsql-committers

From Heikki Linnakangas
Subject pgsql: Move the PredicateLockRelation() call from nodeSeqscan.c to heap
Date
Msg-id E1Qc0FZ-00005d-1H@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Move the PredicateLockRelation() call from nodeSeqscan.c to heapam.c. It's
more consistent that way, since all the other PredicateLock* calls are
made in various heapam.c and index AM functions. The call in nodeSeqscan.c
was unnecessarily aggressive anyway, there's no need to try to lock the
relation every time a tuple is fetched, it's enough to do it once.

This has the user-visible effect that if a seq scan is initialized in the
executor, but never executed, we now acquire the predicate lock on the heap
relation anyway. We could avoid that by taking the lock on the first
heap_getnext() call instead, but it doesn't seem worth the trouble given
that it feels more natural to do it in heap_beginscan().

Also, remove the retail PredicateLockTuple() calls from heap_getnext(). In
a seqscan, started with heap_begin(), we're holding a whole-relation
predicate lock on the heap so there's no need to lock the tuples
individually.

Kevin Grittner and me

Branch
------
REL9_1_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/f01e3d3a414f909762ab840719aeb8ae291aab5a

Modified Files
--------------
src/backend/access/heap/heapam.c   |   21 ++++++++++++++-------
src/backend/executor/nodeSeqscan.c |    6 ------
src/include/access/relscan.h       |    1 -
3 files changed, 14 insertions(+), 14 deletions(-)


pgsql-committers by date:

Previous
From: Magnus Hagander
Date:
Subject: pgsql: Protect pg_stat_reset_shared() against NULL input
Next
From: Heikki Linnakangas
Date:
Subject: pgsql: Grab predicate locks on matching tuples in a lossy bitmap heap s