1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-24 00:23:06 +03:00

Initialize ShmemVariableCache like other shmem areas

For sake of consistency.

Reviewed-by: Tristan Partin, Richard Guo
Discussion: https://www.postgresql.org/message-id/6537d63d-4bb5-46f8-9b5d-73a8ba4720ab@iki.fi
This commit is contained in:
Heikki Linnakangas
2023-12-08 09:46:59 +02:00
parent 049ef3398d
commit 15916ffb04
5 changed files with 32 additions and 12 deletions

View File

@@ -34,6 +34,33 @@
VariableCache ShmemVariableCache = NULL;
/*
* Initialization of shared memory for ShmemVariableCache.
*/
Size
VarsupShmemSize(void)
{
return sizeof(VariableCacheData);
}
void
VarsupShmemInit(void)
{
bool found;
/* Initialize our shared state struct */
ShmemVariableCache = ShmemInitStruct("ShmemVariableCache",
sizeof(VariableCacheData),
&found);
if (!IsUnderPostmaster)
{
Assert(!found);
memset(ShmemVariableCache, 0, sizeof(VariableCacheData));
}
else
Assert(found);
}
/*
* Allocate the next FullTransactionId for a new transaction or
* subtransaction.