Skip to content

Commit

Permalink
Merge pull request #83 from zopefoundation/only-vote-reports-conflicts
Browse files Browse the repository at this point in the history
Only tpc_vote can report resolved conflicts with the new commit protocol
  • Loading branch information
jimfulton committed Jul 5, 2016
2 parents c95d47c + 19c1de9 commit d377efd
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 17 deletions.
2 changes: 1 addition & 1 deletion CHANGES.rst
Expand Up @@ -6,7 +6,7 @@
==================

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)
==================
Expand Down
2 changes: 1 addition & 1 deletion src/ZODB/ConflictResolution.py
Expand Up @@ -28,7 +28,7 @@

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):
pass
Expand Down
7 changes: 2 additions & 5 deletions src/ZODB/Connection.py
Expand Up @@ -706,18 +706,15 @@ def _store_objects(self, writer, transaction):

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
# while current. This is a convenient choke point to do this.
self._readCurrent.pop(oid, None)

if not serial:
return
if serial is True:
serial = ResolvedSerial
elif not isinstance(serial, bytes):
raise serial
assert isinstance(serial, bytes), serial
obj = self._cache.get(oid, None)
if obj is None:
return
Expand Down
11 changes: 1 addition & 10 deletions src/ZODB/tests/testDemoStorage.py
Expand Up @@ -46,8 +46,6 @@

class DemoStorage(ZODB.DemoStorage.DemoStorage):

delayed_store = False

def tpc_begin(self, *args):
super(DemoStorage, self).tpc_begin(*args)
self.__stored = []
Expand All @@ -57,16 +55,14 @@ def store(self, oid, *args):
if s != ResolvedSerial:
assert type(s) is bytes, s
return
if not self.delayed_store:
return True
self.__stored.append(oid)

tpc_vote = property(lambda self: self._tpc_vote, lambda *_: None)

def _tpc_vote(self, transaction):
s = self.changes.tpc_vote(transaction)
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):
r = []
Expand Down Expand Up @@ -143,11 +139,6 @@ def base_and_changes():
self._checkHistory(base_and_changes())
self._storage = self._storage.pop()

def checkResolveLate(self):
self._storage.delayed_store = True
self.checkResolve()


class DemoStorageHexTests(DemoStorageTests):

def setUp(self):
Expand Down

0 comments on commit d377efd

Please sign in to comment.