Re: Autovacuum cancellation - Mailing list pgsql-patches

From Tom Lane
Subject Re: Autovacuum cancellation
Date
Msg-id 26532.1193348146@sss.pgh.pa.us
Whole thread Raw
In response to Autovacuum cancellation  (Alvaro Herrera <alvherre@commandprompt.com>)
Responses Re: Autovacuum cancellation  (Gregory Stark <stark@enterprisedb.com>)
Re: Autovacuum cancellation  (Simon Riggs <simon@2ndquadrant.com>)
List pgsql-patches
Alvaro Herrera <alvherre@commandprompt.com> writes:
> Patch attached, please comment.  It only avoids cancelling when the
> vacuum is for wraparound.

I'm not entirely convinced that there can be only one autovac proc in
the portion of the waits-for graph explored by DeadlockCheck.  If there
is more than one, we'll cancel a random one of them, which seems OK ---
but the comment added to FindLockCycleRecurse is bogus.

I thought about suggesting that we test PROC_VACUUM_FOR_WRAPAROUND
before setting blocking_autovacuum_proc at all, but I guess the reason
you don't do that is you don't want to take ProcArrayLock there (and we
decided it was unsafe to check the bit without the lock).  So the other
thing that comment block needs is a note that it seems OK to check
PROC_IS_AUTOVACUUM without the lock, because it never changes for an
existing PGPROC, but not PROC_VACUUM_FOR_WRAPAROUND.

Otherwise it looks OK --- a bit ugly but I don't have a better idea.

There's some things still to be desired here: if an autovac process is
involved in a hard deadlock, the patch doesn't favor zapping it over
anybody else, nor consider cancelling the autovac as an alternative to
rearranging queues for a soft deadlock.  But dealing with that will open
cans of worms that I don't think we want to open for 8.3.

            regards, tom lane

pgsql-patches by date:

Previous
From: Chris Browne
Date:
Subject: Minor change to pg_dump docs
Next
From: Gregory Stark
Date:
Subject: Re: Autovacuum cancellation