bzr, rsync, and atomic operations

John Arbash Meinel john at arbash-meinel.com
Fri Oct 14 15:04:46 BST 2005


Jan Hudec wrote:
> On Thu, Oct 13, 2005 at 13:41:42 -0500, John Arbash Meinel wrote:
> 
>>Well, for bzr, almost all writes to a file are done through "AtomicFile"
>>which means it writes to a temporary and copies it across.
> 
> 
> Does it work on Windows too? I know how atomic writes are done on POSIX
> using rename, but I am not sure Windows have the same semantics.

Well, we don't have truly atomic writes on windows. We still write to a
temporary, but instead of renaming over the existing file, we have to
delete it, and then rename into its place.
So it is "almost-atomic". It still is consistent, you just might end up
with nothing if something is interrupted at exactly the right time.

(Speaking of which, we probably should put in a couple of catches for
common exceptions like KeyboardInterrupt, to keep things working even then.)

> 
> Also where does the module come from? I can't seem to find it in python
> documentation nor in the cheese shop.

It is in the bzrlib source code. Not a separate module.
(bzrlib/atomicfile.py)

John
=:->

> 
> --
> 						 Jan 'Bulb' Hudec <bulb at ucw.cz>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20051014/f3408f0a/attachment.pgp 


More information about the bazaar mailing list