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 b360e0f

Browse filesBrowse files
committed
Make tuplesort_set_bound() assertions more comprehensible, hopefully.
Add the comments that I griped were missing. Also re-order tests so that parallelism-related tests aren't randomly separated from each other. Discussion: https://postgr.es/m/CAAaqYe9GD__4Crm=ddz+-XXcNhfY_V5gFYdLdmkFNq=2VHO56Q@mail.gmail.com
1 parent bac2fae commit b360e0f
Copy full SHA for b360e0f

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

+6
-5
lines changed

‎src/backend/utils/sort/tuplesort.c

Copy file name to clipboardExpand all lines: src/backend/utils/sort/tuplesort.c
+6-5Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,20 +1187,21 @@ tuplesort_set_bound(Tuplesortstate *state, int64 bound)
11871187
{
11881188
/* Assert we're called before loading any tuples */
11891189
Assert(state->status == TSS_INITIAL && state->memtupcount == 0);
1190-
1190+
/* Can't set the bound twice, either */
11911191
Assert(!state->bounded);
1192+
/* Also, this shouldn't be called in a parallel worker */
11921193
Assert(!WORKER(state));
11931194

1195+
/* Parallel leader allows but ignores hint */
1196+
if (LEADER(state))
1197+
return;
1198+
11941199
#ifdef DEBUG_BOUNDED_SORT
11951200
/* Honor GUC setting that disables the feature (for easy testing) */
11961201
if (!optimize_bounded_sort)
11971202
return;
11981203
#endif
11991204

1200-
/* Parallel leader ignores hint */
1201-
if (LEADER(state))
1202-
return;
1203-
12041205
/* We want to be able to compute bound * 2, so limit the setting */
12051206
if (bound > (int64) (INT_MAX / 2))
12061207
return;

0 commit comments

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