multiple sessions to same destination

tim.conway at philips.com tim.conway at philips.com
Thu Oct 10 21:47:00 EST 2002


What I meant is that rsync won't crash.  It might, however, create a 
corrupt file.  first, it rolls down the file making the checksums.  THEN, 
it picks pieces out of the old file to interleave with data from the 
remote to create the new copy, so if it changes between the checksumming 
and the sending, you could definitely make a corrupt file.  Of course, if 
you are letting people modify the same item at the same time with no 
controls, you don't care about data integrity anyway, but you can keep the 
changes atomic, meaning that what each rsync writes is what it sent, by 
using the -W option, in which case, if there's any change to be sent at 
all, the whole thing comes from the remote, which will avoid the 
possibility of interleaving incorrect data.  (i should fix that big ugly 
run-on sentence, but i'll leave it to the reader)  Each file rsync creates 
starts out as a .file, with some random string on the end of the name to 
make it probably unique, and when it's finished, the original copy is 
unlinked, and the new one is renamed to the original's name.  So, what you 
could have would be two guys sending the same file.  first one to finish 
gets his file in place, and then his changes disappear when the second 
transfer finishes.

Tim Conway
conway.tim at sphlihp.com reorder name and reverse domain
303.682.4917 office, 303.921.0301 cell
Philips Semiconductor - Longmont TC
1880 Industrial Circle, Suite D
Longmont, CO 80501
Available via SameTime Connect within Philips, caesupport2 on AIM
"There are some who call me.... Tim?"




Derek Simkowiak <dereks at itsite.com>
10/10/2002 02:09 PM

 
        To:     Tim Conway/LMT/SC/PHILIPS at AMEC
        cc:     "Moughan, Laurence" <Laurence.Moughan at o2.com>
"'rsync at lists.samba.org'" <rsync at lists.samba.org>
        Subject:        Re: multiple sessions to same destination
        Classification: 



> Yeah, you're fine, as long as, as you say, no two sessions are accessing
> the same objects.  Even then, rsync handles it fairly well...

                 Can you elaborate on this?

                 Below is message I sent a while ago, but never got a 
response on.
I'd like to know what you mean by "rsync handles it fairly well".  Any
information you have would be greatly appreciated.

--
Date: Thu, 26 Sep 2002 17:24:53 -0700 (PDT)
Subject: Server writes...?


                 I have a quick question about rsync's writing of files.

                 I have a team of people that all use the host BigServer, 
which is
running rsync as a deamon, as a central place to keep all shared files
backed up.  The "master copy" for any given file is considered to be the
local file that somebody has worked on -- i.e., BigServer is NOT
considered the master copy.  BigServer is the backup copy.  Team members
back up their files to BigServer periodically with the rsync client.

                 Sometimes several team members work on the same file.  In 
this
case, the team member who most recently rsync'd their local copy up to
BigServer has a backup -- anyone else loses their "BigServer backup copy"
the instant one of the other team members uploads their version.  (The
semantics are exactly like a team sharing a single Samba share for
backup.)

                 The files the team write might be big, as in several 
dozen or
hundreds of megs.

                 Now to my question: What happens if three team members 
all try to
write the same huge file to BigServer at "the same time"?  Meaning, the
rsync daemon on BigServer gets three connections that start uploading
"/shared_space/bigfile.mov", before any one of the connections has
finished uploading its complete copy?

                 Is there any chance that the resulting 
"/shared_space/bigfile.mov"
on BigServer would have a corrupted copy, because several clients were
uploading at the same time?  Or, does the rsync daemon guarantee that the
last person (the 3rd team member to connect to BigServer) gets to upload
the final, uncorrupted version of "bigfile.mov" to BigServer?

                 Any help is greatly appreciated.  I've read all the docs 
I could
find but did not see this addressed.


Thank You,
Derek Simkowiak
dereks at itsite dot com

[...]
--

                 Since that email I have learned that rsync uploads to a 
temporary
file, and then copies or moves it over to the final destination.  (See the
--temp-dir option to rsync).  So I think the problem is reduced to the
question as "what if 3 logged in users cp (or mv?) a file to the same
destination at the same time".  But I'm not sure.

                 Any information is greatly appreciated.


Thanks,
Derek







More information about the rsync mailing list