Skip to content

Commit 64bc26f

Browse files
committed
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.
1 parent 01ae881 commit 64bc26f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/backend/utils/sort/tuplesort.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2669,8 +2669,8 @@ mergeruns(Tuplesortstate *state)
26692669
(state->availMem) / 1024, numInputTapes);
26702670
#endif
26712671

2672-
state->read_buffer_size = Min(state->availMem / numInputTapes, 0);
2673-
USEMEM(state, state->availMem);
2672+
state->read_buffer_size = Max(state->availMem / numInputTapes, 0);
2673+
USEMEM(state, state->read_buffer_size * numInputTapes);
26742674

26752675
/* End of step D2: rewind all output tapes to prepare for merging */
26762676
for (tapenum = 0; tapenum < state->tapeRange; tapenum++)

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