pgsql: Improve division of labor between execParallel.c and nodeGather[

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Improve division of labor between execParallel.c and nodeGather[
Date: 2017-09-01 21:39:12
Message-ID: E1dntei-000215-KJ@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Improve division of labor between execParallel.c and nodeGather[Merge].c.

Move the responsibility for creating/destroying TupleQueueReaders into
execParallel.c, to avoid duplicative coding in nodeGather.c and
nodeGatherMerge.c. Also, instead of having DestroyTupleQueueReader do
shm_mq_detach, do it in the caller (which is now only ExecParallelFinish).
This means execParallel.c does both the attaching and detaching of the
tuple-queue-reader shm_mqs, which seems less weird than the previous
arrangement.

These changes also eliminate a vestigial memory leak (of the pei->tqueue
array). It's now demonstrable that rescans of Gather or GatherMerge don't
leak memory.

Discussion: https://postgr.es/m/8670.1504192177@sss.pgh.pa.us

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/01edb5c7fc3bcf6aea15f2b3be36189b52ad9d1a

Modified Files
--------------
src/backend/executor/execParallel.c | 72 ++++++++++++++++++++++++++++++++--
src/backend/executor/nodeGather.c | 64 +++++++++++-------------------
src/backend/executor/nodeGatherMerge.c | 50 +++++++----------------
src/backend/executor/tqueue.c | 4 +-
src/include/executor/execParallel.h | 18 +++++----
5 files changed, 119 insertions(+), 89 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2017-09-02 03:38:59 pgsql: doc: Fix typos and other minor issues
Previous Message Peter Eisentraut 2017-09-01 19:42:10 pgsql: Add memory info to getrusage output