Re: Double partition lock in bufmgr

From: Konstantin Knizhnik <k(dot)knizhnik(at)postgrespro(dot)ru>
To: Zhihong Yu <zyu(at)yugabyte(dot)com>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Double partition lock in bufmgr
Date: 2020-12-19 12:50:30
Message-ID: 335c3a13-74d1-26c0-584c-73ceed3a9ffc@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
bufmgr.patch text/x-patch 1.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2020-12-19 16:19:07 Re: multi-install PostgresNode
Previous Message Alastair Turner 2020-12-19 11:45:15 Re: Proposed patch for key managment