Merge lp:~lucio.torre/ubuntuone-client/dont-reorder-deletes into lp:ubuntuone-client

Proposed by Lucio Torre
Status: Merged
Approved by: Guillermo Gonzalez
Approved revision: 718
Merged at revision: 723
Proposed branch: lp:~lucio.torre/ubuntuone-client/dont-reorder-deletes
Merge into: lp:ubuntuone-client
Diff against target: 53 lines (+8/-11)
2 files modified
tests/syncdaemon/test_sync.py (+7/-2)
ubuntuone/syncdaemon/sync.py (+1/-9)
To merge this branch: bzr merge lp:~lucio.torre/ubuntuone-client/dont-reorder-deletes
Reviewer Review Type Date Requested Status
Guillermo Gonzalez Approve
John O'Brien (community) Approve
Review via email: mp+36353@code.launchpad.net

Commit message

make sure we dont reorder deletes

Description of the change

make sure we dont reorder deletes
with this change the conflict is avoided and integration tests pass
i dont know why this was done this way the first time.

To post a comment you must log in.
718. By Lucio Torre

added docs to test

Revision history for this message
John O'Brien (jdobrien) wrote :

go go go!

review: Approve
Revision history for this message
Guillermo Gonzalez (verterok) wrote :

looks good, tests pass.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/syncdaemon/test_sync.py'
2--- tests/syncdaemon/test_sync.py 2010-09-15 19:02:52 +0000
3+++ tests/syncdaemon/test_sync.py 2010-09-22 18:03:44 +0000
4@@ -1349,7 +1349,12 @@
5 self.handler.records = []
6
7 def test_handle_deletes_last(self):
8- """The handler for SV_FILE_DELETED is called last"""
9+ """The handler for SV_FILE_DELETED is not called last
10+
11+ If we reorder deletes we will get a fake conflict when a
12+ delete and move that overwrites the deleted file arrives.
13+ """
14+
15 self.create_filetxt()
16 self.create_dir()
17
18@@ -1373,7 +1378,7 @@
19 self.sync.handle_AQ_DELTA_OK(**kwargs)
20
21 # check that the handlers are called in order
22- self.assertEqual(called, ['hash', 'delete'])
23+ self.assertEqual(called, ['delete', 'hash'])
24
25 def test_exception_mark_node_as_dirty(self):
26 """We mark the node as dirty and send an event on error."""
27
28=== modified file 'ubuntuone/syncdaemon/sync.py'
29--- ubuntuone/syncdaemon/sync.py 2010-09-15 19:02:52 +0000
30+++ ubuntuone/syncdaemon/sync.py 2010-09-22 18:03:44 +0000
31@@ -1077,6 +1077,7 @@
32 # about it
33 if not dt.is_live:
34 to_delete.append(dt)
35+ self._handle_SV_FILE_DELETED(dt.share_id, dt.node_id)
36 # nothing else should happen with this
37 continue
38
39@@ -1146,15 +1147,6 @@
40 "Node delta for %s:%s can't be applied.",
41 dt.share_id, dt.node_id)
42
43- for dt in to_delete:
44- try:
45- # delete all the nodes after applying all deltas
46- self._handle_SV_FILE_DELETED(dt.share_id, dt.node_id)
47- except Exception:
48- self.logger.exception(
49- "Node delete for %s:%s can't be applied.",
50- dt.share_id, dt.node_id)
51-
52 # And mark the node as dirty
53 self.mark_node_as_dirty(dt.share_id, dt.node_id)
54

Subscribers

People subscribed via source and target branches