Commit 68b6c5e9 authored by Vincent Pelletier's avatar Vincent Pelletier

Do not work on local_var.conflict_serial_dict when resolving conflicts.

If a conflict gets reported while handling a previously-reported conflict
on the same object, second conflict is dropped on
  conflict_serial_dict.pop()
before it is handled.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2595 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 2b07640a
......@@ -761,15 +761,16 @@ class Application(object):
# Check for conflicts
data_dict = local_var.data_dict
object_serial_dict = local_var.object_serial_dict
conflict_serial_dict = local_var.conflict_serial_dict
conflict_serial_dict = local_var.conflict_serial_dict.copy()
local_var.conflict_serial_dict.clear()
resolved_conflict_serial_dict = local_var.resolved_conflict_serial_dict
for oid, conflict_serial_set in conflict_serial_dict.items():
for oid, conflict_serial_set in conflict_serial_dict.iteritems():
resolved_serial_set = resolved_conflict_serial_dict.setdefault(
oid, set())
conflict_serial = max(conflict_serial_set)
if resolved_serial_set and conflict_serial <= max(resolved_serial_set):
# A later serial has already been resolved, skip.
resolved_serial_set.update(conflict_serial_dict.pop(oid))
resolved_serial_set.update(conflict_serial_set)
continue
serial = object_serial_dict[oid]
data = data_dict[oid]
......@@ -783,8 +784,7 @@ class Application(object):
'%r:%r with %r', dump(oid), dump(serial),
dump(conflict_serial))
# Mark this conflict as resolved
resolved_serial_set.update(conflict_serial_dict.pop(
oid))
resolved_serial_set.update(conflict_serial_set)
# Try to store again
self._store(oid, conflict_serial, new_data)
append(oid)
......
......@@ -482,7 +482,6 @@ class ClientApplicationTests(NeoUnitTestBase):
self.assertRaises(ConflictError, app.waitStoreResponses,
failing_tryToResolveConflict)
self.assertTrue(oid not in app.local_var.data_dict)
self.assertEquals(app.local_var.conflict_serial_dict[oid], set([tid, ]))
self.assertEquals(app.local_var.object_stored_counter_dict[oid], {})
self.checkAskStoreObject(conn)
......
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