Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit90525d7

Browse files
committed
Don't duplicate parallel seqscan shmem sizing logic in nbtree.
This is architecturally mildly problematic, which becomes morepronounced with the upcoming introduction of pluggable storage.To fix, teach heap_parallelscan_estimate() to deal with SnapshotAnysnapshots, and then use it from _bt_parallel_estimate_shared().Author: Andres FreundDiscussion:https://postgr.es/m/20180703070645.wchpu5muyto5n647@alap3.anarazel.de
1 parent285d8e1 commit90525d7

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

‎src/backend/access/heap/heapam.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1615,8 +1615,14 @@ heap_endscan(HeapScanDesc scan)
16151615
Size
16161616
heap_parallelscan_estimate(Snapshotsnapshot)
16171617
{
1618-
returnadd_size(offsetof(ParallelHeapScanDescData,phs_snapshot_data),
1619-
EstimateSnapshotSpace(snapshot));
1618+
Sizesz= offsetof(ParallelHeapScanDescData,phs_snapshot_data);
1619+
1620+
if (IsMVCCSnapshot(snapshot))
1621+
sz=add_size(sz,EstimateSnapshotSpace(snapshot));
1622+
else
1623+
Assert(snapshot==SnapshotAny);
1624+
1625+
returnsz;
16201626
}
16211627

16221628
/* ----------------

‎src/backend/access/nbtree/nbtsort.c

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ typedef struct BTShared
158158
/*
159159
* This variable-sized field must come last.
160160
*
161-
* See _bt_parallel_estimate_shared().
161+
* See _bt_parallel_estimate_shared() and heap_parallelscan_estimate().
162162
*/
163163
ParallelHeapScanDescDataheapdesc;
164164
}BTShared;
@@ -1405,15 +1405,8 @@ _bt_end_parallel(BTLeader *btleader)
14051405
staticSize
14061406
_bt_parallel_estimate_shared(Snapshotsnapshot)
14071407
{
1408-
if (!IsMVCCSnapshot(snapshot))
1409-
{
1410-
Assert(snapshot==SnapshotAny);
1411-
returnsizeof(BTShared);
1412-
}
1413-
1414-
returnadd_size(offsetof(BTShared,heapdesc)+
1415-
offsetof(ParallelHeapScanDescData,phs_snapshot_data),
1416-
EstimateSnapshotSpace(snapshot));
1408+
returnadd_size(offsetof(BTShared,heapdesc),
1409+
heap_parallelscan_estimate(snapshot));
14171410
}
14181411

14191412
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp