Use saved snapshot for scanner

When scan is started using `ts_scanner_start_scan` it create a snapshot
to use when scanning the data, but this is not subsequently used in
`ts_scanner_next`.

This commit fixes this by using the already created snapshot instead of
calling `GetLastSnapshot()`.
This commit is contained in:
Mats Kindahl 2020-08-24 17:34:01 +02:00 committed by Mats Kindahl
parent e058236311
commit 81ed667392

View File

@ -295,10 +295,10 @@ ts_scanner_next(ScannerCtx *ctx, InternalScannerCtx *ictx)
#if PG12_GE
TupleTableSlot *slot = ictx->tinfo.slot;
PushActiveSnapshot(GetLatestSnapshot());
Assert(ctx->snapshot);
ictx->tinfo.lockresult = table_tuple_lock(ictx->tablerel,
&(slot->tts_tid),
GetLatestSnapshot(),
ctx->snapshot,
slot,
GetCurrentCommandId(false),
ctx->tuplock->lockmode,
@ -306,7 +306,6 @@ ts_scanner_next(ScannerCtx *ctx, InternalScannerCtx *ictx)
0 /* don't follow updates */,
&tmfd);
PopActiveSnapshot();
#else
HeapTuple tuple = ExecFetchSlotTuple(ictx->tinfo.slot);
Buffer buffer;