[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Atomicity under Windows

From: <peter.westlake_at_arm.com>
Date: 2002-06-10 10:37:41 CEST

On 2002-06-09 22:22:10 Greg Hudson wrote:
>Apologies for the diversion into obscure Unix and NFS semantics. It's
>important for my back-end design. Nothing specific to Subversion here,
>though, so busy developers can ignore us.
>
>On Sat, 2002-06-08 at 17:46, Stephen C. Tweedie wrote:
...
>> Most NFS systems will offer
>> decent fcntl() locking these days, for example, and there are already
>> libraries in existance (used for things like mailbox locking) to
>> emulate NFS locking via atomic creation of temporary lock files on
>> those systems where fcntl() does not work.
>
>I'm still not sure how to create a lock in older NFS implementations, if
>it's even possible.

Faced with a similar problem, I abandoned lock files altogether
and used a daemon instead. It was a very simple process that used
sockets for communication. A "lock" was an arbitrary string. As
well as being very simple to implement, this approach had the
advantage that there were never any locks left around if a process
died unexpectedly. The daemon could tell when a socket had closed,
and free the lock. The clients could also tell if the daemon had
exited, though it never did unless I told it to. Debugging was easy
using telnet.

The only disadvantage of using a lock daemon is that you are reliant
on the daemon process running. This should not be a problem for Subversion,
since it already relies on a rather large and complicated process running.

My original lock daemon was a couple of hundred lines of Perl, including
comments. It isn't open source, but I would be happy to write a similar
thing in C if it was wanted - I now have permission to work on svn! Only
in my spare time, but that's better than nothing.

Peter.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Jun 10 10:38:32 2002

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.