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): ...@@ -47,11 +47,6 @@ class Length(persistent.Persistent):
def _p_resolveConflict(self, old, s1, s2): def _p_resolveConflict(self, old, s1, s2):
return s1 + s2 - old 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): def change(self, delta):
self.value += delta self.value += delta
......
...@@ -16,6 +16,10 @@ New Features ...@@ -16,6 +16,10 @@ New Features
- Removed the dependency on zope.proxy. - 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 Bugs Fixed
---------- ----------
......
...@@ -828,16 +828,9 @@ class Connection(ExportImport, object): ...@@ -828,16 +828,9 @@ class Connection(ExportImport, object):
# load. We can only be sure about invalidations after the # load. We can only be sure about invalidations after the
# load. # load.
# If an object has been invalidated, there are several cases # If an object has been invalidated, among the cases to consider:
# to consider: # - Try MVCC
# 1. Check _p_independent() # - Raise ConflictError.
# 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 self.before is not None: if self.before is not None:
# Load data that was current before the time we have. # Load data that was current before the time we have.
...@@ -855,9 +848,7 @@ class Connection(ExportImport, object): ...@@ -855,9 +848,7 @@ class Connection(ExportImport, object):
if self._invalidatedCache: if self._invalidatedCache:
raise ReadConflictError() raise ReadConflictError()
if (obj._p_oid in self._invalidated and if (obj._p_oid in self._invalidated):
not myhasattr(obj, "_p_independent")):
# If the object has _p_independent(), we will handle it below.
self._load_before_or_conflict(obj) self._load_before_or_conflict(obj)
return return
...@@ -871,11 +862,6 @@ class Connection(ExportImport, object): ...@@ -871,11 +862,6 @@ class Connection(ExportImport, object):
self._inv_lock.release() self._inv_lock.release()
if invalid: 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) self._load_before_or_conflict(obj)
return return
...@@ -926,25 +912,6 @@ class Connection(ExportImport, object): ...@@ -926,25 +912,6 @@ class Connection(ExportImport, object):
return True 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): def register(self, obj):
"""Register obj with the current transaction manager. """Register obj with the current transaction manager.
......
...@@ -30,16 +30,6 @@ import ZODB.tests.util ...@@ -30,16 +30,6 @@ import ZODB.tests.util
class P(Persistent): class P(Persistent):
pass 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): class ZODBTests(ZODB.tests.util.TestCase):
def setUp(self): def setUp(self):
...@@ -495,14 +485,6 @@ class ReadConflictTests(ZODB.tests.util.TestCase): ...@@ -495,14 +485,6 @@ class ReadConflictTests(ZODB.tests.util.TestCase):
self.obj = P() self.obj = P()
self.readConflict() self.readConflict()
def checkIndependent(self):
self.obj = Independent()
self.readConflict(shouldFail=False)
def checkNotIndependent(self):
self.obj = DecoyIndependent()
self.readConflict()
def checkReadConflictIgnored(self): def checkReadConflictIgnored(self):
# Test that an application that catches a read conflict and # Test that an application that catches a read conflict and
# continues can not commit the transaction later. # continues can not commit the transaction later.
......
...@@ -246,15 +246,6 @@ class IPersistent(Interface): ...@@ -246,15 +246,6 @@ class IPersistent(Interface):
object data to be reloaded. 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. # TODO: document conflict resolution.
class IPersistentDataManager(Interface): 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