Re: removal of dangling temp tables
Alvaro Herrera <alvherre@2ndquadrant.com>
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: "Tsunakawa, Takayuki" <tsunakawa.takay@jp.fujitsu.com>
Cc: Michael Paquier <michael@paquier.xyz>, Tom Lane <tgl@sss.pgh.pa.us>, Robert Haas <robertmhaas@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2018-12-26T23:51:56Z
Lists: pgsql-hackers
Attachments
- autovac-temp-REL9_4_STABLE.patch (text/x-diff) patch
On 2018-Dec-26, Tsunakawa, Takayuki wrote:
> From: Alvaro Herrera [mailto:alvherre@2ndquadrant.com]
> > The more aggressive action is to backpatch 943576bddcb5 ("Make autovacuum
> > more aggressive to remove orphaned temp tables") which is currently only
> > in pg11. We would put the new PGPROC member at the end of the struct, to
> > avoid ABI incompatibilities, but it'd bring trouble for extensions that
> > put PGPROC in arrays. I checked the code of some known extensions; found
> > that pglogical uses PGPROC, but only pointers to it, so it wouldn't be
> > damaged by the proposed change AFAICS.
>
> +1
> I think this is a bug from a user's perspective that garbage is left.
> I want to believe that fixing bugs of PostgreSQL itself are
> prioritized over the ABI compatibility for extensions, if we have to
> choose one of them.
Having been victim of ABI incompatibility myself, I loathe giving too
much priority to other issues that can be resolved in other ways, so I
don't necessarily support your view on bugs.
That said, I think in this case it shouldn't be a problem, so I'm going
to work on that next.
I haven't got around to creating the abidiff reporting system yet ...
> > Another possibly useful change is to make DISCARD ALL and DISCARD TEMP delete
> > everything in what would be the backend's temp namespace, even if it hasn't
> > been initialized yet. This would cover the case where a connection pooler
> > keeps the connection open for a very long time, which I think is a common
> > case.
>
> That sounds good.
Thanks. I just tested that the attached patch does the intended. (I
named it "autovac" but obviously the DISCARD part is not about
autovacuum). I intend to push this patch first, and later backpatch the
other one.
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Commits
-
Have DISCARD ALL/TEMP remove leftover temp tables
- b7258a30aa6f 9.5.16 landed
- aa2e84d2cc8d 9.6.12 landed
- 3c4ca21093b5 10.7 landed
- 2602838fa338 9.4.21 landed
-
Make autovacuum more selective about temp tables to keep
- 5199abaca318 9.4.21 landed
- a85045cccb1b 9.5.16 landed
- a6ca47cd2f3f 10.7 landed
- 7fc2363a6158 9.6.12 landed
-
Make autovacuum more aggressive to remove orphaned temp tables
- 943576bddcb5 11.0 cited
-
autovacuum: Drop orphan temp tables more quickly but with more caution.
- a734fd5d1c30 10.0 cited