[ZODB-Dev] ZODB _v_ attributes are tricky

Dieter Maurer dieter at handshake.de
Thu Apr 1 14:45:00 EST 2004


Neil Schemenauer wrote at 2004-3-31 13:20 -0500:
> ...
>The key point is that _v_ attributes
>that become invalid in one connection are not necessarily
>invalidated in other connections.

What does it mean that a "_v_" attribute "becomes invalid"?
Looks like a funny term for me.

>It's obvious when you think about
>it.  They have no OID themselves and so ZODB has no way of "talking"
>about them.
>
>If the _v_ attribute only depends on the non-persistent attributes
>of the object it is attached to then I think you are safe.  However,
>I'm not sure if ZODB does the right thing on abort.  Are the _v_
>attributes on dirty objects dropped?

When the objects are indeed dirty...

Note however, that writing an "_v_" attribute does *NOT* make
the object dirty. In this case, a transaction can
be aborted but the object retains its volatile attributes
set in this transaction.

You should also note another peculiarity in the treatment
of "_v_attributes". When you write an object
with "_v_attributes" (change one of its non-_v_attributes),
then the object is invalidated after "commit" in all connections *BUT*
the connection that made the change. This connection maintains
the "_v_" attributes for the object while all others (effectively)
loose it. Care must be taken not to retains old values.

-- 
Dieter



More information about the ZODB-Dev mailing list