Commit Graph

208 Commits

Author SHA1 Message Date
Stanislau Hlebik
62f843f0e5 mononoke: preserve the rest of Logging fields when calling with_mutated_scuba
Summary:
Currently when we call with_mutated_scuba() we create a new LoggingContainer.
That means that all the data from the previous LoggingContainer like PerfCounters
is lost. I suspect this is the reason we don't log any BlobGets/Puts for
repo_create_commit methods (see
[scuba](https://fburl.com/scuba/mononoke_scs_server/fautos3s)) - we call
[with_mutated_scuba method](https://fburl.com/code/srd1c4xu) right before
calling repo_create_commit(), and I suspect this loses the counters.

Let's instead copy all the Logging fields when calling `with_mutated_scuba`.

Reviewed By: krallin

Differential Revision: D27964719

fbshipit-source-id: 881c11bb5fb1927dbf55d0d625ea8bfbf11be131
2021-04-23 05:57:18 -07:00
Alex Hornby
bc85aade21 rust: update to zstd to 0.7.0+zstd.1.4.9
Summary:
Update the zstd crates.

This also patches async-compression crate to point at my fork until upstream PR https://github.com/Nemo157/async-compression/pull/117 to update to zstd 1.4.9 can land.

Reviewed By: jsgf, dtolnay

Differential Revision: D27942174

fbshipit-source-id: 26e604d71417e6910a02ec27142c3a16ea516c2b
2021-04-22 14:34:06 -07:00
Alex Hornby
45f521ddde mononoke: enable default patch.crates-io for internal Cargo.tomls
Reviewed By: quark-zju

Differential Revision: D27915811

fbshipit-source-id: 3f830def66c1c5f0569925c42cc8335ee585e0e7
2021-04-22 10:59:42 -07:00
Thomas Orozco
8ef8706e6e mononoke: add a new session class for WarmBookmarksCache
Summary:
I'd like to be able to track the proportion of traffic coming to bookmarks from
warm bookmarks cache vs. from elsewhere. We don't have a great abstraction to
pass this via the CoreContext at this time, but the SessionClass seems like a
pretty good fit.

Indeed, since it's always available in the CoreContext, and can be freely
mutated without having to rebuild the whole session. Besides, it aligns pretty
well with the existing use cases we have for SessionClass, which is to give you
different level of service depending on who you are.

Reviewed By: StanislavGlebik

Differential Revision: D27938413

fbshipit-source-id: a9dcc5a10c8d1459ee9586324a727c668e2e4e40
2021-04-22 08:13:09 -07:00
Stanislau Hlebik
6183cd68e4 mononoke: log how manynodes were requested in known call to perf counter
Summary:
We didn't log it to perf counters log, and that makes it hard to aggregate,
show distributions etc

Let's start doing that

Reviewed By: krallin

Differential Revision: D27856968

fbshipit-source-id: 82fbba70154ee011073f3122256bd296bbb938ae
2021-04-20 04:06:54 -07:00
Stanislau Hlebik
5c7ff35af8 mononoke: copy bonsai changeset from prod repo to backup repo if they don't match
Summary:
To prevent bonsai changeset divergence between prod and backup repo by copying
bonsais from prod repo directly during hg sync job push.

See more details about motivation in D27824210

Reviewed By: ikostia

Differential Revision: D27852341

fbshipit-source-id: 93e0b1891008858eb99d5e692e4dd60c2e23f446
2021-04-19 09:00:11 -07:00
Thomas Orozco
4130c60595 mononoke/cmdlib: remove public-facing add_scribe_logging_args API
Summary:
Like it says in the title. There's no reason for this to be ad ad-hoc "throw in
an arg" when everything else is done by adding arg types.

Reviewed By: HarveyHunt

Differential Revision: D27791333

fbshipit-source-id: 38e5a479800179b249ace5cc599340cb84eb53e2
2021-04-16 10:27:44 -07:00
Thomas Orozco
cf5b91ec95 mononoke/cmdlib: remove public-facing add_mcrouter_args API
Summary:
Like it says in the title. Let's remove ad-hoc "add an arg then look the arg"
mechanisms like this one.

Reviewed By: HarveyHunt

Differential Revision: D27791334

fbshipit-source-id: 257cea7763ab5130525ad739fe4ebdda4e8bfeb6
2021-04-16 10:27:44 -07:00
Thomas Orozco
db4c509b9e mononoke: use MononokeEnvironment in RepoFactory
Summary:
There is a very frustrating operation that happens often when working on the
Mononoke code base:

- You want to add a flag
- You want to consume it in the repo somewhere

Unfortunately, when we need to do this, we end up having to thread this from a
million places and parse it out in every single main() we have.

This is a mess, and it results in every single Mononoke binary starting with
heaps of useless boilerplate:

```
    let matches = app.get_matches();

    let (caching, logger, mut runtime) = matches.init_mononoke(fb)?;

    let config_store = args::init_config_store(fb, &logger, &matches)?;

    let mysql_options = args::parse_mysql_options(&matches);
    let blobstore_options = args::parse_blobstore_options(&matches)?;
    let readonly_storage = args::parse_readonly_storage(&matches);
```

So, this diff updates us to just use MononokeEnvironment directly in
RepoFactory, which means none of that has to happen: we can now add a flag,
parse it into MononokeEnvironment, and get going.

While we're at it, we can also remove blobstore options and all that jazz from
MononokeApiEnvironment since now it's there in the underlying RepoFactory.

Reviewed By: HarveyHunt

Differential Revision: D27767700

fbshipit-source-id: e1e359bf403b4d3d7b36e5f670aa1a7dd4f1d209
2021-04-16 10:27:43 -07:00
Thomas Orozco
eba01d39e5 mononoke: move ScrubHandler out of ScrubOptions
Summary:
ScrubOptions normally represents options we parsed from the CLI, but right now
we abuse this a little bit to throw a ScrubHandler into them, which we
sometimes mutate before using this config.

In this stack, I'm unifying how we pass configs to RepoFactory, and this little
exception doesn't really fit. So, let's change this up, and make ScrubHandler
something you may give the RepoFactory if you're so inclined.

Reviewed By: HarveyHunt

Differential Revision: D27767699

fbshipit-source-id: fd38bf47eeb723ec7d62f8d34e706d8581a38c43
2021-04-16 10:27:43 -07:00
Thomas Orozco
c2c904f933 mononoke: initialize loggers, config, caching, tunables & runtime in MononokeMatches
Summary:
Basically every single Mononoke binary starts with the same preamble:

- Init mononoke
- Init caching
- Init logging
- Init tunables

Some of them forget to do it, some don't, etc. This is a mess.

To make things messier, our initialization consists of a bunch of lazy statics
interacting with each other (init logging & init configerator are kinda
intertwined due to the fact that configerator wants a logger but dynamic
observability wants a logger), and methods you must only call once.

This diff attempts to clean this up by moving all this initialization into the
construction of MononokeMatches. I didn't change all the accessor methods
(though I did update those that would otherwise return things instantiated at
startup).

I'm planning to do a bit more on top of this, as my actual goal here is to make
it easier to thread arguments from MononokeMatches to RepoFactory, and to do so
I'd like to just pass my MononokeEnvironment as an input to RepoFactory.

Reviewed By: HarveyHunt

Differential Revision: D27767698

fbshipit-source-id: 00d66b07b8c69f072b92d3d3919393300dd7a392
2021-04-16 10:27:43 -07:00
Thomas Orozco
3df7627d2d mononoke: rename MononokeEnvironment to MononokeApiEnvironment
Summary:
I want to call something else MononokeEnvironment (the environment the whole
binary is running in), so let's rename this one.

Reviewed By: StanislavGlebik

Differential Revision: D27767696

fbshipit-source-id: bd6f2f282a7fc1bc09926a0286ecb8a5777a0a24
2021-04-16 10:27:43 -07:00
Jan Mazur
77a205db89 quiet certain connection errors when shutting down
Summary: Similar to D27155123 (1a56da1c6f).

Reviewed By: krallin

Differential Revision: D27805926

fbshipit-source-id: cf58a2e9b2ef92ca536f3b61b63fb42cfb1ec940
2021-04-16 02:26:04 -07:00
Simon Farnsworth
b38e7d3a40 Separate MySQL pool for SQLBlob
Summary: SQLBlob doesn't benefit from sharing a pool with other MySQL users, but does benefit from more aggressive connection timeouts. Give it its own pool, which we can tweak later.

Reviewed By: krallin

Differential Revision: D27651133

fbshipit-source-id: 8f5216ec0506b217f9365babfe1ebac00f68a9a9
2021-04-12 05:25:48 -07:00
Harvey Hunt
7358178f4a mononoke: Remove external sync logic
Summary:
Now that the `hg_external_sync` jobs are gone we can delete the code
in Mononoke that behaves differently when a sync job connects.

Reviewed By: StanislavGlebik

Differential Revision: D27500506

fbshipit-source-id: 443fb54577833dbf44ece6ae90a5f25ffed38cd5
2021-04-08 09:17:11 -07:00
Mark Juggurnauth-Thomas
23e065fe0e repo_listener: remove dependency on blobrepo_factory
Summary:
This import is only used for the `ReadOnlyStorage` type, which is canonically
defined in `blobstore_factory`.

Reviewed By: krallin

Differential Revision: D27363467

fbshipit-source-id: ed1388e661453e1b434c83af63c76da1eea1bce1
2021-04-07 14:01:47 -07:00
Mark Juggurnauth-Thomas
117398d820 mononoke_api: use RepoFactory to construct repositories
Summary:
Switch from `blobrepo_factory` to the new `RepoFactory` to construct `BlobRepo`
in `mononoke_api`.

The factory is part of the `MononokeEnvironment`, and is used to build all of the repos.

Reviewed By: krallin

Differential Revision: D27363473

fbshipit-source-id: 81345969e5899467f01d285c232a510b8edddb17
2021-04-07 14:01:47 -07:00
Jan Mazur
24d2aa1442 bump region2region QPS
Summary:
We need to bump SCS counters expressing Mononoke's QPS. They will look something like:
`requests:mononoke:oregon:carolina` for requests coming from proxygen in prn and mononoke in frc.

CSLB expects regions' full names.

We're getting src region from proxygen as a header.

Reviewed By: krallin

Differential Revision: D27082868

fbshipit-source-id: 12accb8a9df5cf6a80c2c281d2f61ac1e68176d1
2021-03-22 10:12:43 -07:00
Jan Mazur
e8444aadb7 add top-level-tier command line argument
Summary:
Before I use a new command line argument I need to add it first.
This one will be set to the top level smc tier which is mononoke, mononoke.experimental, etc.
It will be used to bump SCS counters consumed by CSLB.

I don't want this to be optional because I don't want people to accidentally turn off publishing SCS counters representing QPS. On the other hand I don't want people who run it locally to pollute prod counters (in the script that sets this up locally its set to some dommy tier).

Reviewed By: krallin

Differential Revision: D27190020

fbshipit-source-id: 472011f0584012b036efdd015565cda3b3c029e9
2021-03-22 03:13:54 -07:00
Jan Mazur
1a56da1c6f ignore BrokenPipe error when shutting down connection
Summary:
We use srselect on hg hosts to figure out which Mononoke servers hgcli can connect to.

We were getting BrokenPipe errors most likely from srselect.

`E0318 03:51:02.558708   679 [tk] eden/mononoke/server/repo_listener/src/connection_acceptor.rs:201] connection_acceptor error: Failed to handle connection to [2401:db00:12:90c3:face:0:361:0]:57594: Failed to handle_connection: Failed to handle_http: Failed to serve_connection: error shutting down connection: Broken pipe (os error 32): Broken pipe (os error 32)
`

Tbh it isn't much different than `ErrorKind::NotConnected` because we'are shutting the connection down anyway and it doesn't matter whether client hung up or is already dead.

Reviewed By: krallin

Differential Revision: D27155123

fbshipit-source-id: 96bb2b268f116a20f16605eb04c867c9ad047b1f
2021-03-18 05:54:28 -07:00
Mark Juggurnauth-Thomas
c310245e9b repo_listener: log when connection handlers are cancelled
Summary:
Unlike the source control service, requests aren't usually cancelled in the
main server.  However, if the request doesn't complete within the shutdown
timeout, it does get cancelled.

Add logging for this case.

Reviewed By: krallin

Differential Revision: D27086622

fbshipit-source-id: dbd9dee1a6a84b4cd5570302a0a62fb96d2489aa
2021-03-17 08:59:19 -07:00
Stanislau Hlebik
a80dece152 mononoke: add a way to limit s3 blobstore
Summary:
S3 blobstore is sensitive to the number of open connections and it causes perf
problems. Let's add a way to limit the number of simultaneous open connections.

Also see D26911520

Reviewed By: krallin

Differential Revision: D26911679

fbshipit-source-id: 1e3e4922b26d0a29c94c89b4aa76b9b5928effe6
2021-03-11 00:55:14 -08:00
Thomas Orozco
7e8332c9a5 mononoke: actually disable control api when !enable_http_control_api
Summary: Like it says in the title. I also replaced one of our status codes that was wrong.

Reviewed By: johansglock

Differential Revision: D26844865

fbshipit-source-id: b8c1261d0077cf5dc006827e16667e382db7d189
2021-03-05 05:26:57 -08:00
Thomas Orozco
2a803fc10d third-party/rust: update futures
Summary:
Those newer versions of Futures have compatibility improvements with Tokio,
notably:

- https://github.com/rust-lang/futures-rs/pull/2333
- https://github.com/rust-lang/futures-rs/pull/2358

Reviewed By: farnz

Differential Revision: D26778794

fbshipit-source-id: 5a9dc002083e5edfa5c614d8d2242e586a93fcf6
2021-03-04 06:42:55 -08:00
Jan Mazur
d5e9c99e09 change hipster action in check_if_trusted
Summary:
It doesn't make a whole lot of sense to user the "tupperware" permission here.
Lets make a distinction in who is allowed to provision mononoke vs. who is allowed to forward identities to it.
I have created a separate action with the same identities allows as in the "tupperware" permission.

https://www.internalfb.com/intern/hipster/acls/view/?type=TIER&consumer=mononoke

Reviewed By: StanislavGlebik

Differential Revision: D26777489

fbshipit-source-id: d3999dc4da7a57ac721572610f65eba664e595e9
2021-03-03 06:35:11 -08:00
Ilia Medianikov
58b9ac23ef mononoke: Don't create separate ConfigStore's in tests
Summary:
Atm in tests a separate ConfigStore with file source is created for some configs and then a reference to it is dropped immediately ([see get_config_handle function in mod.rs](https://fburl.com/diffusion/fpkj7ekv)). This is uncomfortable as we may need a reference to e.g. force update configs in tests.

Instead of creating separate stores we can reuse static configerator which already uses local files (in tests).

Reviewed By: krallin

Differential Revision: D26725515

fbshipit-source-id: 24269cd93b7d35216c025807c3f3eb527688b72b
2021-03-03 03:52:41 -08:00
Lukas Piatkowski
edb679f785 autocargo v2: rollout and replace v1 in all use-cases
Summary:
This diff rollouts V2 of autocargo in an atomic way so there are quite a few things done here.

Arc lint support:

V1 used to be part of the default fbsource `arc lint` engine, but since V2 calls buck it must live in a separate lint engine. So this diff:
- Adds running `autocargo` as part of `arc lint-rust`

Mergedriver update:

- Mergedriver used in resolving conflicts on commits is now pointing to V2
- It handles files in `public_autocargo/` directories in addition to the ones containig generation preamble

Including regeneration results of running `common/rust/cargo_from_buck/bin/autocargo`. All the differences are accounted for:

- Some sections and attributes are removed as they can be autodiscovered by Cargo (like `lib.path = "src/lib.rs"` or empty [lib] section)
- "readme" attribute is properly defined as relative to Cargo.toml location rather than as hardcoded string
- "unittest = false" on a Buck rule propagates as "test = false; doctest = false" to Cargo
- "rusqlite" is not special-cased anymore, so the "budled" feature will have to be enabled using custom configuration if required by the project (for rust-shed in order to not break windows builds a default feature section was added)
- Files generated from thrift_library rules that do not support "rust" language are removed
- Custom .bzl rules that create rust artifacts (like `rust_python_extension`) are no longer ignored

Others:

- Changed `bin/cargo-autocargo` to be a wrapper for calling V2 via `cargo autocargo`
- Updated following files to use V2:
  - `common/rust/tools/reindeer/version-bump`
  - `remote_execution/rust/setup.sh`
- Removed few files from V1 that would otherwise interfere with V2 automatic regeneration/linting/testing

Reviewed By: zertosh

Differential Revision: D26728789

fbshipit-source-id: d1454e7ce658a2d3194704f8d77b12d688ec3e64
2021-03-02 06:43:29 -08:00
Ilia Medianikov
0aff1c23ec mononoke: server: add support for force updating tunables and configerator and remove sleeps in tests
Summary: We have a number of sleeps in our integration tests. The two main reasons are configs & tunables that need reloading. Currently, we have no way of force-reloading those.

Reviewed By: krallin

Differential Revision: D26615732

fbshipit-source-id: 217c4ae039abd398972b4a9764d08e18d6182493
2021-02-26 10:18:31 -08:00
Lukas Piatkowski
f317302b0f autocargo v1: reformating of oss-dependencies, workspace and patch sections and thrift files to match v2
Summary:
For dependencies V2 puts "version" as the first attribute of dependency or just after "package" if present.
Workspace section is after patch section in V2 and since V2 autoformats patch section then the third-party/rust/Cargo.toml manual entries had to be formatted manually since V1 takes it as it is.
The thrift files are to have "generated by autocargo" and not only "generated" on their first line. This diff also removes some previously generated thrift files that have been incorrectly left when the corresponding Cargo.toml was removed.

Reviewed By: ikostia

Differential Revision: D26618363

fbshipit-source-id: c45d296074f5b0319bba975f3cb0240119729c92
2021-02-25 15:10:56 -08:00
Thomas Orozco
52a1c515a8 third-party/rust: update tokio-util to 0.3 and rename it
Summary:
Like our other "tokio ecosystem" crates, I'm renaming this one tokio-util-02
(as in tokio-02) since this is the last version it is compatible with. Note that this had a
breaking change as well, so I updated the callsites.

Reviewed By: HarveyHunt

Differential Revision: D26636350

fbshipit-source-id: 30f7da1036c861a97717c8d26648daaae33ecfbd
2021-02-25 07:42:30 -08:00
Thomas Orozco
c064d70c02 mononoke: fork Gotham less
Summary:
We use a forked version of Gotham in Mononoke. This isn't great, because we
have to maintain this fork. Ideally, we'd upstream our changes, but as is
they're a bit intrusive and not generally useful, which makes this hard.

I've reworked how we do our Gotham changes, and now we only need to make 1 bit
of code public, which might be easier to get upstream. Concretely, Gotham has a
concept of "connected handler" that links a Hyper request and a socket address,
but in our case we want more things. This change lets us instantiate our own
Gotham state, and then add a few more things to it as necessary.

This diff updates our code accordingly to be compatible. This also lets us trim
down on some ceremony we had to do call into Gotham
from Mononoke Server.

Reviewed By: farnz

Differential Revision: D26634653

fbshipit-source-id: 024a48ebc3f323c165ac412ef422755e8cb1c650
2021-02-25 07:42:29 -08:00
Thomas Orozco
d71fa2882c common/rust/futures_ext: update to tokio_shim
Summary:
Like it says in the title, this updates futures_ext to use tokio_shim, which
makes it compatible with Tokio 0.2 and 1.0.

There is one small difference in behavior here, which is that in Tokio 1.0,
sleep isn't Unpin anymore, so callers will need to call `boxed()` or use Tokio's `pin!` macro if they need
Unpin.

I do want to get as close to what upstream is doing in Tokio 1.0, so I think
it's good to keep that behavior.

Reviewed By: farnz

Differential Revision: D26610036

fbshipit-source-id: ff72275da55558fdf8fe3ad009d25cf84e108a5a
2021-02-25 02:11:30 -08:00
Thomas Orozco
0734a61cb1 common/rust: remove tracing
Summary:
This was a thing that was only ever used in Mononoke, and we don't think it's
usable and haven't been using it. Let's get rid of it. As-is, it won't even work
for most people due to its (indirect) dependency on Tokio 0.1.

Reviewed By: StanislavGlebik

Differential Revision: D26512243

fbshipit-source-id: faa16683f2adb20dfba43c4768486b982bc02ff9
2021-02-22 09:22:41 -08:00
Johan Schuijt-Li
0a16d7d2b8 netspeed increase timeout
Summary:
When testing over slow connections with packet loss, 10 seconds isn't nearly
long enough. Extend to 5 minutes.

Reviewed By: singhsrb

Differential Revision: D26571682

fbshipit-source-id: 8ebdcf07cb2f0fb001640666bdea02f69ad5fb7b
2021-02-21 23:06:23 -08:00
Lukas Piatkowski
cd0b6d50e2 autocargo v1: changes to match autocargo v2 generation results.
Summary:
The changes (and fixes) needed were:
- Ignore rules that are not rust_library or thrift_library (previously only ignore rust_bindgen_library, so that binary and test dependencies were incorrectly added to Cargo.toml)
- Thrift package name to match escaping logic of `tools/build_defs/fbcode_macros/build_defs/lib/thrift/rust.bzl`
- Rearrange some attributes, like features, authors, edition etc.
- Authors to use " instead of '
- Features to be sorted
- Sort all dependencies as one instead of grouping third party and fbcode dependencies together
- Manually format certain entries from third-party/rust/Cargo.toml, since V2 formats third party dependency entries and V1 just takes them as is.

Reviewed By: zertosh

Differential Revision: D26544150

fbshipit-source-id: 19d98985bd6c3ac901ad40cff38ee1ced547e8eb
2021-02-19 11:03:55 -08:00
Thomas Orozco
012ecf21db mononoke/repo_listener: remove tokio 0.1
Summary: Easy: it's not used.

Reviewed By: StanislavGlebik

Differential Revision: D26485713

fbshipit-source-id: 39de39f73ebf5b53f5eaecfc8fa5cf5aeb1d88e8
2021-02-19 07:00:53 -08:00
Jan Mazur
f9376fce90 load_limiter: static, sliced rate limitting
Summary: We would like to consistently rate limit a percentage of hosts from a specific tier expressed as a subset of identities.

Reviewed By: krallin

Differential Revision: D26312370

fbshipit-source-id: d3fc9e892a8c9f62e22b079fa947a85078831687
2021-02-15 09:56:56 -08:00
Lukas Piatkowski
87ddbe2f74 autocargo v1: update autocargo field format to allow transition to autocargo v2
Summary:
Autocargo V2 will use a more structured format for autocargo field
with the help of `cargo_toml` crate it will be easy to deserialize and handle
it.

Also the "include" field is apparently obsolete as it is used for cargo-publish (see https://doc.rust-lang.org/cargo/reference/manifest.html#the-exclude-and-include-fields). From what I know this might be often wrong, especially if someone tries to publish a package from fbcode, then the private facebook folders might be shipped. Lets just not set it and in the new system one will be able to set it explicitly via autocargo parameter on a rule.

Reviewed By: ahornby

Differential Revision: D26339606

fbshipit-source-id: 510a01a4dd80b3efe58a14553b752009d516d651
2021-02-12 23:28:25 -08:00
Thomas Orozco
db7f9fe76b third-party/rust: update Hyper
Summary:
johansglock pointed out that Hyper is affected by CVE-2021-21299. Let's update
to a fixed version.

Reviewed By: farnz

Differential Revision: D26313854

fbshipit-source-id: 4db04d3044fb9f22a037bda0a88a5314f62f9dfc
2021-02-12 04:56:24 -08:00
Thomas Orozco
2a21e4fb17 third-party/rust: update Tokio to 0.2.25 + add a patch to disable coop scheduling
Summary:
See the patch & motivation here:

818f943db3

Reviewed By: StanislavGlebik

Differential Revision: D26399890

fbshipit-source-id: e184a3f6c1dd03cb4cdb7ea18073c3392d7ce355
2021-02-12 04:56:23 -08:00
Thomas Orozco
497544a63e mononoke/edenapi_service: check & bump load counters for trees & files
Summary:
Like it says in the title. Let's add some basic throttling control here, in
line with what we have in Mononoke Server. The numbers don't quite match up
since fetches in EdenAPI don't include linknodes or history, but this should be
better than nothing and sufficient for now, and makes sense to have with
EdenAPI & Mononoke Server running in the same process.

Reviewed By: HarveyHunt

Differential Revision: D26250746

fbshipit-source-id: 338eda4341a163d0d915f10bf45fc7f40c74fc69
2021-02-05 15:16:09 -08:00
Thomas Orozco
67125980bb mononoke: add load limiter to EdenAPI sessions
Summary:
Like it says in the title. I'd like to access our load limiter from there and
this is a good way to do it.

Note that EdenAPI doesn't have client hostnames when we instantiate the load
limiter, but we also don't truly need it because our client identities include
the hostprefix (at least in cases where a reverse lookup stands a chance of
succeeding, i.e. in prod).

Reviewed By: HarveyHunt

Differential Revision: D26250743

fbshipit-source-id: d1ad062d2967bfe28b3ddc164cac977d297d1b6a
2021-02-05 15:16:09 -08:00
Thomas Orozco
390e60a0a7 mononoke: extract load limiter set up in its own crate
Summary: I'd like to reuse this in EdenAPI. This will allow for that!

Reviewed By: StanislavGlebik

Differential Revision: D26250744

fbshipit-source-id: 47e86cba4d9fafc35f26cb6431921a157a207925
2021-02-05 15:16:08 -08:00
Thomas Orozco
1af547c62a mononoke: move is_quicksand, is_external_sync to permission_checker crate
Summary:
I'd like to use those in the load_limiter crate, but that'd create a cyclic
dependency, so I need to move them. Considering those methods operate on
identity sets anyway, it seems like a good idea to just move them there.

Reviewed By: StanislavGlebik

Differential Revision: D26250747

fbshipit-source-id: 4de89eae50bd5b574c2c08798e1fd753da9cab90
2021-02-05 15:16:08 -08:00
Ilia Medianikov
ba7e78c567 mononoke: expose PerfCounters at request level
Summary: One thing we have right now in Repo Client is logging of perf counters (this happens in the call to finalize_command). However, we don't have this at the request level. This is a little annoying because there is some context about the client calling us that only exists in the request level, so we can't aggregate on PerfCounters there.

Reviewed By: krallin

Differential Revision: D26257247

fbshipit-source-id: 220c1adafd583420e64599befbd165152c3a8c6f
2021-02-05 10:58:27 -08:00
Johan Schuijt-Li
a0c7b4c7a5 connection handling: keep socket alive by sending empty messages
Summary:
Load balancers can shut down our connection if we don't keep sending data over
there. While we wait for user input, keep sending empty messages over stderr.
These messages will be ignored by Mercurial, but have the side-effect that load
balancers will consider the socket active and therefor keep the socket alive.

Reviewed By: krallin

Differential Revision: D26276314

fbshipit-source-id: f46070a29bbcb4faaa64251e72216cd056354459
2021-02-05 10:35:44 -08:00
Thomas Orozco
b1574802a7 mononoke/server: bring back cache warmup parallelism (aka boot 2x as fast)
Summary:
Like it says in the title. This updates Mononoke to restore parallelism in the
repo startup sequence, notably as part as cache warmup is concerned, which is
the biggest time consumer of Mononoke startup (I'm saying "restore" here
because we used to have this and it appears to have been accidentally removed a
month ago).

Note that we incidentally got some of the parallelism back earlier this week
for repo creation when I updated Mononoke Server to use `mononoke_api`, but
that didn't do anything for cache warmup, hence this diff.

Reviewed By: StanislavGlebik

Differential Revision: D26276745

fbshipit-source-id: 687a52a2326de7158fc7ad1982547a698faff314
2021-02-05 10:02:40 -08:00
Thomas Orozco
b7aa756c11 mononoke/server: log how many connections have yet to finish
Summary: It's kinda nice to have.

Reviewed By: StanislavGlebik

Differential Revision: D26276565

fbshipit-source-id: 12c784082e1791803c421f8d21b3a05a5a8f98d9
2021-02-05 09:22:41 -08:00
Thomas Orozco
c88a08b9df mononoke: add futures_watchdog, a crate to help find stalls
Summary:
Like it says in the title. This adds a crate that provides a combinator that
lets us easily find stalls caused by futures that stay in `poll()` for too
long.

The goal is to make this minimal overhead for whoever is using it: all you need
is to import it + give it a logger. It automatically looks up the line where
it's called and gives it back to you in logs. This uses the `track_caller`
functionality to make this work.

Reviewed By: farnz

Differential Revision: D26250068

fbshipit-source-id: a1458e5adebac7eab6c2de458f679c7215147937
2021-02-04 10:40:04 -08:00
Thomas Orozco
201a50db11 mononoke/server: expose EdenAPI
Summary:
Like it says in the title, this adds support for exposing EdenAPI in Mononoke
Server. That's it!

Differential Revision: D26131777

fbshipit-source-id: 15ed2d6d80b1ea06763adc0b7312d1cab2df5b76
2021-02-04 10:40:04 -08:00