Bruce Momjian wrote:
> > > I am not so concerned about this case but about other cases where we are
> > > computing xid distances across the invalid range.
> > 
> > Such as?
> 
> Not sure.  I have not had time to research this, but there might be
> cases where this backward movement matters --- remember our XIDs are
> valid only within about a 2 billion range, and we do less/greater
> comparisons in that range (using a macro).  That macro is not going to
> cover over backward xid movement.

OK, I am done training for the day, and found this macro:
        
        /* advance a transaction ID variable, handling wraparound correctly */
        #define TransactionIdAdvance(dest)  \
            do { \
                (dest)++; \
                if ((dest) < FirstNormalTransactionId) \
                    (dest) = FirstNormalTransactionId; \
            } while(0)

which seems OK, but we the -= all over varsup.c

    /*
     * We'll refuse to continue assigning XIDs in interactive mode once we get
     * within 1M transactions of data loss.  This leaves lots of room for the
     * DBA to fool around fixing things in a standalone backend, while not
     * being significant compared to total XID space. (Note that since
     * vacuuming requires one transaction per table cleaned, we had better be
     * sure there's lots of XIDs left...)
     */
    xidStopLimit = xidWrapLimit - 1000000;
    if (xidStopLimit < FirstNormalTransactionId)
        xidStopLimit -= FirstNormalTransactionId;

Now I am not sure where to add a C comment.  :-(

-- 
  Bruce Momjian  <br...@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to