Re: PITR and rollback

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Dhruv Pilania <dhruv(at)cs(dot)sunysb(dot)edu>
Cc: pgsql-hackers(at)postgresql(dot)org, richt(at)multera(dot)com
Subject: Re: PITR and rollback
Date: 2002-07-23 22:15:27
Message-ID: 200207232215.g6NMFR107689@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Any chance you can work on save points/nested transactions? See
doc/TODO.detail/transactions for info. I can help explaining the ideas
in there.

---------------------------------------------------------------------------

Dhruv Pilania wrote:
> Hi,
>
> I am a new postgresql developer. needed some help with wal/PITR. Can
> someone working in this area answer my question?
> (the email looks long but the question is simple :) )
>
> I have been trying to implement undo of transactions using wal. i.e. given
> a xid x, postgres can undo all operations of x. For starters, I
> want to do this in very simple cases i.e. assume x only
> inserts/updates/deletes tuples and does not change database schema. also I
> assume that all of x's wal entries are in one segment.
>
> The code for this is quite simple if database supports undo or rollback to
> a point in time. There is a lot of discussion on the mailing list about
> PITR. I am eagerly waiting for the PITR code to be available on cvs. so
> my questions are....
>
> 1. once PITR has been implemented, infinite play forward will work. Will
> undo also be supported? i.e. can we recover to the past from a "current"
> wal log?
> as a very simple scenario---
> xid 1 " insert record y in relation r" commit
> xid 2 " update record x in relation r" commit
> shutdown
> ---now we take database back to start of xid 1.
>
> if answer to qn 1 is no...
> 2. my approach is something like this,
> scan log back until start of transaction record
> scan forward until commit record
> if record is for transaction x
> undo(record)
> to undo,
> use preimage in record and everything else is pretty much same as redo.
> i.e. we open relation, get desired block and work on it etc.
> can someone tell me if this will work?
>
>
> hoping someone currently working on wal/pitr can help me on this
> issues....
>
> thanks,
> Dhruv
>
>
> PS.
>
> transaction dependency tracking
> -------------------------------
> I added support in postgres to do transaction dependency tracking.
> basically, x depends on y if x reads something written by y. I maintain a
> dependency graph and also a corresponding disk based log that is accessed
> only at transaction commit. there is a tool which can be used to query
> this graph. the time over heads are pretty low (< 1%).
> with a dependency graph a DBA can say " I want to undo transaction x and
> all transactions that depend on x".
>
> so now in the second phase, I am looking at undo of a transactions. any
> thoughts on this are very welcome....
>
>
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2002-07-23 23:13:18 Re: contrib/ltree for 7.2 or 7.3 ?
Previous Message Edwin S. Ramirez 2002-07-23 21:42:12 Oracle Decode Function