sapling/eden/scm/tests/test-mmapindexthreshold-strip.t
Xavier Deguillard ed4021b8e3 revisionstore: disallow reading LFS pointers from packfiles
Summary:
For repositories that have the old-style LFS extension enabled, the pointers
are stored in packfiles/indexedlog alongside with a flag that signify to the
upper layers that the blob is externally stored. With the new way of doing LFS,
pointers are stored separately.

When both are enabled, we are observing some interesting behavior where
different get and get_meta calls may return different blobs/metadata for the
same filenode. This may happen if a filenode is stored in both a packfile as an
LFS pointers, and in the LFS store. Guaranteeing that the revisionstore code is
deterministic in this situation is unfortunately way too costly (a get_meta
call would for instance have to fully validate the sha256 of the blob, and this
wouldn't guarantee that it wouldn't become corrupted on disk before calling
get).

The solution take here is to simply ignore all the lfs pointers from
packfiles/indexedlog when remotefilelog.lfs is enabled. This way, there is no
risk of reading the metadata from the packfiles, and the blob from the
LFSStore. This brings however another complication for the user created blobs:
these are stored in packfiles and would thus become unreadable, the solution is
to simply perform a one-time full repack of the local store to make sure that
all the pointers are moved from the packfiles to to LFSStore.

In the code, the Python bindings are using ExtStoredPolicy::Ignore directly as
these are only used in the treemanifest code where no LFS pointers should be
present, the repack code uses ExtStoredPolicy::Use to be able to read the
pointers, it wouldn't be able to otherwise.

Reviewed By: DurhamG

Differential Revision: D22951598

fbshipit-source-id: 0e929708ba5a3bb2a02c0891fd62dae1ccf18204
2020-09-09 18:27:42 -07:00

23 lines
702 B
Raku

#chg-compatible
$ configure modern
$ setconfig experimental.changegroup3=False
$ 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