Re: Darcs-git: a few notes for Git hackers
- From
- H. Peter Anvin <hpa@zytor.com>
- Date
- May 9, 2005, 22:50 UTC
- Message-ID
- <427FE938.7050904@zytor.com>
- In-Reply-To
- <7ipsw010i5.fsf@lanthane.pps.jussieu.fr>
Juliusz Chroboczek wrote:
Show 21 quoted lines
>>>I see. Let me know if you decide to use a different name for the >>>lock file so I can switch to using the same one as yours. > > >>Are you using flock(), or some other contraption that breaks if a >>process dies unexpectedly? > > No, I'm using a file that is created by the NFS-safe equivalent of > open(O_CREAT | O_EXCL). This is what Darcs has been doing basically > forever. > > Darcs usually doesn't die unexpectedly -- it's a Haskell program, so > bugs usually manifest themselves with an exception being thrown > allowing Darcs to clean-up after itself. > > The one exception is when Darcs gets killed by the OOM killer (which, > as you doubtless know, doesn't give any advance warning to a process, > thus making it impossible for a process to deal with it gracefully). > In such cases, manual intervention is necessary anyway -- a file could > have been written half-way. >
In the case of git, it should not be necessary even then; there might be a broken file in the repository but nothing would reference it so it shouldn't have any effect. Functionally speaking, operations on the git repository are in themselves atomic.
-hpa