Re: Lock problem with autovacuum truncating heap - Mailing list pgsql-hackers

From Jan Wieck
Subject Re: Lock problem with autovacuum truncating heap
Date
Msg-id 4D8FE767.50702@Yahoo.com
Whole thread Raw
In response to Re: Lock problem with autovacuum truncating heap  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Lock problem with autovacuum truncating heap
List pgsql-hackers
On 3/27/2011 6:21 PM, Robert Haas wrote:
> On Sun, Mar 27, 2011 at 3:25 PM, Jan Wieck<JanWieck@yahoo.com>  wrote:
>>  Since we are talking about stable releases, I think just releasing and
>>  reacquiring the exclusive lock is enough. We can then try to further improve
>>  things for future releases.
>
> That seems unsafe - things can change under you while you don't hold the lock...

The only change relevant in this case would be some concurrent client 
extending the relation while we don't hold the lock. A call to 
RelationGetNumberOfBlocks() after reacquiring the lock will tell. Safety 
reestablished.

> I kind of like the idea of committing the transaction and then
> beginning a new one just to do the truncation.  Given the way the
> deadlock detector treats autovacuum, the current coding seems quite
> risky.

I don't like a 1,000 ms hiccup in my system, regardless of how many 
transaction hoops you make it go through.


Jan

-- 
Anyone who trades liberty for security deserves neither
liberty nor security. -- Benjamin Franklin


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: [DOCS] patch for createdb section in tutorial
Next
From: Robert Haas
Date:
Subject: Re: Lock problem with autovacuum truncating heap