Grab predicate locks on matching tuples in a lossy bitmap heap scan.
Non-lossy case was already handled correctly. Kevin Grittner
This commit is contained in:
parent
79aa44536f
commit
d9fe63acb0
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue