sapling/eden/scm/tests/test-mmapindexthreshold-strip.t
Xavier Deguillard edd44536ae transaction: copy files before truncation
Summary:
On Windows, if a file is memory mapped it cannot be truncated, unfortunately,
with the 00changelog.i being almost 500MB, this means that every time Mercurial
starts, the file needs to be read entirely. With the code being moved to Rust,
this read is done twice, resulting in a memory consumption of over 900MB.

Instead of always trying truncate the file in place, let's just try to truncate
it first, and then copy it, truncate it and then move it back in place. This
will allow us to memory map the 00changelog.i on Windows, which should
significantly reduce the memory consumption of Mercurial.

Reviewed By: DurhamG

Differential Revision: D21953553

fbshipit-source-id: e0f447fea017a34c8da8cdbbc6914cee7b5b2bee
2020-06-10 19:29:45 -07:00

22 lines
656 B
Raku

#chg-compatible
$ configure modern
$ enable rebase
$ setconfig experimental.mmapindexthreshold=1
$ hg init
$ hg debugdrawdag <<'EOS'
> a1 # a1/a = a1
> |
> a # a/a = a
> EOS
$ hg debugindex -c
rev offset length base linkrev nodeid p1 p2
0 0 55 0 0 b173517d0057 000000000000 000000000000
1 55 59 1 1 18d792233a72 b173517d0057 000000000000
$ hg debugstrip -r a1 -q
$ hg debugindex -c
rev offset length base linkrev nodeid p1 p2
0 0 55 0 0 b173517d0057 000000000000 000000000000