1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-19 13:42:17 +03:00

logtape.c: do not preallocate for tapes when sorting

The preallocation logic is only useful for HashAgg, so disable it when
sorting.

Also, adjust an out-of-date comment.

Reviewed-by: Peter Geoghegan
Discussion: https://postgr.es/m/CAH2-Wzn_o7tE2+hRVvwSFghRb75AJ5g-nqGzDUqLYMexjOAe=g@mail.gmail.com
Backpatch-through: 13
This commit is contained in:
Jeff Davis
2020-09-11 17:10:02 -07:00
parent 7634bd4f6d
commit 0758964963
4 changed files with 32 additions and 18 deletions

View File

@@ -2591,7 +2591,7 @@ inittapes(Tuplesortstate *state, bool mergeruns)
/* Create the tape set and allocate the per-tape data arrays */
inittapestate(state, maxTapes);
state->tapeset =
LogicalTapeSetCreate(maxTapes, NULL,
LogicalTapeSetCreate(maxTapes, false, NULL,
state->shared ? &state->shared->fileset : NULL,
state->worker);
@@ -4657,8 +4657,9 @@ leader_takeover_tapes(Tuplesortstate *state)
* randomAccess is disallowed for parallel sorts.
*/
inittapestate(state, nParticipants + 1);
state->tapeset = LogicalTapeSetCreate(nParticipants + 1, shared->tapes,
&shared->fileset, state->worker);
state->tapeset = LogicalTapeSetCreate(nParticipants + 1, false,
shared->tapes, &shared->fileset,
state->worker);
/* mergeruns() relies on currentRun for # of runs (in one-pass cases) */
state->currentRun = nParticipants;