Re: Bug in autovacuum.c? - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Bug in autovacuum.c?
Date
Msg-id 201103312035.p2VKZ1l26221@momjian.us
Whole thread Raw
In response to Re: Bug in autovacuum.c?  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Bug in autovacuum.c?
List pgsql-hackers
Robert Haas wrote:
> >> > The effect is to map max xid + 1 to max xid -
> >> > FirstNormalTransactionId(3) + 1, which makes the xid look like it is
> >> > going backwards, less than max xid --- not good.
> >>
> >> The XID space is *circular*.
> >
> > Right but you would think that as the xid moves forward, the caculation
> > of how far back to vacuum should move only forward. ?In this case,
> > incrementing the xid by one would cause the vacuum horizon to move
> > backward by two.
> 
> I don't see how that would happen.   The XID immediately preceding
> FirstNormalTransactionId is 2^32-1, and that's exactly what this
> calculation produces.

OK, let me see if I understand --- the caculation is below:
   xidForceLimit = recentXid - autovacuum_freeze_max_age;   if (xidForceLimit < FirstNormalTransactionId)
xidForceLimit-= FirstNormalTransactionId;
 

The values:
xidForceLimit    Result---------------------------max_xid-2    max_xid-2max_xid-1    max_xid-1max_xid        max_xid0
    max_xid-3    <- backward here1        max_xid-22        max_xid-13        3
 

With the -= change to =, we get:
xidForceLimit    Result---------------------------max_xid-2    max_xid-2max_xid-1    max_xid-1max_xid        max_xid0
    31        32        33        3
 

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com
 + It's impossible for everything to be true. +


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: pg_upgrade exit_nicely()
Next
From: AAMIR KHAN
Date:
Subject: GSoC 2011 Eager MV implementation proposal