pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Prevent query-lifespan memory leakage of SP-GiST traversal value 3+ messages / 1 participants [nested] [flat]
* pgsql: Prevent query-lifespan memory leakage of SP-GiST traversal value @ 2018-03-20 03:59 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 3+ messages in thread From: Tom Lane @ 2018-03-20 03:59 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Prevent query-lifespan memory leakage of SP-GiST traversal values. The original coding of the SP-GiST scan traversalValue feature (commit ccd6eb49a) arranged for traversal values to be stored in the query's main executor context. That's fine if there's only one index scan per query, but if there are many, we have a memory leak as successive scans create new traversal values. Fix it by creating a separate memory context for traversal values, which we can reset during spgrescan(). Back-patch to 9.6 where this code was introduced. In principle, adding the traversalCxt field to SpGistScanOpaqueData creates an ABI break in the back branches. But I (tgl) have little sympathy for extensions including spgist_private.h, so I'm not very worried about that. Alternatively we could stick the new field at the end of the struct in back branches, but that has its own downsides. Anton Dignös, reviewed by Alexander Kuzmenkov Discussion: https://postgr.es/m/CALNdv1jb6y2Te-m8xHLxLX12RsBmZJ1f4hESX7J0HjgyOhA9eA@mail.gmail.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/467963c3e9c5ba9a953959f8aebcdd7206188a18 Modified Files -------------- src/backend/access/spgist/spgscan.c | 9 ++++++++- src/include/access/spgist_private.h | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Prevent query-lifespan memory leakage of SP-GiST traversal value @ 2018-03-20 03:59 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 3+ messages in thread From: Tom Lane @ 2018-03-20 03:59 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Prevent query-lifespan memory leakage of SP-GiST traversal values. The original coding of the SP-GiST scan traversalValue feature (commit ccd6eb49a) arranged for traversal values to be stored in the query's main executor context. That's fine if there's only one index scan per query, but if there are many, we have a memory leak as successive scans create new traversal values. Fix it by creating a separate memory context for traversal values, which we can reset during spgrescan(). Back-patch to 9.6 where this code was introduced. In principle, adding the traversalCxt field to SpGistScanOpaqueData creates an ABI break in the back branches. But I (tgl) have little sympathy for extensions including spgist_private.h, so I'm not very worried about that. Alternatively we could stick the new field at the end of the struct in back branches, but that has its own downsides. Anton Dignös, reviewed by Alexander Kuzmenkov Discussion: https://postgr.es/m/CALNdv1jb6y2Te-m8xHLxLX12RsBmZJ1f4hESX7J0HjgyOhA9eA@mail.gmail.com Branch ------ REL_10_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/d18a88acf2d1591f9332bdb1da918037c90d3aa0 Modified Files -------------- src/backend/access/spgist/spgscan.c | 9 ++++++++- src/include/access/spgist_private.h | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Prevent query-lifespan memory leakage of SP-GiST traversal value @ 2018-03-20 03:59 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 3+ messages in thread From: Tom Lane @ 2018-03-20 03:59 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Prevent query-lifespan memory leakage of SP-GiST traversal values. The original coding of the SP-GiST scan traversalValue feature (commit ccd6eb49a) arranged for traversal values to be stored in the query's main executor context. That's fine if there's only one index scan per query, but if there are many, we have a memory leak as successive scans create new traversal values. Fix it by creating a separate memory context for traversal values, which we can reset during spgrescan(). Back-patch to 9.6 where this code was introduced. In principle, adding the traversalCxt field to SpGistScanOpaqueData creates an ABI break in the back branches. But I (tgl) have little sympathy for extensions including spgist_private.h, so I'm not very worried about that. Alternatively we could stick the new field at the end of the struct in back branches, but that has its own downsides. Anton Dignös, reviewed by Alexander Kuzmenkov Discussion: https://postgr.es/m/CALNdv1jb6y2Te-m8xHLxLX12RsBmZJ1f4hESX7J0HjgyOhA9eA@mail.gmail.com Branch ------ REL9_6_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/57ef2da434e235f6295bf49a065fce3da398fd8b Modified Files -------------- src/backend/access/spgist/spgscan.c | 9 ++++++++- src/include/access/spgist_private.h | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2018-03-20 03:59 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2018-03-20 03:59 pgsql: Prevent query-lifespan memory leakage of SP-GiST traversal value Tom Lane <tgl@sss.pgh.pa.us> 2018-03-20 03:59 pgsql: Prevent query-lifespan memory leakage of SP-GiST traversal value Tom Lane <tgl@sss.pgh.pa.us> 2018-03-20 03:59 pgsql: Prevent query-lifespan memory leakage of SP-GiST traversal value Tom Lane <tgl@sss.pgh.pa.us>
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