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

Appearance settings

Commit 275b341

Browse filesBrowse 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 b1738ff commit 275b341
Copy full SHA for 275b341

File tree

Expand file treeCollapse file tree

1 file changed

+5
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-2
lines changed

‎src/backend/optimizer/plan/planner.c

Copy file name to clipboardExpand all lines: src/backend/optimizer/plan/planner.c
+5-2Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6375,8 +6375,11 @@ plan_create_index_workers(Oid tableOid, Oid indexOid)
63756375
double reltuples;
63766376
double allvisfrac;
63776377

6378-
/* Return immediately when parallelism disabled */
6379-
if (max_parallel_maintenance_workers == 0)
6378+
/*
6379+
* We don't allow performing parallel operation in standalone backend or
6380+
* when parallelism is disabled.
6381+
*/
6382+
if (!IsUnderPostmaster || max_parallel_maintenance_workers == 0)
63806383
return 0;
63816384

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

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.