[Zope-DB] newbie: read access to a object in midst of transaction

Dieter Maurer dieter at handshake.de
Wed Oct 8 15:27:55 EDT 2003


Nesbitt, Steve wrote at 2003-10-7 16:27 -0700:
 > ...
 > I am trying to determine if implementing these registries in ZODB will
 > provide this behavior. In particular:
 > 1) What is the lookup behavior if I wrap the regeneration behavior in a
 > transaction? If I've started but not yet completed a transaction, do lookup
 > requests a) see the pre-transaction start registry objects

Yes

 > or b) or block
 > (throwing an exception)

No

 > or c) see the incomplete object in the midst of
 > regeneration

No


 > 2) If it doesn't block, is there a way I can make it (or at least return an
 > indicator that the results may be out of date)?

You have to use your own looks.

 > 3) Once the transaction has completed successfully, do all copies of the
 > registries get updated immediately?

No. The completing transaction sends invalidation messages to
all other connections. They process the invalidation requests at
transaction boundaries. If, however, they try to read an invalidated object
and do not find the object already in their cache, they
get a "ReadConflictError" (which usually restarts the request
automatically).

 > 4) Am I barking up the wrong tree here - using the wrong tool/concepts to
 > solve this problem.

If you really need blocking, the ZODB is not the right tool
as it avoids locks and uses an optimistic concurrency protocol.


Dieter



More information about the Zope-DB mailing list