[ZODB-Dev] ZODB4 project plan

Phillip J. Eby pje@telecommunity.com
Wed, 27 Nov 2002 20:02:23 -0500


At 12:33 AM 11/28/02 +0100, Magnus Lycka wrote:
>At 11:22 2002-11-27 -0500, Phillip J. Eby wrote:
>>Speaking of YAGNI's and ZODB4, does anybody have any actual use cases for 
>>nested transactions?  I notice that's listed on the project plan, but I 
>>thought that discussion on the Persistence-SIG suggested them to be overkill.
>
>While it's currently not a concrete issue for us, I've been wondering
>about how to use undo in our app SystemSpecifyer (now at sourceforge)
>when we make it a multi user application.
>
>I'd like to be able to combine multi user functionality with a fine
>grained undo feature (as in a word processor), and I planned to use
>ZODB undo.
>
>If I commit a transaction to ZEO and some other user commits another
>transaction after that, I suppose I can't undo my changes without
>undoing the other user's changes.

That's only true if both transactions touch the same object in some way 
(e.g. a ZCatalog).  Otherwise, transactions can be undone independently, 
and this doesn't require either versions or subtransactions.


>Typically, different users don't change the same objects, so I guess
>I could use versions (but it's just been a thought).

Versions actually were intended for situations rather like yours, but 
really the only service they provide is ensuring that other users know what 
items others have changed, and preventing others from changing the locked 
objects until the version is either committed or aborted.

If you'd rather let everybody change things, and just occasionally have to 
deal with overlapping undo, you don't need versions.


>Then I guessed
>(without having investigated this) that changes in subtransactions
>aren't written to ZEO until the main tranaction commits, and then I
>suppose I could use this for my fine grained undo, but if both
>features go away, I don't quite know how to solve this.

If I understand your requirements correctly, "plain old undo" should do 
what you want.  In theory, versions *might* be helpful, but in practice 
versions don't really scale well for multi-user edits, IMHO.

Subtransactions or nested transactions, on the other hand, won't help your 
use case even in theory.  :)