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 d9fe702

Browse filesBrowse files
committed
Handle lack of DSM slots in parallel btree build, take 2.
Commit 74618e7 added a new check intended to fix a bug, but put it in the wrong place so that parallel btree build was always disabled. Do the check after we've actually tried to create a DSM segment. Back-patch to 11, like the earlier commit. Reviewed-by: Peter Geoghegan Discussion: https://postgr.es/m/CAH2-WzmDABkJzrNnvf%2BOULK-_A_j9gkYg_Dz-H62jzNv4eKQTw%40mail.gmail.com
1 parent 7d91b60 commit d9fe702
Copy full SHA for d9fe702

File tree

Expand file treeCollapse file tree

1 file changed

+10
-8
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+10
-8
lines changed

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

Copy file name to clipboardExpand all lines: src/backend/access/nbtree/nbtsort.c
+10-8Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,14 +1332,6 @@ _bt_begin_parallel(BTBuildState *buildstate, bool isconcurrent, int request)
13321332
pcxt = CreateParallelContext("postgres", "_bt_parallel_build_main",
13331333
request);
13341334

1335-
/* If no DSM segment was available, back out (do serial build) */
1336-
if (pcxt->seg == NULL)
1337-
{
1338-
DestroyParallelContext(pcxt);
1339-
ExitParallelMode();
1340-
return;
1341-
}
1342-
13431335
scantuplesortstates = leaderparticipates ? request + 1 : request;
13441336

13451337
/*
@@ -1383,6 +1375,16 @@ _bt_begin_parallel(BTBuildState *buildstate, bool isconcurrent, int request)
13831375
/* Everyone's had a chance to ask for space, so now create the DSM */
13841376
InitializeParallelDSM(pcxt);
13851377

1378+
/* If no DSM segment was available, back out (do serial build) */
1379+
if (pcxt->seg == NULL)
1380+
{
1381+
if (IsMVCCSnapshot(snapshot))
1382+
UnregisterSnapshot(snapshot);
1383+
DestroyParallelContext(pcxt);
1384+
ExitParallelMode();
1385+
return;
1386+
}
1387+
13861388
/* Store shared build state, for which we reserved space */
13871389
btshared = (BTShared *) shm_toc_allocate(pcxt->toc, estbtshared);
13881390
/* Initialize immutable state */

0 commit comments

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