git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 01ae881)
Fix thinko in safeguard for negative availMem.
Thu, 8 Dec 2016 21:05:21 +0000 (23:05 +0200)
Thu, 8 Dec 2016 21:05:21 +0000 (23:05 +0200)
Also, use pass read_buffer_size * numInputTapes rather than just availMem
to USEMEM, to be neat.

Peter Geoghegan.


diff --git a/src/backend/utils/sort/tuplesort.c b/src/backend/utils/sort/tuplesort.c
index 46eecbf942f77a11473e966416f8a62a0468de08..baf87b3cdfc9c4bb15de24305e806de828bde9d7 100644 (file)
--- a/src/backend/utils/sort/tuplesort.c
+++ b/src/backend/utils/sort/tuplesort.c
@@ -2669,8 +2669,8 @@ mergeruns(Tuplesortstate *state)
(state->availMem) / 1024, numInputTapes);
#endif
- state->read_buffer_size = Min(state->availMem / numInputTapes, 0);
- USEMEM(state, state->availMem);
+ state->read_buffer_size = Max(state->availMem / numInputTapes, 0);
+ USEMEM(state, state->read_buffer_size * numInputTapes);
/* End of step D2: rewind all output tapes to prepare for merging */
for (tapenum = 0; tapenum < state->tapeRange; tapenum++)
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /