From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Correctly re-use hash tables in buildSubPlanHash().
Date: Sat, 29 Feb 2020 18:48:25 +0000
Message-ID: <E1j87A1-0002Gg-Jj@gemulon.postgresql.org> (raw)
Correctly re-use hash tables in buildSubPlanHash().
Commit 356687bd8 omitted to remove leftover code for destroying
a hashed subplan's hash tables, with the result that the tables
were always rebuilt not reused; this leads to severe memory
leakage if a hashed subplan is re-executed enough times.
Moreover, the code for reusing the hashnulls table had a typo
that would have made it do the wrong thing if it were reached.
Looking at the code coverage report shows severe under-coverage
of the potential callers of ResetTupleHashTable, so add some test
cases that exercise them.
Andreas Karlsson and Tom Lane, per reports from Ranier Vilela
and Justin Pryzby.
Backpatch to v11, as the faulty commit was.
Discussion: https://postgr.es/m/edb62547-c453-c35b-3ed6-a069e4d6b937@proxel.se
Discussion: https://postgr.es/m/CAEudQAo=DCebm1RXtig9OH+QivpS97sMkikt0A9qHmMUs+g6ZA@mail.gmail.com
Discussion: https://postgr.es/m/20200210032547.GA1412@telsasoft.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/58c47ccfff20b8c125903482725c1dbfd30beade
Modified Files
--------------
src/backend/executor/nodeSubplan.c | 6 +-
src/test/regress/expected/subselect.out | 123 ++++++++++++++++++++++++++++++++
src/test/regress/sql/subselect.sql | 65 +++++++++++++++++
3 files changed, 191 insertions(+), 3 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: pgsql: Correctly re-use hash tables in buildSubPlanHash().
In-Reply-To: <E1j87A1-0002Gg-Jj@gemulon.postgresql.org>
References: <E1j87A1-0002Gg-Jj@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox