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

Commit6869563

Browse files
committed
Allow the pgstat process to restart immediately after a receiving
SIGQUIT signal, rather than waiting for PGSTAT_RESTART_INTERVAL.
1 parenta4127b7 commit6869563

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

‎src/backend/postmaster/pgstat.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*
1414
*Copyright (c) 2001-2007, PostgreSQL Global Development Group
1515
*
16-
*$PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.149 2007/03/16 17:57:36 mha Exp $
16+
*$PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.150 2007/03/22 19:53:30 momjian Exp $
1717
* ----------
1818
*/
1919
#include"postgres.h"
@@ -572,6 +572,10 @@ pgstat_start(void)
572572
return0;
573573
}
574574

575+
voidallow_immediate_pgstat_restart(void)
576+
{
577+
last_pgstat_start_time=0;
578+
}
575579

576580
/* ------------------------------------------------------------
577581
* Public functions used by backends follow

‎src/backend/postmaster/postmaster.c

Lines changed: 14 additions & 1 deletion
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.526 2007/03/07 13:35:02 alvherre Exp $
40+
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.527 2007/03/22 19:53:30 momjian Exp $
4141
*
4242
* NOTES
4343
*
@@ -1896,7 +1896,10 @@ pmdie(SIGNAL_ARGS)
18961896
signal_child(PgArchPID,SIGQUIT);
18971897
/* Tell pgstat to shut down too; nothing left for it to do */
18981898
if (PgStatPID!=0)
1899+
{
18991900
signal_child(PgStatPID,SIGQUIT);
1901+
allow_immediate_pgstat_restart();
1902+
}
19001903
/* Tell autovac launcher to shut down too */
19011904
if (AutoVacPID!=0)
19021905
signal_child(AutoVacPID,SIGTERM);
@@ -1952,7 +1955,10 @@ pmdie(SIGNAL_ARGS)
19521955
signal_child(PgArchPID,SIGQUIT);
19531956
/* Tell pgstat to shut down too; nothing left for it to do */
19541957
if (PgStatPID!=0)
1958+
{
19551959
signal_child(PgStatPID,SIGQUIT);
1960+
allow_immediate_pgstat_restart();
1961+
}
19561962
/* Tell autovac launcher to shut down too */
19571963
if (AutoVacPID!=0)
19581964
signal_child(AutoVacPID,SIGTERM);
@@ -1977,7 +1983,10 @@ pmdie(SIGNAL_ARGS)
19771983
if (PgArchPID!=0)
19781984
signal_child(PgArchPID,SIGQUIT);
19791985
if (PgStatPID!=0)
1986+
{
19801987
signal_child(PgStatPID,SIGQUIT);
1988+
allow_immediate_pgstat_restart();
1989+
}
19811990
if (DLGetHead(BackendList))
19821991
SignalChildren(SIGQUIT);
19831992
ExitPostmaster(0);
@@ -2241,7 +2250,10 @@ reaper(SIGNAL_ARGS)
22412250
signal_child(PgArchPID,SIGQUIT);
22422251
/* Tell pgstat to shut down too; nothing left for it to do */
22432252
if (PgStatPID!=0)
2253+
{
22442254
signal_child(PgStatPID,SIGQUIT);
2255+
allow_immediate_pgstat_restart();
2256+
}
22452257
/* Tell autovac launcher to shut down too */
22462258
if (AutoVacPID!=0)
22472259
signal_child(AutoVacPID,SIGTERM);
@@ -2404,6 +2416,7 @@ HandleChildCrash(int pid, int exitstatus, const char *procname)
24042416
"SIGQUIT",
24052417
(int)PgStatPID)));
24062418
signal_child(PgStatPID,SIGQUIT);
2419+
allow_immediate_pgstat_restart();
24072420
}
24082421

24092422
/* We do NOT restart the syslogger */

‎src/include/pgstat.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
*Copyright (c) 2001-2007, PostgreSQL Global Development Group
77
*
8-
*$PostgreSQL: pgsql/src/include/pgstat.h,v 1.55 2007/03/16 17:57:36 mha Exp $
8+
*$PostgreSQL: pgsql/src/include/pgstat.h,v 1.56 2007/03/22 19:53:31 momjian Exp $
99
* ----------
1010
*/
1111
#ifndefPGSTAT_H
@@ -369,7 +369,7 @@ extern void CreateSharedBackendStatus(void);
369369
externvoidpgstat_init(void);
370370
externintpgstat_start(void);
371371
externvoidpgstat_reset_all(void);
372-
372+
externvoidallow_immediate_pgstat_restart(void);
373373
#ifdefEXEC_BACKEND
374374
externvoidPgstatCollectorMain(intargc,char*argv[]);
375375
#endif

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp