What are some arguments against locking?

Sean Russell hg at ser1.net
Fri Jun 27 08:14:29 CDT 2008


On Wednesday 25 June 2008 03:00:34 pm Paul Chiusano wrote:
> For context, my coworker's basic argument is that sometimes people make
> changes to the same file and the changes are difficult to merge, requiring
> hours of work to figure out what the merged changes should look like. Even
> if this is relatively infrequent, it's enough of a time sink to make it
> worth preventing it entirely by locking. How do other people avoid
> situations like this when using Mercurial? Note that I am NOT saying I
> agree with this argument at all, I just wanted to have some additional
> perspectives on this so that I can explain things a bit better.

At the company I currently work for, we're currently fighting about whether to 
use ClearCase or Subversion.  ClearCase has been used in the company for 
seven years or so (alongside a few CVS users), and they want to standardize.  
In any case, we just hired an architect for one team, and he's by far the 
most expert ClearCase user I've ever met, and has been using it for ages.  He 
knows more about CC than any of the Rational consultants we've brought in in 
the past couple of years.

In any case, I (a Subversion proponent) and he got talking about locking, 
which I was lamenting, and he mentioned that every experienced ClearCase user 
configures her CC environment to check out unreserved by default, essentially 
bypassing the locking, and those that don't get jumped on.

Why?

1. Because merging is *not* difficult.  You have to merge, one way or another; 
might as well do it on check-in as any other time.

2. People forget to check in, and they go home.  They go offline for the 
weekend.  They go on vacation.  They get fired, and go away permanently.  
Locks are a management nightmare, and cause way, way more overhead than the 
occasional conflicting edit.

3. Locking stops people from working.  If two developers need to edit the same 
file, then only one can do any work at a time.  This is a waste of resource.  
Make an analogy to modern CPUs, and multi-processing; locking stops this from 
happening.

4. Because of  (2) and (3), people commonly bypass locking (even to the point 
of making a copy of the file and editing it locally, then merging it later), 
which is worse than using a system where merging conflicts is the norm.

5. No VCS, commercial or open source, that has been started in recent years 
uses a locking model as a default mode of operation.  This should tell you 
something about the usefulness of locking.  BTW, you should independently 
verify this claim -- it is difficult to prove a negative, but a quick look at 
the Wikipedia VCS comparison page 
(http://en.wikipedia.org/wiki/Comparison_of_revision_control_software) bears 
this out.

--- SER


More information about the Mercurial mailing list