[Christian Heimes, suggests changing Transaction.commit() to start with
# TODO deprecate subtransactions
self._subtransaction_savepoint = self.savepoint(1)
i.e. swapping the first two blocks]
> subtransactions != savepoints
> There is *no* promise of nestability with subtransactions. Committing a
> subtransaction invalidates prior savepoints by design. This is necessary
> to maintain backward compatibility.
I'm not sure I follow this: old code could not be using savepoints
directly, so what would break in code that stuck solely to subtxn commits?
The internal savepoint used to implement commit(1) now isn't exposed to
users, so they couldn't roll back directly to older subtxn commits, and the
transaction internals only remember the (internal) savepoint for the most
recent commit(1) done.
So I don't see how backward compatibility would be injured. BTW, I tried
it, and all the ZODB tests pass with this change.
> If you don't like this behavior, don't use subtransactions. A good
> community project would be to convert all of the subtransaction calls in
> Zope to savepoint calls.
Yup. Speaking of which, some of the comments say subtxns are deprecated,
but they're not really. It's too late to deprecate them in 3.4 (for 3.6).
Is it OK to deprecate them now in 3.5 (for 3.7)? I would like to, and
deprecation nags are good motivators. If not 3.5, in 3.6 (for 3.8)?
For more information about ZODB, see the ZODB Wiki:
ZODB-Dev mailing list - ZODB-Dev@zope.org