Commit Graph

10 Commits

Author SHA1 Message Date
Mark Thomas
15242183ef treemanifest: consider all parents of outgoing nodes for tree comparison
Summary:
When determining the contexts to compare trees against, consider all parents
of the missing nodes that aren't themselves missing.

In the case of:
```
  C
 / \
D   B
    |
    A
```
Where A and D are common and B and C are missing, the parents of the roots
are only A, which means D's tree will not be compared against and all of its
trees will be included.

Reviewed By: StanislavGlebik

Differential Revision: D14798681

fbshipit-source-id: c80add907338a3011daf54a2304ea19415b7f9fb
2019-04-08 03:32:00 -07:00
Durham Goode
73683c048e tracing: add various tracing across the code base
Summary:
Now that we have perftracing infra, let's trace a bunch of likely
problem spots.

Reviewed By: sfilipco

Differential Revision: D14426367

fbshipit-source-id: 354a241aa9ac5d75d34062a9838d581b4f46746f
2019-03-25 19:31:13 -07:00
Xavier Deguillard
ed47a4b8ea repack: add an option to run background repack with --packsonly
Summary:
Most of the repacks are background repacks, and most of the complaints are
coming from laptops users. Thanks to the rust repack, most of time during
repack is now spent in repacking loosefiles. While repacking them is expensive,
testing whether data is in a loosefile and obtaining it is actually pretty
fast. Packfiles have the opposite issue, repacking them is fast, but finding
data in them may be expensive if a lot of them are present.

Based on this, it makes sense to repack packfiles more frequently than
loosefiles. At first, the newly added option will be used to turn-off loosefile
repack for laptop users. A less frequent loosefile repack will be implemented
in a later patch.

Reviewed By: DurhamG

Differential Revision: D14586986

fbshipit-source-id: 5bc5c839cf8d2d78bcc4ffa016bbe3cf1b2ef3f7
2019-03-25 18:39:26 -07:00
Jun Wu
b40af5890c metrics: add metrics about fetching remote data
Summary: Log data about round-trip count, and object count for files, trees, and SSH calls.

Differential Revision: D14515776

fbshipit-source-id: cce416fd7dccdad3c73a9f1751a04ddac0d2c507
2019-03-20 22:49:18 -07:00
Mark Thomas
dbe1d30cf0 treemanifest: include all trees when infinitepush rebundle converts trees
Summary:
If an infinitepush bundle contains flat manifests and is served from a
treemanifest repository, it can potentially fail to send all the needed data to
the client.

Understanding the bug requires two bits of context:
1. When sending commits from a tree server to a tree client, we generally don't
send any trees because they can be fetched by the client ondemand later. The one
exception to this is for infinitepush bundles, where the trees inside the bundle
cannot be served ondemand, and therefore must be served at pull time. To do this
we check if a given manifest node exists in the repositories permanent storage,
and if it doesn't, we assume it came from an infinitepush bundle and serve it
with the pull.
2. When we lookup a manifest and fail to find a tree, our last resort is the
ondemandstore which knows how to convert a flat manifest into a tree manifest.
On the server, this is responsible for converting each of the flat bundle's
manifests into treemanifests before we serve the bundle to the client. As part
of converting the flat manifests into treemanifests, it writes the new tree
data into a pack file.

The bug is then, when serving a stack of commits, if we try to package up the
top tree first (i.e. the most recent tree), we end up converting the entire
stack from flat into trees, which inserts the bottom most trees into the
temporary pack file.  Because they exist in the temporary pack file, when we
later check if they are part of the repositories store we end up finding them,
which causes us to treat them as not-infinitepush-trees which means we don't
serve them to the client.

The fix is to change the infinitepush tree-serving code to not consider the
mutable packs when checking if it should send trees.

Reviewed By: mitrandir77

Differential Revision: D14403925

fbshipit-source-id: 38043dfc49df5ff9ea2fae1d3cac341c4936509c
2019-03-11 05:39:49 -07:00
Xavier Deguillard
f09d3b816c treemanifest: fix repack and backfilltree
Summary: These 2 commands were broken when treemanifest.treeonly=True was set

Reviewed By: DurhamG

Differential Revision: D14316779

fbshipit-source-id: e626df41c92036fa3bd61c072f09b0d6c99c6f9f
2019-03-05 11:40:46 -08:00
Johan Schuijt-Li
877d1315da treemanifest/remotenames: use write path for reads after push
Summary:
Treemanifest uses it's own fallbackpath for reads in all cases, but
particularly in the case of remotenames it should stay on the path that is
actively being used by the push. It is possible to have remotenames which are
mirrored and selected by query strings in the repo path. In this case it is
possible that the mirror is still out of date when reading back data from our
push. Ensure that when doing a push the remote server this is considered
'sticky' so that we read back from the remote we pushed to, rather then
determening the path ourselves.

To disable, please use:
  treemanifest.stickypushpath=False

Reviewed By: DurhamG, markbt, quark-zju

Differential Revision: D14165444

fbshipit-source-id: 75a53ffab895d87a4c52814f7887145c134868b5
2019-02-22 06:03:18 -08:00
Liubov Dmitrieva
13abfafb8d treemanifest: use simplecache as a cache store
Summary:
simplecache extension support both memcache and local disk as a cache store.

we are going to use memcache on hg servers

getting rid of the caches on disks will save 966GB of disk space per machine.

P60876105

this will also allow hg machines to share the same cached data

Reviewed By: DurhamG

Differential Revision: D13927163

fbshipit-source-id: 3155c61da4a82dd7a790a8ccf8dbc701fe3957e1
2019-02-07 04:59:48 -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