Re: Documentation on page files - Mailing list pgsql-hackers

From Martijn van Oosterhout
Subject Re: Documentation on page files
Date
Msg-id 20020423175200.A13917@svana.org
Whole thread Raw
In response to Re: Documentation on page files  (Hannu Krosing <hannu@tm.ee>)
Responses Re: Documentation on page files
Re: Documentation on page files
List pgsql-hackers
On Tue, Apr 23, 2002 at 09:15:22AM +0200, Hannu Krosing wrote:
> On Tue, 2002-04-23 at 01:29, Martijn van Oosterhout wrote:
> > 
> > The dumping is more of an extra, the original idea was to check for errors
> > in the datafiles. Hence the working name of "pgfsck". At the moment the
> > dumping dumps only tuples where xmax == 0 but I'm not sure if that's
> > correct.
> 
> AFAIK it is not. As Tom once explained me, it is ok for tuples xmax to
> be !=0 and still have a valid tuple. The validity is determined by some
> bits in tuple header.

Well, from my thinking about how you would use these fields in a logical
way, it seems it's possible for xmax to be non-zero if the transaction
numbered xmax was not committed. But in that case (unless it was a delete)
there would be a newer tuple with the same oid but xmax == 0 (and this
uncommitted transaction as xmin).

The problem is that inside the DB, you have a current transaction plus a
list of committed transactions. Externally, you have no idea, so xmax == 0
is as valid a view as any other. This would have the effect of dumping out
whatever would be visible if every transaction were committed.

I think. If anyone knows a good document on MVCC implementations, let me
know.

> But I think the most useful behaviour should be to dump system fields
> too, so mildly knowledgeable sysadmin can import the dump and do the
> right thing afterwards (like restore data as it was before transaction
> nr 7000)

Well, i didn't think you could have statements of the form:

insert into table (xmin,xmax,cmin,cmax,...) values (...);

So you would have to leave it as a comment. In which case someone would have
to go and by hand work out what would be in or out. I can make it an option
but I don't think it would be particularly useful. Maybe
--pretend-uncommitted <xact>

Just a thought, if I did a "delete from table" accedently, and stopped the
postmaster and twiddled the xlog for that transaction, would that have the
effect of undeleting those tuples?
-- 
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Canada, Mexico, and Australia form the Axis of Nations That
> Are Actually Quite Nice But Secretly Have Nasty Thoughts About America


pgsql-hackers by date:

Previous
From: Dave Page
Date:
Subject: Re: Implement a .NET Data
Next
From: Curt Sampson
Date:
Subject: Re: "make report"