Commit Graph

8258 Commits

Author SHA1 Message Date
Lukas Piatkowski
077b90de0d mononoke:hgcli: fix broken OSS build
Summary: OSS build fails due to unused `res` variable, I don't know why it passes buck builds.

Reviewed By: ikostia

Differential Revision: D25187773

fbshipit-source-id: ee15132f5ccd279104a07bc8dc91de096566d9cf
2020-11-26 09:57:18 -08:00
Thomas Orozco
65c6869384 mononoke/blobrepo/test: use fbinit::compat_test consistently
Summary:
We have 4 different ways of awaiting futures in there: sometimes we create a
runtime, sometimes we use async-unit, sometimes we use `fbinit::test` and
sometimes we use `fbinit::compat_test`. Let's be consistent.

While in there, let's also get rid of `should_panic`, since that's not a very
good way of running tests.

Reviewed By: HarveyHunt

Differential Revision: D25186195

fbshipit-source-id: b64bb61935fb2132d2e5d8dff66fd4efdae1bf64
2020-11-26 08:22:05 -08:00
Thomas Orozco
015331583d mononoke: remove HgBlobEntry
Summary:
HgBlobEntry is kind of a problematic type right now:

- It has no typing to indicate if it's a file or a manifest
- It always has a file type, but we only sometimes care about it

This results in us using `HgBlobEntry` to sometimes represent
`Entry<HgManifestId, (FileType, HgFileNodeId)>`, and some other times to
represent `Entry<HgManifestId, HgFileNodeId>`.

This makes code a) confusing, b) harder to refactor because you might be having
to change unrelated code that cares for the use case you don't care about (i.e.
with or without the FileType), and c) results in us sometimes just throwing in
a `FileType::Normal` because we don't care about the type, which is prone to
breaking stuff.

So, this diff just removes it, and replaces it with the appropriate types.

Reviewed By: farnz

Differential Revision: D25122291

fbshipit-source-id: e9c060c509357321a8059d95daf22399177140f1
2020-11-26 08:22:05 -08:00
Thomas Orozco
1916f9c60b mononoke/derived_data/mercurial: prepare to remove HgEntry
Summary:
I'd like to get rid of HgEntry altogether, as it's not a very useful
abstraction (`Entry` is better). This is one step towards this, by moving the
HgEntry -> Leaf conversion close to where the `HgEntry` is created (which is
where we upload filenodes).

Reviewed By: markbt

Differential Revision: D25122290

fbshipit-source-id: 0e3049392791153b9547091516e702fb04ad7094
2020-11-26 08:22:05 -08:00
Thomas Orozco
c43aa44aca mononoke/mercurial_types: use manifest::Entry instead of HgEntryId
Summary:
I'd like to remove the number of places that use HgEntryId, and make its usage
a little more consistent. Indeed, right now, HgEntryId is used in some places
to upload things where we just give it a fake entry type, and sometimes to
represent an actual entry in a manifest; This isn't great.

Let's remove it from here.

Reviewed By: markbt

Differential Revision: D25122289

fbshipit-source-id: 5075383e037e4e890af203d133f0a25118c19823
2020-11-26 08:22:05 -08:00
Thomas Orozco
34fbac34e1 mononoke/mercurial_types: remove unused ContentBlobInfo
Summary:
This contains a path, which it turns out is actually never used throughout the
codebase. Remove it.

Reviewed By: markbt

Differential Revision: D25122292

fbshipit-source-id: eab528bfb1e3893bca4d92d62c30499cf9eead6c
2020-11-26 08:22:05 -08:00
Alex Hornby
636536bebb mononoke: add SkeletonManifestMapping to walker
Summary: So we can scrub and inspect them

Reviewed By: StanislavGlebik

Differential Revision: D25120995

fbshipit-source-id: d150e55f0d72f584c15dbaf2bd017d19130312b2
2020-11-26 08:07:52 -08:00
Stanislau Hlebik
3d03808d05 mononoke: asyncifying loop_over_log_entries
Reviewed By: aslpavel

Differential Revision: D25184814

fbshipit-source-id: 74e702e059856371fc8737bea3e755321ebe07ba
2020-11-26 07:42:49 -08:00
Stanislau Hlebik
3492e5531b mononoke: asyncify build_outcome_handler
Reviewed By: aslpavel

Differential Revision: D25184784

fbshipit-source-id: 66ca7fb874c7172c39ddfafd0ebde36e9c71f350
2020-11-26 07:42:49 -08:00
Stanislau Hlebik
629cfc750d mononoke: asyncify build_reporting_handler
Summary: This diff asyncifies build_reporting_handler, and while there also simplifies this function a bit by ignoring cases where log_entries is empty or not specified

