Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit fc0f3b4

Browse files
committed
Fix parallel sort, broken by the balanced merge patch.
The code for initializing the tapes on each merge iteration was skipped in a parallel worker. I put the !WORKER(state) check in wrong place while rebasing the patch. That caused failures in the index build in 'multiple-row-versions' isolation test, in multiple buildfarm members. On my laptop it was easier to reproduce by building an index on a larger table, so that you got a parallel sort more reliably.
1 parent aa3ac64 commit fc0f3b4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/backend/utils/sort/tuplesort.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -2923,7 +2923,7 @@ mergeruns(Tuplesortstate *state)
29232923
* Rewind all the output tapes, and make them inputs for the next
29242924
* pass.
29252925
*/
2926-
if (state->nInputRuns == 0 && !WORKER(state))
2926+
if (state->nInputRuns == 0)
29272927
{
29282928
int64 input_buffer_size;
29292929

@@ -2975,7 +2975,8 @@ mergeruns(Tuplesortstate *state)
29752975
* sorted tape, we can stop at this point and do the final merge
29762976
* on-the-fly.
29772977
*/
2978-
if (!state->randomAccess && state->nInputRuns <= state->nInputTapes)
2978+
if (!state->randomAccess && state->nInputRuns <= state->nInputTapes
2979+
&& !WORKER(state))
29792980
{
29802981
/* Tell logtape.c we won't be writing anymore */
29812982
LogicalTapeSetForgetFreeSpace(state->tapeset);

0 commit comments

Comments
 (0)