Re: autovacuum does not start in HEAD

From: ITAGAKI Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: autovacuum does not start in HEAD
Date: 2007-05-07 04:43:05
Message-ID: 20070507125824.8850.ITAGAKI.TAKAHIRO@oss.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Alvaro Herrera <alvherre(at)commandprompt(dot)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 current time 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2007-05-07 05:38:36 Re: plperl vs. bytea
Previous Message Alvaro Herrera 2007-05-07 02:45:52 Re: [COMMITTERS] pgsql: Teach tuplesort.c about "top N" sorting, in which only the first

Browse pgsql-patches by date

  From Date Subject
Next Message Magnus Hagander 2007-05-07 05:41:45 Re: Clear up strxfrm() in UTF-8 with locale on Windows
Previous Message ITAGAKI Takahiro 2007-05-07 01:54:45 Re: Clear up strxfrm() in UTF-8 with locale on Windows