Commit 6a686360 authored by Julien Muchembled's avatar Julien Muchembled

client: small optimization in _handleConflicts

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2810 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 75ea48b1
...@@ -580,7 +580,6 @@ class Application(object): ...@@ -580,7 +580,6 @@ class Application(object):
conflict_serial = max(conflict_serial_set) conflict_serial = max(conflict_serial_set)
serial = object_serial_dict[oid] serial = object_serial_dict[oid]
data = data_dict[oid] data = data_dict[oid]
resolved = False
if ZERO_TID in conflict_serial_set: if ZERO_TID in conflict_serial_set:
# Storage refused us from taking object lock, to avoid a # Storage refused us from taking object lock, to avoid a
# possible deadlock. TID is actually used for some kind of # possible deadlock. TID is actually used for some kind of
...@@ -610,7 +609,7 @@ class Application(object): ...@@ -610,7 +609,7 @@ class Application(object):
self._store(txn_context, store_oid, store_serial, self._store(txn_context, store_oid, store_serial,
store_data, unlock=True) store_data, unlock=True)
else: else:
resolved = True continue
elif data is not None: elif data is not None:
resolved_serial_set = resolved_conflict_serial_dict.setdefault( resolved_serial_set = resolved_conflict_serial_dict.setdefault(
oid, set()) oid, set())
...@@ -632,22 +631,19 @@ class Application(object): ...@@ -632,22 +631,19 @@ class Application(object):
# Try to store again # Try to store again
self._store(txn_context, oid, conflict_serial, new_data) self._store(txn_context, oid, conflict_serial, new_data)
append(oid) append(oid)
resolved = True continue
else: else:
neo.lib.logging.info('Conflict resolution failed for ' \ neo.lib.logging.info('Conflict resolution failed for ' \
'%r:%r with %r', dump(oid), dump(serial), '%r:%r with %r', dump(oid), dump(serial),
dump(conflict_serial)) dump(conflict_serial))
if not resolved: # XXX: Is it really required to remove from data_dict ?
# XXX: Is it really required to remove from data_dict ? del data_dict[oid]
del data_dict[oid] txn_context['data_list'].remove(oid)
txn_context['data_list'].remove(oid) if data is None:
if data is None: raise ReadConflictError(oid=oid, serials=(conflict_serial,
exc = ReadConflictError(oid=oid, serials=(conflict_serial, serial))
serial)) raise ConflictError(oid=oid, serials=(txn_context['ttid'],
else: serial), data=data)
exc = ConflictError(oid=oid, serials=(txn_context['ttid'],
serial), data=data)
raise exc
return result return result
@profiler_decorator @profiler_decorator
......
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