Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit d9fe63a

Browse files
committed
Grab predicate locks on matching tuples in a lossy bitmap heap scan.
Non-lossy case was already handled correctly. Kevin Grittner
1 parent 79aa445 commit d9fe63a

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/backend/executor/nodeBitmapHeapscan.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#include "executor/nodeBitmapHeapscan.h"
4343
#include "pgstat.h"
4444
#include "storage/bufmgr.h"
45+
#include "storage/predicate.h"
4546
#include "utils/memutils.h"
4647
#include "utils/snapmgr.h"
4748
#include "utils/tqual.h"
@@ -371,14 +372,23 @@ bitgetpage(HeapScanDesc scan, TBMIterateResult *tbmres)
371372
{
372373
ItemId lp;
373374
HeapTupleData loctup;
375+
bool valid;
374376

375377
lp = PageGetItemId(dp, offnum);
376378
if (!ItemIdIsNormal(lp))
377379
continue;
378380
loctup.t_data = (HeapTupleHeader) PageGetItem((Page) dp, lp);
379381
loctup.t_len = ItemIdGetLength(lp);
380-
if (HeapTupleSatisfiesVisibility(&loctup, snapshot, buffer))
382+
loctup.t_tableOid = scan->rs_rd->rd_id;
383+
ItemPointerSet(&loctup.t_self, page, offnum);
384+
valid = HeapTupleSatisfiesVisibility(&loctup, snapshot, buffer);
385+
if (valid)
386+
{
381387
scan->rs_vistuples[ntup++] = offnum;
388+
PredicateLockTuple(scan->rs_rd, &loctup, snapshot);
389+
}
390+
CheckForSerializableConflictOut(valid, scan->rs_rd, &loctup,
391+
buffer, snapshot);
382392
}
383393
}
384394

0 commit comments

Comments
 (0)