Re: Double shared memory allocation for SLRU LWLocks

From: Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>
To: Teodor Sigaev <teodor(at)sigaev(dot)ru>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Double shared memory allocation for SLRU LWLocks
Date: 2017-07-12 19:59:09
Message-ID: CAPpHfdvi98Ag7BNHdHiUXBGus74VnsUwkeyMjOdFgT+rceQXUQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jul 12, 2017 at 2:03 PM, Teodor Sigaev <teodor(at)sigaev(dot)ru> wrote:

> It seems to me that we're allocating shared memory for SLRU lwlocks twice,
>> unless I'm missing something.
>>
> I think you are right.
>
> Did you check previous versions? i.e. should it be applyed to previous
> branches?? I suppose yes, to minimize code difference.
>

Problem was introduced by fe702a7b. I think it would be good to backpatch
to 9.6. Besides it doesn't cause any user-visible problem, nevertheless
it's a bug.

> Also I'd like an idea to add Assert(offset <= SimpleLruShmemSize(nslots,
> nlsns)) at the end of SimpleLruInit()

Good point. Please, find it in attached patch.

------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Attachment Content-Type Size
fix-slru-lwlock-shmem-double-allocation-2.patch application/octet-stream 1.5 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeevan Ladhe 2017-07-12 20:01:08 Re: Adding support for Default partition in partitioning
Previous Message Jeevan Ladhe 2017-07-12 19:52:39 Re: Adding support for Default partition in partitioning