Re: autovacuum truncate exclusive lock round two - Mailing list pgsql-hackers

From Jan Wieck
Subject Re: autovacuum truncate exclusive lock round two
Date
Msg-id 508A9090.6050909@Yahoo.com
Whole thread Raw
In response to Re: autovacuum truncate exclusive lock round two  (Amit Kapila <amit.kapila@huawei.com>)
Responses Re: autovacuum truncate exclusive lock round two
List pgsql-hackers
On 10/26/2012 6:35 AM, Amit Kapila wrote:
> On Friday, October 26, 2012 11:50 AM Jan Wieck wrote:
>> On 10/26/2012 1:29 AM, Amit Kapila wrote:
>> >    One other way could be to check after every few pages for a
>> conflicting
>> > lock request.
>>
>> How is this any different from what my patch does?
>    The difference is that in the patch it checks for waiters by using 2
> parameters autovacuum_truncate_lock_check and blkno%32 and what I
>    had mentioned was to check only based on blkno.
>    Will it effect too much if we directly check for waiters after every 32
> (any feasible number) blocks?

The blkno%32 is there to not do the gettimeofday() call too often. But 
relying on the blkno alone is IMHO not a good idea. It had to be a 
number small enough so that even on a busy system and when the pages 
have to be read from disk, vacuum checks and releases the lock quickly. 
But large enough so that it doesn't create a significant amount of 
spinlock calls in the lmgr. We would end up with another parameter, 
number of blocks, that is a lot harder to estimate a good value for.


Jan

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



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Extensions Documentation
Next
From: "Karl O. Pinc"
Date:
Subject: Doc patch, distinguish sections with an empty row in error code table