Re: [HACKERS] Autovacuum improvements - Mailing list pgsql-patches

From Alvaro Herrera
Subject Re: [HACKERS] Autovacuum improvements
Date
Msg-id 20070115221509.GC24671@alvh.no-ip.org
Whole thread Raw
In response to Re: [HACKERS] Autovacuum improvements  (Alvaro Herrera <alvherre@commandprompt.com>)
Responses Re: [HACKERS] Autovacuum improvements  ("Matthew T. O'Connor" <matthew@zeut.net>)
List pgsql-patches
Alvaro Herrera wrote:
> Tom Lane wrote:
> > Alvaro Herrera <alvherre@commandprompt.com> writes:
> > > Here it is.
> >
> > I'd drop the InitProcess API change, which touches many more places than
> > you really need, and just have InitProcess check IsAutoVacuumProcess(),
> > which should be valid by the time control gets to it.  This is more like
> > the way that InitPostgres handles it, anyway.
>
> Hmm, the problem is SubPostmasterMain, which is in the EXEC_BACKEND
> path.  It hasn't reached the autovacuum.c code yet, so it hasn't had the
> chance to set the am_autovacuum static variable (in autovacuum.c).  I
> guess the answer here is to allow that variable to be set from the
> outside.

New version of the patch attached.

I'll probably apply this tomorrow morning unless there are objections.

An important difference from the previous patch is that
DatabaseHasActiveBackends (now renamed to
DatabaseCancelAutovacuumActivity) cycles through the whole ProcArray
instead of stopping at the first occurence of a backend in that
database.  This is to be able to fulfill its mission of cancelling *any*
autovacuum activity that may be taking place on the database (not just
the one that happens to be below the first process in the ProcArray).


I also tried the EXEC_BACKEND case (albeit less extensively) and it
seems to work -- it cancels running autovacuums at least.

--
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

Attachment

pgsql-patches by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: vcbuild updates
Next
From: Bruce Momjian
Date:
Subject: Re: TODO improvements