Alvaro Herrera <[EMAIL PROTECTED]> 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



---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Reply via email to