Rename ShmemVariableCache and initialize it in more standard way

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Tristan Partin <tristan(at)neon(dot)tech>
Subject: Rename ShmemVariableCache and initialize it in more standard way
Date: 2023-12-04 12:49:57
Message-ID: 6537d63d-4bb5-46f8-9b5d-73a8ba4720ab@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

This came up in the "Refactoring backend fork+exec code" thread recently
[0], but is independent of that work:

On 11/07/2023 01:50, Andres Freund wrote:
>> --- a/src/backend/storage/ipc/shmem.c
>> +++ b/src/backend/storage/ipc/shmem.c
>> @@ -144,6 +144,8 @@ InitShmemAllocation(void)
>> /*
>> * Initialize ShmemVariableCache for transaction manager. (This doesn't
>> * really belong here, but not worth moving.)
>> + *
>> + * XXX: we really should move this
>> */
>> ShmemVariableCache = (VariableCache)
>> ShmemAlloc(sizeof(*ShmemVariableCache));
>
> Heh. Indeed. And probably just rename it to something less insane.

Here's a patch to allocate and initialize it with a pair of ShmemSize
and ShmemInit functions, like all other shared memory structs.

+1 on renaming it too. It's not a cache, the values tracked in
ShmemVariableCache are the authoritative source. Attached patch renames
it to "TransamVariables", but I'm all ears for other suggestions.

[0]
https://www.postgresql.org/message-id/20230710225043.svl7fqxecwshwc7a@awork3.anarazel.de

--
Heikki Linnakangas
Neon (https://neon.tech)

Attachment Content-Type Size
0001-Initialize-ShmemVariableCache-like-other-shmem-areas.patch text/x-patch 4.8 KB
0002-Rename-ShmemVariableCache-to-TransamVariables.patch text/x-patch 46.1 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Isaac Morland 2023-12-04 12:50:10 Re: Should REINDEX be listed under DDL?
Previous Message Andrew Dunstan 2023-12-04 12:41:20 Re: Emitting JSON to file using COPY TO