Commit Graph

7 Commits

Author SHA1 Message Date
Durham Goode
c5b3e4bcb6 packs: refresh stores after fetching packs
Summary:
The prefetch code was not refreshing the pack stores after writing
stuff into packs. This meant that in some cases we would execute a prefetch,
then when we went to read an entry from the store it wouldn't be found. That
would trigger a one-by-one download, which would happen to trigger a pack store
refresh (since remotecontentstore had a refresh) which would cause the rest of
the prefetched data to then become visible.

This fixes it to make prefetch responsible for refreshing the pack data.

This also caused issues where prefetching lfs files requires the hg fetching to
get the metadata, then it reads that metadata and does an lfs fetch. Since the
original metadata wasn't visible (since the packs had not refreshed), this
resulted in infinite recursion until the default 100ms refresh time passed.

Differential Revision: D15171701

fbshipit-source-id: 190b1da542675265efaad75a2a6826cbe3c9631c
2019-05-03 13:09:33 -07:00
Aida Getoeva
220e4c9879 add loose files size and count metrics
Summary: Added new metrics to log loose files size and number during repack. We need it to understand how much better the pack files work in terms of disc and memory usage.

Reviewed By: markbt

Differential Revision: D14544811

fbshipit-source-id: 5a4d894bd5a3358c7e0f93ecc9db5e9f2c2f2372
2019-03-21 09:59:44 -07:00
Xavier Deguillard
f4072c3d0a remotefilelog: split fetching data and history
Summary:
When using packfiles, history and data are in different files, and thus it's
possible to only fetch one.

For now, besides the requests coming from contentstore and metadatastore, both
will be fetched, as the code hasn't been audited to know whether we only want
history or data.

Differential Revision: D14387734

fbshipit-source-id: 6aafd477ff486b9316458ce0e80636152db45b89
2019-03-12 10:51:57 -07:00
Xavier Deguillard
0fdc258804 remotefilelog: add a packfile remote store
Summary:
When searching for data, mercurial will search the datastores by first looking
into the local cache, then try to find the data over the network. When
remotefilelog.fetchpacks is enabled, all the data fetched over the network will
be stored into packfiles, but those fetches are done via the loose-files remote
datastore. Due to this, even if memcache successfully find the requested data,
the datastore won't find it, due to it expecting loosefiles.

Fixing this simply requires the fetches to be done via a packfile store when
remotefilelog.fetchpacks is enabled.

Reviewed By: DurhamG

Differential Revision: D14216815

fbshipit-source-id: ed97c64651a733b36e0f2b4e209ce8ccdbb7911e
2019-03-04 13:48:11 -08:00
Durham Goode
20f9ac38f6 remotefilelog: handle corrupt loose files more gracefully
Summary:
If the history portion of a loose file was corrupt, users would often
get errors like "ValueError: substring not found" when trying to split on the
null separators. Let's catch that and handle it where appropriate. For cache
stores, we move it out of the way and return a KeyError, so the union store will
move on to try to fetch it from the server again. For local stores, we return a
ValueError and surface it to the user since their local data may be corrupt.

Reviewed By: quark-zju

Differential Revision: D13976499

fbshipit-source-id: 39e63f19fc752ca0179fbc5b0908a28d46de3a3a
2019-02-07 13:40:42 -08:00
Jun Wu
9dc21f8d0b codemod: import from the edenscm package
Summary:
D13853115 adds `edenscm/` to `sys.path` and code still uses `import mercurial`.
That has nasty problems if both `import mercurial` and
`import edenscm.mercurial` are used, because Python would think `mercurial.foo`
and `edenscm.mercurial.foo` are different modules so code like
`try: ... except mercurial.error.Foo: ...`, or `isinstance(x, mercurial.foo.Bar)`
would fail to handle the `edenscm.mercurial` version. There are also some
module-level states (ex. `extensions._extensions`) that would cause trouble if
they have multiple versions in a single process.

Change imports to use the `edenscm` so ideally the `mercurial` is no longer
imported at all. Add checks in extensions.py to catch unexpected extensions
importing modules from the old (wrong) locations when running tests.

Reviewed By: phillco

Differential Revision: D13868981

fbshipit-source-id: f4e2513766957fd81d85407994f7521a08e4de48
2019-01-29 17:25:32 -08:00
Jun Wu
c12e300bb8 codemod: move Python packages to edenscm
Summary:
Move top-level Python packages `mercurial`, `hgext` and `hgdemandimport` to
a new top-level package `edenscm`. This allows the Python packages provided by
the upstream Mercurial to be installed side-by-side.

To maintain compatibility, `edenscm/` gets added to `sys.path` in
`mercurial/__init__.py`.

Reviewed By: phillco, ikostia

Differential Revision: D13853115

fbshipit-source-id: b296b0673dc54c61ef6a591ebc687057ff53b22e
2019-01-28 18:35:41 -08:00