pg.ddx.io pgsql-hackers@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Heikki Linnakangas <hlinnaka@iki.fi>
To: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Cc: Tomas Vondra <tomas@vondra.me>
Cc: Peter Eisentraut <peter@eisentraut.org>
Cc: Thomas Munro <thomas.munro@gmail.com>
Cc: Dmitry Dolgov <9erthalion6@gmail.com>
Cc: pgsql-hackers@postgresql.org, Robert Haas <robertmhaas@gmail.com>
Cc: chaturvedipalak1911@gmail.com, Andres Freund <andres@anarazel.de>
Subject: Re: Changing shared_buffers without restart
Date: Tue, 10 Feb 2026 17:39:13 +0200
Message-ID: <a22cfcd3-1c8d-41e7-9d89-7afd46eb6db1@iki.fi> (raw )
In-Reply-To: <CAExHW5uVQGGn8p3Dq0uTSi8-+Tb83mfkhTzQLj_CSQJqdQ8p+g@mail.gmail.com >
References: <gzb2oqqabzqidlnumrbau2k2fscb5jo6nlpdjnf6pu5y4bk5mo@xoujqgtiqvgr >
<CA+hUKGLfdc6gbXc0bE6R_TukCMzbKLvgjZsLtfyPxQOnOaGivw@mail.gmail.com >
<kwvbsat7reeopjhwopfypwdhsfrcev7nmmltec5ec6zzkjol5o@itpqaokfw7kb >
<CA+hUKGLQhsZ1dEf5Zo6JuPbs6n-qX=cTGy49feKf1iFA_TBP1g@mail.gmail.com >
<CAExHW5v9cE+ETusTafZyvy+eVpnVvoayVm7ZOk4Ddq8fxY270A@mail.gmail.com >
<CAExHW5sYg_d4O7oGRqbomnVODeqR3YNAeYAa526n1dsWCM=+Fg@mail.gmail.com >
<CAExHW5vB8sAmDtkEN5dcYYeBok3D8eAzMFCOH1k+krxht1yFjA@mail.gmail.com >
<qltuzcdxapofdtb5mrd4em3bzu2qiwhp3cdwdsosmn7rhrtn4u@yaogvphfwc4h >
<CAExHW5sOu8+9h6t7jsA5jVcQ--N-LCtjkPnCw+rpoN0ovT6PHg@mail.gmail.com >
<CAExHW5sVxEwQsuzkgjjJQP9-XVe0H2njEVw1HxeYFdT7u7J+eQ@mail.gmail.com >
<CAExHW5s8s=UhjqNa_Tz1PFCRLzt3=5nvd5vD1wFdKWMQCmFySQ@mail.gmail.com >
<9ac6082a-2e30-4462-a260-1507452aa962@iki.fi >
<CAExHW5tSw8r06RLAArvf923cO4NGetitPhQ7AO0o7hsKx8jsNw@mail.gmail.com >
<91265854-b3ba-45c6-aa44-7e8dcdd51470@iki.fi >
<CAExHW5uVQGGn8p3Dq0uTSi8-+Tb83mfkhTzQLj_CSQJqdQ8p+g@mail.gmail.com >
On 10/02/2026 17:23, Ashutosh Bapat wrote:
> I didn't look too deeply but what's broken in the EXEC_BACKEND case?
Dunno, I didn't look too deeply either :-D. But I think it's just some
silly bug, i.e. the design should work with EXEC_BACKEND.
>> --------------
>>
>> /* This struct lives in shared memory */
>> typedef struct
>> {
>> int field;
>> } FoobarSharedCtlData;
>>
>> static void FoobarShmemInit(void *arg);
>>
>> /* Descriptor for the shared memory area */
>> ShmemStructDesc FoobarShmemDesc = {
>> .name = "Foobar subsystem",
>> .size = sizeof(FoobarSharedCtlData),
>> .init_fn = FoobarShmemInit,
>> };
>>
>> /* Pointer to the shared memory struct */
>> #define FoobarCtl ((FoobarSharedCtlData *) FoobarShmemDesc.ptr)
>>
>
> I don't like this much since it limits the ability to debug. A macro
> is not present in the symbol table.
True, although FoobarShmemDesc would still be present in the symbol table.
> How about something like attached?
> Once we do that we can make the ShmemStructDesc local to
> ShmemRegisterStruct() calls and construct them on the fly . There's no
> other use for them.
Works for me.
> LGTM.
>
> One more comment.
> /* estimated size of the shmem index table (not a hard limit) */
> #define SHMEM_INDEX_SIZE (64)
>
> What do you mean by "not a hard limit"?
That was just copy-pasted from existing code. (Don't look too deeply ;-) )
> We will be limited by the number of entries in the array; a limit that
> doesn't exist in the earlier implementation. I mean one can easily
> have 100s of extensions loaded, each claiming a couple shared memory
> structures. How large do we expect the array to be? Maybe we should
> create a linked list which is converted to an array at the end of
> registration. The array and its size can be easily passed to the child
> through the launch backend as compared to the list. Looking at
> launch_backend changes, even that doesn't seem to be required since
> SubPostmasterMain() calls RegisterShmemStructs().
Or you can also just repalloc() a larger array if it fills up.
> Also, do we want to discuss this in a thread of its own?
Makes sense.
- Heikki
view thread (168+ messages) latest in thread
Message-ID: <a22cfcd3-1c8d-41e7-9d89-7afd46eb6db1@iki.fi>
Permalink: ../a22cfcd3-1c8d-41e7-9d89-7afd46eb6db1@iki.fi/
Also on: postgresql.org/message-id/a22cfcd3-1c8d-41e7-9d89-7afd46eb6db1@iki.fi
copy link · copy postgr.es
reply Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: hlinnaka@iki.fi, ashutosh.bapat.oss@gmail.com, tomas@vondra.me, peter@eisentraut.org, thomas.munro@gmail.com, 9erthalion6@gmail.com, robertmhaas@gmail.com, andres@anarazel.de
Subject: Re: Changing shared_buffers without restart
In-Reply-To: <a22cfcd3-1c8d-41e7-9d89-7afd46eb6db1@iki.fi>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox