From: | Richard Guo <guofenglinux(at)gmail(dot)com> |
---|---|
To: | Tristan Partin <tristan(at)neon(dot)tech> |
Cc: | Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de> |
Subject: | Re: Rename ShmemVariableCache and initialize it in more standard way |
Date: | 2023-12-05 03:40:53 |
Message-ID: | CAMbWs49UvmEqtZm5B9Xw_9Y0j0CUq26j-kj+8_1KbpELM0ZTGg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, Dec 5, 2023 at 12:31 AM Tristan Partin <tristan(at)neon(dot)tech> wrote:
> On Mon Dec 4, 2023 at 6:49 AM CST, Heikki Linnakangas wrote:
> > This came up in the "Refactoring backend fork+exec code" thread recently
> > [0], but is independent of that work:
> >
> > Here's a patch to allocate and initialize it with a pair of ShmemSize
> > and ShmemInit functions, like all other shared memory structs.
> >
> > + if (!IsUnderPostmaster)
> > + {
> > + Assert(!found);
> > + memset(ShmemVariableCache, 0,
> sizeof(VariableCacheData));
> > + }
> > + else
> > + Assert(found);
>
> Should the else branch instead be a fatal log?
The Assert here seems OK to me. We do the same when initializing
commitTsShared/MultiXactState. I think it would be preferable to adhere
to this convention.
> Patches look good to me.
Also +1 to the patches.
Thanks
Richard
From | Date | Subject | |
---|---|---|---|
Next Message | Nathan Bossart | 2023-12-05 03:46:47 | introduce dynamic shared memory registry |
Previous Message | Peter Geoghegan | 2023-12-05 03:25:55 | Re: Optimizing nbtree ScalarArrayOp execution, allowing multi-column ordered scans, skip scan |