Re: [PATCH/RFC v3 01/13] Move index v2 specific functions to their own file
- From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
- Date
- Aug 10, 2012, 02:23 UTC
- Message-ID
- <CACsJy8ChnS4cE3YnQQA8YQ5ebCA06QBXxEB7Oqhv4z_1y9Wc8w@mail.gmail.com>
- In-Reply-To
- <7v7gt7mwo3.fsf@alter.siamese.dyndns.org>
On Fri, Aug 10, 2012 at 7:13 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 15 quoted lines
> By the way, you can only detect such inconsistency when you are > lucky enough that you catch the other person in the middle of > writing. > > If the index you are looking at holds a large tree with very many > paths, it is possible that there are two large directories, and > after you read all entries from one, the other process starts > modifying the paths in that directory, without you ever finding it > out. If the goal of the topic is to make the index work better in > projects with large trees, it may be wise to think about locking the > whole thing, so that you do not have to rely on the per-entry crc > and you being lucky to detect such a race. The per-entry crc, as > far as I understand, may have been introduced primarily to detect > on-disk data corruption; it is not a suitable mechanism to detect > conflicting accesses.
So we acquire the lock just before we need to write, or at the time we open for reading?
-- Duy