From: Heikki Linnakangas Date: Wed, 29 Jun 2011 18:40:27 +0000 (+0300) Subject: Grab predicate locks on matching tuples in a lossy bitmap heap scan. X-Git-Tag: REL9_2_BETA1~1477 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d9fe63acb033141be695815a8a663de8dae4f8af;p=postgresql Grab predicate locks on matching tuples in a lossy bitmap heap scan. Non-lossy case was already handled correctly. Kevin Grittner --- diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c index 40ad775758..568035a481 100644 --- a/src/backend/executor/nodeBitmapHeapscan.c +++ b/src/backend/executor/nodeBitmapHeapscan.c @@ -42,6 +42,7 @@ #include "executor/nodeBitmapHeapscan.h" #include "pgstat.h" #include "storage/bufmgr.h" +#include "storage/predicate.h" #include "utils/memutils.h" #include "utils/snapmgr.h" #include "utils/tqual.h" @@ -371,14 +372,23 @@ bitgetpage(HeapScanDesc scan, TBMIterateResult *tbmres) { ItemId lp; HeapTupleData loctup; + bool valid; lp = PageGetItemId(dp, offnum); if (!ItemIdIsNormal(lp)) continue; loctup.t_data = (HeapTupleHeader) PageGetItem((Page) dp, lp); loctup.t_len = ItemIdGetLength(lp); - if (HeapTupleSatisfiesVisibility(&loctup, snapshot, buffer)) + loctup.t_tableOid = scan->rs_rd->rd_id; + ItemPointerSet(&loctup.t_self, page, offnum); + valid = HeapTupleSatisfiesVisibility(&loctup, snapshot, buffer); + if (valid) + { scan->rs_vistuples[ntup++] = offnum; + PredicateLockTuple(scan->rs_rd, &loctup, snapshot); + } + CheckForSerializableConflictOut(valid, scan->rs_rd, &loctup, + buffer, snapshot); } }