Re: after using pg_resetxlog, db lost

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Shea,Dan [CIS]" <Dan(dot)Shea(at)ec(dot)gc(dot)ca>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: after using pg_resetxlog, db lost
Date: 2004-06-24 03:41:26
Message-ID: 8397.1088048486@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

"Shea,Dan [CIS]" <Dan(dot)Shea(at)ec(dot)gc(dot)ca> writes:
> Tom I see you from past emails that you reference using -i -f with
> pg_filedump. I have tried this, but do not know what I am looking at.

What you want to look at is valid XMIN and XMAX values. In this
example:

> Item 1 -- Length: 196 Offset: 4292 (0x10c4) Flags: USED
> XID: min (2) CMIN|XMAX: 211 CMAX|XVAC: 469
> Block Id: 0 linp Index: 1 Attributes: 24 Size: 28
> infomask: 0x2912 (HASVARWIDTH|HASOID|XMIN_COMMITTED|XMAX_INVALID|UPDATED)

the infomask shows XMIN_COMMITTED, so xmin (here 2) is valid, but it also
shows XMAX_INVALID, so the putative XMAX (211) should be ignored.

In general the xmin field should be valid, but xmax shares storage with
cmin and so you have to look at the infomask bits to know whether to
believe that the cmin/xmax field represents a transaction ID.

The cmax/xvac field could also hold a transaction ID. If I had only
the above data to go on, I'd guess that the current transaction counter
is at least 469.

Under normal circumstances, command counter values (cmin or cmax) are
unlikely to exceed a few hundred, while the transaction IDs you are
looking for are likely to be much larger. So you could get away with
just computing the max of *all* the numbers you see in xmin, cmin/xmax,
or cmax/cvac, and then using something a million or so bigger for safety
factor.

regards, tom lane

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Laurent Martelli 2004-06-24 12:25:33 Re: Pas la samedi
Previous Message Shea,Dan [CIS] 2004-06-24 02:46:49 Re: after using pg_resetxlog, db lost