Re: error_severity of brin work item - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: error_severity of brin work item
Date
Msg-id 20201201185724.GA23756@alvherre.pgsql
Whole thread Raw
In response to Re: error_severity of brin work item  (Justin Pryzby <pryzby@telsasoft.com>)
Responses Re: error_severity of brin work item
List pgsql-hackers
On 2020-Dec-01, Justin Pryzby wrote:

> This was an idea I made up - I don't know any of the details of this, but if
> you give a hint I could look at it more.  There'd (still) be a race window, but
> I think that's ok.

See CommitTransaction() and friends, where AtEOXact_on_commit_actions()
and others are called.  You'd have to create a new routine (say
AtEOXact_Autovacuum or more specific AtEOXact_AutovacuumWorkItems), to
be called at the right places in xact.c.  Keep a global variable, say a
list of OIDs.  On subxact commit, the list is reassigned to its parent
transaction; on subxact abort, the list is discarded.  On top xact
commit, the list of OIDs is passed to some new routine in autovacuum.c
that scans the workitem array and deletes items as appropriate.

Not sure what's a good place for OIDs to be added to the list.  We don't
have AM-specific entry points for relation drop.  I think this is the
weakest point of this.


> Another idea is if perform_work_item() were responsible for discarding
> relations which disappear.  Currently it does this, which is racy since it
> holds no lock.

That has the property that it remains contained in autovacuum.c, but no
other advantages I think.



pgsql-hackers by date:

Previous
From: Justin Pryzby
Date:
Subject: Re: error_severity of brin work item
Next
From: Chapman Flack
Date:
Subject: Re: proposal: unescape_text function