Re: Handling racy entries in the v5 format [Re: [GSoC] Designing a faster index format - Progress report week 7]
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 6, 2012, 17:31 UTC
- Message-ID
- <7vk3zkmjo1.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <87aa0gbwon.fsf@thomas.inf.ethz.ch>
Thomas Rast <trast@student.ethz.ch> writes:
Show 8 quoted lines
> (Michael, we have adapted it somewhat this since you left IRC.) > > When writing an entry: check whether ce_mtime >= index.mtime. If so, > write out ce_mtime=0. > > The index.mtime here is a lower bound on the mtime of the new index, > obtained e.g. by touching the index and then stat()ing it immediately > before writing out the changed entries.
Is this even workable? I found that "open, read a byte, write it back in place, then stat" was not giving useful timestamp and that was the reason the original racy-git code chose not to do this.
You may be able to do "open, read a byte, write it back in place, fsync, close and then stat", but doing so while holding that file also as a lock feels somewhat dirty...