pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Yuhang Qiu <iamqyh@gmail.com>
To: Alexandre Felipe <o.alexandre.felipe@gmail.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: [PATCH] bufmgr: tighten LWLock:BufferMapping on InvalidateBuffer
Date: Fri, 11 Sep 2026 17:56:15 +0800
Message-ID: <318A4D41-5CB8-4B2B-84AC-BDC8B52E0F4D@gmail.com> (raw)
In-Reply-To: <CAE8JnxMOJaSJSB0kVw6DkeCcoOqQUQiFTUkYbxGJnwDbohKhvw@mail.gmail.com>
References: <CAE8JnxOR9cJtXGG-3Ki33zHyh5oEcuVeRqeToEvu-44T+R-DnA@mail.gmail.com>
	<hsnzvaqgbcy5z273m3ha773xhvinvdvxbssl6bz67w4spgg2h3@zv77ylqbly5m>
	<CAE8JnxN38Ms3N+2NAVk+hoNiZty4hLAWajNo1nitCXhhjqAbvA@mail.gmail.com>
	<CAE8JnxN5Ot8HN3x=7vqo8NdwJux51=UQ5ArW5E-Dq=tKEtZMcg@mail.gmail.com>
	<wgdm7wmxmw4bprczss5adlrw523n4k7sb6imqir2ffculhj5lr@lkbykmjlkzsl>
	<CAE8JnxP0HJ53Z7t0-vUh23We04GAZ658pa8=K-mVY90PoUhH8Q@mail.gmail.com>
	<B9C99A9B-E480-411E-BFC8-4343195B3EAA@gmail.com>
	<CAE8JnxMv=Di26-XYhVGTcpEUKRaygvcdQMbTx8noa=poYkUjFA@mail.gmail.com>
	<lp2wqvtafhtyxxy3tr27haf7shgq2qhtq2rfsfihpg56zmb6nw@5zvkv7upyctk>
	<CAE8JnxMkTbEFTfLpa1+6yAJpxih8QOLTLpAvscATHLEjCOR4Mg@mail.gmail.com>
	<C3EB5EF4-4F93-4715-837B-F45C20A3F57C@gmail.com>
	<CAE8JnxMOJaSJSB0kVw6DkeCcoOqQUQiFTUkYbxGJnwDbohKhvw@mail.gmail.com>

Hi Alexandre,

> If this seems acceptable, the next steps could be ...

I don't think this design works.

Rooms change the semantics of an LWLock: exclusive access no longer
excludes all other holders. Data access needs to be reworked to support
this. The buffer mapping access in this patch already has a problem:
different rooms in the same partition can map to the same hash bucket,
allowing concurrent modifications to its chain and causing entries to be
lost.

In 0001, releasing the last room while LW_FLAG_WAKE_IN_PROGRESS is set
leaves LW_EXCLUSIVE set. Shared waiters cannot clear it and remain
blocked forever unless a subsequent exclusive acquisition and release
clears it. This also affects ordinary LW_EXCLUSIVE acquisitions.

All 26 rooms share one state word. Acquirers of disjoint rooms still
CAS on the same cache line, so the scalability bottleneck remains and
may even get worse. In this case, I would increase NUM_BUFFER_PARTITIONS.

Best regards,
Yuhang Qiu







view thread (13+ messages)

Message-ID: <318A4D41-5CB8-4B2B-84AC-BDC8B52E0F4D@gmail.com>
Permalink:  ../318A4D41-5CB8-4B2B-84AC-BDC8B52E0F4D@gmail.com/
Also on:    postgresql.org/message-id/318A4D41-5CB8-4B2B-84AC-BDC8B52E0F4D@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: iamqyh@gmail.com, o.alexandre.felipe@gmail.com, andres@anarazel.de
  Subject: Re: [PATCH] bufmgr: tighten LWLock:BufferMapping on InvalidateBuffer
  In-Reply-To: <318A4D41-5CB8-4B2B-84AC-BDC8B52E0F4D@gmail.com>
  References: <CAE8JnxOR9cJtXGG-3Ki33zHyh5oEcuVeRqeToEvu-44T+R-DnA@mail.gmail.com> <hsnzvaqgbcy5z273m3ha773xhvinvdvxbssl6bz67w4spgg2h3@zv77ylqbly5m> <CAE8JnxN38Ms3N+2NAVk+hoNiZty4hLAWajNo1nitCXhhjqAbvA@mail.gmail.com> <CAE8JnxN5Ot8HN3x=7vqo8NdwJux51=UQ5ArW5E-Dq=tKEtZMcg@mail.gmail.com> <wgdm7wmxmw4bprczss5adlrw523n4k7sb6imqir2ffculhj5lr@lkbykmjlkzsl> <CAE8JnxP0HJ53Z7t0-vUh23We04GAZ658pa8=K-mVY90PoUhH8Q@mail.gmail.com> <B9C99A9B-E480-411E-BFC8-4343195B3EAA@gmail.com> <CAE8JnxMv=Di26-XYhVGTcpEUKRaygvcdQMbTx8noa=poYkUjFA@mail.gmail.com> <lp2wqvtafhtyxxy3tr27haf7shgq2qhtq2rfsfihpg56zmb6nw@5zvkv7upyctk> <CAE8JnxMkTbEFTfLpa1+6yAJpxih8QOLTLpAvscATHLEjCOR4Mg@mail.gmail.com> <C3EB5EF4-4F93-4715-837B-F45C20A3F57C@gmail.com> <CAE8JnxMOJaSJSB0kVw6DkeCcoOqQUQiFTUkYbxGJnwDbohKhvw@mail.gmail.com> <318A4D41-5CB8-4B2B-84AC-BDC8B52E0F4D@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox