Re: [HACKERS] getting status transaction error

From: "Merlin Moncure" <mmoncure(at)gmail(dot)com>
To: "Merlin Moncure" <mmoncure(at)gmail(dot)com>, "postgres general" <pgsql-general(at)postgresql(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] getting status transaction error
Date: 2007-02-06 20:48:57
Message-ID: b42b73150702061248h412187bar34a9e5dc29dc28fb@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On 2/6/07, Alvaro Herrera <alvherre(at)commandprompt(dot)com> wrote:
> Merlin Moncure wrote:
> > On 2/6/07, Alvaro Herrera <alvherre(at)commandprompt(dot)com> wrote:
> > >> actually, here is some more relevant bits from the log.
> > >> Feb 6 06:31:33 mojo postgres[1088]: [1-1] :: LOG: autovacuum:
> > >> processing database "template0"
> > >> Feb 6 06:31:33 mojo postgres[1088]: [2-1] :: ERROR: could not access
> > >> status of transaction 544441911
> > >> Feb 6 06:31:33 mojo postgres[1088]: [2-2] :: DETAIL: could not open
> > >> file "pg_clog/0207": No such file or directory
> > >
> > Latest checkpoint's NextXID: 2162841139
> > 2^31: 2147483648
>
> I think the relevant arithmetic here is
>
> echo "2162841139 544441911 - p" | dc
> 1618399228
>
> That's a billion and a half transactions. Autovacuum uses the formula
>
> this_whole_db = (tmp->age >
> (int32) ((MaxTransactionId >> 3) * 3 - 100000));
>
> to determine whether it needs database-wide vacuum.
> (MaxTransactionId >> 3) is 536870911, so the calculation is
> 536870911 * 3 - 100000
>
> echo "536870911 3 * 100000 - p" | dc
> 1610512733
>
> which looks awfully close to the number above. About 7 million
> transactions must have passed since the first time the error showed up
> -- does that sound likely?
>
> Well, scratch that -- what's the _current_ Xid? (not lastest
> checkpoint's)

I don't know any better way to get that than this:
postgres=# insert into foo default values;
INSERT 0 1
postgres=# select xmin,xmax from foo;
xmin | xmax
------------+------
2163877346 | 0
(1 row)

merlin

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2007-02-06 20:51:11 Re: PostgreSQL/FireBird
Previous Message Thomas F. O'Connell 2007-02-06 20:44:22 8.2.2 Announcement?

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2007-02-06 20:50:34 Re: Status of autovacuum and the sporadic stats failures ?
Previous Message Alvaro Herrera 2007-02-06 20:40:06 Re: Status of autovacuum and the sporadic stats failures ?