Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf0b7ab7

Browse files
committed
postmaster: Don't repeatedly transition to crashing state
Previously HandleChildCrash() skipped logging and signalling child exits ifalready in an immediate shutdown or in FatalError state, but stilltransitioned server state in response to a crash. That's redundant.In the other place we transition to FatalError, we do take care to not do sowhen already in FatalError state.To make it easier to combine different paths for entering FatalError state,only do so once in HandleChildCrash().Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>Discussion:https://postgr.es/m/kgng5nrvnlv335evmsuvpnh354rw7qyazl73kdysev2cr2v5zu@m3cfzxicm5kp
1 parentd239c1a commitf0b7ab7

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

‎src/backend/postmaster/postmaster.c

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2685,24 +2685,20 @@ CleanupBackend(PMChild *bp,
26852685
staticvoid
26862686
HandleChildCrash(intpid,intexitstatus,constchar*procname)
26872687
{
2688-
booltake_action;
2689-
26902688
/*
26912689
* We only log messages and send signals if this is the first process
26922690
* crash and we're not doing an immediate shutdown; otherwise, we're only
26932691
* here to update postmaster's idea of live processes. If we have already
26942692
* signaled children, nonzero exit status is to be expected, so don't
26952693
* clutter log.
26962694
*/
2697-
take_action= !FatalError&&Shutdown!=ImmediateShutdown;
2695+
if (FatalError||Shutdown==ImmediateShutdown)
2696+
return;
26982697

2699-
if (take_action)
2700-
{
2701-
LogChildExit(LOG,procname,pid,exitstatus);
2702-
ereport(LOG,
2703-
(errmsg("terminating any other active server processes")));
2704-
SetQuitSignalReason(PMQUIT_FOR_CRASH);
2705-
}
2698+
LogChildExit(LOG,procname,pid,exitstatus);
2699+
ereport(LOG,
2700+
(errmsg("terminating any other active server processes")));
2701+
SetQuitSignalReason(PMQUIT_FOR_CRASH);
27062702

27072703
/*
27082704
* Signal all other child processes to exit. The crashed process has
@@ -2711,11 +2707,9 @@ HandleChildCrash(int pid, int exitstatus, const char *procname)
27112707
* We could exclude dead-end children here, but at least when sending
27122708
* SIGABRT it seems better to include them.
27132709
*/
2714-
if (take_action)
2715-
TerminateChildren(send_abort_for_crash ?SIGABRT :SIGQUIT);
2710+
TerminateChildren(send_abort_for_crash ?SIGABRT :SIGQUIT);
27162711

2717-
if (Shutdown!=ImmediateShutdown)
2718-
FatalError= true;
2712+
FatalError= true;
27192713

27202714
/* We now transit into a state of waiting for children to die */
27212715
if (pmState==PM_RECOVERY||

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp