Re: allowing VACUUM to be cancelled for conflicting locks

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Claudio Freire <klaussfreire(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Abhijit Menon-Sen <ams(at)2ndquadrant(dot)com>, PostgreSQL-Dev <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: allowing VACUUM to be cancelled for conflicting locks
Date: 2014-04-28 18:01:35
Message-ID: 20140428180135.GE14464@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2014-04-28 13:58:10 -0400, Tom Lane wrote:
> Claudio Freire <klaussfreire(at)gmail(dot)com> writes:
> > On Mon, Apr 28, 2014 at 12:52 PM, Alvaro Herrera
> > <alvherre(at)2ndquadrant(dot)com> wrote:
> >> Tom Lane wrote:
> >>> Abhijit Menon-Sen <ams(at)2ndquadrant(dot)com> writes:
> >>>> In the past, we've had situations where "everything is hung" turned out
> >>>> to be because of a script that ran manual VACUUM that was holding some
> >>>> lock. It's admittedly not a huge problem, but it might be useful if a
> >>>> manual VACUUM could be cancelled the way autovacuum can be.
>
> >>> I think the real answer to that is "stop using manual VACUUM".
>
> >> As much as I'm a fan of autovacuum, that's not always possible.
>
> > Or even recommended, unless the docs changed radically in the last
> > couple of weeks.
>
> Actually, having just looked at the code in question, I think this whole
> thread is based on an obsolete assumption. AFAICS, since commit b19e4250b
> manual vacuum behaves exactly like autovacuum as far as getting kicked off
> the exclusive lock is concerned. There's certainly not any tests for
> autovacuum in lazy_truncate_heap() today.

I don't think this is about the truncation thing, but about the
deadlock.c/proc.c logic around DS_BLOCKED_BY_AUTOVACUUM. I.e. that a
autovacuum is cancelled if user code tries to acquire a conflicting
lock.

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Janes 2014-04-28 18:03:53 Re: allowing VACUUM to be cancelled for conflicting locks
Previous Message Jeff Janes 2014-04-28 18:00:27 Re: allowing VACUUM to be cancelled for conflicting locks