From: | Bruce Momjian <bruce(at)momjian(dot)us> |
---|---|
To: | Robert Haas <robertmhaas(at)gmail(dot)com> |
Cc: | Alvaro Herrera <alvherre(at)commandprompt(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Bug in autovacuum.c? |
Date: | 2011-03-31 20:35:01 |
Message-ID: | 201103312035.p2VKZ1l26221@momjian.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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-2
max_xid-1 max_xid-1
max_xid max_xid
0 max_xid-3 <- backward here
1 max_xid-2
2 max_xid-1
3 3
With the -= change to =, we get:
xidForceLimit Result
---------------------------
max_xid-2 max_xid-2
max_xid-1 max_xid-1
max_xid max_xid
0 3
1 3
2 3
3 3
--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ It's impossible for everything to be true. +
From | Date | Subject | |
---|---|---|---|
Next Message | AAMIR KHAN | 2011-03-31 20:38:22 | GSoC 2011 Eager MV implementation proposal |
Previous Message | Peter Eisentraut | 2011-03-31 20:31:33 | pg_upgrade exit_nicely() |