>From 4937a10f0ce0217f70bc2aa15ea790e789d85a47 Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Wed, 17 Jun 2015 18:07:37 -0300 Subject: [PATCH] Clamp autovacuum launcher sleep time to 5 minutes --- src/backend/postmaster/autovacuum.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 5b69959..3cc437e 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -844,6 +844,14 @@ launcher_determine_sleep(bool canlaunch, bool recursing, struct timeval * nap) nap->tv_sec = 0; nap->tv_usec = MIN_AUTOVAC_SLEEPTIME * 1000; } + + /* + * If the sleep time is too large, clamp it to five minutes (plus some + * seconds, for simplicity). This avoids an essentially infinite sleep in + * strange cases like clocks going backwards a few years. + */ + if (nap->tv_sec > 300) + nap->tv_sec = 300; } /* -- 2.1.4