Skip to content

Commit c6755e2

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 e42e2f3 commit c6755e2

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
@@ -1051,6 +1051,11 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
10511051
{
10521052
ParallelBitmapHeapState *pstate;
10531053
EState *estate = node->ss.ps.state;
1054+
dsa_area *dsa = node->ss.ps.state->es_query_dsa;
1055+
1056+
/* If there's no DSA, there are no workers; initialize nothing. */
1057+
if (dsa == NULL)
1058+
return;
10541059

10551060
pstate = shm_toc_allocate(pcxt->toc, node->pscan_len);
10561061

@@ -1083,6 +1088,10 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
10831088
ParallelBitmapHeapState *pstate = node->pstate;
10841089
dsa_area *dsa = node->ss.ps.state->es_query_dsa;
10851090

1091+
/* If there's no DSA, there are no workers; do nothing. */
1092+
if (dsa == NULL)
1093+
return;
1094+
10861095
pstate->state = BM_INITIAL;
10871096

10881097
if (DsaPointerIsValid(pstate->tbmiterator))
@@ -1108,6 +1117,8 @@ ExecBitmapHeapInitializeWorker(BitmapHeapScanState *node,
11081117
ParallelBitmapHeapState *pstate;
11091118
Snapshot snapshot;
11101119

1120+
Assert(node->ss.ps.state->es_query_dsa != NULL);
1121+
11111122
pstate = shm_toc_lookup(pwcxt->toc, node->ss.ps.plan->plan_node_id, false);
11121123
node->pstate = pstate;
11131124

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