mirror of
https://github.com/postgres/postgres.git
synced 2025-11-18 02:02:55 +03:00
Rename some shared memory initialization routines
To make them follow the usual naming convention where FoobarShmemSize() calculates the amount of shared memory needed by Foobar subsystem, and FoobarShmemInit() performs the initialization. I didn't rename CreateLWLocks() and InitShmmeIndex(), because they are a little special. They need to be called before any of the other ShmemInit() functions, because they set up the shared memory bookkeeping itself. I also didn't rename InitProcGlobal(), because unlike other Shmeminit functions, it's not called by individual backends. Reviewed-by: Andreas Karlsson Discussion: https://www.postgresql.org/message-id/c09694ff-2453-47e5-b26c-32a16cd75ce6@iki.fi
This commit is contained in:
@@ -115,7 +115,7 @@ CalculateShmemSize(int *num_semaphores)
|
||||
sizeof(ShmemIndexEnt)));
|
||||
size = add_size(size, dsm_estimate_size());
|
||||
size = add_size(size, DSMRegistryShmemSize());
|
||||
size = add_size(size, BufferShmemSize());
|
||||
size = add_size(size, BufferManagerShmemSize());
|
||||
size = add_size(size, LockManagerShmemSize());
|
||||
size = add_size(size, PredicateLockShmemSize());
|
||||
size = add_size(size, ProcGlobalShmemSize());
|
||||
@@ -132,7 +132,7 @@ CalculateShmemSize(int *num_semaphores)
|
||||
size = add_size(size, LWLockShmemSize());
|
||||
size = add_size(size, ProcArrayShmemSize());
|
||||
size = add_size(size, BackendStatusShmemSize());
|
||||
size = add_size(size, SInvalShmemSize());
|
||||
size = add_size(size, SharedInvalShmemSize());
|
||||
size = add_size(size, PMSignalShmemSize());
|
||||
size = add_size(size, ProcSignalShmemSize());
|
||||
size = add_size(size, CheckpointerShmemSize());
|
||||
@@ -286,7 +286,7 @@ CreateOrAttachShmemStructs(void)
|
||||
CommitTsShmemInit();
|
||||
SUBTRANSShmemInit();
|
||||
MultiXactShmemInit();
|
||||
InitBufferPool();
|
||||
BufferManagerShmemInit();
|
||||
|
||||
/*
|
||||
* Set up lock manager
|
||||
@@ -296,22 +296,22 @@ CreateOrAttachShmemStructs(void)
|
||||
/*
|
||||
* Set up predicate lock manager
|
||||
*/
|
||||
InitPredicateLocks();
|
||||
PredicateLockShmemInit();
|
||||
|
||||
/*
|
||||
* Set up process table
|
||||
*/
|
||||
if (!IsUnderPostmaster)
|
||||
InitProcGlobal();
|
||||
CreateSharedProcArray();
|
||||
CreateSharedBackendStatus();
|
||||
ProcArrayShmemInit();
|
||||
BackendStatusShmemInit();
|
||||
TwoPhaseShmemInit();
|
||||
BackgroundWorkerShmemInit();
|
||||
|
||||
/*
|
||||
* Set up shared-inval messaging
|
||||
*/
|
||||
CreateSharedInvalidationState();
|
||||
SharedInvalShmemInit();
|
||||
|
||||
/*
|
||||
* Set up interprocess signaling mechanisms
|
||||
|
||||
@@ -370,7 +370,7 @@ static inline FullTransactionId FullXidRelativeTo(FullTransactionId rel,
|
||||
static void GlobalVisUpdateApply(ComputeXidHorizonsResult *horizons);
|
||||
|
||||
/*
|
||||
* Report shared-memory space needed by CreateSharedProcArray.
|
||||
* Report shared-memory space needed by ProcArrayShmemInit
|
||||
*/
|
||||
Size
|
||||
ProcArrayShmemSize(void)
|
||||
@@ -415,7 +415,7 @@ ProcArrayShmemSize(void)
|
||||
* Initialize the shared PGPROC array during postmaster startup.
|
||||
*/
|
||||
void
|
||||
CreateSharedProcArray(void)
|
||||
ProcArrayShmemInit(void)
|
||||
{
|
||||
bool found;
|
||||
|
||||
|
||||
@@ -212,10 +212,10 @@ static void CleanupInvalidationState(int status, Datum arg);
|
||||
|
||||
|
||||
/*
|
||||
* SInvalShmemSize --- return shared-memory space needed
|
||||
* SharedInvalShmemSize --- return shared-memory space needed
|
||||
*/
|
||||
Size
|
||||
SInvalShmemSize(void)
|
||||
SharedInvalShmemSize(void)
|
||||
{
|
||||
Size size;
|
||||
|
||||
@@ -227,18 +227,18 @@ SInvalShmemSize(void)
|
||||
}
|
||||
|
||||
/*
|
||||
* CreateSharedInvalidationState
|
||||
* SharedInvalShmemInit
|
||||
* Create and initialize the SI message buffer
|
||||
*/
|
||||
void
|
||||
CreateSharedInvalidationState(void)
|
||||
SharedInvalShmemInit(void)
|
||||
{
|
||||
int i;
|
||||
bool found;
|
||||
|
||||
/* Allocate space in shared memory */
|
||||
shmInvalBuffer = (SISeg *)
|
||||
ShmemInitStruct("shmInvalBuffer", SInvalShmemSize(), &found);
|
||||
ShmemInitStruct("shmInvalBuffer", SharedInvalShmemSize(), &found);
|
||||
if (found)
|
||||
return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user