sapling/eden/scm/edenscmnative
Xavier Deguillard 86965b2f80 revisionstore: query store before fetching
Summary:
While the change looks fairly mechanical and simple, the why is a bit tricky.
If we follow the calls of `ContentStore::get`, we can see that it first goes
through every on-disk stores, and then switches to the remote ones, thanks to
that, when we reach the remote stores there is no reason to believe that the
local store attached to them contains the data we're fetching. Thus the
code used to always prefetch the data, before reading from the store what was
just written.

While this is true for regular stores (packstore, indexedlog, etc), it starts
to break down for the LFS store. The reason being that the LFS store is
internally represented as 2 halves: a pointer store, and a blob store.  It is
entirely possible that the LFS store contains a pointer, but not the actual
blob. In that case, the `get` executed on the LFS store will simply return
`Ok(None)` as the blob just isn't present, which will cause us to fallback to
the remote stores. Since we do have the pointer locally, we shouldn't try to
refetch it from the remote store, and thus why a `get_missing` needs to be run
before fetching from the remote store.

As I was writing this, I realized that all of this subtle behavior is basically
the same between all the stores, but unfortunately, doing a:
  impl<T: RemoteDataStore + ?Sized> HgIdDataStore for T
Conflicts with the one for `Deref<Target=HgIdDataStore>`. Macros could be used
to avoid code duplication, but for now let's not stray into them.

Reviewed By: DurhamG

Differential Revision: D21132667

fbshipit-source-id: 67a2544c36c2979dbac70dac5c1d055845509746
2020-04-27 12:53:11 -07:00
..
bindings revisionstore: query store before fetching 2020-04-27 12:53:11 -07:00
__init__.py Move fb-mercurial sources into an eden/scm subdirectory. 2019-11-13 16:04:48 -08:00
clindex.pyi add type annotations for a few more edenscmnative modules 2020-03-20 10:41:32 -07:00
clindex.pyx remove the mercurial.policy module 2020-02-21 13:54:19 -08:00
linelog.pyx py3/cython: set the language_level to 3str 2020-01-30 12:52:06 -08:00
patchrmdir.pyi add type annotations for a few more edenscmnative modules 2020-03-20 10:41:32 -07:00
patchrmdir.pyx py3: make patchrmdir work with Python 3 2020-01-30 17:22:30 -08:00
traceprof.pyx py3/cython: set the language_level to 3str 2020-01-30 12:52:06 -08:00