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

Re: Locking design (was Re: svn commit: r9885 - trunk/notes)

From: Greg Hudson <ghudson_at_MIT.EDU>
Date: 2004-05-26 21:56:23 CEST

On Wed, 2004-05-26 at 13:41, Ben Collins-Sussman wrote:
> > With no transaction-based consistency protection?
> Write to a tmpfile, then move it.

It's not *quite* that simple. If you and I are both trying to lock
(different) files at the same time, then we could run into a race. (You
read, I read, you write, I write, and your lock is omitted.) If the
tmpfile always has the same name and is opened with O_EXCL, then one of
us will fail to open the tmpfile, which means there would have to be a
retry loop.

Another non-DB technique would be to have a directory tree of the locked
files. That would scale better in some ways and would eliminate the
possibility of multiple people interfering with each other by locking
different files, but it would mean checking a to-be-committed
transaction against the lock table would be slower. (We could probably
use directory pruning techniques to make it pretty fast, though.)

To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed May 26 21:57:42 2004

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.