[ZODB-Dev] database conflict fail

Marius Gedminas marius at gedmin.as
Thu Mar 22 21:07:09 UTC 2012


On Thu, Mar 22, 2012 at 04:13:34PM -0400, Claudiu Saftoiu wrote:
> On Thu, Mar 22, 2012 at 2:45 PM, Vincent Pelletier <plr.vincent at gmail.com>wrote:
> 
> > Le jeudi 22 mars 2012 18:23:47, Claudiu Saftoiu a écrit :
> > > Ahh, now that looks promising. Are there any particularly good places to
> > > get documentation on that sort of thing? All I see when I google are
> > > mailing list archives.
> >
> > See ZODB/ConflictResolution.txt . Disclaimer: I didn't read it. I read the
> > code - but I expect the text file to be easier to assimilate :) .
> > BTrees/Length.py:Length class implements a simple _p_resolveConflict (yours
> > will be even simpler).
> 
> Thanks, I will take a look.
> 
> > There should be some details in the exceptoin itself. Like, oids, currently
> > commited TID and the TID transaction started with. root()._p_jar[the_oid]
> > will
> > get you the object. Then the hard part starts: guess where in the object
> > tree
> > that object is. If you have varied classes, and significant data on your
> > persistent instances, it will be easy.
> >
> 
> Ok, I just got a ConflictError:
> 
> ConflictError: database conflict error (oid 0x139c35, class
> BTrees.OOBTree.OOBucket, serial this txn started with 0x03954ed053c0ff88
> 2012-03-22 16:48:19.629820, serial currently committed 0x03954f996d61c944
> 2012-03-22 20:09:25.636401)
> 
> in my paster shell I do:
> 
> In [14]: root._p_jar[0x139c35]

OIDs are 64-bit numbers internally encoded as 8-byte-long binary strings.
Use

    >>> !from ZODB.utils import p64
    >>> p root._p_jar.get(p64(0x139c35))

or http://pypi.python.org/pypi/zodbbrowser

> 
> However, this causes:
> 
> In [14]: root._p_jar[0x139c35]
> ERROR: An unexpected error occurred while tokenizing input
> The following traceback may be corrupted or invalid
> The error message is: ('EOF in multi-line statement', (85, 0))

Where did the EOF come from?

(This is why I don't trust ipython.)

> 
> ---------------------------------------------------------------------------
> TypeError                                 Traceback (most recent call last)
> 
> /home/tsa/sports/<ipython console> in <module>()
> 
> /home/tsa/env/lib/python2.6/site-packages/ZODB/Connection.pyc in get(self,
> oid)
>     246             return obj
>     247
> --> 248         p, serial = self._storage.load(oid, '')
>     249         obj = self._reader.getGhost(p)
>     250
> 
> /home/tsa/env/lib/python2.6/site-packages/ZEO/ClientStorage.pyc in
> load(self, oid, version)
>     813         self._lock.acquire()    # for atomic processing of
> invalidations
>     814         try:
> --> 815             t = self._cache.load(oid)
>     816             if t:
>     817                 return t
> 
> /home/tsa/env/lib/python2.6/site-packages/ZEO/cache.pyc in call(*args, **kw)
>     141             inst._lock.acquire()
>     142             try:
> --> 143                 return self.func(inst, *args, **kw)
>     144             finally:
>     145                 inst._lock.release()
> 
> /home/tsa/env/lib/python2.6/site-packages/ZEO/cache.pyc in load(self, oid)
>     487     @locked
>     488     def load(self, oid):
> --> 489         ofs = self.current.get(oid)
>     490         if ofs is None:
>     491             self._trace(0x20, oid)
> 
> /home/tsa/env/lib/python2.6/site-packages/ZODB/fsIndex.pyc in get(self,
> key, default)
>     123
>     124     def get(self, key, default=None):
> --> 125         tree = self._data.get(key[:6], default)
>     126         if tree is default:
>     127             return default
> 
> TypeError: 'int' object is unsubscriptable

This makes more sense than the EOF error above.

Marius Gedminas
-- 
I am monolingual and English is the ling I mono.
        -- James Nicoll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://mail.zope.org/pipermail/zodb-dev/attachments/20120322/b746daa8/attachment.sig>


More information about the ZODB-Dev mailing list