Windows file locking with bzr 2.2.3

John Arbash Meinel john at arbash-meinel.com
Thu Feb 24 22:12:59 UTC 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


...
> On Thu, Feb 24, 2011 at 03:47:52PM -0600, John Arbash Meinel wrote:
>> On Windows, taking an exclusive lock blocks all other requests, even
>> from the same process. IMO Windows makes more sense here, for whatever
>> the purpose of locking the file, most logic will assume they got what
>> they asked for. (Thread1 thinks it has an exclusive lock, so does
>> thread2, but they can both mutate the state on Linux.)
> 
> I don't really understand how stricter locking ties into explicitly
> listing a root directory, but I suppose that doesn't really matter to
> me ;).
> 
> I hope nobody ever emails the BE list requesting file locking, since
> it looks really annoying ;).
> 
> Thanks for the quick diagnosis!
> 

We use a read lock while reading the list of files, to ensure that
things don't change in the middle. (Otherwise you might see a file, but
not the containing directory, for example.)

We use a write lock while updating the tree, to ensure that the data
structure stays consistent. (Otherwise process 1 might try to add foo,
and process 2 might add bar, and one of them would ignore the others
changes, etc.)

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk1m1+sACgkQJdeBCYSNAANJqQCgqJTI4zILHRDx9jVBN927LKEv
InoAn0MDdpiIN1DTNvK2sNmTKMrtu4W/
=qx8U
-----END PGP SIGNATURE-----



More information about the bazaar mailing list