Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 16a1e1e

Browse files
committed
Prevent parallel index build in a standalone backend.
This can't work if there's no postmaster, and indeed the code got an assertion failure trying. There should be a check on IsUnderPostmaster gating the use of parallelism, as the planner has for ordinary parallel queries. Commit 40d964e got this right, so follow its model of checking IsUnderPostmaster at the same place where we check for max_parallel_maintenance_workers == 0. In general, new code implementing parallel utility operations should do the same. Report and patch by Yulin Pei, cosmetically adjusted by me. Back-patch to v11 where this code came in. Discussion: https://postgr.es/m/HK0PR01MB22747D839F77142D7E76A45DF4F50@HK0PR01MB2274.apcprd01.prod.exchangelabs.com
1 parent 4f728a1 commit 16a1e1e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/backend/optimizer/plan/planner.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6254,8 +6254,11 @@ plan_create_index_workers(Oid tableOid, Oid indexOid)
62546254
double reltuples;
62556255
double allvisfrac;
62566256

6257-
/* Return immediately when parallelism disabled */
6258-
if (max_parallel_maintenance_workers == 0)
6257+
/*
6258+
* We don't allow performing parallel operation in standalone backend or
6259+
* when parallelism is disabled.
6260+
*/
6261+
if (!IsUnderPostmaster || max_parallel_maintenance_workers == 0)
62596262
return 0;
62606263

62616264
/* Set up largely-dummy planner state */

0 commit comments

Comments
 (0)