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

Commit0177f43

Browse files
committed
Fix oversight: in case where SIGTERM is received while there are
live backends, the archiver and stats processes never got sent akill signal. They'd eventually exit on their own, but not for awhile,which is a bit annoying when you are trying to replace the executablefile on a platform that doesn't allow removal of busy executables.Also, tweak main loop logic so that we will perform the backgroundtasks after select() returns EINTR.
1 parent23671f5 commit0177f43

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

‎src/backend/postmaster/postmaster.c

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*
3838
*
3939
* IDENTIFICATION
40-
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.415 2004/07/24 20:01:42 tgl Exp $
40+
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.416 2004/07/2701:46:03 tgl Exp $
4141
*
4242
* NOTES
4343
*
@@ -1154,12 +1154,13 @@ ServerLoop(void)
11541154

11551155
if (selres<0)
11561156
{
1157-
if (errno==EINTR||errno==EWOULDBLOCK)
1158-
continue;
1159-
ereport(LOG,
1160-
(errcode_for_socket_access(),
1161-
errmsg("select() failed in postmaster: %m")));
1162-
returnSTATUS_ERROR;
1157+
if (errno!=EINTR&&errno!=EWOULDBLOCK)
1158+
{
1159+
ereport(LOG,
1160+
(errcode_for_socket_access(),
1161+
errmsg("select() failed in postmaster: %m")));
1162+
returnSTATUS_ERROR;
1163+
}
11631164
}
11641165

11651166
/*
@@ -2014,6 +2015,11 @@ reaper(SIGNAL_ARGS)
20142015
* We expect that it wrote a shutdown checkpoint. (If
20152016
* for some reason it didn't, recovery will occur on next
20162017
* postmaster start.)
2018+
*
2019+
* Note: we do not wait around for exit of the archiver or
2020+
* stats processes. They've been sent SIGQUIT by this
2021+
* point, and in any case contain logic to commit hara-kiri
2022+
* if they notice the postmaster is gone.
20172023
*/
20182024
ExitPostmaster(0);
20192025
}
@@ -2095,6 +2101,12 @@ reaper(SIGNAL_ARGS)
20952101
/* And tell it to shut down */
20962102
if (BgWriterPID!=0)
20972103
kill(BgWriterPID,SIGUSR2);
2104+
/* Tell pgarch to shut down too; nothing left for it to do */
2105+
if (PgArchPID!=0)
2106+
kill(PgArchPID,SIGQUIT);
2107+
/* Tell pgstat to shut down too; nothing left for it to do */
2108+
if (PgStatPID!=0)
2109+
kill(PgStatPID,SIGQUIT);
20982110
}
20992111

21002112
reaper_done:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp