[ZODB-Dev] strange commit error

Jim Fulton jim at zope.com
Wed Dec 3 10:42:01 EST 2008


On Dec 3, 2008, at 5:50 AM, Miles wrote:

> Hi,
>
> I'm hoping that someone can help us understand what is going on here -
> though if it's the wrong list please let me know :-).  Although the
> context is zope, the nub of the issue seems to be ZODB-related.
>
> We needed to recover some old data that had been deleted from a
> FileStorage and wrote a small "zopectl" script to do this:
>
>  - we started zope with "zopectl debug";
>  - we used zc.beforestorage to open a separate COPY of the database at
> an earlier data;
>  - we located the objects in the old copy;
>  - we attempted to insert a copy of the OLD object into the current
> database (following zope's _getCopy method):
>
>         f=tempfile.TemporaryFile()
>         old_db_connection.exportFile(self._p_oid,f)
>         f.seek(0)
>         container = app.new_folder
>         ob=container._p_jar.importFile(f)
>
>  - this seemed to work fine, but when I go to commit, I get an error:
>
>    (from ZODB.serialize.py - line 350)
>
>            if obj._p_jar._implicitlyAdding(oid):
>                raise InvalidObjectReference(
>                    "A new object is reachable from multiple  
> databases. "
>                    "Won't try to guess which one was correct!"
>                    )
>
> Can anyone shed any light on what this error means?!

It means a new object is referenced from objects in multiple databases  
and it doesn't know what database to assign it to.

>  Given a persistent
> object, what is the correct way to get a completely fresh copy that is
> not tied to any database at all, so I can transfer these old objects  
> to
> the current database.

I would use the database export/import API to export it from one  
database and import it to another. (There are issues with doing this  
in Zope 3, but I assume you're using Zope 2.

Jim

--
Jim Fulton
Zope Corporation




More information about the ZODB-Dev mailing list