Re: Autovacuum loose ends

From: Alvaro Herrera
Subject: Re: Autovacuum loose ends
Date: ,
Msg-id: 20050723011605.GC2734@alvh.no-ip.org
(view: Whole thread, Raw)
In response to: Re: Autovacuum loose ends  (Tom Lane)
List: pgsql-hackers

Tree view

Autovacuum loose ends  (Tom Lane, )
 Re: Autovacuum loose ends  ("Matthew T. O'Connor", )
  Re: Autovacuum loose ends  (Tom Lane, )
   Re: Autovacuum loose ends  ("Matthew T. O'Connor", )
   Re: Autovacuum loose ends  (Greg Stark, )
   Re: Autovacuum loose ends  (Hannu Krosing, )
   Re: Autovacuum loose ends  (Ron Mayer, )
    Re: Autovacuum loose ends  (Tom Lane, )
 Re: Autovacuum loose ends  (Alvaro Herrera <-ip.org>, )
  Re: Autovacuum loose ends  (Tom Lane, )
  Re: Autovacuum loose ends  (Tom Lane, )
 Re: Autovacuum loose ends  (Alvaro Herrera <-ip.org>, )
  Re: Autovacuum loose ends  (Tom Lane, )
   Re: Autovacuum loose ends  (Alvaro Herrera <-ip.org>, )

On Fri, Jul 22, 2005 at 07:37:53PM -0400, Tom Lane wrote:
> Alvaro Herrera <-ip.org> writes:
> > I've hacked the whole thing enough that I fixed most of the issues.
> > However this one I don't know how to handle.  What I need to do is
> > compare each database's frozen Xid with the current transaction Id.
> > I can get the frozenxid from the flatfile -- however I don't have
> > anything with which to compare it.  I tried ReadNewTransactionId(), but
> > it doesn't work because it tries to acquire a LWLock, which isn't
> > possible because we don't have a PGPROC before connecting to a database.
> 
> > I guess I could the Xid from pg_control.  This seems unclean however.
> > Opinions about doing that?  Better ideas?
> 
> Getting it from pg_control isn't that bad; the value could be as old as
> the last checkpoint, but that should be close enough for this purpose.

Ok, fair enough.

That makes me wonder however if the test should be heavier.  Right now,
the test is
       /*        * We decide to vacuum at the same point where vacuum.c's        * vac_truncate_clog() would decide
startgiving warnings.        */       age = (int32) (ReadNewTransactionId() - db->frozenxid);       whole_db = (age >
(int32)((MaxTransactionId >> 3) * 3));
 

Now that we are going to test a TransactionId that was current slightly
in the past, maybe it should instead read
       whole_db = (age > (int32) ((MaxTransactionId >> 3) * 4));

so that vac_truncate_clog doesn't start emitting warning just before we
do the vacuum.

-- 
Alvaro Herrera (<alvherre[a]alvh.no-ip.org>)
FOO MANE PADME HUM



pgsql-hackers by date:

From: "Luke Lonergan"
Date:
Subject: Re: A Guide to Constraint Exclusion (Partitioning)
From: Simon Riggs
Date:
Subject: Re: A Guide to Constraint Exclusion (Partitioning)