Skip to content

Commit ec7629d

Browse files
committed
Teach bitmap heap scan to cope with absence of a DSA.
If we have a plan that uses parallelism but are unable to execute it using parallelism, for example due to a lack of available DSM segments, then the EState's es_query_dsa will be NULL. Parallel bitmap heap scan needs to fall back to a non-parallel scan in such cases. Patch by me, reviewed by Dilip Kumar Discussion: http://postgr.es/m/CAEepm=0kADK5inNf_KuemjX=HQ=PuTP0DykM--fO5jS5ePVFEA@mail.gmail.com
1 parent 7015bb3 commit ec7629d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/backend/executor/nodeBitmapHeapscan.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -963,6 +963,11 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
963963
{
964964
ParallelBitmapHeapState *pstate;
965965
EState *estate = node->ss.ps.state;
966+
dsa_area *dsa = node->ss.ps.state->es_query_dsa;
967+
968+
/* If there's no DSA, there are no workers; initialize nothing. */
969+
if (dsa == NULL)
970+
return;
966971

967972
pstate = shm_toc_allocate(pcxt->toc, node->pscan_len);
968973

@@ -995,6 +1000,10 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
9951000
ParallelBitmapHeapState *pstate = node->pstate;
9961001
dsa_area *dsa = node->ss.ps.state->es_query_dsa;
9971002

1003+
/* If there's no DSA, there are no workers; do nothing. */
1004+
if (dsa == NULL)
1005+
return;
1006+
9981007
pstate->state = BM_INITIAL;
9991008

10001009
if (DsaPointerIsValid(pstate->tbmiterator))
@@ -1019,6 +1028,8 @@ ExecBitmapHeapInitializeWorker(BitmapHeapScanState *node, shm_toc *toc)
10191028
ParallelBitmapHeapState *pstate;
10201029
Snapshot snapshot;
10211030

1031+
Assert(node->ss.ps.state->es_query_dsa != NULL);
1032+
10221033
pstate = shm_toc_lookup(toc, node->ss.ps.plan->plan_node_id, false);
10231034
node->pstate = pstate;
10241035

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy