1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

Don't duplicate parallel seqscan shmem sizing logic in nbtree.

This is architecturally mildly problematic, which becomes more
pronounced with the upcoming introduction of pluggable storage.

To fix, teach heap_parallelscan_estimate() to deal with SnapshotAny
snapshots, and then use it from _bt_parallel_estimate_shared().

Author: Andres Freund
Discussion: https://postgr.es/m/20180703070645.wchpu5muyto5n647@alap3.anarazel.de
This commit is contained in:
Andres Freund
2019-01-15 12:19:21 -08:00
parent 285d8e1205
commit 90525d7b4e
2 changed files with 11 additions and 12 deletions

View File

@ -1615,8 +1615,14 @@ heap_endscan(HeapScanDesc scan)
Size
heap_parallelscan_estimate(Snapshot snapshot)
{
return add_size(offsetof(ParallelHeapScanDescData, phs_snapshot_data),
EstimateSnapshotSpace(snapshot));
Size sz = offsetof(ParallelHeapScanDescData, phs_snapshot_data);
if (IsMVCCSnapshot(snapshot))
sz = add_size(sz, EstimateSnapshotSpace(snapshot));
else
Assert(snapshot == SnapshotAny);
return sz;
}
/* ----------------