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

Commitbb892ce

Browse files
committed
Tweak postmaster code to avoid double reporting when bgwriter crashes.
1 parent5cc3864 commitbb892ce

File tree

1 file changed

+13
-19
lines changed

1 file changed

+13
-19
lines changed

‎src/backend/postmaster/postmaster.c

Lines changed: 13 additions & 19 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.418 2004/08/01 17:45:43 tgl Exp $
40+
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.419 2004/08/04 20:09:47 tgl Exp $
4141
*
4242
* NOTES
4343
*
@@ -248,8 +248,8 @@ static void pmdie(SIGNAL_ARGS);
248248
staticvoidreaper(SIGNAL_ARGS);
249249
staticvoidsigusr1_handler(SIGNAL_ARGS);
250250
staticvoiddummy_handler(SIGNAL_ARGS);
251-
staticvoidCleanupProc(intpid,intexitstatus);
252-
staticvoidHandleChildCrash(intpid,intexitstatus);
251+
staticvoidCleanupBackend(intpid,intexitstatus);
252+
staticvoidHandleChildCrash(intpid,intexitstatus,constchar*procname);
253253
staticvoidLogChildExit(intlev,constchar*procname,
254254
intpid,intexitstatus);
255255
staticintBackendRun(Port*port);
@@ -1947,7 +1947,7 @@ reaper(SIGNAL_ARGS)
19471947
while ((pid=win32_waitpid(&exitstatus))>0)
19481948
{
19491949
/*
1950-
* We need to do this here, and not inCleanupProc, since this is
1950+
* We need to do this here, and not inCleanupBackend, since this is
19511951
* to be called on all children when we are done with them. Could
19521952
* move to LogChildExit, but that seems like asking for future
19531953
* trouble...
@@ -2025,9 +2025,8 @@ reaper(SIGNAL_ARGS)
20252025
/*
20262026
* Any unexpected exit of the bgwriter is treated as a crash.
20272027
*/
2028-
LogChildExit(LOG,gettext("background writer process"),
2029-
pid,exitstatus);
2030-
HandleChildCrash(pid,exitstatus);
2028+
HandleChildCrash(pid,exitstatus,
2029+
gettext("background writer process"));
20312030
continue;
20322031
}
20332032

@@ -2067,7 +2066,7 @@ reaper(SIGNAL_ARGS)
20672066
/*
20682067
* Else do standard backend child cleanup.
20692068
*/
2070-
CleanupProc(pid,exitstatus);
2069+
CleanupBackend(pid,exitstatus);
20712070
}/* loop over pending child-death reports */
20722071

20732072
if (FatalError)
@@ -2116,13 +2115,13 @@ reaper(SIGNAL_ARGS)
21162115

21172116

21182117
/*
2119-
*CleanupProc -- cleanup after terminated backend.
2118+
*CleanupBackend -- cleanup after terminated backend.
21202119
*
21212120
* Remove all local state associated with backend.
21222121
*/
21232122
staticvoid
2124-
CleanupProc(intpid,
2125-
intexitstatus)/* child's exit status. */
2123+
CleanupBackend(intpid,
2124+
intexitstatus)/* child's exit status. */
21262125
{
21272126
Dlelem*curr;
21282127

@@ -2136,7 +2135,7 @@ CleanupProc(int pid,
21362135
*/
21372136
if (exitstatus!=0)
21382137
{
2139-
HandleChildCrash(pid,exitstatus);
2138+
HandleChildCrash(pid,exitstatus,gettext("server process"));
21402139
return;
21412140
}
21422141

@@ -2166,8 +2165,7 @@ CleanupProc(int pid,
21662165
* process, and to signal all other remaining children to quickdie.
21672166
*/
21682167
staticvoid
2169-
HandleChildCrash(intpid,
2170-
intexitstatus)/* child's exit status. */
2168+
HandleChildCrash(intpid,intexitstatus,constchar*procname)
21712169
{
21722170
Dlelem*curr,
21732171
*next;
@@ -2179,11 +2177,7 @@ HandleChildCrash(int pid,
21792177
*/
21802178
if (!FatalError)
21812179
{
2182-
LogChildExit(LOG,
2183-
(pid==BgWriterPID) ?
2184-
gettext("background writer process") :
2185-
gettext("server process"),
2186-
pid,exitstatus);
2180+
LogChildExit(LOG,procname,pid,exitstatus);
21872181
ereport(LOG,
21882182
(errmsg("terminating any other active server processes")));
21892183
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp