Re: [PATCH/RFC v3 01/13] Move index v2 specific functions to their own file

2012-08-10 Thread Thomas Gummerer
On 08/10, Junio C Hamano wrote: > Thomas Rast writes: > > > But I think the idea always was that any write that changes the basic > > layout of the file (so that you would read something wrong) will need a > > full rewrite. Otherwise we're too far in DB land. > > > > Most updates will be > > of

Re: [PATCH/RFC v3 01/13] Move index v2 specific functions to their own file

2012-08-10 Thread Junio C Hamano
Thomas Rast writes: > But I think the idea always was that any write that changes the basic > layout of the file (so that you would read something wrong) will need a > full rewrite. Otherwise we're too far in DB land. > > Most updates will be > of the "update the stat and/or sha1 of a file" kind

Re: [PATCH/RFC v3 01/13] Move index v2 specific functions to their own file

2012-08-10 Thread Thomas Rast
Junio C Hamano writes: > If you found that an entry you read halfway has an inconsistent crc, > and if you suspect that is because somebody else was writing to the > same index, it is a _sure_ sign that you are not alone, and all the > entries you read so far to the core, even if they weren't tou

Re: [PATCH/RFC v3 01/13] Move index v2 specific functions to their own file

2012-08-09 Thread Nguyen Thai Ngoc Duy
On Fri, Aug 10, 2012 at 7:13 AM, Junio C Hamano wrote: > 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 the

Re: [PATCH/RFC v3 01/13] Move index v2 specific functions to their own file

2012-08-09 Thread Junio C Hamano
Junio C Hamano writes: > If you found that an entry you read halfway has an inconsistent crc, > and if you suspect that is because somebody else was writing to the > same index, it is a _sure_ sign that you are not alone, and all the > entries you read so far to the core, even if they weren't tou

Re: [PATCH/RFC v3 01/13] Move index v2 specific functions to their own file

2012-08-09 Thread Thomas Gummerer
On 08/09, Junio C Hamano wrote: > Thomas Gummerer writes: > > > /* remember to discard_cache() before reading a different cache! */ > > int read_index_from(struct index_state *istate, const char *path) > > { > > ... > > mmap = xmmap(NULL, mmap_size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd,

Re: [PATCH/RFC v3 01/13] Move index v2 specific functions to their own file

2012-08-09 Thread Junio C Hamano
Thomas Gummerer writes: > /* remember to discard_cache() before reading a different cache! */ > int read_index_from(struct index_state *istate, const char *path) > { > ... > mmap = xmmap(NULL, mmap_size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, > 0); > - close(fd); > if (mmap

Re: [PATCH/RFC v3 01/13] Move index v2 specific functions to their own file

2012-08-08 Thread Thomas Gummerer
On 08/08, Nguyen Thai Ngoc Duy wrote: > On Wed, Aug 8, 2012 at 6:17 PM, Thomas Gummerer wrote: > > Move index version 2 specific functions to their own file, > > to prepare for the addition of a new index file format. With > > the split into two files we have the non-index specific > > functions

Re: [PATCH/RFC v3 01/13] Move index v2 specific functions to their own file

2012-08-08 Thread Nguyen Thai Ngoc Duy
On Wed, Aug 8, 2012 at 6:17 PM, Thomas Gummerer wrote: > Move index version 2 specific functions to their own file, > to prepare for the addition of a new index file format. With > the split into two files we have the non-index specific > functions in read-cache.c and the index-v2 specific functio

[PATCH/RFC v3 01/13] Move index v2 specific functions to their own file

2012-08-08 Thread Thomas Gummerer
Move index version 2 specific functions to their own file, to prepare for the addition of a new index file format. With the split into two files we have the non-index specific functions in read-cache.c and the index-v2 specific functions in read-cache-v2.c Helped-by: Nguyen Thai Ngoc Duy Signed-o