[ZODB-Dev] Locating backrefs of persistent objects
Marius Gedminas
marius at gedmin.as
Thu Dec 17 16:06:27 EST 2009
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mail.zope.org/pipermail/zodb-dev/attachments/20091217/517ebc42/attachment.bin
More information about the ZODB-Dev
mailing list