@@ -561,14 +561,6 @@ static void ShmemBackendArrayAdd(Backend *bn);
561
561
static void ShmemBackendArrayRemove (Backend * bn );
562
562
#endif /* EXEC_BACKEND */
563
563
564
- #define StartupDataBase () StartChildProcess(StartupProcess)
565
- #define StartArchiver () StartChildProcess(ArchiverProcess)
566
- #define StartBackgroundWriter () StartChildProcess(BgWriterProcess)
567
- #define StartCheckpointer () StartChildProcess(CheckpointerProcess)
568
- #define StartWalWriter () StartChildProcess(WalWriterProcess)
569
- #define StartWalReceiver () StartChildProcess(WalReceiverProcess)
570
- #define StartWalSummarizer () StartChildProcess(WalSummarizerProcess)
571
-
572
564
/* Macros to check exit status of a child process */
573
565
#define EXIT_STATUS_0 (st ) ((st) == 0)
574
566
#define EXIT_STATUS_1 (st ) (WIFEXITED(st) && WEXITSTATUS(st) == 1)
@@ -1457,14 +1449,14 @@ PostmasterMain(int argc, char *argv[])
1457
1449
1458
1450
/* Start bgwriter and checkpointer so they can help with recovery */
1459
1451
if (CheckpointerPID == 0 )
1460
- CheckpointerPID = StartCheckpointer ( );
1452
+ CheckpointerPID = StartChildProcess ( CheckpointerProcess );
1461
1453
if (BgWriterPID == 0 )
1462
- BgWriterPID = StartBackgroundWriter ( );
1454
+ BgWriterPID = StartChildProcess ( BgWriterProcess );
1463
1455
1464
1456
/*
1465
1457
* We're ready to rock and roll...
1466
1458
*/
1467
- StartupPID = StartupDataBase ( );
1459
+ StartupPID = StartChildProcess ( StartupProcess );
1468
1460
Assert (StartupPID != 0 );
1469
1461
StartupStatus = STARTUP_RUNNING ;
1470
1462
pmState = PM_STARTUP ;
@@ -1798,9 +1790,9 @@ ServerLoop(void)
1798
1790
pmState == PM_HOT_STANDBY || pmState == PM_STARTUP )
1799
1791
{
1800
1792
if (CheckpointerPID == 0 )
1801
- CheckpointerPID = StartCheckpointer ( );
1793
+ CheckpointerPID = StartChildProcess ( CheckpointerProcess );
1802
1794
if (BgWriterPID == 0 )
1803
- BgWriterPID = StartBackgroundWriter ( );
1795
+ BgWriterPID = StartChildProcess ( BgWriterProcess );
1804
1796
}
1805
1797
1806
1798
/*
@@ -1809,7 +1801,7 @@ ServerLoop(void)
1809
1801
* be writing any new WAL).
1810
1802
*/
1811
1803
if (WalWriterPID == 0 && pmState == PM_RUN )
1812
- WalWriterPID = StartWalWriter ( );
1804
+ WalWriterPID = StartChildProcess ( WalWriterProcess );
1813
1805
1814
1806
/*
1815
1807
* If we have lost the autovacuum launcher, try to start a new one. We
@@ -1828,7 +1820,7 @@ ServerLoop(void)
1828
1820
1829
1821
/* If we have lost the archiver, try to start a new one. */
1830
1822
if (PgArchPID == 0 && PgArchStartupAllowed ())
1831
- PgArchPID = StartArchiver ( );
1823
+ PgArchPID = StartChildProcess ( ArchiverProcess );
1832
1824
1833
1825
/* If we need to signal the autovacuum launcher, do so now */
1834
1826
if (avlauncher_needs_signal )
@@ -3019,11 +3011,11 @@ process_pm_child_exit(void)
3019
3011
* if this fails, we'll just try again later.
3020
3012
*/
3021
3013
if (CheckpointerPID == 0 )
3022
- CheckpointerPID = StartCheckpointer ( );
3014
+ CheckpointerPID = StartChildProcess ( CheckpointerProcess );
3023
3015
if (BgWriterPID == 0 )
3024
- BgWriterPID = StartBackgroundWriter ( );
3016
+ BgWriterPID = StartChildProcess ( BgWriterProcess );
3025
3017
if (WalWriterPID == 0 )
3026
- WalWriterPID = StartWalWriter ( );
3018
+ WalWriterPID = StartChildProcess ( WalWriterProcess );
3027
3019
MaybeStartWalSummarizer ();
3028
3020
3029
3021
/*
@@ -3033,7 +3025,7 @@ process_pm_child_exit(void)
3033
3025
if (!IsBinaryUpgrade && AutoVacuumingActive () && AutoVacPID == 0 )
3034
3026
AutoVacPID = StartAutoVacLauncher ();
3035
3027
if (PgArchStartupAllowed () && PgArchPID == 0 )
3036
- PgArchPID = StartArchiver ( );
3028
+ PgArchPID = StartChildProcess ( ArchiverProcess );
3037
3029
3038
3030
/* workers may be scheduled to start now */
3039
3031
maybe_start_bgworkers ();
@@ -3188,7 +3180,7 @@ process_pm_child_exit(void)
3188
3180
HandleChildCrash (pid , exitstatus ,
3189
3181
_ ("archiver process" ));
3190
3182
if (PgArchStartupAllowed ())
3191
- PgArchPID = StartArchiver ( );
3183
+ PgArchPID = StartChildProcess ( ArchiverProcess );
3192
3184
continue ;
3193
3185
}
3194
3186
@@ -3767,7 +3759,7 @@ PostmasterStateMachine(void)
3767
3759
Assert (Shutdown > NoShutdown );
3768
3760
/* Start the checkpointer if not running */
3769
3761
if (CheckpointerPID == 0 )
3770
- CheckpointerPID = StartCheckpointer ( );
3762
+ CheckpointerPID = StartChildProcess ( CheckpointerProcess );
3771
3763
/* And tell it to shut down */
3772
3764
if (CheckpointerPID != 0 )
3773
3765
{
@@ -3899,7 +3891,7 @@ PostmasterStateMachine(void)
3899
3891
3900
3892
/*
3901
3893
* If we need to recover from a crash, wait for all non-syslogger children
3902
- * to exit, then reset shmem and StartupDataBase .
3894
+ * to exit, then reset shmem and start the startup process .
3903
3895
*/
3904
3896
if (FatalError && pmState == PM_NO_CHILDREN )
3905
3897
{
@@ -3921,7 +3913,7 @@ PostmasterStateMachine(void)
3921
3913
/* re-create shared memory and semaphores */
3922
3914
CreateSharedMemoryAndSemaphores ();
3923
3915
3924
- StartupPID = StartupDataBase ( );
3916
+ StartupPID = StartChildProcess ( StartupProcess );
3925
3917
Assert (StartupPID != 0 );
3926
3918
StartupStatus = STARTUP_RUNNING ;
3927
3919
pmState = PM_STARTUP ;
@@ -5066,7 +5058,7 @@ process_pm_pmsignal(void)
5066
5058
*/
5067
5059
Assert (PgArchPID == 0 );
5068
5060
if (XLogArchivingAlways ())
5069
- PgArchPID = StartArchiver ( );
5061
+ PgArchPID = StartChildProcess ( ArchiverProcess );
5070
5062
5071
5063
/*
5072
5064
* If we aren't planning to enter hot standby mode later, treat
@@ -5501,7 +5493,7 @@ MaybeStartWalReceiver(void)
5501
5493
pmState == PM_HOT_STANDBY ) &&
5502
5494
Shutdown <= SmartShutdown )
5503
5495
{
5504
- WalReceiverPID = StartWalReceiver ( );
5496
+ WalReceiverPID = StartChildProcess ( WalReceiverProcess );
5505
5497
if (WalReceiverPID != 0 )
5506
5498
WalReceiverRequested = false;
5507
5499
/* else leave the flag set, so we'll try again later */
@@ -5518,7 +5510,7 @@ MaybeStartWalSummarizer(void)
5518
5510
if (summarize_wal && WalSummarizerPID == 0 &&
5519
5511
(pmState == PM_RUN || pmState == PM_HOT_STANDBY ) &&
5520
5512
Shutdown <= SmartShutdown )
5521
- WalSummarizerPID = StartWalSummarizer ( );
5513
+ WalSummarizerPID = StartChildProcess ( WalSummarizerProcess );
5522
5514
}
5523
5515
5524
5516
0 commit comments