Commit f901cdd6 authored by Jeremy Hylton's avatar Jeremy Hylton

Make sure _setstate_noncurrent() returns True on success.

Bug reported by Dieter Maurer.

The change required several of the read-conflict tests to be updated
to specify that they don't want MVCC support.  It was basically
accidental that they passed before this change.  Note that we don't
have any tests of code that gets a read conflict in MVCC mode, which
would only be possible after a pack() or in some other weird case.
parent 32ddff9f
......@@ -13,7 +13,7 @@
##############################################################################
"""Database connection support
$Id: Connection.py,v 1.111 2004/01/06 03:05:45 tim_one Exp $"""
$Id: Connection.py,v 1.112 2004/01/06 03:44:53 jeremy Exp $"""
import logging
import sys
......@@ -532,6 +532,7 @@ class Connection(ExportImport, object):
self._noncurrent[obj._p_oid] = True
self._reader.setGhostState(obj, data)
obj._p_serial = start
return True
def _handle_independent(self, obj):
# Helper method for setstate() handles possibly independent objects
......
......@@ -212,7 +212,7 @@ class ZODBTests(unittest.TestCase):
# error because the object state read is not necessarily
# consistent with the objects read earlier in the transaction.
conn = self._db.open()
conn = self._db.open(mvcc=False)
conn.setLocalTransaction()
r1 = conn.root()
r1["p"] = self.obj
......@@ -220,7 +220,7 @@ class ZODBTests(unittest.TestCase):
conn.getTransaction().commit()
# start a new transaction with a new connection
cn2 = self._db.open()
cn2 = self._db.open(mvcc=False)
# start a new transaction with the other connection
cn2.setLocalTransaction()
r2 = cn2.root()
......@@ -245,7 +245,7 @@ class ZODBTests(unittest.TestCase):
def checkReadConflictIgnored(self):
# Test that an application that catches a read conflict and
# continues can not commit the transaction later.
root = self._db.open().root()
root = self._db.open(mvcc=False).root()
root["real_data"] = real_data = PersistentMapping()
root["index"] = index = PersistentMapping()
......@@ -256,7 +256,7 @@ class ZODBTests(unittest.TestCase):
get_transaction().commit()
# load some objects from one connection
cn2 = self._db.open()
cn2 = self._db.open(mvcc=False)
cn2.setLocalTransaction()
r2 = cn2.root()
real_data2 = r2["real_data"]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment