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

Commitda1a9d0

Browse files
committed
Clamp autovacuum launcher sleep time to 5 minutes
This avoids the problem that it might go to sleep for an unreasonableamount of time in unusual conditions like the server clock movingbackwards an unreasonable amount of time.(Simply moving the server clock forward again doesn't solve the problemunless you wake up the autovacuum launcher manually, say by sending itSIGHUP).Per trouble report from Prakash Itnal inhttps://www.postgresql.org/message-id/CAHC5u79-UqbapAABH2t4Rh2eYdyge0Zid-X=Xz-ZWZCBK42S0Q@mail.gmail.comAnalyzed independently by Haribabu Kommi and Tom Lane.
1 parentbe87143 commitda1a9d0

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

‎src/backend/postmaster/autovacuum.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ intLog_autovacuum_min_duration = -1;
128128

129129
/* the minimum allowed time between two awakenings of the launcher */
130130
#defineMIN_AUTOVAC_SLEEPTIME 100.0/* milliseconds */
131+
#defineMAX_AUTOVAC_SLEEPTIME 300/* seconds */
131132

132133
/* Flags to tell if we are in an autovacuum process */
133134
staticboolam_autovacuum_launcher= false;
@@ -844,6 +845,15 @@ launcher_determine_sleep(bool canlaunch, bool recursing, struct timeval * nap)
844845
nap->tv_sec=0;
845846
nap->tv_usec=MIN_AUTOVAC_SLEEPTIME*1000;
846847
}
848+
849+
/*
850+
* If the sleep time is too large, clamp it to an arbitrary maximum (plus
851+
* any fractional seconds, for simplicity). This avoids an essentially
852+
* infinite sleep in strange cases like the system clock going backwards a
853+
* few years.
854+
*/
855+
if (nap->tv_sec>MAX_AUTOVAC_SLEEPTIME)
856+
nap->tv_sec=MAX_AUTOVAC_SLEEPTIME;
847857
}
848858

849859
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp