lock free dirstate - prototype

Martin (gzlist) gzlist at googlemail.com
Wed Sep 30 09:02:19 BST 2009


On 30/09/2009, Robert Collins <robertc at robertcollins.net> wrote:
> On Wed, 2009-09-30 at 08:33 +0300, Alexander Belchenko wrote:
>>
>> It's not quite true. Using Win32 API you can have file opened to read but
>> in the same time allowed
>> to delete by another process. Mercurial has implementation of this, btw.
>
> You mean via FILE_SHARE_DELETE ?... been a while. Ah yes, I see. That
> would cause the last person closing to have the OS remove the file, and
> prevent others from opening or replacing it.
>
> So, this is something we would benefit from. How much code is needed to
> get this going?

On a cautionary note, I recently had a problem where an hg repo got
stuck in an unupdateable state where it'd repeatedly blow up deep in
the file handling code, and then roll back. Don't know what exactly
caused it, but the workaround was not using their
pretend-the-windows-filesystem-is-more-posixy hack.

Bad: <http://selenic.com/repo/hg/file/3ef6c14a1e8e/mercurial/osutil.c#l404>
Good: <http://selenic.com/repo/hg/file/3ef6c14a1e8e/mercurial/pure/osutil.py#l11>

Martin



More information about the bazaar mailing list