postgresql/src
Tom Lane 2d44c58c79 Avoid memory leaks when a GatherMerge node is rescanned.
Rescanning a GatherMerge led to leaking some memory in the executor's
query-lifespan context, because most of the node's working data structures
were simply abandoned and rebuilt from scratch.  In practice, this might
never amount to much, given the cost of relaunching worker processes ---
but it's still pretty messy, so let's fix it.

We can rearrange things so that the tuple arrays are simply cleared and
reused, and we don't need to rebuild the TupleTableSlots either, just
clear them.  One small complication is that because we might get a
different number of workers on each iteration, we can't keep the old
convention that the leader's gm_slots[] entry is the last one; the leader
might clobber a TupleTableSlot that we need for a worker in a future
iteration.  Hence, adjust the logic so that the leader has slot 0 always,
while the active workers have slots 1..n.

Back-patch to v10 to keep all the existing versions of nodeGatherMerge.c
in sync --- because of the renumbering of the slots, there would otherwise
be a very large risk that any future backpatches in this module would
introduce bugs.

Discussion: https://postgr.es/m/8670.1504192177@sss.pgh.pa.us
2017-08-31 16:21:05 -04:00
..
backend Avoid memory leaks when a GatherMerge node is rescanned. 2017-08-31 16:21:05 -04:00
bin pg_test_timing: Some NLS fixes 2017-08-26 09:25:19 -04:00
common Update copyright in recently added files 2017-07-26 18:17:18 -04:00
fe_utils Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
include Avoid memory leaks when a GatherMerge node is rescanned. 2017-08-31 16:21:05 -04:00
interfaces Teach libpq to detect integer overflow in the row count of a PGresult. 2017-08-29 15:18:01 -04:00
makefiles Always use -fPIC, not -fpic, when building shared libraries with gcc. 2017-06-01 13:32:55 -04:00
pl Change tupledesc->attrs[n] to TupleDescAttr(tupledesc, n). 2017-08-20 11:19:07 -07:00
port Stamp HEAD as 11devel. 2017-08-14 18:08:30 -04:00
template Remove "sco" and "unixware" ports. 2016-10-11 11:26:04 -04:00
test Expand partitioned tables in PartDesc order. 2017-08-31 15:50:18 -04:00
timezone Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
tools Hash tables backed by DSA shared memory. 2017-08-22 22:43:07 -07:00
tutorial Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
.gitignore
DEVELOPERS
Makefile Remove redundant coverage target 2017-02-17 08:56:57 -05:00
Makefile.global.in Be more thorough about cleaning out gcov litter. 2017-08-11 17:39:27 -04:00
Makefile.shlib Remove support for bcc and msvc standalone libpq builds 2017-04-11 15:22:21 +02:00
nls-global.mk nls-global.mk: search build dir for source files, too 2016-06-07 18:55:18 -04:00