Reviewed By: farnz

Differential Revision: D25184396

fbshipit-source-id: 46b5d2f9fb5571e502bcdf5a0fe964fb62426313
2020-11-26 07:42:49 -08:00
Stanislau Hlebik
c8400473c9 mononoke: asyncify locking/unlocking functions in hg_sync
Reviewed By: aslpavel

Differential Revision: D25184377

fbshipit-source-id: 72457cb669d00c68eee0fb2c19a866458a369bdb
2020-11-26 07:42:49 -08:00
Stanislau Hlebik
9f6fb707d9 mononoke: asyncify combine_entries in hg_sync job
Reviewed By: ahornby

Differential Revision: D25184363

fbshipit-source-id: fcc289e72b99fe524e6f92ab672bbcfba7101e9a
2020-11-26 07:42:49 -08:00
Stanislau Hlebik
196dec1904 mononoke: asyncify sync_single_combined_entry in hg_sync job
Reviewed By: ahornby

Differential Revision: D25184245

fbshipit-source-id: 59985cdc3cadc7ff945db60fabbcd6c241ff3ba1
2020-11-26 07:42:49 -08:00
Stanislau Hlebik
569733215c mononoke: make SYNC_LOOP async
Summary:
This diff asyncifies SYNC_LOOP similar to how SYNC_ONCE was asyncified.
The biggest part of SYNC_LOOP is a stream that starts with loop_over_log_entries. Previously it was a very long chain of combinators. This diff makes this chain ~2 times smaller, but unfortunately it can't make it even smaller  because of the use of "buffered(...)" method.

Reviewed By: ahornby

Differential Revision: D25123487

fbshipit-source-id: e913bbd1369e4375b5b1d0e6ba462e463a5a44fc
2020-11-26 07:42:48 -08:00
Thomas Orozco
e209225921 commitcloud: read backed up heads via backedup() revset
Summary:
The write & read path use different back up state files, which means they can
go out of sync. If that happens, it's a bit annoying because:

- The output of `hg cloud check` is out of sync with that of `hg sl`
- `hg cloud backup -r` says the commit is backedup, and `hg cloud check -r`
  says it isn't.

This diff fixes this by just using the `backedup()` revset, which under the
hood reads all state files.

Reviewed By: liubov-dmitrieva

Differential Revision: D25186071

fbshipit-source-id: 0ae2d43227d65a3564b2f796218b55982d5cc467
2020-11-26 06:35:57 -08:00
Stanislau Hlebik
2ca8bd5900 mononoke: make hg sync job SYNC_ONCE async
Reviewed By: farnz

Differential Revision: D25123103

fbshipit-source-id: 634287909a6be9e1b34160d63e27f14eabcdce95
2020-11-26 04:41:44 -08:00
Stanislau Hlebik
ed51aac36c mononoke: make retry asynchronous
Reviewed By: ikostia

Differential Revision: D25122781

fbshipit-source-id: a7d69c2cdeff0c9c6abd92e486af191e8baed8d5
2020-11-26 04:41:44 -08:00
Stanislau Hlebik
657d226360 mononoke: make try_prepare_single_bundle async
Reviewed By: farnz

Differential Revision: D25121835

fbshipit-source-id: 2564c404a01ad1f1772da4fef47c4a8940f80f0d
2020-11-26 04:41:44 -08:00
Lukas Piatkowski
15f0f924e6 mononoke/blobstore: use async_trait instead of BoxFuture
Reviewed By: farnz

Differential Revision: D25124793

fbshipit-source-id: 1ebe72d1db8043fabf9f20538f3e95c755e049e0
2020-11-23 07:58:34 -08:00
Thomas Orozco
95cc0e5a30 revisionstore: log more info when we time out
Summary:
Right now we just get a "deadline exceeded" error, which isn't very amenable to
helping us understand why we timed out. Let's add more logging. Notably,
I'd like to understnad what we've actually received at this point, if anything,
and how long we waited, as I'm starting to suspect this issue doesn't have much
to do with HTTP.

See https://fb.workplace.com/groups/scm/permalink/3361972140519049/ for
more context.

Reviewed By: quark-zju

Differential Revision: D25128159

fbshipit-source-id: b45d3415526fdf21aa80b7eeed98ee9206fbfd12
2020-11-23 01:45:54 -08:00
Katie Mancini
a46707cc19 Fix eden du --clean on MacOS
Summary:
`eden du --clean` currently fails with

