Idea for nested transactions / savepoints

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Idea for nested transactions / savepoints
Date: 2001-08-05 04:32:39
Message-ID: 200108050432.f754Wdo11696@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I have been thinking about how to implement nested transactions /
savepoints. As you may remember, Vadim wants to add UNDO to WAL and
thus enable this feature.

Some objected because of the added WAL complexity and the problem with
long running transactions requiring lots of WAL segments.

I have not been able to come up with any solution that doesn't have some
UNDO capability to mark aborted tuples of the current transaction.

My idea is that we not put UNDO information into WAL but keep a List of
rel ids / tuple ids in the memory of each backend and do the undo inside
the backend. We could go around and clear our transaction id from
tuples that need to be undone.

Basically, I am suggesting a per-backend UNDO segment. This seems to
enable nested transactions without the disadvantages of putting it in
WAL.

Am I missing something about why UNDO should be in WAL?

I realize UNDO in WAL would allow UNDO of any transaction, but we don't
need that in our current non-overwriting system. It is only nested
transactions we need to undo, and I don't think we need WAL writing for
that because we are always undoing something before we commit the main
transaction. In a crash recover, the entire transaction is aborted
anyway.

--
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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hannu Krosing 2001-08-05 05:48:44 Re: Question about todo item
Previous Message Tom Lane 2001-08-05 03:55:24 Re: Question about todo item