On Tue, Dec 01, 2020 at 03:57:24PM -0300, Alvaro Herrera wrote: > 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()
..thanks. I was going to persue the other idea first since this is new to me. > 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. I assume it would just add OIDs of *all* dropped rels, and the autovacuum half would silently ignore any OID for which there's no work item. (As it would do in any case). > > 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. It has the advantage that it moves all the try_open stuff out of brin. I started implementing this, and then realized that the try_open stuff *has* to be in the brin_summarize function, to handle the case that someone passes a non-index, since it's SQL exposed. So maybe we should use your LockOid patch now, and refactor in the future if we add additional work-item types. -- Justin