From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Fix failure to account for memory used by tuplestore_putvalues() |
Date: | 2011-06-15 18:06:15 |
Message-ID: | E1QWuTn-0001zQ-H4@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Fix failure to account for memory used by tuplestore_putvalues().
This oversight could result in a tuplestore using much more than the
intended amount of memory. It would only happen in a code path that loaded
a tuplestore via tuplestore_putvalues(), and many of those won't emit huge
amounts of data; but cases such as holdable cursors and plpgsql's RETURN
NEXT command could have the problem. The fix ensures that the tuplestore
will switch to write-to-disk mode when it overruns work_mem.
The potential overrun was finite, because we would still count the space
used by the tuple pointer array, so the tuplestore code would eventually
flip into write-to-disk mode anyway. When storing wide tuples we would
go far past the expected work_mem usage before that happened; but this
may account for the lack of prior reports.
Back-patch to 8.4, where tuplestore_putvalues was introduced.
Per bug #6061 from Yann Delorme.
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/10db3de66eb226e9aed32e789abd532c41f0f471
Modified Files
--------------
src/backend/utils/sort/tuplestore.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2011-06-15 21:23:19 | pgsql: In pg_upgrade, clean up code layout in validateDirectoryOption() |
Previous Message | Tom Lane | 2011-06-15 17:16:01 | pgsql: Fix oversights in pg_basebackup's -z (compression) option. |