Re: autovacuum does not start in HEAD - Mailing list pgsql-hackers

From ITAGAKI Takahiro
Subject Re: autovacuum does not start in HEAD
Date
Msg-id 20070507125824.8850.ITAGAKI.TAKAHIRO@oss.ntt.co.jp
Whole thread Raw
In response to Re: autovacuum does not start in HEAD  (Alvaro Herrera <alvherre@commandprompt.com>)
Responses Re: autovacuum does not start in HEAD
List pgsql-hackers
Alvaro Herrera <alvherre@commandprompt.com> wrote:

> ITAGAKI Takahiro wrote:
> > > I found that autovacuum launcher does not launch any workers in HEAD.
> > 
> > The attached autovacuum-fix.patch could fix the problem. I changed
> > to use 'greater or equal' instead of 'greater' at the decision of
> > next autovacuum target.
> 
> I have committed a patch which might fix this issue in autovacuum.c rev 1.44.
> Please retest.

HEAD (r1.45) is still broken. We skip entries using the test adl_next_worker - autovacuum_naptime < current_time <=
adl_next_worker,
but the second inequation should be adl_next_worker - autovacuum_naptime < current_time < adl_next_worker,
because adl_next_worker can equal current_time.

@@ -1036,8 +1036,8 @@                 * Skip this database if its next_worker value falls between                 * the
currenttime and the current time plus naptime.                 */
 
-                if (TimestampDifferenceExceeds(current_time,
-                                               dbp->adl_next_worker, 0) &&
+                if (!TimestampDifferenceExceeds(dbp->adl_next_worker,
+                                                current_time, 0) &&
!TimestampDifferenceExceeds(current_time,                                               dbp->adl_next_worker,
                                    autovacuum_naptime * 1000))
 

By the way, why do we need the upper bounds to decide a next target?
Can we use simplify it to "current_time < adl_next_worker"?

@@ -1033,16 +1033,11 @@            if (dbp->adl_datid == tmp->adw_datid)            {                /*
-                 * Skip this database if its next_worker value falls between
-                 * the current time and the current time plus naptime.
+                 * Skip this database if its next_worker value is later than
+                 * the current time.                 */
-                if (TimestampDifferenceExceeds(current_time,
-                                               dbp->adl_next_worker, 0) &&
-                    !TimestampDifferenceExceeds(current_time,
-                                                dbp->adl_next_worker,
-                                                autovacuum_naptime * 1000))
-                    skipit = true;
-
+                skipit = !TimestampDifferenceExceeds(dbp->adl_next_worker,
+                                                     current_time, 0);                break;            }
elem= DLGetPred(elem);
 

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center




pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: [COMMITTERS] pgsql: Teach tuplesort.c about "top N" sorting, in which only the first
Next
From: "Pavel Stehule"
Date:
Subject: Re: plperl vs. bytea