Commit 64bc26f9 authored by Heikki Linnakangas's avatar Heikki Linnakangas

Fix thinko in safeguard for negative availMem.

Also, use pass read_buffer_size * numInputTapes rather than just availMem
to USEMEM, to be neat.

Peter Geoghegan.
parent 01ae881e
...@@ -2669,8 +2669,8 @@ mergeruns(Tuplesortstate *state) ...@@ -2669,8 +2669,8 @@ mergeruns(Tuplesortstate *state)
(state->availMem) / 1024, numInputTapes); (state->availMem) / 1024, numInputTapes);
#endif #endif
state->read_buffer_size = Min(state->availMem / numInputTapes, 0); state->read_buffer_size = Max(state->availMem / numInputTapes, 0);
USEMEM(state, state->availMem); USEMEM(state, state->read_buffer_size * numInputTapes);
/* End of step D2: rewind all output tapes to prepare for merging */ /* End of step D2: rewind all output tapes to prepare for merging */
for (tapenum = 0; tapenum < state->tapeRange; tapenum++) for (tapenum = 0; tapenum < state->tapeRange; tapenum++)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment