Commit Graph

64660 Commits

Author SHA1 Message Date
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
9e92ba1d28 mononoke: always initialize tunables in integration tests
Summary:
We actually require tunables in our binaries, but some of our tests have
historically not initialized them, because the underlying binaries don't
load tunables (so they get defaults).

I'd like to remove the footgun of binaries not initializing tunables, but to do
this I need tunables to be everywhere, which is what this does.

Reviewed By: StanislavGlebik

Differential Revision: D27791723

fbshipit-source-id: 13551a999ecebb8e35aef55c0e2c0df0dac20d43
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
Pyre Bot Jr
dc8edb9bd7 Add annotations to eden/fs/py/eden/thrift/test/client_test.py
Reviewed By: xavierd

Differential Revision: D27823522

fbshipit-source-id: 6bec6252e1c6f402528aed2ee784ba85373e6db3
2021-04-16 10:14:23 -07:00
Alex Hornby
072e871771 mononoke: log packblob test compressed sizes
Summary: This test failed on CI for unknown reasons,  log the sizes in the failure as a clue.

Reviewed By: farnz

Differential Revision: D27822287

fbshipit-source-id: d15c8165c1d5a5a588b48d7b8469e5cd9cba1a35
2021-04-16 08:34:19 -07:00
Jan Mazur
e885d25c86 use ErrorKind instead of generic ahyhow::Error to match on errors
Summary: Changing generic anyhow::Error to ErrorKind so there is no need to downcast when we want to match on errors.

Reviewed By: krallin

Differential Revision: D27742374

fbshipit-source-id: ba4c1779d5919eb989dadf5f457d893a3618fffc
2021-04-16 08:26:29 -07:00
Stanislau Hlebik
d93c5a3784 mononoke: add public phase warmer
Reviewed By: krallin

Differential Revision: D27821286

fbshipit-source-id: ece394a2f7f46a3b67d6074a615741c56dc7e3d8
2021-04-16 08:20:48 -07:00
svcscm svcscm
76a3055775 Updating submodules
Summary:
GitHub commits:

9ee9660e44
401e76e9e6
5c051ed675
27d39c9049
e61976ca83
2ed81908df
8ce4192225
358c035658
fb83c639ae
d72ae5499d

Reviewed By: yns88

fbshipit-source-id: eaf5b7e90c7cd6acedc24d533cb4c237cd9e4cef
2021-04-16 08:02:41 -07:00
Thomas Orozco
1367bb124f mononoke: "randomize" a few more queries
Reviewed By: StanislavGlebik

Differential Revision: D27821553

fbshipit-source-id: e5ebddfda7dc902efec0cf1a7924aa651b5cbc80
2021-04-16 07:11:52 -07:00
Simon Farnsworth
577d58ae72 Rearrange blobstore factory to ensure that PackBlob has a BlobstoreWithLink
Summary:
In the next diff, the packer will need to create PackBlobs with access to link and unlink operations on the underlying data store.

Rearrange blobstore factory so that this is guaranteed by design, noting that we will want to manually create just a PackBlob later.

Reviewed By: ahornby

Differential Revision: D27795485

fbshipit-source-id: e16c7baea4f2402a4f8f95d722adb5c422c5b8e3
2021-04-16 06:51:18 -07:00
svcscm svcscm
5bfda982de Updating submodules
Summary:
GitHub commits:

d3ddc64b6f
9a023a1d34
880b35e0b7
8c395224ca
9cb3c09e5e
4c41e51c07
a032870708
70835f3858
f4c2f9d036
fe6be75b79
f6c0232d78
7c0b2bb1f1
ff7bc1081b

Reviewed By: yns88

fbshipit-source-id: fdceffb41f43f1aa2dcc791ff4c60f876aa78237
2021-04-16 06:45:52 -07:00
svcscm svcscm
3f2ddeee53 Updating submodules
Summary:
GitHub commits:

3cb38fd0fb
d68838f2a1
842cc1dbab
a3c1fac8eb
7843439a19
2825c959ed
e0a8f18fad
c806f5f3fb
0a5a997fa2
973db55be4
ff558e648a
8ab002d154

Reviewed By: yns88

fbshipit-source-id: 12b4bb34b266a9c3dbe1289452263dc15b41f104
2021-04-16 03:36:30 -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
svcscm svcscm
a0c85e4e2a Updating submodules
Summary:
GitHub commits:

322dd13b50
8407e0861f
822c9ac1e1
e31125bcd2
b5c2ada309
57ed5c5018
e743586c8c
b77111d63c
22d663645f
b16caecd51
63d9a947ea
f246c4eb4d

Reviewed By: yns88

fbshipit-source-id: 807ed021974e3231f105dbff26e55321276296b8
2021-04-16 00:03:28 -07:00
svcscm svcscm
621b2c0061 Updating submodules
Summary:
GitHub commits:

96d3db5f81
ca48be1a8a
4a3a390d1c
8b26cdbd67
da5adbd751
4316be0b3e
7a279e8899
d049bbe6cb
b6f2d52ede
573e381a0b
8340e56c23
d5f512dc2f

Reviewed By: yns88

fbshipit-source-id: e555f79b577cd510ef0c8bb90c15fabc0cfe1136
2021-04-15 22:43:34 -07:00
svcscm svcscm
1f2ca87529 Updating submodules
Summary:
GitHub commits:

f658b65817
0d2c8630c2
39b3ce8641
ebb45e0700
e64cb6b838
00803d619c
3781fb32b2
83a3821d95
d5859eb1f8
d04d314269
c5d12e085c

Reviewed By: yns88

fbshipit-source-id: 4414a7e3bc7847c88c2faf8bd9d0ead7b5081727
2021-04-15 21:19:08 -07:00
Andrey Chursin
360a6b5a0e checkout: check unkwnown file content in native checkout
Summary:
This replicates behaviour of Python code - if unknown file content matches content of the file to be check out, do not abort checkout

This is useful for resuming interrupted checkouts / clones

Reviewed By: DurhamG

Differential Revision: D27799147

fbshipit-source-id: 7d2582583525da18fba08dfcd8bced2b619304de
2021-04-15 20:08:17 -07:00
Andrey Chursin
82f93150a0 vfs: add VFS::read
Summary: Adding method to VFS to read file content

Reviewed By: DurhamG

Differential Revision: D27799146

fbshipit-source-id: c7e5c2dbd496d3cfd349a435225b1d44ee14cda0
2021-04-15 20:08:17 -07:00
svcscm svcscm
a3eb6b227a Updating submodules
Summary:
GitHub commits:

e5aa957716
3f6fe1192f
b682ee968a
eedb709626
633e23d134
8cc415f918
e37c6c0cd1
d89983e9d9
a9129ade68
d6e80e7b4c
2c0fc32350

Reviewed By: yns88

fbshipit-source-id: 75b1a80c39f85e38b6f04d5d85a0c99b32f4a728
2021-04-15 20:04:12 -07:00
svcscm svcscm
a301076e3e Updating submodules
Summary:
GitHub commits:

6774e2ceb2
bc9e5cf1eb
3a09d54cee
c69aa19d60
3b106cafab
5d25a8aeb5
523ff150ef
f993ff0753
c2dfd3dda5
900d55e7e3
0c2b82e117
b0872a058b
0dd19e7b27

Reviewed By: yns88

fbshipit-source-id: b8c6f40dd666a1e66556b99c40ccf55662318094
2021-04-15 17:30:47 -07:00
svcscm svcscm
01aab88001 Updating submodules
Summary:
GitHub commits:

a0fd97c4b7
c6819f9640
c93c0b80c6
83031e7343
b25603a77e
d54b9702b5
07753286be
35bcab7c3c

Reviewed By: yns88

fbshipit-source-id: b089095de46d4b226be5987bad8e5dcd4115f8c4
2021-04-15 14:48:18 -07:00
Thomas Orozco
acaa598e7a mononoke/bookmarks: temporarily work around fault injection in SQL queries
Reviewed By: markbt, mitrandir77, StanislavGlebik

Differential Revision: D27799466

fbshipit-source-id: b44c4d7a8c76a37a6683694cdf56bcb06e02a529
2021-04-15 13:11:13 -07:00
Kostia Balytskyi
59ee3033c9 megarepo: sync D27794245 to fbcode
Reviewed By: farnz

Differential Revision: D27794480

fbshipit-source-id: 5e3643ea0124e22e78744d9cc45e4ec9cf1da8b2
2021-04-15 09:39:09 -07:00
Katie Mancini
fd78a70d7a fix prefetch-profile activate
Summary:
activate recently got broken when we added the prefetch-metadata flag,
this needs to be on activate as well as fetch

Reviewed By: xavierd

Differential Revision: D27778771

fbshipit-source-id: 052710c2f206e66d8042314773b6b408cff4915c
2021-04-15 09:30:16 -07:00
Andrey Chursin
261e309caf checkout: handle --clean in native checkout
Summary: Currently native checkout aborts on unknown files even with --clean flag. It should not abort with --clean

Reviewed By: DurhamG

Differential Revision: D27779554

fbshipit-source-id: 2badc84c10eab28d2b1fc8840142ef883ac48c26
2021-04-15 09:26:12 -07:00
Stanislau Hlebik
38a3921a2f mercurial: fix unused_import warning
Summary: It's been showing up while building mononoke. Let's fix it

Reviewed By: sfilipco

Differential Revision: D27789928

fbshipit-source-id: a15912f66b9ad3370545aed88405dbeb800e63de
2021-04-15 09:20:09 -07:00
Durham Goode
f0f6a38fbe dynamicconfig: backout D26801059 that enabled no-repo configs
Summary: This seems to have broken the EdenFS HgPrefetch test.

Reviewed By: xavierd

Differential Revision: D27795192

fbshipit-source-id: 80a748036961aa6a5750182bf65637fb76825341
2021-04-15 09:00:19 -07:00
Thomas Orozco
aed52d2afc fix hg-server panic formatting
Summary:
This now warms as of Rust 1.51, but we turn it into an error:

https://www.internalfb.com/intern/sandcastle/log/?instance_id=18014398919947596&step_id=18014402571733773&step_index=5&name=Build

Context: https://fb.workplace.com/groups/rust.language/permalink/5558170997564803/

I think the diff that introduced this code raced with the one that updated the panic messages globally.

Reviewed By: HarveyHunt

Differential Revision: D27791846

fbshipit-source-id: d551768103a96ffcbe87770b0b79f92494f4fa87
2021-04-15 06:20:25 -07:00
Johan Schuijt-Li
deb1059f81 mononokepeer: support connecting over unix socket proxy
Reviewed By: markbt

Differential Revision: D27647191

fbshipit-source-id: c3b50529cd5ef421e84dc34b45550742f8cd19c6
2021-04-15 05:18:34 -07:00
CodemodService Bot
383d91a214 Daily arc lint --take BLACK
Reviewed By: zertosh

Differential Revision: D27790050

fbshipit-source-id: 7c17ceb0f960610333cc72b66efd696ca30898ef
2021-04-15 04:28:09 -07:00
svcscm svcscm
daaba7b528 Updating submodules
Summary:
GitHub commits:

c258327b7f
927dda6da6
82a9478107
ad92eb50ba
66c6562520

Reviewed By: yns88

fbshipit-source-id: 0e0b1b565e497735818352365af5934ef35751f0
2021-04-15 01:43:18 -07:00
Jan Mazur
de0cd376bf get --insecure flag from options
Summary:
Before:
```
➜  scm hg --insecure pull --config paths.default='mononoke://localhost:20667/fbsource' --insecure
pulling from mononoke://localhost:20667/fbsource
trying different paths
trying path infinitepush mononoke://mononoke.internal.tfbnw.net/fbsource
connected to twshared7229.27.lla2.facebook.com session XlIEDC1TJoVscAfF
searching for changes
adding commits
adding manifests
adding file changes
added 45 commits with 0 changes to 0 files
(running background incremental repack)
➜  scm hg --insecure pull --config paths.default='mononoke://devvm2552.lla0.facebook.com:20667/fbsource' --insecure
pulling from mononoke://devvm2552.lla0.facebook.com:20667/fbsource
connected to devvm2552.lla0.facebook.com session 14iIYK6mFs9KmUM3
no changes found
adding commits
devel-warn: applied empty changegroup at: /opt/fb/mercurial/edenscm/mercurial/bundle2.py:522 (_processchangegroup)
adding manifests
adding file changes
added 0 commits with 0 changes to 0 files
(running background incremental repack)
➜  scm hg pull --config paths.default='mononoke://devvm2552.lla0.facebook.com:20667/fbsource'                 pulling from mononoke://devvm2552.lla0.facebook.com:20667/fbsource
connected to devvm2552.lla0.facebook.com session kyOtOxOMm2iEAgqw
searching for changes
adding commits
adding manifests
adding file changes
added 1 commits with 0 changes to 0 files
(running background incremental repack)
```

Something from this stack D27243638 (3295f0f1fe) might have broken --insecure flag
when pulling. I believe this is the fix.

Reviewed By: johansglock

Differential Revision: D27765417

fbshipit-source-id: 7c7f47643e73b568985e74794ee028b40499674d
2021-04-15 00:32:17 -07:00
svcscm svcscm
e6d6acea88 Updating submodules
Summary:
GitHub commits:

b0ba20ca08
573239c033
b1f62be10e
98298496a2

Reviewed By: yns88

fbshipit-source-id: 6975589ed367a74460b253cd1e526963a0bcc4b8
2021-04-15 00:08:32 -07:00
svcscm svcscm
f97ebd49f0 Updating submodules
Summary:
GitHub commits:

2138c061ea
332d921376
e909b61bb9
0423a390de
e65962d7b4
cd754c2499

Reviewed By: yns88

fbshipit-source-id: 4ba8ed6341b520344dc8f10211156d9fa55f7942
2021-04-14 20:02:51 -07:00
Andrey Chursin
9d644ac97e checkout: integrate with rust progress bar
Summary: This will show proper checkout progress when using native checkout

Reviewed By: quark-zju

Differential Revision: D27775423

fbshipit-source-id: 79f2afa02bd1fab7d5f747da1c714d4d1126ce7c
2021-04-14 19:43:26 -07:00
svcscm svcscm
098f8acdb4 Updating submodules
Summary:
GitHub commits:

617ab7c11f
c0f8ffb345
b6081024aa
3e58781963
f3be51c6e4
8133df0c2f
d4df9b9ef9
625201fa6c

Reviewed By: yns88

fbshipit-source-id: 242948f60ed28e896e1149094001e939a86d17f8
2021-04-14 18:37:54 -07:00
Maxime Arthaud
f2c0b69e6d suppress errors in fbcode/eden - batch 1
Reviewed By: MaggieMoss

Differential Revision: D27738056

fbshipit-source-id: 82957c165d968da999d021e9745b1bf967c615ea
2021-04-14 18:04:55 -07:00
Arun Kulshreshtha
a1be9e6a7f http-client: avoid quadratic behavior when deseralizing large CBOR values
Summary:
EdenAPI makes heavy use of streaming HTTP responses consisting of a series of serialized CBOR values. In order to process the data in a streaming manner, we use the `CborStream` combinator, which attempts to deserialize the CBOR values as they are received.

`CborStream` hits a pathological case when it receives a very large CBOR value. Previously, it would always buffer the input stream into 1 MB chunks, and attempt to deserialize whenever a new chunk was received. In the case of downloading values that are >1GB in size, this meant potentially thousands of wasted deserialization attempts. In practice, this meant that EdenAPI would hang when receiving the content of large files.

To address this problem, this diff adds a simple heuristic: If a partial CBOR value exceeds the current buffer size, double the size threshold before attempting to deserialize again. This reduces the pathological case from `O(n^2)` to `O(log(n))` (with some caveats, described in the comment in the code).

Reviewed By: krallin

Differential Revision: D27759698

fbshipit-source-id: 67882c31ce95a934b96c61f1c72bd97cad942d2e
2021-04-14 17:34:01 -07:00
svcscm svcscm
7cdfc89589 Updating submodules
Summary:
GitHub commits:

12a03c27b2
e4a48c0c6e
88680371fb

Reviewed By: yns88

fbshipit-source-id: 5499cf75511ac002eee4333b1278d20b21561f49
2021-04-14 15:41:41 -07:00
Durham Goode
4803877dde dynamicconfig: generate dynamicconfigs when there's no repo
Summary:
Previously we'd skip dynamicconfigs when there wasn't a repo available.
Now that dynamicconfig can represent the NoRepo state, let's load dynamicconfigs
in that situation.

This also supports the case where there is no user name.

Reviewed By: kulshrax

Differential Revision: D26801059

