mirror of
https://github.com/postgres/postgres.git
synced 2025-05-02 11:44:50 +03:00
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
This commit is contained in:
parent
bac2fae05c
commit
b360e0fcd7
@ -1187,20 +1187,21 @@ tuplesort_set_bound(Tuplesortstate *state, int64 bound)
|
|||||||
{
|
{
|
||||||
/* Assert we're called before loading any tuples */
|
/* Assert we're called before loading any tuples */
|
||||||
Assert(state->status == TSS_INITIAL && state->memtupcount == 0);
|
Assert(state->status == TSS_INITIAL && state->memtupcount == 0);
|
||||||
|
/* Can't set the bound twice, either */
|
||||||
Assert(!state->bounded);
|
Assert(!state->bounded);
|
||||||
|
/* Also, this shouldn't be called in a parallel worker */
|
||||||
Assert(!WORKER(state));
|
Assert(!WORKER(state));
|
||||||
|
|
||||||
|
/* Parallel leader allows but ignores hint */
|
||||||
|
if (LEADER(state))
|
||||||
|
return;
|
||||||
|
|
||||||
#ifdef DEBUG_BOUNDED_SORT
|
#ifdef DEBUG_BOUNDED_SORT
|
||||||
/* Honor GUC setting that disables the feature (for easy testing) */
|
/* Honor GUC setting that disables the feature (for easy testing) */
|
||||||
if (!optimize_bounded_sort)
|
if (!optimize_bounded_sort)
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Parallel leader ignores hint */
|
|
||||||
if (LEADER(state))
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* We want to be able to compute bound * 2, so limit the setting */
|
/* We want to be able to compute bound * 2, so limit the setting */
|
||||||
if (bound > (int64) (INT_MAX / 2))
|
if (bound > (int64) (INT_MAX / 2))
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user