[Zope] Transactions

Martijn Pieters mj@digicool.com
Mon, 11 Jun 2001 09:54:09 +0200


On Sun, Jun 10, 2001 at 08:34:28PM +0100, Daniel Fairs wrote:
> Hi,
> 
> Reading some of the recent emails on Zope's transaction engine, something
> popped into my head which isn't mentioned in the book. How visible are
> Zope's transactions? I'm talking about the difference between read
> committed, read uncommitted and serializable transactions that you get in
> relational databases. I'm guessing that objects in Zope which participate in
> transactions can see changes made during that transaction? Is it possible to
> change this, so other transactions can read uncommitted data?

All objects accessed in the same thread use the same database connection,
and thus see the same uncommited data. Other threads use different
connections, and thus cannot see uncommited data from other threads. This
is part of the thread safety mechanims of Zope.

> Clearly, this isn't so important on smaller sites - but what happens when
> you start using Zope in high-transaction-volume sites?

If two threads try and commit conflicting data, on of the threads is
restarted with the new data from the other thread. Alternatively, the
object(s) involved in the conflict get a chance to resolve the conflict by
merging the uncommited data of the two threads.

This application-level conflict resolution protocol has been implemented
in Zope 2.3.1 and newer. See the original proposal:

  http://www.zope.org/Members/jim/ZODB/ApplicationLevelConflictResolution

-- 
Martijn Pieters
| Software Engineer  mailto:mj@digicool.com
| Digital Creations  http://www.digicool.com/
| Creators of Zope   http://www.zope.org/
---------------------------------------------