Re: autovacuum truncate exclusive lock round two

From: Jan Wieck <JanWieck(at)Yahoo(dot)com>
To: Amit Kapila <amit(dot)kapila(at)huawei(dot)com>
Cc: 'Stephen Frost' <sfrost(at)snowman(dot)net>, 'PostgreSQL Development' <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: autovacuum truncate exclusive lock round two
Date: 2012-10-26 13:30:56
Message-ID: 508A9090.6050909@Yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Karl O. Pinc 2012-10-26 14:03:03 Doc patch, distinguish sections with an empty row in error code table
Previous Message Peter Eisentraut 2012-10-26 12:27:28 Re: Extensions Documentation