[ZODB-Dev] [Problem] "_v_" variables too volatile

Dieter Maurer dieter at handshake.de
Wed Dec 10 06:32:19 EST 2003


ZODB "_v_" variables are often used to hold objects that need
to be available during the complete request.
Examples are:

 * database connections,
 
 * "_v_skindata" in the skins tool
 
 * and "EnhanceObjectManager", a product of mine that uses "_v_"
   variable to give "manage_afterAdd/beforeDelete" more information
   about their context.

The ZODB flushes its cache only at transaction boundaries.
Therefore, "_v_" attributes behave usually for the use cases above.
If however, subtransactions are used, these use cases can break
non-deterministically.


There are two options:

  *  abandon "_v_" variables for such use cases

     We then need a new device for these use cases

  *  prevent objects with "_v_" variables from being flushed
     at subtransaction boundaries


Unless I do not here strong objections, I will extend
the ZODB such that:

  *  setting a "_v_" attribute of a "Persistent" object
     sets a "_p_volatile" attribute.

  *  "incrGC" gets an argument "flushVolatile", defaulting to "1".
     If not set, objects with "_p_volatile" are not flushed

  *  in "subtransaction commit/abort" "incrGC" is called
     with "flushVolatile=0".


-- 
Dieter



More information about the ZODB-Dev mailing list