Re: Call CalculateShmemSize() only once

From: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Heikki Linnakangas <heikki(dot)linnakangas(at)databricks(dot)com>
Subject: Re: Call CalculateShmemSize() only once
Date: 2026-11-06 07:45:29
Message-ID: CAExHW5sQgJ-D2eAJEWEkSnc9EgxKmkDTTMfap8KU9ajTF+XVpQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Nov 2, 2026 at 3:41 PM Ashutosh Bapat
<ashutosh(dot)bapat(dot)oss(at)gmail(dot)com> wrote:
>
> On Fri, Oct 30, 2026 at 11:25 PM Nathan Bossart
> <nathandbossart(at)gmail(dot)com> wrote:
> >
> > > As a follow-up, would it make sense to introduce an SRS_SIZED state
> > > between SRS_REQUESTING and SRS_INITIALIZING? We could enter it when
> > > ShmemGetRequestedSize() finishes and adjust the state checks
> > > accordingly. This would prevent new requests from being registered
> > > after the required shared memory size has been calculated.
> > > EXEC_BACKEND child attachment and late allocation would retain their
> > > existing paths without entering this state. I can update the patch if
> > > this seems worthwhile.
> >
> > Seems worth exploring.
>
> Done. This is a small change that fits the existing state machine. I
> have included it as a separate patch for review; it could be merged
> into the CalculateShmemSize() patch with an updated commit message.

Here's patch with the earlier patches squashed into one.

--
Best Wishes,
Ashutosh Bapat

Attachment Content-Type Size
v20261106-0001-Call-CalculateShmemSize-only-once-when-cre.patch text/x-patch 8.9 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Zsolt Parragi 2026-11-06 08:08:46 Re: pg_dump --exclude-table loses FOR ALL TABLES EXCEPT publications
Previous Message David Rowley 2026-11-06 07:23:42 Re: DISTINCT aggregate crashes when ORDER BY repeats its argument