Merge lp://qastaging/~facundo/ubuntuone-client/plt-fixpath into lp://qastaging/ubuntuone-client
Proposed by
Facundo Batista
Status: | Merged |
---|---|
Approved by: | Facundo Batista |
Approved revision: | 1311 |
Merged at revision: | 1321 |
Proposed branch: | lp://qastaging/~facundo/ubuntuone-client/plt-fixpath |
Merge into: | lp://qastaging/ubuntuone-client |
Diff against target: |
512 lines (+385/-12) 5 files modified
contrib/testing/testcase.py (+1/-0) tests/syncdaemon/test_pathlockingtree.py (+273/-0) tests/syncdaemon/test_sync.py (+6/-5) ubuntuone/syncdaemon/action_queue.py (+100/-7) ubuntuone/syncdaemon/sync.py (+5/-0) |
To merge this branch: | bzr merge lp://qastaging/~facundo/ubuntuone-client/plt-fixpath |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Guillermo Gonzalez | Approve | ||
Manuel de la Peña (community) | Approve | ||
Review via email:
|
Commit message
Fix the PathLockTree elements on a move operation.
Description of the change
Fix the PathLockTree elements on a move operation.
Tests included.
To post a comment you must log in.
Here is some background for the other reviewers:
<facundobatista> so... the situation is the following, the PathLockTree locks operations on other operations regarding the path
<facundobatista> if you touch a file 'foo', a MakeFile and Upload are queued, the Makefile will be executed, taking the lock on 'foo', the Upload will be locked because of the same path
<facundobatista> when Makefile finishes, it releases the lock, the Upload jumps in, all happy
<facundobatista> so, if you then do something like "ls > foo; mv foo bar"
* pedronis has quit (Ping timeout: 246 seconds)
<facundobatista> syncdaemon will get the FILE_CREATE and CLOSE_WRITE and will queue the Makefile and actually send HQ to hash the file
<facundobatista> the Makefile will be executed, taking the lock on 'foo'
<facundobatista> of course, there's a move really fast after the CREATE and CLOSE
<facundobatista> internal stuff is adjusted because of that move
<facundobatista> milliseconds later, the HQ jumps in, and tries to hash 'foo', it gets an error because the file moved! so after that error the correct path is taken (MOVE adjusted internal stuff!), and finally HQ hashes 'bar'
<facundobatista> when HQ finishes hashing bar, it queues an Upload
<facundobatista> the Upload tries to get the pathlock on 'bar' and it succeeds!!!
<facundobatista> because the Makefile was holding a lock on 'foo'
<facundobatista> so the Upload jumps in, but out of order
<facundobatista> so
<facundobatista> the fix does the following
<facundobatista> when the MOVE is processed by syncdaemon
<facundobatista> it adjusts the path of PathLockTree, changing 'foo' to 'bar', there
<facundobatista> so, the Upload will be locked
<facundobatista> and that's all
<facundobatista> it made me to change a little the internals of PathLockTree, but that's another more complex story