Content-Length: 263837 | pFad | http://github.com/postgrespro/postgres_cluster/commit/64bc26f90d342ca343f5ba383a97691a58991204

D5 Fix thinko in safeguard for negative availMem. · postgrespro/postgres_cluster@64bc26f · GitHub
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)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres_cluster/commit/64bc26f90d342ca343f5ba383a97691a58991204

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy