mirror of
https://github.com/postgres/postgres.git
synced 2025-11-21 00:42:43 +03:00
process startup: Always call Init[Auxiliary]Process() before BaseInit().
For EXEC_BACKEND InitProcess()/InitAuxiliaryProcess() needs to have been called well before we call BaseInit(), as SubPostmasterMain() needs LWLocks to work. Having the order of initialization differ between platforms makes it unnecessarily hard to understand the system and to add initialization points for new subsystems without a lot of duplication. To be able to change the order, BaseInit() cannot trigger CreateSharedMemoryAndSemaphores() anymore - obviously that needs to have happened before we can call InitProcess(). It seems cleaner to create shared memory explicitly in single user/bootstrap mode anyway. After this change the separation of bufmgr initialization into InitBufferPoolAccess() / InitBufferPoolBackend() is not meaningful anymore so the latter is removed. Author: Andres Freund <andres@anarazel.de> Reviewed-By: Kyotaro Horiguchi <horikyota.ntt@gmail.com> Discussion: https://postgr.es/m/20210802164124.ufo5buo4apl6yuvs@alap3.anarazel.de
This commit is contained in:
@@ -90,8 +90,6 @@ AuxiliaryProcessMain(AuxProcType auxtype)
|
||||
SetProcessingMode(BootstrapProcessing);
|
||||
IgnoreSystemIndexes = true;
|
||||
|
||||
BaseInit();
|
||||
|
||||
/*
|
||||
* As an auxiliary process, we aren't going to do the full InitPostgres
|
||||
* pushups, but there are a couple of things that need to get lit up even
|
||||
@@ -106,6 +104,8 @@ AuxiliaryProcessMain(AuxProcType auxtype)
|
||||
InitAuxiliaryProcess();
|
||||
#endif
|
||||
|
||||
BaseInit();
|
||||
|
||||
/*
|
||||
* Assign the ProcSignalSlot for an auxiliary process. Since it doesn't
|
||||
* have a BackendId, the slot is statically allocated based on the
|
||||
@@ -118,9 +118,6 @@ AuxiliaryProcessMain(AuxProcType auxtype)
|
||||
*/
|
||||
ProcSignalInit(MaxBackends + MyAuxProcType + 1);
|
||||
|
||||
/* finish setting up bufmgr.c */
|
||||
InitBufferPoolBackend();
|
||||
|
||||
/*
|
||||
* Auxiliary processes don't run transactions, but they may need a
|
||||
* resource owner anyway to manage buffer pins acquired outside
|
||||
|
||||
Reference in New Issue
Block a user