pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Shea,Dan [CIS] <Dan.Shea@ec.gc.ca>
Cc: pgsql-performance@postgresql.org
Subject: Re: after using pg_resetxlog, db lost
Date: Wed, 23 Jun 2004 23:41:26 -0400
Message-ID: <8397.1088048486@sss.pgh.pa.us> (raw)
In-Reply-To: <644D07D3D59D8F408CD01AC2F833D8C62B9210@cisxa.cmc.int.ec.gc.ca>
References: <644D07D3D59D8F408CD01AC2F833D8C62B9210@cisxa.cmc.int.ec.gc.ca>

"Shea,Dan [CIS]" <Dan.Shea@ec.gc.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



view thread (9+ messages)  latest in thread

Message-ID: <8397.1088048486@sss.pgh.pa.us>
Permalink:  ../8397.1088048486@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/8397.1088048486@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, Dan.Shea@ec.gc.ca
  Subject: Re: after using pg_resetxlog, db lost
  In-Reply-To: <8397.1088048486@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox