On 03/29/2011 07:39 PM, Erik Dahl wrote:
> I was running a pack and canceled so that I could reboot my box.  After it 
> came back up I tried to restart the pack and got this:
>    File 
> "/opt/zenoss/lib/python2.6/site-packages/RelStorage-1.4.2-py2.6.egg/relstorage/adapters/packundo.py",
>  line 397, in _add_refs_for_tid
>      self.runner.run_many(cursor, stmt, add_rows)
> IntegrityError: (1062, "Duplicate entry '255911127406517196-2714-893440' for 
> key 'PRIMARY'")

Ah, I recognize this now.  This is a minor bug that I believe has been 
fixed for 1.5.0.  It only affects packing; it has zero impact on your 

The bug occurs when filling the object_ref table for packing.  If you 
interrupt the pack operation while the object_ref table is being filled, 
the corresponding entry in object_refs_added will not be created and the 
next attempt to pack will try again and stumble in exactly this way. 
The bug has been solved by replacing entries in object_ref rather than 
just inserting them.  The object_ref and object_refs_added tables are 
only used during packing.

Perhaps the quickest thing to do is remove only the offending entries:

delete from object_refs_added where tid = 255911127406517196;
delete from object_ref where tid = 255911127406517196;

A bit of trivia: that error message says that object 2714 in transaction 
255911127406517196 has at least one direct reference to object 893440.

For more information about ZODB, see the ZODB Wiki:

ZODB-Dev mailing list  -  ZODB-Dev@zope.org

Reply via email to