Re: Changing shared_buffers without restart
Greg Burd <greg@burd.me>
From: "Burd, Greg" <greg@burd.me>
To: Dmitry Dolgov <9erthalion6@gmail.com>
Cc: Andres Freund <andres@anarazel.de>,
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-14T14:22:17Z
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
> On Jul 14, 2025, at 10:01 AM, Dmitry Dolgov <9erthalion6@gmail.com> wrote: > >> On Mon, Jul 14, 2025 at 09:42:46AM -0400, Andres Freund wrote: >> 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. > > To clarify, we're not talking about this scenario as "that's how it > would work after the resize". The point is that to expand shared buffers > they need to be initialized, included into the whole buffer machinery > (freelist, clock sweep, etc.) and NBuffers has to be updated. Those > steps are separated in time, and I'm currently trying to understand what > are the consequences of performing them in different order and whether > there are possible concurrency issues under various scenarios. Does this > make more sense, or still not? Hello, first off thanks for working on the intricate issues related to resizing shared_buffers. Second, I'm new in this code so take that in account but I'm the person trying to remove the freelist entirely [1] so I have reviewed this code recently. I'd initialize them, expand BufferDescriptors, and adjust NBuffers. The clock-sweep algorithm will eventually find them and make use of them. The buf->freeNext should be FREENEXT_NOT_IN_LIST so that StrategyFreeBuffer() will do the work required to append it the freelist after use. AFAICT there is no need to add to the freelist up front. best. -greg [1] https://postgr.es/m/flat/E2D6FCDC-BE98-4F95-B45E-699C3E17BA10%40burd.me