[Zope3-checkins] CVS: ZODB4/src/zodb - conflict.py:1.14.14.1

Jeremy Hylton jeremy@zope.com
Wed, 18 Jun 2003 12:52:38 -0400


Update of /cvs-repository/ZODB4/src/zodb
In directory cvs.zope.org:/tmp/cvs-serv25225

Modified Files:
      Tag: ZODB3-2-merge
	conflict.py 
Log Message:
Add logging for failure to load committed data.

Remove XXX comment about IUndoStorage.  For a storage to support
conflict resolution, it must support multiple revisions.


=== ZODB4/src/zodb/conflict.py 1.14 => 1.14.14.1 ===
--- ZODB4/src/zodb/conflict.py:1.14	Thu May  1 15:34:58 2003
+++ ZODB4/src/zodb/conflict.py	Wed Jun 18 12:52:37 2003
@@ -23,6 +23,8 @@
 
 from zodb.interfaces import ConflictError
 from zodb.serialize import BaseObjectReader, ObjectWriter
+from zodb.interfaces import _fmt_oid
+from zodb.utils import u64
 
 ResolvedSerial = "rs"
 
@@ -167,13 +169,6 @@
             return None
         newstate = reader.getState(newpickle)
 
-        # XXX Using loadSerial() ties conflict resolution to the IUndoStorage
-        # interface.  This is a bad thing for non-versioning storages like
-        # BDBMinimalStorage and MemoryMinimalStorage because they don't
-        # support undo, and thus do not implement IUndoStorage.  IUndoStorage
-        # is the interface that defines loadSerial().  Hmm, maybe we should
-        # move loadSerial() out of that interface?
-
         p = self._storage.loadSerial(oid, oldSerial)
         try:
             old = reader.getState(p)
@@ -181,7 +176,13 @@
             logging.warn("CR: Error loading object: %s", err)
             return None
         if committedData is None:
-            committedData = self._storage.loadSerial(oid, committedSerial)
+            try:
+                committedData = self._storage.loadSerial(oid, committedSerial)
+            except KeyError:
+                logging.debug("CR: Could not load committed state "
+                              "oid=%s serial=%s" % (_fmt_oid(oid),
+                                                    u64(committedSerial)))
+                return None
         try:
             committed = reader.getState(committedData)
         except (EOFError, PicklingError), err: