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;
}
/* ----------------
/*
* This variable-sized field must come last.
*
- * See _bt_parallel_estimate_shared().
+ * See _bt_parallel_estimate_shared() and heap_parallelscan_estimate().
*/
ParallelHeapScanDescData heapdesc;
} BTShared;
static Size
_bt_parallel_estimate_shared(Snapshot snapshot)
{
- if (!IsMVCCSnapshot(snapshot))
- {
- Assert(snapshot == SnapshotAny);
- return sizeof(BTShared);
- }
-
- return add_size(offsetof(BTShared, heapdesc) +
- offsetof(ParallelHeapScanDescData, phs_snapshot_data),
- EstimateSnapshotSpace(snapshot));
+ return add_size(offsetof(BTShared, heapdesc),
+ heap_parallelscan_estimate(snapshot));
}
/*