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@candle.pha.pa.us | (610)
853-3000+ If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill,
Pennsylvania19026