From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Avoid leaking memory during large-scale REASSIGN OWNED BY operat |
Date: | 2021-12-01 18:45:07 |
Message-ID: | E1msUbL-0007lF-NL@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Avoid leaking memory during large-scale REASSIGN OWNED BY operations.
The various ALTER OWNER routines tend to leak memory in
CurrentMemoryContext. That's not a problem when they're only called
once per command; but in this usage where we might be touching many
objects, it can amount to a serious memory leak. Fix that by running
each call in a short-lived context.
(DROP OWNED BY likely has a similar issue, except that you'll probably
run out of lock table space before noticing. REASSIGN is worth fixing
since for most non-table object types, it won't take any lock.)
Back-patch to all supported branches. Unfortunately, in the back
branches this helps to only a limited extent, since the sinval message
queue bloats quite a lot in this usage before commit 3aafc030a,
consuming memory more or less comparable to what's actually leaked.
Still, it's clearly a leak with a simple fix, so we might as well fix it.
Justin Pryzby, per report from Guillaume Lelarge
Discussion: https://postgr.es/m/CAECtzeW2DAoioEGBRjR=CzHP6TdL=yosGku8qZxfX9hhtrBB0Q@mail.gmail.com
Branch
------
REL_11_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/82d354411749ac9756974c789bec4f78f2dafbf7
Modified Files
--------------
src/backend/catalog/pg_shdepend.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
From | Date | Subject | |
---|---|---|---|
Next Message | Daniel Gustafsson | 2021-12-01 19:49:21 | Re: pgsql: Add TAP tests for contrib/sslinfo |
Previous Message | Tom Lane | 2021-12-01 17:24:58 | pgsql: psql: include intra-query "--" comments in what's sent to the se |