]> granicus.if.org Git - postgresql/commit
Move the PredicateLockRelation() call from nodeSeqscan.c to heapam.c. It's
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Wed, 29 Jun 2011 18:43:53 +0000 (21:43 +0300)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Wed, 29 Jun 2011 19:10:45 +0000 (22:10 +0300)
commitf01e3d3a414f909762ab840719aeb8ae291aab5a
tree3dcdccfdb6fad20ab0c5e1ac7cee2097d060fdac
parent1aa447a1e1273e51f1bb34e085c021941db86212
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
src/backend/access/heap/heapam.c
src/backend/executor/nodeSeqscan.c
src/include/access/relscan.h