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

Commita75fb9b

Browse files
committed
Have autovacuum workers listen to SIGHUP, too
They have historically ignored it, but it's been said to be useful attimes to change their settings mid-flight.Author: Michael Paquier
1 parent6e4bf4e commita75fb9b

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

‎src/backend/postmaster/autovacuum.c

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ static PgStat_StatTabEntry *get_pgstat_tabentry_relid(Oid relid, bool isshared,
311311
PgStat_StatDBEntry*shared,
312312
PgStat_StatDBEntry*dbentry);
313313
staticvoidautovac_report_activity(autovac_table*tab);
314-
staticvoidavl_sighup_handler(SIGNAL_ARGS);
314+
staticvoidav_sighup_handler(SIGNAL_ARGS);
315315
staticvoidavl_sigusr2_handler(SIGNAL_ARGS);
316316
staticvoidavl_sigterm_handler(SIGNAL_ARGS);
317317
staticvoidautovac_refresh_stats(void);
@@ -419,7 +419,7 @@ AutoVacLauncherMain(int argc, char *argv[])
419419
* backend, so we use the same signal handling. See equivalent code in
420420
* tcop/postgres.c.
421421
*/
422-
pqsignal(SIGHUP,avl_sighup_handler);
422+
pqsignal(SIGHUP,av_sighup_handler);
423423
pqsignal(SIGINT,StatementCancelHandler);
424424
pqsignal(SIGTERM,avl_sigterm_handler);
425425

@@ -1329,7 +1329,7 @@ AutoVacWorkerFailed(void)
13291329

13301330
/* SIGHUP: set flag to re-read config file at next convenient time */
13311331
staticvoid
1332-
avl_sighup_handler(SIGNAL_ARGS)
1332+
av_sighup_handler(SIGNAL_ARGS)
13331333
{
13341334
intsave_errno=errno;
13351335

@@ -1460,11 +1460,8 @@ AutoVacWorkerMain(int argc, char *argv[])
14601460
* Set up signal handlers. We operate on databases much like a regular
14611461
* backend, so we use the same signal handling. See equivalent code in
14621462
* tcop/postgres.c.
1463-
*
1464-
* Currently, we don't pay attention to postgresql.conf changes that
1465-
* happen during a single daemon iteration, so we can ignore SIGHUP.
14661463
*/
1467-
pqsignal(SIGHUP,SIG_IGN);
1464+
pqsignal(SIGHUP,av_sighup_handler);
14681465

14691466
/*
14701467
* SIGINT is used to signal canceling the current table's vacuum; SIGTERM
@@ -2163,6 +2160,22 @@ do_autovacuum(void)
21632160

21642161
CHECK_FOR_INTERRUPTS();
21652162

2163+
/*
2164+
* Check for config changes before processing each collected table.
2165+
*/
2166+
if (got_SIGHUP)
2167+
{
2168+
got_SIGHUP= false;
2169+
ProcessConfigFile(PGC_SIGHUP);
2170+
2171+
/*
2172+
* You might be tempted to bail out if we see autovacuum is now
2173+
* disabled. Must resist that temptation -- this might be a
2174+
* for-wraparound emergency worker, in which case that would be
2175+
* entirely inappropriate.
2176+
*/
2177+
}
2178+
21662179
/*
21672180
* hold schedule lock from here until we're sure that this table still
21682181
* needs vacuuming. We also need the AutovacuumLock to walk the

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp