Re: Temp table handling after anti-wraparound shutdown (Was: BUG #15840)

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Thierry Husson <thusson(at)informiciel(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Temp table handling after anti-wraparound shutdown (Was: BUG #15840)
Date: 2019-06-07 23:59:37
Message-ID: 20190607235937.GA1590@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Fri, Jun 07, 2019 at 03:58:43PM -0700, Andres Freund wrote:
> Do we need to move the orphan temp cleanup code into database vacuums or
> such?

When entering into the vacuum() code path for an autovacuum, only one
relation at a time is processed, and we have prior that extra
processing related to toast relations when selecting the relations to
work on, or potentially delete orphaned temp tables. For a manual
vacuum, we finish by deciding which relation to process in
get_all_vacuum_rels(), so the localized processing is a bit different
than what's done in do_autovacuum() when scanning pg_class for
relations.

Technically, I think that it would work to give up on the gathering of
the orphaned OIDs in a gathering and let them be gathered in the list
of items to vacuum, and then put the deletion logic down to
vacuum_rel(). However, there is a take: for autovacuum we gather the
orphaned entries and the other relations to process, then drop all the
orphaned OIDs, and finally vacuum/analyze the entries collected. So
if you put the deletion logic down into vacuum_rel() then we won't be
able to drop orphaned tables before working on a database, which would
be bad if we know about an orphaned set, but autovacuum works for a
long time on other legit entries first.
--
Michael

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Alvaro Herrera 2019-06-08 00:25:42 Re: BUG #15840: Vacuum does not work after database stopped for wraparound protection. Database seems unrepearable.
Previous Message Andres Freund 2019-06-07 23:01:03 Re: BUG #15840: Vacuum does not work after database stopped for wraparound protection. Database seems unrepearable.

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2019-06-08 00:03:17 Re: Custom table AMs need to include heapam.h because of BulkInsertState
Previous Message Andres Freund 2019-06-07 23:27:44 Re: Binary support for pgoutput plugin