Bug 3719 - --update should avoid overwriting a concurrently changed dest file
Summary: --update should avoid overwriting a concurrently changed dest file
Status: ASSIGNED
Alias: None
Product: rsync
Classification: Unclassified
Component: core (show other bugs)
Version: 2.6.9
Hardware: Sparc Solaris
: P3 enhancement (vote)
Target Milestone: ---
Assignee: Wayne Davison
QA Contact: Rsync QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-24 12:11 UTC by Yair Lenga
Modified: 2008-06-23 19:39 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yair Lenga 2006-04-24 12:11:03 UTC
I'm using rsync to update a "semi-live" repository of files, where users may update either the master or the backup repository. I'm using '--update' to make sure that old files do not overwrite newer files.

In the current code, the timestamp is capture and compared at the beginning of the transfer. At this point, a decision is made if the update will be performed. This implementation create a window where a file on the recieving side can be updated, and then overwritten by a file from the backup repository.

Suggested fix will be to add an extra check for the timestamp of the destination file, before renaming the temporary file into the final name.

With this check, the window where newer files can be written will be reduced to few milliseconds - much better then the current window - few seconds - depending on file size, communication gap, etc. The cost for the extra 'stat' is minor (compared with the overall cost of getting the update).
Comment 1 Wayne Davison 2006-04-24 14:05:58 UTC
I'll consider this.