[ZODB-Dev] Re: [Persistence-sig] "Straw Man" transaction API

Jeremy Hylton jeremy@alum.mit.edu
Thu, 1 Aug 2002 10:58:50 -0400


>>>>> "AB" == Anthony Baxter <anthony@interlink.com.au> writes:

  >>>> Barry A. Warsaw wrote
  >> Say you had savepoint(t1), savepoint(t2), and savepoint(t3) where
  >> t1 < t2 < t3.  Then you rolled back savepoint(t1) and then try to
  >> rollback savepoint(t3), you'd get an exception right?

Yes.  RollbackError.

  AB> If you have multiple savepoints in the same transaction, should
  AB> you be allowed to roll back the one that's not the most recent?
  AB> To my brain, this doesn't make sense...

It does make sense.  It's all about saving partial progress so that
you can return to it later if something goes wrong.  Nested
transactions are an example of something that wants to rollback to
arbitrary earlier savepoints.  If part of a subtransaction fails, you
need to rollback to th beginning of the subtransaction.  You need not
abort the entire transaction, because some part of the application can
recover and continue from the last savepoint.  In particular, the
state of persistent objects gets rollback but the total state of your
application (e.g. control flow, non-persistent local variables, etc.)
is not.

Jeremy