[PATCH 3 of 3] revlog: read index data using mmap

Yuya Nishihara yuya at tcha.org
Fri Oct 7 02:34:33 EDT 2016


On Wed, 5 Oct 2016 22:59:15 +0100, Jun Wu wrote:
> Excerpts from Yuya Nishihara's message of 2016-10-05 19:50:33 +0900:
> > On Tue, 4 Oct 2016 15:59:45 +0100, Jun Wu wrote:
> > > # HG changeset patch
> > > # User Jun Wu <quark at fb.com>
> > > # Date 1475550701 -3600
> > > #      Tue Oct 04 04:11:41 2016 +0100
> > > # Node ID 99e7b0589b916b83d825882e907dd79082f4a2d7
> > > # Parent  5ebdfd4ffbedbfe66b7a36cbd06b1e8e624ae7ad
> > > # Available At https://bitbucket.org/quark-zju/hg-draft 
> > > #              hg pull https://bitbucket.org/quark-zju/hg-draft  -r 99e7b0589b91
> > > revlog: read index data using mmap
> > 
> > What happens if revlog is stripped? Using mmap would introduce more error
> > modes we'll need to test.
> 
> If revlog is truncated, I think we will have trouble without mmap, too - the
> pre-truncated index was loaded into memory while the revlog date can be
> truncated. Reading data of a truncated revision would cause an error. But
> the error is catchable.

(except for bus error caused by mmap :-)

> Possible solutions I can think of are:
> 
>   - Change strip to copy the changelog index and rename it, instead of
>     truncating the original file directly. Seems like a reasonable solution
>     to me.
>   - Turn off mmap by default but gate it with a config option.

Both of them sound good to me. We might have to test Windows' mmap behavior.


More information about the Mercurial-devel mailing list