[ZODB-Dev] Locating backrefs of persistent objects
Jim Fulton
jim at zope.com
Thu Dec 17 16:30:58 EST 2009
On Thu, Dec 17, 2009 at 4:06 PM, Marius Gedminas <marius at gedmin.as> wrote:
> 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.
...
> ? Is there existing code I could use for inspiration? zodbex? zc.zodbgc?
> Bits and pieces of ZODB itself?
zc.zodbdgc's multi-zodb-check-refs script will optionally produce a database
of reverse references that your browser could use.
Note that building this database can take a very long time.
Jim
--
Jim Fulton
More information about the ZODB-Dev
mailing list