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

Commitfb7df89

Browse files
committed
Reload config file in startup process on SIGHUP.
Fujii Masao
1 parent820984b commitfb7df89

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

‎src/backend/access/transam/xlog.c

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.332 2009/02/23 09:28:49 heikki Exp $
10+
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.333 2009/03/04 13:56:40 heikki Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -429,6 +429,7 @@ static bool InRedo = false;
429429
/*
430430
* Flag set by interrupt handlers for later service in the redo loop.
431431
*/
432+
staticvolatilesig_atomic_tgot_SIGHUP= false;
432433
staticvolatilesig_atomic_tshutdown_requested= false;
433434
/*
434435
* Flag set when executing a restore command, to tell SIGTERM signal handler
@@ -5362,6 +5363,15 @@ StartupXLOG(void)
53625363
}
53635364
#endif
53645365

5366+
/*
5367+
* Check if we were requested to re-read config file.
5368+
*/
5369+
if (got_SIGHUP)
5370+
{
5371+
got_SIGHUP= false;
5372+
ProcessConfigFile(PGC_SIGHUP);
5373+
}
5374+
53655375
/*
53665376
* Check if we were requested to exit without finishing
53675377
* recovery.
@@ -7641,6 +7651,13 @@ startupproc_quickdie(SIGNAL_ARGS)
76417651
}
76427652

76437653

7654+
/* SIGHUP: set flag to re-read config file at next convenient time */
7655+
staticvoid
7656+
StartupProcSigHupHandler(SIGNAL_ARGS)
7657+
{
7658+
got_SIGHUP= true;
7659+
}
7660+
76447661
/* SIGTERM: set flag to abort redo and exit */
76457662
staticvoid
76467663
StartupProcShutdownHandler(SIGNAL_ARGS)
@@ -7667,8 +7684,8 @@ StartupProcessMain(void)
76677684
/*
76687685
* Properly accept or ignore signals the postmaster might send us
76697686
*/
7670-
pqsignal(SIGHUP,SIG_IGN);/*ignore config file updates */
7671-
pqsignal(SIGINT,SIG_IGN);/* ignore query cancel */
7687+
pqsignal(SIGHUP,StartupProcSigHupHandler);/*reload config file */
7688+
pqsignal(SIGINT,SIG_IGN);/* ignore query cancel */
76727689
pqsignal(SIGTERM,StartupProcShutdownHandler);/* request shutdown */
76737690
pqsignal(SIGQUIT,startupproc_quickdie);/* hard crash time */
76747691
pqsignal(SIGALRM,SIG_IGN);

‎src/backend/postmaster/postmaster.c

Lines changed: 3 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.575 2009/03/03 10:42:05 heikki Exp $
40+
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.576 2009/03/04 13:56:40 heikki Exp $
4141
*
4242
* NOTES
4343
*
@@ -1949,6 +1949,8 @@ SIGHUP_handler(SIGNAL_ARGS)
19491949
(errmsg("received SIGHUP, reloading configuration files")));
19501950
ProcessConfigFile(PGC_SIGHUP);
19511951
SignalChildren(SIGHUP);
1952+
if (StartupPID!=0)
1953+
signal_child(StartupPID,SIGHUP);
19521954
if (BgWriterPID!=0)
19531955
signal_child(BgWriterPID,SIGHUP);
19541956
if (WalWriterPID!=0)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp