Re: [ZODB-Dev] Locating backrefs of persistent objects

2009-12-17 Thread Jim Fulton
On Thu, Dec 17, 2009 at 4:06 PM, Marius Gedminas mar...@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
___
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


Re: [ZODB-Dev] Locating backrefs of persistent objects

2009-12-17 Thread Shane Hathaway
Marius Gedminas 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.

RelStorage has this functionality, but I don't know how we ought to 
expose it.  Start a pack to update the graph, then query the object_ref 
table.  Turn on pack-dry-run if you only want to update the table and 
don't want to pack.

I'd like to make RelStorage implement some Python API for listing 
backreferences, but no such API has been defined.

Shane

___
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