Merge lp:~dobey/ubuntuone-client/fix-getdelta-3-0 into lp:ubuntuone-client/stable-3-0

Proposed by dobey
Status: Merged
Approved by: Roberto Alsina
Approved revision: 1187
Merged at revision: 1188
Proposed branch: lp:~dobey/ubuntuone-client/fix-getdelta-3-0
Merge into: lp:ubuntuone-client/stable-3-0
Diff against target: 36 lines (+15/-0)
2 files modified
tests/syncdaemon/test_action_queue.py (+9/-0)
ubuntuone/syncdaemon/action_queue.py (+6/-0)
To merge this branch: bzr merge lp:~dobey/ubuntuone-client/fix-getdelta-3-0
Reviewer Review Type Date Requested Status
Roberto Alsina (community) Approve
Review via email: mp+106064@code.launchpad.net

Commit message

Use PathLockTree to get one GetDelta at a time.

To post a comment you must log in.
Revision history for this message
Roberto Alsina (ralsina) :
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_action_queue.py'
2--- tests/syncdaemon/test_action_queue.py 2012-04-24 20:47:43 +0000
3+++ tests/syncdaemon/test_action_queue.py 2012-05-16 22:12:18 +0000
4@@ -4478,6 +4478,15 @@
5 cmd = GetDelta(self.rq, 'vol', 1)
6 self.assertEqual(cmd.uniqueness, ('GetDelta', 'vol'))
7
8+ def test_path_locking(self):
9+ """Test that it acquires correctly the path lock."""
10+ t = []
11+ self.patch(PathLockingTree, 'acquire',
12+ lambda s, *a, **k: t.extend((a, k)))
13+ cmd = GetDelta(self.rq, 'volume_id', 123)
14+ cmd._acquire_pathlock()
15+ self.assertEqual(t, [('GetDelta', 'volume_id'), {'logger': None}])
16+
17
18 class GetDeltaFromScratchTestCase(ConnectedBaseTestCase):
19 """Test for GetDelta ActionQueueCommand."""
20
21=== modified file 'ubuntuone/syncdaemon/action_queue.py'
22--- ubuntuone/syncdaemon/action_queue.py 2012-04-24 18:56:40 +0000
23+++ ubuntuone/syncdaemon/action_queue.py 2012-05-16 22:12:18 +0000
24@@ -2070,6 +2070,12 @@
25 self.log = mklog(logger, 'GetDelta', self.volume_id,
26 None, generation=self.generation)
27
28+ def _acquire_pathlock(self):
29+ """Acquire pathlock."""
30+ pathlock = self.action_queue.pathlock
31+ return pathlock.acquire('GetDelta', str(self.volume_id),
32+ logger=self.log)
33+
34
35 class GetDeltaFromScratch(ActionQueueCommand):
36 """Get a delta from scratch."""

Subscribers

People subscribed via source and target branches

to all changes: