Re: [GENERAL] getting status transaction error - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: [GENERAL] getting status transaction error
Date
Msg-id 20070206200000.GO22166@alvh.no-ip.org
Whole thread Raw
In response to Re: [GENERAL] getting status transaction error  ("Merlin Moncure" <mmoncure@gmail.com>)
Responses Re: [GENERAL] getting status transaction error  ("Merlin Moncure" <mmoncure@gmail.com>)
List pgsql-hackers
Merlin Moncure wrote:
> On 2/6/07, Alvaro Herrera <alvherre@commandprompt.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)

--
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

pgsql-hackers by date:

Previous
From: "Merlin Moncure"
Date:
Subject: Re: [GENERAL] getting status transaction error
Next
From: Alvaro Herrera
Date:
Subject: Re: [GENERAL] getting status transaction error