Skip site navigation (1) Skip section navigation (2)

Re: autovacuum truncate exclusive lock round two

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
Cc: Jan Wieck <JanWieck(at)Yahoo(dot)com>,PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: autovacuum truncate exclusive lock round two
Date: 2012-11-15 22:39:26
Message-ID: 20121115223926.GD14789@alvh.no-ip.org (view raw or flat)
Thread:
Lists: pgsql-hackers
Dimitri Fontaine wrote:
> Jan Wieck <JanWieck(at)Yahoo(dot)com> writes:
> > Use this lmgr feature inside count_nondeletable_pages() of vacuumlazy.c to
> > periodically check, if there is a conflicting lock request waiting. If not,
> > keep going. If there is a waiter, truncate the relation to the point checked
> > thus far, release the AccessExclusiveLock, then loop back to where we
> > acquire this lock in the first place and continue checking/truncating.
> 
> I think that maybe we could just bail out after releasing the
> AccessExclusiveLock and trust autovacuum to get back to truncating that
> relation later.

That doesn't work, because the truncating code is not reached unless
vacuuming actually took place.  So if you interrupt it, it will just not
get called again later.  Maybe we could have autovacuum somehow invoke
that separately, but that would require that the fact that truncation
was aborted is kept track of somewhere.

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services


In response to

Responses

pgsql-hackers by date

Next:From: Craig RingerDate: 2012-11-15 23:31:33
Subject: Re: another idea for changing global configuration settings from SQL
Previous:From: Tom LaneDate: 2012-11-15 22:38:47
Subject: Re: another idea for changing global configuration settings from SQL

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group