Re: Changing shared_buffers without restart

From: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
To: Dmitry Dolgov <9erthalion6(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, Robert Haas <robertmhaas(at)gmail(dot)com>
Subject: Re: Changing shared_buffers without restart
Date: 2025-02-28 11:52:29
Message-ID: CAExHW5utfpJ+WTipMLCPYTixn-34HbNCxn-_SvcyQd-XkafU5g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Feb 27, 2025 at 1:58 PM Dmitry Dolgov <9erthalion6(at)gmail(dot)com> wrote:
>
> > On Tue, Feb 25, 2025 at 10:52:05AM GMT, Dmitry Dolgov wrote:
> > > On Fri, Oct 18, 2024 at 09:21:19PM GMT, Dmitry Dolgov wrote:
> > > TL;DR A PoC for changing shared_buffers without PostgreSQL restart, via
> > > changing shared memory mapping layout. Any feedback is appreciated.
> >
> > Hi,
> >
> > Here is a new version of the patch, which contains a proposal about how to
> > coordinate shared memory resizing between backends. The rest is more or less
> > the same, a feedback about coordination is appreciated. It's a lot to read, but
> > the main difference is about:
>
> Just one note, there are still couple of compilation warnings in the
> code, which I haven't addressed yet. Those will go away in the next
> version.

PFA the patchset which implements shrinking shared buffers.
0001-0006 are same as the previous patchset
0007 fixes compilation warnings from previous patches - I think those
should be absorbed into their respective patches
0008 adds TODOs that need some code changes or at least need some
consideration. Some of them might point to the causes of Assertion
failures seen with this patch set.
0009 adds WIP support for shrinking shared buffers - I think this
should be absorbed into 0005
0010 WIP fix for Assertion failures seen from BgBufferSync() - I am
still investigating those.

I am using the attached script to shake the patch well. It runs
pgbench and concurrently resizes the shared_buffers. I am seeing
Assertion failures when running the script in both cases, expanding
and shrinking the buffers. I am investigating "failed
Assert("strategy_delta >= 0")," next.

--
Best Wishes,
Ashutosh Bapat

Attachment Content-Type Size
0004-Introduce-pending-flag-for-GUC-assign-hooks-20250228.patch text/x-patch 11.9 KB
0003-Introduce-multiple-shmem-segments-for-share-20250228.patch text/x-patch 11.1 KB
0005-Allow-to-resize-shared-memory-without-resta-20250228.patch text/x-patch 32.9 KB
0002-Allow-placing-shared-memory-mapping-with-an-20250228.patch text/x-patch 8.7 KB
0001-Allow-to-use-multiple-shared-memory-mapping-20250228.patch text/x-patch 30.1 KB
0006-Use-anonymous-files-to-back-shared-memory-s-20250228.patch text/x-patch 6.7 KB
0010-WIP-Reinitialize-buffer-sync-strategy-20250228.patch text/x-patch 6.6 KB
0007-Fix-compilation-failures-in-previous-patche-20250228.patch text/x-patch 2.4 KB
0009-WIP-Support-shrinking-shared-buffers-20250228.patch text/x-patch 8.1 KB
0008-Add-TODOs-and-questions-about-previous-comm-20250228.patch text/x-patch 11.4 KB
pgbench-concurrent-resize-buffers.sh application/x-shellscript 2.1 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2025-02-28 12:01:41 Re: Changing shared_buffers without restart
Previous Message Tatsuo Ishii 2025-02-28 11:48:51 Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options