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

Commit421d502

Browse files
committed
Treat the autovac launcher more like a regular backend, in that we wait
for it to die before telling the bgwriter to initiate shutdown checkpoint.Since it's connected to shared memory, this seems more prudent than thealternative of letting it quit asynchronously. Resolves my complaintof yesterday about repeated shutdown checkpoints in CVS HEAD.
1 parent8f55b9a commit421d502

File tree

1 file changed

+12
-27
lines changed

1 file changed

+12
-27
lines changed

‎src/backend/postmaster/postmaster.c

Lines changed: 12 additions & 27 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.529 2007/06/29 17:07:39 alvherre Exp $
40+
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.530 2007/07/01 18:28:41 tgl Exp $
4141
*
4242
* NOTES
4343
*
@@ -1242,7 +1242,8 @@ ServerLoop(void)
12421242
}
12431243

12441244
/* If we have lost the autovacuum launcher, try to start a new one */
1245-
if ((AutoVacuumingActive()||start_autovac_launcher)&&AutoVacPID==0&&
1245+
if (AutoVacPID==0&&
1246+
(AutoVacuumingActive()||start_autovac_launcher)&&
12461247
StartupPID==0&& !FatalError&&Shutdown==NoShutdown)
12471248
{
12481249
AutoVacPID=StartAutoVacLauncher();
@@ -1873,11 +1874,14 @@ pmdie(SIGNAL_ARGS)
18731874
ereport(LOG,
18741875
(errmsg("received smart shutdown request")));
18751876

1876-
/* autovacuum workers are shut down immediately */
1877+
/* autovacuum workers aretold toshut down immediately */
18771878
if (DLGetHead(BackendList))
18781879
SignalSomeChildren(SIGTERM, true);
1880+
/* and the autovac launcher too */
1881+
if (AutoVacPID!=0)
1882+
signal_child(AutoVacPID,SIGTERM);
18791883

1880-
if (DLGetHead(BackendList))
1884+
if (DLGetHead(BackendList)||AutoVacPID!=0)
18811885
break;/* let reaper() handle this */
18821886

18831887
/*
@@ -1896,13 +1900,7 @@ pmdie(SIGNAL_ARGS)
18961900
signal_child(PgArchPID,SIGQUIT);
18971901
/* Tell pgstat to shut down too; nothing left for it to do */
18981902
if (PgStatPID!=0)
1899-
{
19001903
signal_child(PgStatPID,SIGQUIT);
1901-
allow_immediate_pgstat_restart();
1902-
}
1903-
/* Tell autovac launcher to shut down too */
1904-
if (AutoVacPID!=0)
1905-
signal_child(AutoVacPID,SIGTERM);
19061904
break;
19071905

19081906
caseSIGINT:
@@ -1919,13 +1917,15 @@ pmdie(SIGNAL_ARGS)
19191917
ereport(LOG,
19201918
(errmsg("received fast shutdown request")));
19211919

1922-
if (DLGetHead(BackendList))
1920+
if (DLGetHead(BackendList)||AutoVacPID!=0)
19231921
{
19241922
if (!FatalError)
19251923
{
19261924
ereport(LOG,
19271925
(errmsg("aborting any active transactions")));
19281926
SignalChildren(SIGTERM);
1927+
if (AutoVacPID!=0)
1928+
signal_child(AutoVacPID,SIGTERM);
19291929
/* reaper() does the rest */
19301930
}
19311931
break;
@@ -1955,13 +1955,7 @@ pmdie(SIGNAL_ARGS)
19551955
signal_child(PgArchPID,SIGQUIT);
19561956
/* Tell pgstat to shut down too; nothing left for it to do */
19571957
if (PgStatPID!=0)
1958-
{
19591958
signal_child(PgStatPID,SIGQUIT);
1960-
allow_immediate_pgstat_restart();
1961-
}
1962-
/* Tell autovac launcher to shut down too */
1963-
if (AutoVacPID!=0)
1964-
signal_child(AutoVacPID,SIGTERM);
19651959
break;
19661960

19671961
caseSIGQUIT:
@@ -1983,10 +1977,7 @@ pmdie(SIGNAL_ARGS)
19831977
if (PgArchPID!=0)
19841978
signal_child(PgArchPID,SIGQUIT);
19851979
if (PgStatPID!=0)
1986-
{
19871980
signal_child(PgStatPID,SIGQUIT);
1988-
allow_immediate_pgstat_restart();
1989-
}
19901981
if (DLGetHead(BackendList))
19911982
SignalChildren(SIGQUIT);
19921983
ExitPostmaster(0);
@@ -2237,7 +2228,7 @@ reaper(SIGNAL_ARGS)
22372228

22382229
if (Shutdown>NoShutdown)
22392230
{
2240-
if (DLGetHead(BackendList)||StartupPID!=0)
2231+
if (DLGetHead(BackendList)||StartupPID!=0||AutoVacPID!=0)
22412232
gotoreaper_done;
22422233
/* Start the bgwriter if not running */
22432234
if (BgWriterPID==0)
@@ -2250,13 +2241,7 @@ reaper(SIGNAL_ARGS)
22502241
signal_child(PgArchPID,SIGQUIT);
22512242
/* Tell pgstat to shut down too; nothing left for it to do */
22522243
if (PgStatPID!=0)
2253-
{
22542244
signal_child(PgStatPID,SIGQUIT);
2255-
allow_immediate_pgstat_restart();
2256-
}
2257-
/* Tell autovac launcher to shut down too */
2258-
if (AutoVacPID!=0)
2259-
signal_child(AutoVacPID,SIGTERM);
22602245
}
22612246

22622247
reaper_done:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp