Commit Graph

81 Commits

Author SHA1 Message Date
Simon Farnsworth
63098574ff Log clienttelemetry data (correlator, hostname, short command)
Summary:
It's currently challenging to compare client logging to server logging, because we just don't have enough information to correlate logs.

Add in two pieces of data from the client, if available:

1. Client correlator, which lets us compare to client performance logging.
2. Short hg command (`pull`, `update`, `rebase`, but not `update --clean master` or `rebase --source foo --destination master`). This lets us quickly look for problematic commands with a suitable query

Reviewed By: StanislavGlebik

Differential Revision: D16499809

fbshipit-source-id: c17a348c6f950bd207df5296531e5d39124e3a79
2019-07-26 03:41:24 -07:00
David Tolnay
fed2ac83f4 rust: Head start on some upcoming warnings
Summary:
This diff sets two Rust lints to warn in fbcode:

```
[rust]
  warn_lints = bare_trait_objects, ellipsis_inclusive_range_patterns
```

and fixes occurrences of those warnings within common/rust, hg, and mononoke.

Both of these lints are set to warn by default starting with rustc 1.37. Enabling them early avoids writing even more new code that needs to be fixed when we pull in 1.37 in six weeks.

Upstream tracking issue: https://github.com/rust-lang/rust/issues/54910

Reviewed By: Imxset21

Differential Revision: D16200291

fbshipit-source-id: aca11a7a944e9fa95f94e226b52f6f053b97ec74
2019-07-12 00:56:44 -07:00
Andres Suarez
9a90a484f8 Apply rustfmt to all rust files
Reviewed By: jsgf

Differential Revision: D14578283

fbshipit-source-id: 9b4a7b1fd445fd033b64c6af04ee52b27eefb616
2019-07-10 19:36:32 -07:00
Simon Farnsworth
d3ec041698 Use first mfnode to replace empty base manifest in gettreepack
Summary: Gettreepack requests can be slow if there's no base manifest. Instead of trying to track every manifest we've passed down to the client (which is CPU and memory expensive, as we end up tracking every `(path, manifesthash)` pair in the output), simply use the first manifest we were asked for as the base manifest in this case

Reviewed By: StanislavGlebik

Differential Revision: D16120603

fbshipit-source-id: 19119e481dfad37c2539f6f02f6ffccb13bc9895
2019-07-05 08:12:55 -07:00
Greg Cowan
041770b090 Transition fbcode Rust crates to 2018 edition
Summary: Marking all Cargo.tomls in fbcode as 2018 edition.

Reviewed By: jsgf

Differential Revision: D15951175

fbshipit-source-id: edf18449c214ee1ff285d6a2cb61839aaf58a8cd
2019-06-24 13:15:17 -07:00
Xavier Deguillard
f0862cbe16 mononoke: add getpackv2 wire protocol
Summary:
The getpackv1 protocol doesn't unfortunately support LFS blobs, which is
therefore blocking deploying remotefilelog.fetchpacks on ovrsource on the
clients.

The easiest way to get there was to simply add a getpackv2 API that is similar
in every way to getpackv1, but with the addition of a metadata field. While
full support for this was added to Mercurial, the Mononoke support is the
absolute minimum required as Mononoke doesn't support LFS.

I'm expecting that EdenAPI will completely remove the need for getpackv2 and
therefore for this code should be fairly short-lived.

Reviewed By: farnz

Differential Revision: D15954031

fbshipit-source-id: 465ac13ed8987191ccf9a7cec198d913143aaf13
2019-06-24 11:19:41 -07:00
Jeremy Fitzhardinge
ae4a4a5b6c tp2/rust: update to Rust 1.35.0
Summary:
Side-effect changes:
- Doc comments on macro invocations generate a warning that they don't document what the macro expands to => make them non-doc comments
- New warnings from some bad borrowing patterns which were not previously diagnosed (T45010740)

Reviewed By: Imxset21

Differential Revision: D15515133

fbshipit-source-id: a71db51433598e338b660cbf9d2079f4bd51cfba
2019-05-28 14:28:48 -07:00
Arun Kulshreshtha
83128507d2 Add convertion between TreeRequest and GettreepackArgs
Summary: Convert from the type Mercurial uses to represent the arguments to `gettreepack` to Mononoke's representation of that type.

Reviewed By: quark-zju

Differential Revision: D15492733

fbshipit-source-id: 15097cb564f7b5edb024013caea2e4d444263947
2019-05-24 16:56:41 -07:00
Stanislau Hlebik
951cfe3c47 mononoke: remove dependency on hooks from hgproto
Summary: It's not necessary

Reviewed By: aslpavel

Differential Revision: D15340744

fbshipit-source-id: 1a12c5a978b288ae694cfb66b60c6892216cf1e3
2019-05-21 12:25:56 -07:00
Pavel Aslanov
1ba56177c4 implementation of listkeyspatterns wire protocol command
Summary: add support for `listkeyspattern` write protocol command

Reviewed By: StanislavGlebik

Differential Revision: D14727722

fbshipit-source-id: d0883d26109c70f8f5fcd1f0241baab0f5002f81
2019-05-21 12:25:01 -07:00
Laurence Emms
491abcd4a8 Removed HgNodeHash from known()/lookup()/heads()/between() methods in
Summary:
Removed references to HgNodeHash in repo_client in the specified functions. In
addition, updated other files due to type related dependencies.

Reviewed By: StanislavGlebik

Differential Revision: D14543934

fbshipit-source-id: b0d860fe7085ed4b91a62ab1e27fb2907a642a1d
2019-05-21 12:24:52 -07:00
Stanislau Hlebik
a98f532abd mononoke: fix of the discovery problem
Summary:
This is the test to cover tricky case in the discovery logic.
Previously Mononoke's known() wireproto method returned `true` for both public
and draft commits. The problem was in that it affects pushrebase.

There are a few problems with the current setup. A push command like `hg push
-r HASH --to BOOK` may actually do two things - it can either move a bookmark
on the server or do a pushrebase. What it does depends on how discovery phase
of the push finishes.

Each `hg push` starts with a discovery algorithm that tries to figure out what commits
to send to the server. If client decides that server already has all the
commits then it'll just move the bookmark, otherwise it'll run the pushrebase.

During discovery client sends wireproto `known()` method to the server
with a list of commit hashes, and server returns a list of booleans telling if
a server knows the commit or not. Before this diff Mononoke returned true for
both draft commits and public commits, while Mercurial returned true it only
for public commits.

So if Mononoke already has a draft commit (it might have it because the commit was created
via `hg pushbackup` or was created in the previous unsuccessful push attempt),
then hg client discovery will decide to move a bookmark instead of
pushrebasing, which in the case of master bookmark might have disastrous
consequences.

To fix it let's  return false for draft commits, and also implement `knownnodes` which return true for draft commits (a better name for these methods would be `knownpublic` and `known`).

Note though that in order to trigger the problem the position of the bookmark on the server
should be different from the position of the bookmark on the client. This is
because of short-circuting in the hg client discovery logic (see
https://fburl.com/s5r76yle).

The potential downside of the change is that we'll fetch bookmarks more often,
but we'll add bookmark cache later if necessary.

Reviewed By: ikostia

Differential Revision: D14560355

fbshipit-source-id: b943714199576e14a32e87f325ae8059d95cb8ed
2019-03-25 02:20:53 -07:00
Stanislau Hlebik
c3898c81eb mononoke: getpackv1 params parsing
Summary:
This stack is about adding getpackv1 wireproto request support (see task for
more details).

This diff adds a Decoder trait implementation. It parses all parameters for a
single file (i.e. filename + list of nodes). This Decoder is combined with
the previous diff to fully parse getpackv1 request

Reviewed By: lukaspiatkowski

Differential Revision: D14401516

fbshipit-source-id: 9b5fa1f48de338e58a288eb0653bd734cd8d1623
2019-03-11 07:17:07 -07:00
Stanislau Hlebik
9ec3d19252 mononoke: make decode_getfiles_arg_stream generic
Summary:
The stack is about adding support for getpackv1 wireproto request.

This diff make decode_getfiles_arg_stream function generic over Decoder type.
At the moment decode_getfiles_arg_stream is used for unpacking `getfiles` wireproto
request. However getpackv1 packs request in a similar way to getfiles (which
is different from any other wireproto requests). Let's re-use the same
functionality for getpackv1

Reviewed By: lukaspiatkowski

Differential Revision: D14401517

fbshipit-source-id: ef0e9abeecec61c7c3d25b4a9e36da3f05c870cb
2019-03-11 07:17:07 -07:00
Johan Schuijt-Li
5f4a2e3827 clienttelemetry: introduce support
Summary:
Client telemetry is used to send which commands are being run on the client,
which makes debugging slow sessions easier. For the client perspective, the
server hostname is send back so that the user knows to which physical host it's
connected, which is also useful debug info.

Reviewed By: StanislavGlebik

Differential Revision: D14261097

fbshipit-source-id: f4dc752671b76483f9dcb38aa4e3d16680087850
2019-02-28 10:34:47 -08:00
Johan Schuijt-Li
fff25e234f hgproto: rustfmt
Summary: Format code.

Reviewed By: StanislavGlebik

Differential Revision: D14261098

fbshipit-source-id: 8f9e2f8860fdcd24f91cbfef8974eb379c71049d
2019-02-28 10:34:47 -08:00
Stanislau Hlebik
1ec2d25722 mononoke: revert D13751782
Summary:
It breaks mononoke traffic replay - https://fburl.com/scuba/1rxovt8t.
It changed how mononoke logs requets to replay and now bundlecaps is a dict
instead of a string, so this line in traffic replay fails -
https://fburl.com/g8gwhzrq.

Reviewed By: lukaspiatkowski

Differential Revision: D13972033

fbshipit-source-id: a6e8258da8e7a5b6f90b869781f448a2202a07a1
2019-02-15 05:12:29 -08:00
Kostia Balytskyi
02ab033b04 mononoke: enable bundle2 content preservation conditionally
Summary: This is adds a metaconfig option to preserve push/pushrebase bundles in the blobstore.

Reviewed By: StanislavGlebik

Differential Revision: D14020299

fbshipit-source-id: 94304d69e0ac5d81232f058c6d94eec61eb0020a
2019-02-12 13:03:48 -08:00
Kostia Balytskyi
19f4c1cd8d mononoke: add a no-op code to preserve raw bundle2 contents in the blobstore
Summary:
This diff does not change anything on it's own, but rather adds the not
reachable (but already somewhat tested) code to preserve bundles when doing
pushes and pushrebases.

I want to land it now so that conflict resolution is easier.

Reviewed By: StanislavGlebik

Differential Revision: D14001738

fbshipit-source-id: e3279bc34946400210d8d013910e28f8d519a5f8
2019-02-11 14:48:37 -08:00
Lukas Piatkowski
44b06df35f hooks: do not pass repo name to hook execution
Summary:
Repo name is used only be verify_integrity hook and even there the name that Mononoke provides is incorrect. Instead of Mononoke's `repo-RepositoryId(1234)` name the hook is interested in Mercurial's `fbsource` name.
HookConfig is a perfect way to pass such an arbitrary parameter so use it.

Reviewed By: StanislavGlebik

Differential Revision: D13964486

fbshipit-source-id: 94090e409d5206828364202ae62a37abc16e4a27
2019-02-06 04:06:19 -08:00
Arthur Kushka
3f1b256609 Improved internal representation of GetbundleArgs.bundlecaps
Summary:
Implemented advanced parser to parse bundlecaps json object into more suitable to work datastructure.

Patched version of D13602738

Reviewed By: ikostia

Differential Revision: D13751782

fbshipit-source-id: 977b70c121d0df587082b8db615cbea7a00e3aa4
2019-01-31 02:08:12 -08:00
Arthur Kushka
aa4a1deb0a Back out "Improved internal representation of GetbundleArgs.bundlecaps"
Summary: mononoke: Original commit changeset: 6cb5124c7893

Reviewed By: StanislavGlebik

Differential Revision: D13751021

fbshipit-source-id: b80da7ebbaaca3324078efda15704c185050b35f
2019-01-21 07:43:26 -08:00
Arthur Kushka
21048bd300 Improved internal representation of GetbundleArgs.bundlecaps
Summary: Implemented advanced parser to parse bundlecaps json object into more suitable to work datastructure.

Reviewed By: aslpavel

Differential Revision: D13602738

fbshipit-source-id: 9a2f8e78d55a21e80229aae23e5a38f6cc14c7e8
2019-01-21 02:39:04 -08:00
Stanislau Hlebik
1d1e08b267 mononoke: avoid copies in encode_single
Summary:
It showed up in our profiles because it does unnecessary copies. And for big
request like getfiles it matters a bit. So let's fix it.

Reviewed By: aslpavel

Differential Revision: D13634952

fbshipit-source-id: 98be8bf7236eb12a4009b4b174ffac258f46e0f4
2019-01-16 09:21:44 -08:00
Liubov Dmitrieva
ad070bb4c1 getbundle request: bundlecaps param should be a set
Summary:
See representation from Mercurial.

```
gboptsmap = {
    "heads": "nodes",
    "bookmarks": "boolean",
    "common": "nodes",
    "obsmarkers": "boolean",
    "phases": "boolean",
    "bundlecaps": "scsv",
    "listkeys": "csv",
    "cg": "boolean",
    "cbattempted": "boolean",
}
```

Some logic might need to check what caps client supports. So convenient lookup is needed.

For example for phases, when we choose to transport phases via a separate bundle2 section called "phase-heads", we need to check that it is a supported on the client side.

Reviewed By: StanislavGlebik

Differential Revision: D13519888

fbshipit-source-id: 6471f2a5057cc3bb2dd72d9318a6f253a447b758
2019-01-08 01:48:06 -08:00
Liubov Dmitrieva
20a017f839 add "phases" param to getbundle request and its parsing
Summary:
Some params in getbundle requests were ignored in Mononoke

we are going to use "phases" param to check if we need provide phases or not

Mercurial uses 1/0:

```
            elif keytype == "boolean":
                value = "%i" % bool(value)
```

Reviewed By: aslpavel

Differential Revision: D13517508

fbshipit-source-id: b066b335d1b972e9845be9fa3862bbf4d11817cd
2018-12-19 09:47:16 -08:00
Lukas Piatkowski
c112df8189 hgproto: use CoreContext instead of Logger
Summary: passing CoreContext around instead of Logger gives us more flexibility

Reviewed By: StanislavGlebik

Differential Revision: D13340855

fbshipit-source-id: 43bc4def1532ce675a4ec70903fd6c04332c967e
2018-12-06 03:45:53 -08:00
Lukas Piatkowski
5d9a151d85 mononoke: pass CoreContext down to blobstore
Reviewed By: jsgf

Differential Revision: D13324220

fbshipit-source-id: af7a2a650338ea66e504ea0acae1d103af10f8e3
2018-12-04 11:40:15 -08:00
Tim Fox
d64d9121c5 Allow hook manager cache params to be configured
Summary: ${title}

Reviewed By: StanislavGlebik

Differential Revision: D13082486

fbshipit-source-id: fbdffdbfca218199dc2ac61abfcb8887b299db6d
2018-11-22 03:30:17 -08:00
Jeremy Fitzhardinge
b4f0a1e7ce tp2: update rust-crates-io
Summary:
Add libnfs, libffi and starlark.

Also nom now has "verbose-errors" feature (via bindgen -> cexpr -> nom), so make some tweaks to cope.

Reviewed By: farnz

Differential Revision: D10371391

fbshipit-source-id: ba889ad16a7b662c5eddafcb1e705b068ccc9af7
2018-10-15 23:08:01 -07:00
Tim Fox
debd4a5f95 Integrate hooks into mononoke write path
Summary: Integrate hook manager into the Mononoke pushrebase path

Reviewed By: lukaspiatkowski

Differential Revision: D9896005

fbshipit-source-id: ffd79b539288d95b134af97b776b7fcc3afa0ce7
2018-10-02 07:07:16 -07:00
Simon Farnsworth
0aaa4577bc Add minimal support to trigger streaming clones in Mercurial client
Summary:
Streaming clones are a neat hack; we get to send files down to the
Mercurial client, which it then writes out as-is. Usefully, we can send no
files, and the protocol still works.

Set up the capabilities etc needed so that we send streaming clones to
Mercurial clients, even if they're rather useless so far.

Reviewed By: StanislavGlebik

Differential Revision: D9926967

fbshipit-source-id: b543e802adac38c8bc318081eec364aed87b0231
2018-09-19 06:36:56 -07:00
Stanislau Hlebik
785ea8921d mononoke: make getbundle streaming
Summary: Should reduce memory usage and make getbundle a bit faster

Reviewed By: farnz

Differential Revision: D9861578

fbshipit-source-id: 57bca3700e3a38aeb70f267e6dc90d6b8a9d2955
2018-09-18 01:53:10 -07:00
Jeremy Fitzhardinge
ed34b17e1a mononoke: hgproto: make encoding response take ownership of the response
Summary: It avoids a heap of copies

Reviewed By: StanislavGlebik

Differential Revision: D9595689

fbshipit-source-id: a64f0a383acd517830d08cf0be9fc0a1b6903382
2018-08-31 10:23:49 -07:00
Jeremy Fitzhardinge
d8ad00442d mononoke: hgproto: little cleanups
Reviewed By: StanislavGlebik

Differential Revision: D9595691

fbshipit-source-id: eaf8223253ebdc6828758041b1126745aa58d462
2018-08-31 10:23:48 -07:00
Stanislau Hlebik
181388e584 mononoke: add context to the errors
Summary:
I was debugging pushrebase bugs, and the only error I got was
'oneshot::Cancelled'. Let's add a bit more context around it

Reviewed By: farnz

Differential Revision: D9554384

fbshipit-source-id: b3111ef1b5c743d65740f7fa3fd1a92eef9ab784
2018-08-29 07:07:36 -07:00
Lukas Piatkowski
2d92742e38 gettreepack: handle the depth parameter being send by client
Reviewed By: StanislavGlebik

Differential Revision: D9378908

fbshipit-source-id: 980e625765803c7cac9a272f3e701a3b2fa8da28
2018-08-17 09:07:26 -07:00
Liubov Dmitrieva
52a9bdd6a5 eliminate excessive thousands of lines logging
Summary: all that places logged all list of HgNodeHash

Reviewed By: StanislavGlebik

Differential Revision: D9242904

fbshipit-source-id: 42a98b04986f2ed432a8956828356bd5b9bcaa88
2018-08-13 12:08:16 -07:00
Pulkit Goyal
fc880f518b Add Cargo.toml files to crates. (#7)
Summary:
This is a series of patches which adds Cargo.toml files to all the crates and tries to build them. There is individual patch for each crate which tells whether that crate build successfully right now using cargo or not, and if not, reason behind that.

Following are the reasons why the crates don't build:

  * failure_ext and netstring crates which are internal
  * error related to tokio_io, there might be an patched version of tokio_io internally
  * actix-web depends on httparse which uses nightly features

All the build is done using rustc version `rustc 1.27.0-dev`.
Pull Request resolved: https://github.com/facebookexperimental/mononoke/pull/7

Differential Revision: D8778746

Pulled By: jsgf

fbshipit-source-id: 927a7a20b1d5c9643869b26c0eab09e90048443e
2018-07-09 19:52:27 -07:00
Stanislau Hlebik
604340d9ce mononoke: streaming gettreepack
Summary:
Unfortunately I have to remove tracing. The reason is because tracing doesn't
work with Streams. For now it should be fine because enabling tracing in prod
is still not possible because of the memory and cpu overhead.

Reviewed By: farnz

Differential Revision: D8381855

fbshipit-source-id: e28b4396c81527bdf30fa1703c634688cf645ada
2018-06-14 02:50:18 -07:00
Lukas Piatkowski
4f44c3f130 mercurial_types: remove D* types and move mercurial types around
Summary:
Now it is as it should be: mercurial_types have the types, mercurial has revlog related structures
burnbridge

Reviewed By: farnz

Differential Revision: D8319906

fbshipit-source-id: 256e73cdd1b1a304c957b812b227abfc142fd725
2018-06-07 13:19:16 -07:00
Stanislau Hlebik
96898bba07 mononoke: do not log too big node lists
Summary:
Some wireproto methods may have huge argument lists. They just print too much
data to stderr, and make stderr basically useless. Let's limit it

Reviewed By: jsgf

Differential Revision: D8076949

fbshipit-source-id: 58e760f25a7d4fdc9fc7bd95635f916a08e15ed2
2018-05-22 06:49:56 -07:00
Jeremy Fitzhardinge
51c49a47be tp2: update to rust 1.26.0 and corresponding rust-crates-io rebuild
Summary:
Rust 1.26 adds many new language features. In particular `impl Trait` is now
stable, so we no longer need `conservative_impl_trait`.

There also seems to have been changed in the (unstable) TryFrom with respect to
usize, and the behaviour of the never type `!`.

There are still a few deprecation warnings, but they don't cause the build to
fail.

Path remapping is now stable, so the buck config needs to change to use it
rather than the unstable command line option.

TODO:
- get aarch64 rust-crates-io build (can defer to a later update)

Reviewed By: Imxset21

Differential Revision: D7966091

fbshipit-source-id: 2e61e262c21eb01c852a36f49c6a6369cdaddcdb
2018-05-11 11:07:33 -07:00
Simon Farnsworth
b6ebaa6f08 Add a session overview Scuba sample
Summary:
We want to be able to identify "interesting" sessions - add a Scuba
sample that tells us what wireprotocol commands were sent, and how long the
session lasted.

Reviewed By: jsgf

Differential Revision: D7813906

fbshipit-source-id: a9bd48996a60b41098243f6c815465cd33d1429c
2018-04-30 10:44:05 -07:00
Lukas Piatkowski
03255529fa CODEMOD: rename mercurial::NodeHash to HgNodeHash
Reviewed By: sid0

Differential Revision: D7619973

fbshipit-source-id: 229fea891788c33eb1f45446ba2333e945ca5553
2018-04-16 03:40:25 -07:00
Lukas Piatkowski
935a973bd9 hgproto: use mercurial::NodeHash in hgproto handling
Summary:
mercurial::NodeHash is the representation of Mercurial's Sha1 hash, so it should be used to parse and generate hgproto.
This diff doesn't not change two crucial places that are required for full coverage of NodeHash remapping in future:
- Bundle2's tree manifest generation code
- Bundle2's resolver code
Those will be added in dependent diffs

Reviewed By: sid0

Differential Revision: D7600471

fbshipit-source-id: 40e05d5cce6c454200169f6f0049e57d427e9403
2018-04-13 10:00:03 -07:00
Lukas Piatkowski
26d1084ff6 removing unused commands and the corresponding request parsing code
Reviewed By: farnz

Differential Revision: D7568887

fbshipit-source-id: 00f616b745bca746881237ee4eacd1ac42259292
2018-04-10 09:03:40 -07:00
Stanislau Hlebik
b145efaa1a mononoke: trace gettreepack
Summary: Same as with getfiles tracing

Reviewed By: farnz

Differential Revision: D7501835

fbshipit-source-id: afca8910147c49322a4f3d7e12fe3b8ad3c88675
2018-04-07 11:05:32 -07:00
Stanislau Hlebik
12c9f55b9a mononoke: add listkeys wireproto
Summary:
This wireproto method is used by remotenames to update the list of
remotebookmarks. Implementation is the same as for listkeys bundle2 part.

Reviewed By: farnz

Differential Revision: D7271597

fbshipit-source-id: 8a75a93cae0e571d86d657e1c1d718a7fa0ab4ea
2018-03-21 14:24:55 -07:00
Stanislau Hlebik
b35bd5dd9d mononoke: pushkey part parsing
Summary:
Pushkey part is used to send bookmark updates from hg client to the server.
This diff does all the wireproto parsing, but doesn't actually apply bookmark
updates on the server.

Also this diff "implements" branchmap method. We have no plans to support it,
but currently remotenames extension calls it. So this diff adds a fake
implementation that always returns empty response.

Reviewed By: farnz

Differential Revision: D7150973

fbshipit-source-id: 6889c02a1105127b1805ef1fafa6fbe9c2d57e7d
2018-03-16 04:21:32 -07:00