[ZODB-Dev] How to avoid shooting my foot

Jeremy Hylton jeremy@zope.com
Mon, 7 Oct 2002 10:35:14 -0400


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.

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.

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.

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.

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.

Jeremy