fbshipit-source-id: 377cfffb6695a7fbe31303868a88862259ebf8c4
2021-04-14 14:32:16 -07:00
Pyre Bot Jr
b127a5ab2d Add annotations to eden/fs/cli/doctor/test/disk_usage_test.py
Reviewed By: xavierd

Differential Revision: D27766016

fbshipit-source-id: 9862fc315794feaa5f1dd9f1723514e4a0ba0f25
2021-04-14 13:43:13 -07:00
Arun Kulshreshtha
d8cbafba34 edenapi: add edenapi.maxrequests option
Summary: Add a new `edenapi.maxrequests` config option to allow controlling the number of parallel in-flight requests. This can be used to bound resource usage of the client when requesting large amounts of data.

Reviewed By: sfilipco

Differential Revision: D27724817

fbshipit-source-id: 8d607efa83d8b0b94074d1a6e06f6c536cc0c791
2021-04-14 12:41:22 -07:00
Arun Kulshreshtha
c33ed64827 http-client: add option to limit concurrency
Summary: Add a method to allow setting `CURLMOPT_MAX_TOTAL_CONNECTIONS`, which limits the number of concurrent requests within a curl multi session. If the number of requests in the session exceeds this number, they will be queued and sent once earlier requests have completed.

Reviewed By: sfilipco

Differential Revision: D27724818

fbshipit-source-id: 436384aed9d6d29f426e5e45aebb7a72c24ba667
2021-04-14 12:41:22 -07:00
Stanislau Hlebik
e8baaa6bc9 mononoke: log hash validation failures to ods
Summary:
In D27459516 (7dc59708ce) I've added hg filenode hash validation to walker, however I forgot
to start logigng validation failures to walker.

Reviewed By: ahornby

Differential Revision: D27764660

fbshipit-source-id: b012f3d6b0f7a39aa82c966fccc0835ee0b05f0c
2021-04-14 10:17:33 -07:00
Stefan Filip
c694f63a48 configparser: pass fb feature to hostcaps
Summary:
Without this, `make local` will build `hostcaps` without fb-specific logic and
cause wrong configs being used. `hg up master` will error out like:

  File "treemanifest/__init__.py", line 690, in _httpgetdesignatednodes
    self.edenapi.trees(dpack, self.name, keys)
  RustError: Server reported an error (403 Forbidden)

Reviewed By: quark-zju

Differential Revision: D27759821

fbshipit-source-id: d42895f44bc53003f2578b65640ebe4ee05d52e6
2021-04-14 10:15:54 -07:00
Thomas Orozco
ff4fd5bc19 revisionstore: stop ignoring errors in prefetch
Summary:
Right now, if prefetch fails, we just give the client back an error saying
"content not found".

This isn't super helpful, because usually the reason the content is not found
is because we cannot talk to the server that has the content, so showing the
user why we cannot talk to said server is more useful.

I'd like to ship this gradually, so I also added a config flag to turn it off.
Initially I'll have the flag set, but I did default it to not-set in the code
so that our tests run with the desired configuration.

Note: I initially contemplated adding logging for this here, but after
discussion with xavierd it looks like just failing instead of eating the error
is probably a better approach (and it's much simpler). This is also consistent
with what EdenAPI does.

Reviewed By: mzr

Differential Revision: D27761572

fbshipit-source-id: 3506d9c97a00e3f076bd346883e07f49194b0b06
2021-04-14 09:22:28 -07:00
Thomas Orozco
80ce907817 revisionstore: don't fail on 404 on some objects from the server
Summary:
Right now, if the server ever tells us a file is missing, we fail the entire
batch download. This is a bit unfortunate because other objects could still be
downloaded, but also because we lose the distinction between "server crashed"
and "server told us the data we want does not exist".

Besides, it's actually a bit unnecessary. Indeed, this fails, we just ignore
the error anyway up the stack, so it never actually gets accessed.

Reviewed By: mzr

Differential Revision: D27761574

fbshipit-source-id: cb4fb0526a3bf19c04ecb81c05d44d4d8afb81ad
2021-04-14 09:22:28 -07:00
Thomas Orozco
97dc596648 lfs_protocol: implement Display for Operation
Summary: It's convenient!

Reviewed By: StanislavGlebik

Differential Revision: D27761575

fbshipit-source-id: ceff362197f0c08dd22d3940440b6ddde0f9639c
2021-04-14 09:22:28 -07:00