Skip to content

Commit b360e0f

Browse 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

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/backend/utils/sort/tuplesort.c

Lines 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)
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