Re: Documentation on page files

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Hannu Krosing <hannu(at)tm(dot)ee>
Cc: "Ross J(dot) Reedstrom" <reedstrm(at)ece(dot)rice(dot)edu>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Documentation on page files
Date: 2002-04-23 07:52:00
Message-ID: 20020423175200.A13917@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)svana(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Curt Sampson 2002-04-23 08:18:14 Re: "make report"
Previous Message Dave Page 2002-04-23 07:25:55 Re: Implement a .NET Data