Re: Call CalculateShmemSize() only once

From: Melih Mutlu <m(dot)melihmutlu(at)gmail(dot)com>
To: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
Cc: Xuneng Zhou <xunengzhou(at)gmail(dot)com>, Nathan Bossart <nathandbossart(at)gmail(dot)com>, 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-20 14:13:13
Message-ID: CAGPVpCQok7-4aPZZ4Fj8AtuwC5zHDHMhpRywKLuzLdAZassirw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Ashutosh,

Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, 7 Kas 2026 Cmt, 17:31
tarihinde şunu yazdı:

> On Fri, Nov 6, 2026 at 4:46 PM Xuneng Zhou <xunengzhou(at)gmail(dot)com> wrote:
> >
> > Erroring out can help to stop the misake where it occurs. A build
> > without assert could accept the bad call, then fail later somewhere
> > else. It might make the problem a bit hard to understand. That said,
> > assert seems ok here since we haven't found code can make that bad
> > call.
> >
>
> Agreed that an ERROR would make an invalid call easier to diagnose in
> a build without assertions. I think Assert is sufficient here because
> this checks an internal lifecycle invariant, consistent with the other
> state-transition assertions. The current callers calculate the size
> once per shared-memory initialization cycle, and requests made after
> sizing are already rejected by runtime checks.

+1 to this. IMHO Asserts should be enough. And the patch LGTM as it is.

--
Best regards,
Melih

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ayush Tiwari 2026-11-20 14:14:20 Re: [Patch] Batch fsyncs when recycling WAL segments
Previous Message David Geier 2026-11-20 14:07:39 Re: Keep TIDBitmap pagetable memory across bitmap scans