I'd like to implement the following feature for zodbbrowser: given a
persistent object X, find all other persistent objects that have
references to it.

My use case for this is debugging: e.g. given a log entry that mentions
a conflict error about an OOBTreeBucket, I'd like to know which OOBTree
object contains it, and what object wraps the OOBTree, and at that point
I usually see a container with a __name__ and __parent__ and can figure
out what's going on.

I realize that ZODB doesn't keep track of backreferences, so the only
way to get that is to do a full object traversal, which is expensive in
both CPU and memory.

Given all that, what's the best (most efficient) way of computing the
backreferences either for a single object, or for _all_ objects in the
ZODB (that I could then cache for later use)?

  * implement something by hand, by using storage iterators and
    extracting forward references from each pickle

or

  * implement something by hand, by doing graph traversal (BFS/DFS)
    starting from the root object

or

  * reuse existing object graph traversal routines of the ZODB garbage
    collector

?  Is there existing code I could use for inspiration?  zodbex?  zc.zodbgc?
Bits and pieces of ZODB itself?

The wishlist bug for this feature is here:
https://bugs.launchpad.net/zodbbrowser/+bug/497758

Marius Gedminas
-- 
Linux don't need no steenkin' viruses. The users can destroy the
system all by themselves....
                -- Peter Dalgaard in comp.os.linux.misc

Attachment: signature.asc
Description: Digital signature

_______________________________________________
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zodb-dev

Reply via email to