RE: Changing shared_buffers without restart
От | Jack Ng |
---|---|
Тема | RE: Changing shared_buffers without restart |
Дата | |
Msg-id | ecf5907548a44c4c84d8916ccfe00a42@huawei.com обсуждение исходный текст |
Ответ на | Re: Changing shared_buffers without restart (Dmitry Dolgov <9erthalion6@gmail.com>) |
Ответы |
Re: Changing shared_buffers without restart
|
Список | pgsql-hackers |
>> On Mon, Jul 14, 2025 at 03:18:10PM +0000, Jack Ng wrote: >> Just brain-storming here... would moving NBuffers to shared memory solve >this specific issue? Though I'm pretty sure that would open up a new set of >synchronization issues elsewhere, so I'm not sure if there's a net gain. > >It's in fact already happening, there is a shared structure that described the >resize status. But if I get everything right, it doesn't solve all the problems. Hi Dmitry, Just to clarify, you're not only referring to the ShmemControl::NSharedBuffers and related logic in the current patches, but actually getting rid of per-process NBuffers completely and use ShmemControl::NSharedBuffers everywhere instead (or something along those lines)? So that when the coordinator updates ShmemControl::NSharedBuffers, everyone sees the new value right away. I guess this is part of the "simplified design" you mentioned several posts earlier? I also thought about that approach more, and there seems to be new synchronization issues we would need to deal with, like: 1. Mid-execution change of NBuffers in functions like BufferSync and BgBufferSync, which could cause correctness and performance issues. I suppose most of them are solvable with atomics and shared r/w locks etc, but at the cost of higher performance overheads. 2. NBuffers becomes inconsistent with the underlying shared memory mappings for a period of time for each process. Currently both are updated in AnonymousShmemResize and AdjustShmemSize "atomically" for a process, so I wonder if letting them get out-of-sync (even for a brief period) could be problematic. I agree it doesn't seem to solve all the problems. It can simplify certain aspects of the design, but may also introduce new issues. Overall not a "silver bullet" :) Jack
В списке pgsql-hackers по дате отправления: