[ZODB-Dev] How to avoid shooting my foot

Casey Duncan casey@zope.com
Mon, 7 Oct 2002 22:24:45 -0400


I wonder if it would be useful to have a specific ZODB debug mode which=20
flushed objects from the cache on every write. To flush out problems such=
 as=20
this immediately. I guess this still wouldn't catch cases where you chang=
ed=20
*only* a mutable value in place, unless the mode could also hook Python s=
uch=20
that these changes were recorded and triggered an exception on commit. I'=
m=20
thinking the latter is not possible though or we wouldn't have this probl=
em.

-Casey

On Monday 07 October 2002 10:35 am, Jeremy Hylton wrote:
> I think debugging persistence applications is a bit more difficult in
> general.  The root problem, I think, is that all the object update
> machinery is hidden.  This machinery is also the chief advantage of
> ZODB; go figure.
>=20
> When the application has a bug in it, the objects just don't get
> stored in the database or don't get updated.  It isn't always obvious
> in either case.  The object continues to behave like a regular object
> until the next time the program runs and it isn't found.
>=20
> In addition to forgetting to set _p_changed, you can forget to make an
> object reachable from the root.  As a result, it never gets stored in
> the database at all.
>=20
> You can usually debug any of these problems by staring at the code for
> long enough <0.3 wink>.  I'm not sure how to quantify the pain.
> They're annoyances, not more severe.
>=20
> I've wondered if we can add some zLOG messages to help debug a little
> further.  It's easier to add positive logging than negative logging.
> That is, we could add a log message for each object modified by a
> transaction.  If an expected object isn't there, it would be a good
> indicator of a programming error.  It's harded to get negative
> logging.  For example, if a persistence object isn't reachable from
> the root, then there's no way to add a log message to that effect.
>=20
> Jeremy
>=20
>=20
> _______________________________________________
> For more information about ZODB, see the ZODB Wiki:
> http://www.zope.org/Wikis/ZODB/
>=20
> ZODB-Dev mailing list  -  ZODB-Dev@zope.org
> http://lists.zope.org/mailman/listinfo/zodb-dev
>=20