Commit d5084e27 authored by Jim Fulton's avatar Jim Fulton

Removed support for the _p_independent mini framework, which was

made moot by the introduction of multi-version concurrency control
several years ago.
parent 4cb43575
......@@ -47,11 +47,6 @@ class Length(persistent.Persistent):
def _p_resolveConflict(self, old, s1, s2):
return s1 + s2 - old
def _p_independent(self):
# My state doesn't depend on or materially effect the state of
# other objects.
return 1
def change(self, delta):
self.value += delta
......
......@@ -16,6 +16,10 @@ New Features
- Removed the dependency on zope.proxy.
- Removed support for the _p_independent mini framework, which was
made moot by the introduction of multi-version concurrency control
several years ago.
Bugs Fixed
----------
......
......@@ -828,16 +828,9 @@ class Connection(ExportImport, object):
# load. We can only be sure about invalidations after the
# load.
# If an object has been invalidated, there are several cases
# to consider:
# 1. Check _p_independent()
# 2. Try MVCC
# 3. Raise ConflictError.
# Does anything actually use _p_independent()? It would simplify
# the code if we could drop support for it.
# (BTrees.Length does.)
# If an object has been invalidated, among the cases to consider:
# - Try MVCC
# - Raise ConflictError.
if self.before is not None:
# Load data that was current before the time we have.
......@@ -855,9 +848,7 @@ class Connection(ExportImport, object):
if self._invalidatedCache:
raise ReadConflictError()
if (obj._p_oid in self._invalidated and
not myhasattr(obj, "_p_independent")):
# If the object has _p_independent(), we will handle it below.
if (obj._p_oid in self._invalidated):
self._load_before_or_conflict(obj)
return
......@@ -871,13 +862,8 @@ class Connection(ExportImport, object):
self._inv_lock.release()
if invalid:
if myhasattr(obj, "_p_independent"):
# This call will raise a ReadConflictError if something
# goes wrong
self._handle_independent(obj)
else:
self._load_before_or_conflict(obj)
return
self._load_before_or_conflict(obj)
return
self._reader.setGhostState(obj, p)
obj._p_serial = serial
......@@ -926,25 +912,6 @@ class Connection(ExportImport, object):
return True
def _handle_independent(self, obj):
# Helper method for setstate() handles possibly independent objects
# Call _p_independent(), if it returns True, setstate() wins.
# Otherwise, raise a ConflictError.
if obj._p_independent():
self._inv_lock.acquire()
try:
try:
self._invalidated.remove(obj._p_oid)
except KeyError:
pass
finally:
self._inv_lock.release()
else:
self._conflicts[obj._p_oid] = 1
self._register(obj)
raise ReadConflictError(object=obj)
def register(self, obj):
"""Register obj with the current transaction manager.
......
......@@ -30,16 +30,6 @@ import ZODB.tests.util
class P(Persistent):
pass
class Independent(Persistent):
def _p_independent(self):
return 1
class DecoyIndependent(Persistent):
def _p_independent(self):
return 0
class ZODBTests(ZODB.tests.util.TestCase):
def setUp(self):
......@@ -495,14 +485,6 @@ class ReadConflictTests(ZODB.tests.util.TestCase):
self.obj = P()
self.readConflict()
def checkIndependent(self):
self.obj = Independent()
self.readConflict(shouldFail=False)
def checkNotIndependent(self):
self.obj = DecoyIndependent()
self.readConflict()
def checkReadConflictIgnored(self):
# Test that an application that catches a read conflict and
# continues can not commit the transaction later.
......
......@@ -246,15 +246,6 @@ class IPersistent(Interface):
object data to be reloaded.
"""
class IPersistentNoReadConflicts(IPersistent):
def _p_independent():
"""Hook for subclasses to prevent read conflict errors.
A specific persistent object type can define this method and
have it return true if the data manager should ignore read
conflicts for this object.
"""
# TODO: document conflict resolution.
class IPersistentDataManager(Interface):
......
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