Re: [HACKERS] Autovacuum improvements

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] Autovacuum improvements
Date: 2007-01-15 22:15:09
Message-ID: 20070115221509.GC24671@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Alvaro Herrera wrote:
> Tom Lane wrote:
> > Alvaro Herrera <alvherre(at)commandprompt(dot)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 Content-Type Size
kill-autovacuum-2.patch text/x-diff 11.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2007-01-15 22:26:00 Re: xml type and encodings
Previous Message Alvaro Herrera 2007-01-15 21:22:19 Re: Autovacuum improvements

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2007-01-15 22:18:20 Re: BCC55 and libpq 8.2
Previous Message Magnus Hagander 2007-01-15 21:54:26 Re: vcbuild updates