```
Fatal Python error: initfsencoding: unable to load the file system codec
ModuleNotFoundError: No module named 'encodings'
```
Full error: P149352812

It looks like this is because Buck expects to run with a different python, so
here I clear out the PYTHONHOME variable before we start buck.

This reuses out logic used elsewhere to clean up the environment before
calling buck.

Reviewed By: wez

Differential Revision: D24904105

fbshipit-source-id: 73587c52aff3ea00f68339eb44e7042329de2e44
2020-11-20 17:25:55 -08:00
Jonathan Keljo
8cb2b9b710 Work around lru-disk-cache UB in Rust 1.48
Summary: `lru-disk-cache` depends on an old version of `linked-hash-map` which contains UB in 1.48 (see https://github.com/mozilla/sccache/issues/813). They updated the deps in their repo months ago, but haven't pushed a new version. This diff makes us get `lru-disk-cache` directly from their GitHub instead.

Reviewed By: dtolnay

Differential Revision: D25134582

fbshipit-source-id: 05fd63a76b7095ebeea458645b92a83bbd8c4614
2020-11-20 17:01:01 -08:00
Alex Hornby
5a6ccc9188 mononoke: fix DeletedManifest to child step in walker
Summary:
It was mistakenly mapping deleted manifest id to a unode id.

I'm surprised the walk.rs code that constructs the DeletedManifestToDeletedManifestChild edge built with this bug. The DeletedManifestId and ManifestUnodeId types presumably coerce to each other.

Reviewed By: markbt

Differential Revision: D25120994

fbshipit-source-id: 1b53037808779c345c163ef32324961938078fc7
2020-11-20 10:30:09 -08:00
Stanislau Hlebik
444289c5d0 mononoke: allow Push bookmark moves in hg sync job
Summary:
Soon we are going to use hg sync job for configerator repos, and they might use
Push bookmark move. Let's allow it in sync job

Reviewed By: ikostia

Differential Revision: D25121176

fbshipit-source-id: f6000617b42be8392730ffc56be1947fbdbfff76
2020-11-20 08:20:38 -08:00
Thomas Orozco
e65b22d9c4 mononoke/repo_client: do not re-upload commits we already have for infinitepush
Summary:
This adds support for optionally not uploading commits we already have when
they arrive via infinitepush. This can happen if we're replaying bundles.

This works by filtering the commits we have. We still get some futures created
for the underlying uploads, but we never poll them because when we visit
what futures are needed for what commits, we don't select uploads that are
only reachable from commits we filtered out.

Obviously, this isn't super efficient, since the client still has to send us
all this data, but it's better than having them send us all that data then
having us take hours overwriting it all.

Reviewed By: mitrandir77

Differential Revision: D25120844

fbshipit-source-id: f96881d0d98ec622259bedb624fd94b600a2bf1d
2020-11-20 06:30:12 -08:00
Lukas Piatkowski
0f54cc3d63 mononoke/blobstore: make Blobstore generic over lifetime
Summary: Remove 'static requirement for async methods of Blobstore, propagate this change and fixup low hanging fruits where the code can become 'static free easily.

Reviewed By: ahornby, farnz

Differential Revision: D24839054

fbshipit-source-id: 5d5daa04c23c4c9ae902b669b0a71fe41ee6dee6
2020-11-20 05:51:52 -08:00
Xavier Deguillard
8260e17f39 inodes: re-order some cache invalidation
Summary:
It feels like invalidating the entry before the directory makes slightly more
sense, so do it in that order.

Reviewed By: chadaustin

Differential Revision: D24800817

fbshipit-source-id: ed053d07bbae6954c276d1ad7a1ff247e5c055d9
2020-11-19 21:59:44 -08:00
Durham Goode
132f37fa14 py3: fix hggit tests
Summary:
It turns out the hggit tests weren't passing in Python 3, despite us
having removed them from our py3-broken list. Woops. This fixes them and enables
the tests.

Reviewed By: sfilipco

Differential Revision: D25095189

fbshipit-source-id: acffca34b0d5defa7575ede60621ca2ce0a2afe4
2020-11-19 18:47:02 -08:00
Durham Goode
a0af56bbd4 extras: allow surrogateescaped byte extras
Summary:
Back in March we forced all extras to be strings. It turns out hggit
needs to write binary extras since it stores some binary patches in extras.
To support that, let's encode commit extras using surrogateescaped. That will
allow hggit to put binary data in extras in a later diff.

Reviewed By: sfilipco

Differential Revision: D25095190

fbshipit-source-id: 330bf06b15fc435f70119490557b8c22341b6ed9
2020-11-19 18:47:02 -08:00
Aida Getoeva
49a5eff46f mononoke/sql: fix connection to the sharded db
Summary:
Apparently shards for some DBs start from 1 (production_filenodes) and for some - from 0 (production_blobstore).
This diff fixed the issue for mysql connections.

Long term we might want to query SMC for the list of shards instead of hardcoding different values in the different places.

Reviewed By: farnz

Differential Revision: D25057136

fbshipit-source-id: 9201a2ec8afe0b66a246a2ee91cc9389630f5ddf
2020-11-19 13:16:01 -08:00
Chad Austin
3f59c5f443 add eden trace hg command
Summary:
Add a TraceBus to HgQueuedBackingStore and allow tracing import events over Thrift.

This powers a new `eden trace hg` command that allows a live view of
tree and blob imports.

Reviewed By: genevievehelsel

Differential Revision: D24732059

fbshipit-source-id: 525152fe39047160a68c1706217a06a00a6dbef1
2020-11-19 13:02:42 -08:00
Stanislau Hlebik
dec791e015 mononoke: do not report bookmark validation error if we get an infra error
Summary:
We got a few ubns because one bookmark validator in a single region wasn't able
to connect to mysql and was reporting errors.

This diff fixes by separating logical and infra errors

Reviewed By: ikostia

Differential Revision: D25092364

fbshipit-source-id: 93f4be1a7e0467051b7b8d927eef9b4f5cd6a983
2020-11-19 12:57:50 -08:00
Thomas Orozco
d3235ff615 mononoke: remove name from HgBlobEntry
Summary:
This isn't actually being consulted anywhere save for a single test, so let's
just remove it (it's not like the test checks anything important — that field
might not as well exist given we never read it).

Reviewed By: farnz

Differential Revision: D25093494

fbshipit-source-id: 5f4a53f8666fc0e8a89ceade44baa96e71fb813f
2020-11-19 12:55:28 -08:00
Thomas Orozco
dae48357ac mononoke/mercurial_types: remove redundant passing of path in upload
Summary:
This is a bit unnecessary as it stands — we roundtrip the path through
execute() just to return it back. This path was used for trace logging, but
given we literally never look at this log, let's just simplify this logging a
little bit.

Reviewed By: StanislavGlebik

Differential Revision: D25089344

fbshipit-source-id: 15b0f1cce8c9b2938429de19ff063e5677794912
2020-11-19 12:55:28 -08:00
Jun Wu
e91552fefe template: add rev f64 compatibility
Summary:
With segmented changelog, rev can exceed f64 safe range
(Number.MAX_SAFE_INTEGER in Javascript, 9007199254740991, 0x1fffffffffffff).
If rev is used in JSON, then the JSON cannot be parsed with precise rev
information.

This diff adds a compatibility mode so template will map the out-of-range revs
to safe range, and the mapped revs can be detected, and mapped back to be
resolved correctly.

Reviewed By: sfilipco

Differential Revision: D25079001

fbshipit-source-id: 52a5a2c8345a76355b8bf81435034d90c7c31610
2020-11-19 12:15:36 -08:00
Mateusz Kwapich
51b21dd9a7 unit test for dechunker raw bundle2 saving
Summary: Tests the behaviour of collecting the raw bundles.

Reviewed By: krallin

Differential Revision: D25025255

fbshipit-source-id: 114da273a28d131f5dd24047ed28ea23d076f235
2020-11-19 06:41:06 -08:00
David Tolnay
448edf7461 Format fbsource with rustfmt-2.0.0-rc.2
Reviewed By: zertosh

Differential Revision: D25075717

fbshipit-source-id: 244182839311f96b69f381c07983276a04ecc5d3
2020-11-18 19:46:38 -08:00
Arun Kulshreshtha
45dd635486 treemanifest: prevent complete tree fetch after HTTP on-demand fetch
Summary:
The `getdesignatednodes` function returns a boolean indicating whether the requested nodes were actually fetched.

In the case of SSH, this is needed because the server may not support the `designatednodes` capability (only supported by Mononoke). If the fetch fails, Mercurial will fall back to an expensive complete tree fetch.

The HTTP version of this function accidentally omitted `return True`, which meant it implicitly returned `None`, which triggered the fallback path.

Reviewed By: sfilipco

Differential Revision: D25074067

fbshipit-source-id: 089d5382dd566db89ee732cdcb82762c8d43e21a
2020-11-18 17:44:12 -08:00
Xavier Deguillard
78fc38e27b store test: do not compile LocalStoreTest on Windows
Summary: The test doesn't compile on Windows, let's just ifdef it.

Reviewed By: genevievehelsel

Differential Revision: D25033804

fbshipit-source-id: 4f312f010f9d0db42cc9ae19df3f668e8e1c4665
2020-11-18 14:39:17 -08:00
Xavier Deguillard
9eca0f83a7 config test: use AbsolutePath instead of folly::fs::path
Summary:
Converting back and forth between folly::fs::path and AbsolutePath appears to
be problematic on Windows as NUL bytes appears in the paths, causing the tests
to fail. Instead of doing this conversion, let's simply use AbsolutePath everywhere.

Reviewed By: chadaustin

Differential Revision: D25033803

fbshipit-source-id: 6c45c2a20fc4bf18cecc838b219faacfeb8386d8
2020-11-18 14:39:17 -08:00
Thomas Orozco
31b9c58a0f mononoke_api: don't hit all bookmarks in all repos at the same time
Summary:
Querying bookmarks in all repos at the exact same time results in us making a
bunch of concurrent queries to MySQL, which in turn results in MyRouter
allocating a bunch of connections.

This is for reporting the age of bookmarks: that stuff can wait... It doesn't
need to be super fast. Let's make it run on repos one at a time to avoid
allocating dozens of connections every 10 seconds (which is more often than
MyRouter seems to close them).

Reviewed By: ikostia

Differential Revision: D25057432

fbshipit-source-id: 8b65ef65752fc9762a26d835ac80f61573003dd7
2020-11-18 09:48:51 -08:00
Johan Schuijt-Li
0cc4d4f100 introduce ability to talk to mononoke directly
Summary:
Skip the need to go through SSH/Mercurial servers. Directly connect to Mononoke
via TLS with X509 certificates.

Reviewed By: markbt

Differential Revision: D24756947

fbshipit-source-id: a782c894956d6a6be055eaa78287c040ceb57da7
2020-11-18 07:34:38 -08:00
Alex Hornby
7e6a398aa7 mononoke: add test for non-public hg changeset walk
Summary: Add a test case for walking hg data from non-public changeset

Reviewed By: ikostia

Differential Revision: D25023130

fbshipit-source-id: 34295f77926b32c77095f7c10d6daa8ef59d9550
2020-11-18 06:08:45 -08:00
Alex Hornby
3bcfce5803 mononoke: allow excluding filenodes from blobimport
Summary: Add command line option to exclude derived data types from blobimport so we can use it to create non-public commits without filenode data for tests

Differential Revision: D25023116

fbshipit-source-id: d8e5d6955f11cebec0de2075c22981bf6c6f4af3
2020-11-18 06:08:45 -08:00
Alex Hornby
88377d204f mononoke: add DeletedManifest to walker types
Summary: Add DeletedManifest to walker types with edges to linked changeset and its sub-manifests so that they can be scrubbed.

Differential Revision: D25000319

fbshipit-source-id: f146e6132fde0fb13e630d315484cc2c0a964bdc
2020-11-18 06:08:45 -08:00
Mark Juggurnauth-Thomas
99bab44a1a scs_server: reset scuba seq for each request
Reviewed By: farnz

Differential Revision: D25022577

fbshipit-source-id: 040dd3a76e4213f03145fe6d3ce73267da1f4d5f
2020-11-18 05:04:44 -08:00
Alex Hornby
bdcc5c2250 mononoke: add DeletedManifestMapping to walker
Summary: Add the mapping from bonsai to deleted manifest to the walker

Reviewed By: ikostia

Differential Revision: D24989424

fbshipit-source-id: 53d622f661629b9b3de91910f4560b641a95a7bf
2020-11-18 04:47:47 -08:00
Alex Hornby
5f5e222c3d mononoke: walker add selectable output format
Summary: Sometimes pretty debug format is too verbose and one per line regular debug format is preferrable.

Reviewed By: ikostia

Differential Revision: D24996432

fbshipit-source-id: 1acda3985658e4c17b57e36734c77b7579e7e28a
2020-11-18 04:47:47 -08:00
Alex Hornby
04c26ffd11 mononoke: add an output option to walker scrub
Summary: add an output option to walker scrub so we can dump out debug representation of any type the walker can walk

Reviewed By: farnz

Differential Revision: D24996433

fbshipit-source-id: a332d89d65e4d928159155a34bd39b0e2e1131de
2020-11-18 04:47:47 -08:00
generatedunixname89002005325676
c22e5de544 Daily arc lint --take CLANGFORMAT
Reviewed By: zertosh

Differential Revision: D25049451

fbshipit-source-id: 6b9d1b95dca0f2454e94918bb78e545e084e5d14
2020-11-18 04:32:26 -08:00