Commit d377efd3 authored by Jim Fulton's avatar Jim Fulton Committed by GitHub

Merge pull request #83 from zopefoundation/only-vote-reports-conflicts

Only tpc_vote can report resolved conflicts with the new commit protocol
parents c95d47c1 19c1de99
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
================== ==================
Better support of the new commit protocol. This fixes issues with blobs and Better support of the new commit protocol. This fixes issues with blobs and
undo. See https://github.com/zopefoundation/ZODB/pull/77 undo. See pull requests #77, #80, #83
4.4.1 (2016-07-01) 4.4.1 (2016-07-01)
================== ==================
......
...@@ -28,7 +28,7 @@ from pickle import PicklingError ...@@ -28,7 +28,7 @@ from pickle import PicklingError
logger = logging.getLogger('ZODB.ConflictResolution') logger = logging.getLogger('ZODB.ConflictResolution')
ResolvedSerial = b'rs' # deprecated: store/tpc_finish should just use True ResolvedSerial = b'rs' # deprecated: see IMultiCommitStorage.tpc_vote
class BadClassName(Exception): class BadClassName(Exception):
pass pass
......
...@@ -706,7 +706,7 @@ class Connection(ExportImport, object): ...@@ -706,7 +706,7 @@ class Connection(ExportImport, object):
self._handle_serial(oid, s) self._handle_serial(oid, s)
def _handle_serial(self, oid, serial=True, change=True): def _handle_serial(self, oid, serial=ResolvedSerial, change=True):
# if we write an object, we don't want to check if it was read # if we write an object, we don't want to check if it was read
# while current. This is a convenient choke point to do this. # while current. This is a convenient choke point to do this.
...@@ -714,10 +714,7 @@ class Connection(ExportImport, object): ...@@ -714,10 +714,7 @@ class Connection(ExportImport, object):
if not serial: if not serial:
return return
if serial is True: assert isinstance(serial, bytes), serial
serial = ResolvedSerial
elif not isinstance(serial, bytes):
raise serial
obj = self._cache.get(oid, None) obj = self._cache.get(oid, None)
if obj is None: if obj is None:
return return
......
...@@ -46,8 +46,6 @@ from ZODB.ConflictResolution import ResolvedSerial ...@@ -46,8 +46,6 @@ from ZODB.ConflictResolution import ResolvedSerial
class DemoStorage(ZODB.DemoStorage.DemoStorage): class DemoStorage(ZODB.DemoStorage.DemoStorage):
delayed_store = False
def tpc_begin(self, *args): def tpc_begin(self, *args):
super(DemoStorage, self).tpc_begin(*args) super(DemoStorage, self).tpc_begin(*args)
self.__stored = [] self.__stored = []
...@@ -57,8 +55,6 @@ class DemoStorage(ZODB.DemoStorage.DemoStorage): ...@@ -57,8 +55,6 @@ class DemoStorage(ZODB.DemoStorage.DemoStorage):
if s != ResolvedSerial: if s != ResolvedSerial:
assert type(s) is bytes, s assert type(s) is bytes, s
return return
if not self.delayed_store:
return True
self.__stored.append(oid) self.__stored.append(oid)
tpc_vote = property(lambda self: self._tpc_vote, lambda *_: None) tpc_vote = property(lambda self: self._tpc_vote, lambda *_: None)
...@@ -66,7 +62,7 @@ class DemoStorage(ZODB.DemoStorage.DemoStorage): ...@@ -66,7 +62,7 @@ class DemoStorage(ZODB.DemoStorage.DemoStorage):
def _tpc_vote(self, transaction): def _tpc_vote(self, transaction):
s = self.changes.tpc_vote(transaction) s = self.changes.tpc_vote(transaction)
assert s is None, s assert s is None, s
return self.__stored if self.delayed_store else s return self.__stored
def tpc_finish(self, transaction, func = lambda tid: None): def tpc_finish(self, transaction, func = lambda tid: None):
r = [] r = []
...@@ -143,11 +139,6 @@ class DemoStorageTests( ...@@ -143,11 +139,6 @@ class DemoStorageTests(
self._checkHistory(base_and_changes()) self._checkHistory(base_and_changes())
self._storage = self._storage.pop() self._storage = self._storage.pop()
def checkResolveLate(self):
self._storage.delayed_store = True
self.checkResolve()
class DemoStorageHexTests(DemoStorageTests): class DemoStorageHexTests(DemoStorageTests):
def setUp(self): def setUp(self):
......
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