[Zodb-checkins] CVS: ZODB3/ZODB/tests - ConflictResolution.py:1.8.8.1
Jeremy Hylton
jeremy@zope.com
Mon, 28 Oct 2002 11:05:17 -0500
Update of /cvs-repository/ZODB3/ZODB/tests
In directory cvs.zope.org:/tmp/cvs-serv25182/ZODB/tests
Modified Files:
Tag: ZODB3-3_1-branch
ConflictResolution.py
Log Message:
Revert change that removed blanket try/except for conflict resolution.
There are a lot of exceptions that can occur when you try to load
objects from the database for conflict resolution. Reports from the
field are that unexpected errors were causing transactions to fail
hard instead of raising conflict error.
Concrete example:
Traceback (most recent call last):
File "/home/zope/opt/Python_2_1_3/lib/python2.1/site-packages/ZEO/StorageServe
r.py", line 494, in store
self.txn)
File "/home/zope/opt/Python_2_1_3/lib/python2.1/site-packages/Standby/primary.
py", line 131, in store
r = self._storage.store(oid, serial, data, version, t)
File "/home/zope/opt/Python_2_1_3/lib/python2.1/site-packages/ZODB/FileStorage
.py", line 702, in store
data=self.tryToResolveConflict(oid, oserial, serial, data)
File "/home/zope/opt/Python_2_1_3/lib/python2.1/site-packages/ZODB/ConflictRes
olution.py", line 95, in tryToResolveConflict
newstate = unpickler.load()
ImportError: No module named DateTime.DateTime
The solution is to restore the blanket try/except with a log call if
the error isn't a ConflictError. I'd like to do a more careful
analysis of what exceptions can be raised and narrow down the
try/except, but that's too much change to do right now.
=== ZODB3/ZODB/tests/ConflictResolution.py 1.8 => 1.8.8.1 ===
--- ZODB3/ZODB/tests/ConflictResolution.py:1.8 Wed Aug 14 18:07:09 2002
+++ ZODB3/ZODB/tests/ConflictResolution.py Mon Oct 28 11:05:17 2002
@@ -104,7 +104,7 @@
# pickle is to commit two different transactions relative to
# revid1 that add two to _value.
revid2 = self._dostoreNP(oid, revid=revid1, data=zodb_pickle(obj))
- self.assertRaises(AttributeError,
+ self.assertRaises(ConflictError,
self._dostoreNP,
oid, revid=revid1, data=zodb_pickle(obj))
@@ -122,7 +122,7 @@
# pickle is to commit two different transactions relative to
# revid1 that add two to _value.
revid2 = self._dostoreNP(oid, revid=revid1, data=zodb_pickle(obj))
- self.assertRaises(TypeError,
+ self.assertRaises(ConflictError,
self._dostoreNP,
oid, revid=revid1, data=zodb_pickle(obj))