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

Commitd239c1a

Browse files
committed
postmaster: Don't open-code TerminateChildren() in HandleChildCrash()
After removing the duplication no user of sigquit_child() remains, thereforeremove it.Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>Discussion:https://postgr.es/m/kgng5nrvnlv335evmsuvpnh354rw7qyazl73kdysev2cr2v5zu@m3cfzxicm5kp
1 parent4d271e3 commitd239c1a

File tree

1 file changed

+11
-38
lines changed

1 file changed

+11
-38
lines changed

‎src/backend/postmaster/postmaster.c

Lines changed: 11 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,13 @@ boolenable_bonjour = false;
243243
char*bonjour_name;
244244
boolrestart_after_crash= true;
245245
boolremove_temp_files_after_crash= true;
246+
247+
/*
248+
* When terminating child processes after fatal errors, like a crash of a
249+
* child process, we normally send SIGQUIT -- and most other comments in this
250+
* file are written on the assumption that we do -- but developers might
251+
* prefer to use SIGABRT to collect per-child core dumps.
252+
*/
246253
boolsend_abort_for_crash= false;
247254
boolsend_abort_for_kill= false;
248255

@@ -424,7 +431,6 @@ static intBackendStartup(ClientSocket *client_sock);
424431
staticvoidreport_fork_failure_to_client(ClientSocket*client_sock,interrnum);
425432
staticCAC_statecanAcceptConnections(BackendTypebackend_type);
426433
staticvoidsignal_child(PMChild*pmchild,intsignal);
427-
staticvoidsigquit_child(PMChild*pmchild);
428434
staticboolSignalChildren(intsignal,BackendTypeMasktargetMask);
429435
staticvoidTerminateChildren(intsignal);
430436
staticintCountChildren(BackendTypeMasktargetMask);
@@ -2701,32 +2707,12 @@ HandleChildCrash(int pid, int exitstatus, const char *procname)
27012707
/*
27022708
* Signal all other child processes to exit. The crashed process has
27032709
* already been removed from ActiveChildList.
2710+
*
2711+
* We could exclude dead-end children here, but at least when sending
2712+
* SIGABRT it seems better to include them.
27042713
*/
27052714
if (take_action)
2706-
{
2707-
dlist_iteriter;
2708-
2709-
dlist_foreach(iter,&ActiveChildList)
2710-
{
2711-
PMChild*bp=dlist_container(PMChild,elem,iter.cur);
2712-
2713-
/* We do NOT restart the syslogger */
2714-
if (bp==SysLoggerPMChild)
2715-
continue;
2716-
2717-
if (bp==StartupPMChild)
2718-
StartupStatus=STARTUP_SIGNALED;
2719-
2720-
/*
2721-
* This backend is still alive. Unless we did so already, tell it
2722-
* to commit hara-kiri.
2723-
*
2724-
* We could exclude dead-end children here, but at least when
2725-
* sending SIGABRT it seems better to include them.
2726-
*/
2727-
sigquit_child(bp);
2728-
}
2729-
}
2715+
TerminateChildren(send_abort_for_crash ?SIGABRT :SIGQUIT);
27302716

27312717
if (Shutdown!=ImmediateShutdown)
27322718
FatalError= true;
@@ -3349,19 +3335,6 @@ signal_child(PMChild *pmchild, int signal)
33493335
#endif
33503336
}
33513337

3352-
/*
3353-
* Convenience function for killing a child process after a crash of some
3354-
* other child process. We apply send_abort_for_crash to decide which signal
3355-
* to send. Normally it's SIGQUIT -- and most other comments in this file are
3356-
* written on the assumption that it is -- but developers might prefer to use
3357-
* SIGABRT to collect per-child core dumps.
3358-
*/
3359-
staticvoid
3360-
sigquit_child(PMChild*pmchild)
3361-
{
3362-
signal_child(pmchild, (send_abort_for_crash ?SIGABRT :SIGQUIT));
3363-
}
3364-
33653338
/*
33663339
* Send a signal to the targeted children.
33673340
*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp