Re: Double partition lock in bufmgr - Mailing list pgsql-hackers

From Konstantin Knizhnik
Subject Re: Double partition lock in bufmgr
Date
Msg-id 335c3a13-74d1-26c0-584c-73ceed3a9ffc@postgrespro.ru
Whole thread Raw
In response to Re: Double partition lock in bufmgr  (Zhihong Yu <zyu@yugabyte.com>)
Responses Re: Double partition lock in bufmgr
List pgsql-hackers

On 19.12.2020 10:53, Zhihong Yu wrote:
> Hi,
> w.r.t. the code in BufferAlloc(), the pointers are compared.
>
> Should we instead compare the tranche Id of the two LWLock ?
>
> Cheers

As far as LWlocks are stored in the array, comparing indexes in this 
array (tranche Id) is equivalent to comparing element's pointers.
So I do not see any problem here.

Just as experiment I tried a version of BufferAlloc without double 
locking (patch is attached).
I am not absolutely sure that my patch is correct: my main intention was 
to estimate influence of this buffer reassignment on performance.
I just run standard pgbench for database with scale 100 and default 
shared buffers size (256Mb). So there are should be a lot of page 
replacements.
I do not see any noticeable difference:

vanilla: 13087.596845
patch:   13184.442130


Attachment

pgsql-hackers by date:

Previous
From: Alastair Turner
Date:
Subject: Re: Proposed patch for key managment
Next
From: Andrew Dunstan
Date:
Subject: Re: multi-install PostgresNode