@@ -316,9 +316,10 @@ static bool FatalError = false; /* T if recovering from backend crash */
316
316
* Notice that this state variable does not distinguish *why* we entered
317
317
* states later than PM_RUN --- Shutdown and FatalError must be consulted
318
318
* to find that out. FatalError is never true in PM_RECOVERY, PM_HOT_STANDBY,
319
- * or PM_RUN states, nor in PM_SHUTDOWN states (because we don't enter those
320
- * states when trying to recover from a crash). It can be true in PM_STARTUP
321
- * state, because we don't clear it until we've successfully started WAL redo.
319
+ * or PM_RUN states, nor in PM_WAIT_XLOG_SHUTDOWN states (because we don't
320
+ * enter those states when trying to recover from a crash). It can be true in
321
+ * PM_STARTUP state, because we don't clear it until we've successfully
322
+ * started WAL redo.
322
323
*/
323
324
typedef enum
324
325
{
@@ -329,9 +330,9 @@ typedef enum
329
330
PM_RUN , /* normal "database is alive" state */
330
331
PM_STOP_BACKENDS , /* need to stop remaining backends */
331
332
PM_WAIT_BACKENDS , /* waiting for live backends to exit */
332
- PM_SHUTDOWN , /* waiting for checkpointer to do shutdown
333
+ PM_WAIT_XLOG_SHUTDOWN , /* waiting for checkpointer to do shutdown
333
334
* ckpt */
334
- PM_SHUTDOWN_2 , /* waiting for archiver and walsenders to
335
+ PM_WAIT_XLOG_ARCHIVAL , /* waiting for archiver and walsenders to
335
336
* finish */
336
337
PM_WAIT_DEAD_END , /* waiting for dead-end children to exit */
337
338
PM_NO_CHILDREN , /* all important children have exited */
@@ -2354,7 +2355,7 @@ process_pm_child_exit(void)
2354
2355
{
2355
2356
ReleasePostmasterChildSlot (CheckpointerPMChild );
2356
2357
CheckpointerPMChild = NULL ;
2357
- if (EXIT_STATUS_0 (exitstatus ) && pmState == PM_SHUTDOWN )
2358
+ if (EXIT_STATUS_0 (exitstatus ) && pmState == PM_WAIT_XLOG_SHUTDOWN )
2358
2359
{
2359
2360
/*
2360
2361
* OK, we saw normal exit of the checkpointer after it's been
@@ -2363,8 +2364,8 @@ process_pm_child_exit(void)
2363
2364
* occur on next postmaster start.)
2364
2365
*
2365
2366
* At this point we should have no normal backend children
2366
- * left (else we'd not be in PM_SHUTDOWN state) but we might
2367
- * have dead-end children to wait for.
2367
+ * left (else we'd not be in PM_WAIT_XLOG_SHUTDOWN state) but
2368
+ * we might have dead-end children to wait for.
2368
2369
*
2369
2370
* If we have an archiver subprocess, tell it to do a last
2370
2371
* archive cycle and quit. Likewise, if we have walsender
@@ -2382,7 +2383,7 @@ process_pm_child_exit(void)
2382
2383
*/
2383
2384
SignalChildren (SIGUSR2 , btmask (B_WAL_SENDER ));
2384
2385
2385
- UpdatePMState (PM_SHUTDOWN_2 );
2386
+ UpdatePMState (PM_WAIT_XLOG_ARCHIVAL );
2386
2387
}
2387
2388
else
2388
2389
{
@@ -2733,7 +2734,7 @@ HandleChildCrash(int pid, int exitstatus, const char *procname)
2733
2734
pmState == PM_HOT_STANDBY ||
2734
2735
pmState == PM_RUN ||
2735
2736
pmState == PM_STOP_BACKENDS ||
2736
- pmState == PM_SHUTDOWN )
2737
+ pmState == PM_WAIT_XLOG_SHUTDOWN )
2737
2738
UpdatePMState (PM_WAIT_BACKENDS );
2738
2739
2739
2740
/*
@@ -2957,7 +2958,7 @@ PostmasterStateMachine(void)
2957
2958
if (CheckpointerPMChild != NULL )
2958
2959
{
2959
2960
signal_child (CheckpointerPMChild , SIGUSR2 );
2960
- UpdatePMState (PM_SHUTDOWN );
2961
+ UpdatePMState (PM_WAIT_XLOG_SHUTDOWN );
2961
2962
}
2962
2963
else
2963
2964
{
@@ -2982,13 +2983,13 @@ PostmasterStateMachine(void)
2982
2983
}
2983
2984
}
2984
2985
2985
- if (pmState == PM_SHUTDOWN_2 )
2986
+ if (pmState == PM_WAIT_XLOG_ARCHIVAL )
2986
2987
{
2987
2988
/*
2988
- * PM_SHUTDOWN_2 state ends when there's no other children than
2989
- * dead-end children left. There shouldn't be any regular backends
2990
- * left by now anyway; what we're really waiting for is walsenders and
2991
- * archiver.
2989
+ * PM_WAIT_XLOG_ARCHIVAL state ends when there's no other children
2990
+ * than dead-end children left. There shouldn't be any regular
2991
+ * backends left by now anyway; what we're really waiting for is
2992
+ * walsenders and archiver.
2992
2993
*/
2993
2994
if (CountChildren (btmask_all_except (B_LOGGER , B_DEAD_END_BACKEND )) == 0 )
2994
2995
{
@@ -3131,8 +3132,8 @@ pmstate_name(PMState state)
3131
3132
PM_TOSTR_CASE (PM_RUN );
3132
3133
PM_TOSTR_CASE (PM_STOP_BACKENDS );
3133
3134
PM_TOSTR_CASE (PM_WAIT_BACKENDS );
3134
- PM_TOSTR_CASE (PM_SHUTDOWN );
3135
- PM_TOSTR_CASE (PM_SHUTDOWN_2 );
3135
+ PM_TOSTR_CASE (PM_WAIT_XLOG_SHUTDOWN );
3136
+ PM_TOSTR_CASE (PM_WAIT_XLOG_ARCHIVAL );
3136
3137
PM_TOSTR_CASE (PM_WAIT_DEAD_END );
3137
3138
PM_TOSTR_CASE (PM_NO_CHILDREN );
3138
3139
}
@@ -3173,9 +3174,10 @@ LaunchMissingBackgroundProcesses(void)
3173
3174
* The checkpointer and the background writer are active from the start,
3174
3175
* until shutdown is initiated.
3175
3176
*
3176
- * (If the checkpointer is not running when we enter the PM_SHUTDOWN
3177
- * state, it is launched one more time to perform the shutdown checkpoint.
3178
- * That's done in PostmasterStateMachine(), not here.)
3177
+ * (If the checkpointer is not running when we enter the
3178
+ * PM_WAIT_XLOG_SHUTDOWN state, it is launched one more time to perform
3179
+ * the shutdown checkpoint. That's done in PostmasterStateMachine(), not
3180
+ * here.)
3179
3181
*/
3180
3182
if (pmState == PM_RUN || pmState == PM_RECOVERY ||
3181
3183
pmState == PM_HOT_STANDBY || pmState == PM_STARTUP )
@@ -3996,8 +3998,8 @@ bgworker_should_start_now(BgWorkerStartTime start_time)
3996
3998
{
3997
3999
case PM_NO_CHILDREN :
3998
4000
case PM_WAIT_DEAD_END :
3999
- case PM_SHUTDOWN_2 :
4000
- case PM_SHUTDOWN :
4001
+ case PM_WAIT_XLOG_ARCHIVAL :
4002
+ case PM_WAIT_XLOG_SHUTDOWN :
4001
4003
case PM_WAIT_BACKENDS :
4002
4004
case PM_STOP_BACKENDS :
4003
4005
break ;
0 commit comments