Re: Changing shared_buffers without restart
Andres Freund <andres@anarazel.de>
From: Andres Freund <andres@anarazel.de>
To: Dmitry Dolgov <9erthalion6@gmail.com>
Cc: Thom Brown <thom@linux.com>, Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>,
Tomas Vondra <tomas@vondra.me>, Thomas Munro <thomas.munro@gmail.com>,
PostgreSQL-development <pgsql-hackers@postgresql.org>, Jack Ng <Jack.Ng@huawei.com>, Ni Ku <jakkuniku@gmail.com>
Date: 2025-07-14T13:42:46Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Remove PG_MMAP_FLAGS from mem.h
- c100340729b6 19 (unreleased) landed
-
Improve runtime and output of tests for replication slots checkpointing.
- 4464fddf7b50 18.0 cited
-
Revert support for improved tracking of nested queries
- f85f6ab051b7 18.0 cited
-
Use exported symbols list on macOS for loadable modules as well
- 3feff3916ee1 18.0 cited
-
Add support for basic NUMA awareness
- 65c298f61fc7 18.0 cited
-
Avoid unnecessary copying of a string in pg_restore.c
- 5e1915439085 18.0 cited
-
aio: Infrastructure for io_method=worker
- 55b454d0e140 18.0 cited
-
Improve InitShmemAccess() prototype
- 2a7b2d97171d 18.0 landed
Hi, On 2025-07-14 15:20:03 +0200, Dmitry Dolgov wrote: > > On Mon, Jul 14, 2025 at 09:14:26AM -0400, Andres Freund wrote: > > > > Clock sweep can find any buffer, independent of whether it's on the freelist. > > > > > > It does the search based on nextVictimBuffer, where the actual buffer > > > will be a modulo of NBuffers, right? If that's correct and I get > > > everything else right, that would mean as long as NBuffers stays the > > > same (which is the case for the purposes of the current discussion) new > > > buffers, allocated on top of NBuffers after shared memory increase, will > > > not be picked by the clock sweep. > > > > Are you tell me that you'd put "new" buffers onto the freelist, before you > > increase NBuffers? That doesn't make sense. > > Why? I think it basically boils down to "That's not how it supposed to work". If you have buffers that are not in the clock sweep they'll get unfairly high usage counts, as their usecount won't be decremented by the clock sweep. Resulting in those buffers potentially being overly sticky after the s_b resize completed. It breaks the entirely reasonable check to verify that a buffer returned by StrategyGetBuffer() is within the buffer pool. Obviously, if we remove the freelist, not having the clock sweep find the buffer would mean it's unreachable. What on earth would be the point of putting a buffer on the freelist but not make it reachable by the clock sweep? To me that's just nonsensical. Greetings, Andres Freund