Commit Graph

178 Commits

Author SHA1 Message Date
Thomas Orozco
bf4dc18009 mononoke: UploadHgFileEntry::upload: just return a plain future
Summary:
This returns a Result of a tuple, but:

- This never errs.
- Nothing ever reads the left side of the tuple.

So let's stop doing that.

Reviewed By: StanislavGlebik

Differential Revision: D25219887

fbshipit-source-id: f33dcf6f6e68cb17b40c4638470312afae0662e6
2020-12-03 06:19:31 -08:00
Pavel Aslanov
337bab2744 convert to new type futures
Summary: Convert `ChangesetFetcher` to new type futures

Reviewed By: StanislavGlebik

Differential Revision: D25244213

fbshipit-source-id: 4207386d81397a930a566db008019bb8f31bf602
2020-12-02 15:40:12 -08:00
Mark Juggurnauth-Thomas
8fe2b30e9a derived_data: commonise blobstore mapping implementations
Summary:
Create `BlobstoreMapping` as a trait with the common implementations for
derived data mappings that are stored in the blobstore.

Reviewed By: StanislavGlebik

Differential Revision: D25099915

fbshipit-source-id: 8a62fbb809918045336944c8cd3584b109811012
2020-12-02 07:33:41 -08:00
Mark Juggurnauth-Thomas
0f13c1283e derived_data: rename Mode to DeriveMode
Reviewed By: StanislavGlebik

Differential Revision: D25218193

fbshipit-source-id: 7a4ff3cb3e2b0e0c0f849b0de69a75626aeddf4c
2020-12-02 07:33:41 -08:00
Mark Juggurnauth-Thomas
6b0203d10f derived_data: use batch_derive for backfilling data
Summary:
Batch derivation was disabled as it caused problems for other derived data types.

This was because the default batch implementation was wrong: it attempted to derive
potentially linear stacks concurrently, which would cause O(n^2) derivations.

Fix the default implementation to be a naive sequential iteration, and re-enable
batch derivation for fsnodes and skeleton manifests.

Reviewed By: StanislavGlebik

Differential Revision: D25218195

fbshipit-source-id: 730555829f092cc36e1c81cf02c2b4962a3904da
2020-12-02 07:33:41 -08:00
Mark Juggurnauth-Thomas
c414b36a30 fsnodes: don't rederive parents fsnodes during batch derivation
Summary:
On the second and subsequent linear stack in a batch, the parent fsnode may
have been derived in the previous iteration of the loop.  Since we haven't
completed this batch yet, the mappings have not been stored, and so the
attempt to derive the parent will result in the parent being derived again,
repeating the work of this batch sequentially.

Apply the optimization used in skeleton manifests and fetch the parent fsnodes
out of the result we are accumulating.

Reviewed By: StanislavGlebik

Differential Revision: D25218194

fbshipit-source-id: 5cc49204b53984f8aa73542f1a794a6251eb2b2e
2020-12-02 07:33:41 -08:00
Mark Juggurnauth-Thomas
509dcf3ccd skeleton_manifests: enable derivation of skeleton manifests in batches
Summary:
Similar to fsnodes, allow skeleton manifests to be derived in parallel in large
batches by splitting the changesets into linear stacks with no internal
conflicts, and deriving each changeset in that batch in parallel.

Reviewed By: StanislavGlebik

Differential Revision: D25218196

fbshipit-source-id: e578de9ffd472e732abb1e2ef9cd19c073280cd4
2020-12-02 07:33:41 -08:00
Pavel Aslanov
6e93ed73f9 convert to new type futures
Summary: convert mercurial_derived_data to new type futures

Reviewed By: ahornby

Differential Revision: D25220329

fbshipit-source-id: c2532a12e915b315fe6eb72f122dbc37822bbb2a
2020-12-01 03:03:45 -08:00
Kostia Balytskyi
e4dab84619 scuba: turn ScubaSampleBuilderExt into a wrapper struct
Summary:
This diff prepares the Mononoke codebase for composition-based extendability of
`ScubaSampleBuilder`. Specifically, in the near future I will add:
- new methods for verbose scuba logging
- new data field (`ObservabilityContext`) to check if verbose logging should
  be enabled or disabled

The higher-level goal here is to be able to enable/disable verbose Scuba
logging (either overall or for certain slices of logs, like for a certain
session id) in real time, without restarting Mononoke. To do so, I plan to
expose the aforementioned verbose logging methods, which will run a check
against the stored `ObservabilityContext` and make a decision of whether the
logging is enabled or not. `ObservabilityContext` will of course hide
implementation details from the renamed `ScubaSampleBuilderExt`, and just provide a yes/no
answer based on the current config and sample fields.

At the moment this should be a completely harmless change.

Reviewed By: krallin

Differential Revision: D25211089

fbshipit-source-id: ea03dda82fadb7fc91a2433e12e220582ede5fb8
2020-11-30 21:26:24 -08:00
Pavel Aslanov
a1d0ce7ef7 remove dependency on old futures
Summary: remove dependency on old futures from derived data filenodes

Reviewed By: ahornby

Differential Revision: D25218521

fbshipit-source-id: 4d7eaf42c3ba15ea09276a7f3567128d5216e814
2020-11-30 12:00:22 -08:00
Pavel Aslanov
4f72c1eadf use new type futures in tests
Summary: Old futures removed from unodes tests

Reviewed By: ahornby

Differential Revision: D25197780

fbshipit-source-id: f5b3acaf6556515994495ccf443e9cb204b4573e
2020-11-30 12:00:22 -08:00
Pavel Aslanov
13cc72bd97 remove dependency on futures-old and futures_ext
Summary: `derived_data:derived_data` had already been almost converted, I've cleaned up some test so it would be possible to completely remove old futures dependency

Reviewed By: StanislavGlebik

Differential Revision: D25197406

fbshipit-source-id: 064439f42a15f715befc019e5350dda0a2975f2b
2020-11-30 12:00:22 -08:00
Pavel Aslanov
48b6813a06 convert save_bonsai_changesets to new type futures
Summary:
- convert save_bonsai_changesets to new type futures
- `blobrepo:blobrepo` is free from old futures deps

Reviewed By: StanislavGlebik

Differential Revision: D25197060

fbshipit-source-id: 910bd3f9674094b56e1133d7799cefea56c84123
2020-11-30 12:00:22 -08:00
Mark Juggurnauth-Thomas
9614148f59 skeleton_manifests: don't store duplicate skeleton manifest blobs
Summary:
If files are only modified, and not added or deleted, the skeleton manifest
doesn't change.  Avoid duplicate writes by skipping the write if the skeleton
manifest we derive has the same ID as one of its parents.

Reviewed By: ahornby

Differential Revision: D25099917

fbshipit-source-id: 62900406711becea88491e706a09c6032109c964
2020-11-30 06:23:46 -08:00
Alex Hornby
7c4d5a0ddc mononoke: expose a couple of fastlog functions for use in walker
Summary: Use these in next diff from walker so we can start to scrub fastlog

Reviewed By: aslpavel

Differential Revision: D25187548

fbshipit-source-id: 4188a0c9bdb51a898817b6f5801fe473b6712385
2020-11-30 03:23:55 -08:00
Pavel Aslanov
4a0cb69c4e convert BlobRepo::{changeset_exists_by_bonsai, get_changeset_parents_by_bonsai} to new futures
Summary: convert `BlobRepo::{changeset_exists_by_bonsai, get_changeset_parents_by_bonsai}` to new futures

Reviewed By: ahornby

Differential Revision: D25195811

fbshipit-source-id: 0238440aa0757af6362effe09f1771c939bda030
2020-11-27 11:11:18 -08:00
Pavel Aslanov
6f08815dc3 convert BlobRepo::get_bonsai_bookmark to new type futures
Summary: convert `BlobRepo::get_bonsai_bookmark` to new type futures

Reviewed By: StanislavGlebik

Differential Revision: D25188577

fbshipit-source-id: fb6f2b592b9e9f76736bc1af5fa5a08d12744b5f
2020-11-27 11:11:18 -08:00
Lukas Piatkowski
fa1a195fd0 mononoke/blobstore: pass CoreContext via borrowed instead of owned value
Summary: Follow up after removing 'static from blobstore.

Reviewed By: StanislavGlebik

Differential Revision: D25182106

fbshipit-source-id: e13a7a31d71b4674425123268e655ae66127f1b7
2020-11-27 03:31:07 -08:00
Thomas Orozco
acf1453e12 mononoke: rename BlobManifest to HgBlobManifest
Summary:
We have `HgBlobChangeset`, `HgFileEnvelope`, `HgManifestEnvelope` ... but we
also have `BlobManifest`. Let's be a little consistent.

Reviewed By: markbt

Differential Revision: D25122288

fbshipit-source-id: 9ae0be49986dbcc31cee9a46bd30093b07795c62
2020-11-26 11:26:50 -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
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
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
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
Mark Juggurnauth-Thomas
eddc285862 skeleton_manifest: add first_case_conflict method
Summary:
Add a method to `SkeletonManifest` which finds the paths to the first case
conflict, if there is one.

First means lexicographically first within directories, and with the shortest path.

Reviewed By: ahornby, StanislavGlebik

Differential Revision: D24990175

fbshipit-source-id: ec10f66582b81c40740823e32362ca489a6ebb4d
2020-11-18 02:10:55 -08:00
Mark Juggurnauth-Thomas
2a76d65847 derived_data: rename BonsaiDerived::derive03 to derive
Summary: Now that `derive03` is the only version available, rename it to `derive`.

Reviewed By: krallin

Differential Revision: D24900106

fbshipit-source-id: c7fbf9a00baca7d52da64f2b5c17e3fe1ddc179e
2020-11-13 01:48:03 -08:00
Mark Juggurnauth-Thomas
383e60ed8c derived_data: remove old futures version of BonsaiDerived::derive
Summary:
Now that all code is using `BonsaiDerived::derive03`, we can remove the old
futures version `BonsaiDerived::derive`.

Reviewed By: krallin

Differential Revision: D24900108

fbshipit-source-id: 885d903d4a45e639e4d44e19b5d70fac26bce279
2020-11-13 01:48:03 -08:00
Mark Juggurnauth-Thomas
37ab107de9 derived_data: switch to BonsaiDerived::derive03
Reviewed By: krallin

Differential Revision: D24900119

fbshipit-source-id: e1dee3796b48fc12070f6455f4a1b6c7f1bcf32c
2020-11-13 01:48:03 -08:00
Mark Juggurnauth-Thomas
a4b6704653 unodes: switch to BonsaiDerived::derive03
Reviewed By: krallin

Differential Revision: D24900115

fbshipit-source-id: f16c49563247b7f10a4158a5b8852cfc3ace40f5
2020-11-13 01:48:02 -08:00
Mark Juggurnauth-Thomas
657cf2ecd1 mercurial_derived_data: switch to BonsaiDerived::derive03
Reviewed By: krallin

Differential Revision: D24900122

fbshipit-source-id: b4ef459e2ad384d70be8654f514463f951aedf04
2020-11-13 01:48:02 -08:00
Mark Juggurnauth-Thomas
017cba81f3 fsnodes: switch to BonsaiDerived::derive03
Reviewed By: krallin

Differential Revision: D24900125

fbshipit-source-id: 266b450aac16f74ad2a5be4a981e5c9d155cf4be
2020-11-13 01:48:01 -08:00
Mark Juggurnauth-Thomas
6f15e8a724 filenodes: switch to BonsaiDerived::derive03
Reviewed By: krallin

Differential Revision: D24900127

fbshipit-source-id: f7f956ac5441d77392810428c013b160fdfb8932
2020-11-13 01:48:01 -08:00
Mark Juggurnauth-Thomas
0ad9a45b4a fastlog: switch to BonsaiDerived::derive03
Reviewed By: krallin

Differential Revision: D24900109

fbshipit-source-id: a6e7c226b99794d99f5b2093e591b66bd3f4bacd
2020-11-13 01:48:01 -08:00
Mark Juggurnauth-Thomas
89cfdeccb6 deleted_files_manifest: switch to BonsaiDerived::derive03
Reviewed By: krallin

Differential Revision: D24900116

fbshipit-source-id: 387e75a4f45a9c283ab73322154c19e314bf6a21
2020-11-13 01:48:01 -08:00
Mark Juggurnauth-Thomas
364f20adad changeset_info: switch to BonsaiDerived::derive03
Reviewed By: krallin

Differential Revision: D24900117

fbshipit-source-id: 46afb23a5d12af89933fc658ec4225196659faa9
2020-11-13 01:48:01 -08:00
Mark Juggurnauth-Thomas
635e1835a2 blame: switch to BonsaiDerived::derive03
Reviewed By: krallin

Differential Revision: D24900123

fbshipit-source-id: 86d65d939f736589ee6006b7610066a38194971e
2020-11-13 01:48:01 -08:00
Mark Juggurnauth-Thomas
bfc7614037 skeleton_manifest: implement skeleton manifest derivation
Summary: Implement derivation of skeleton manifests.

Differential Revision: D24787534

fbshipit-source-id: e55d053a717fe052fc4da69bd9034784b356b7cc
2020-11-11 13:23:48 -08:00
Mark Juggurnauth-Thomas
89957422b8 tests_utils: allow all MPaths in created commits
Summary:
Allow users of `tests_utils` to create paths that are not `String`, by supporting any type
that can be converted into `MPath`.

Reviewed By: StanislavGlebik

Differential Revision: D24887002

fbshipit-source-id: 47ad567507185863c1cfa3c6738f30aa9266901a
2020-11-11 13:23:48 -08:00
Mark Juggurnauth-Thomas
4909562fe9 derived_data_test_utils: move test_utils to derived_data and update to new futures
Summary:
`manifest/test_utils` contains test utilities that are only used by derived data, and only one
of which relates to manifests.  Its name (`test_utils`) is also confusing with `tests/utils`.

Move it to `derived_data_test_utils`, and update it to new futures.

Reviewed By: mitrandir77

Differential Revision: D24787536

fbshipit-source-id: 7a4a735132ccf81e3f75683c7f44c9ada11bc9d7
2020-11-09 07:23:51 -08:00
Thomas Orozco
26e06ef1a0 mononoke/filestore: update fetch methods to return 0.3 stream
Summary:
This updates the external facing API of the filestore to use 0.3 streams.
Internally, there is still a bit of 0.3 streams, but as of this change, it's
all 0.3 outside.

This required a few changes here and there in places where it was simpler to
just update them to use 0.3 futures instead of `compat()`-ing everything.

Reviewed By: ikostia

Differential Revision: D24731298

fbshipit-source-id: 18a1dc58b27d129970a6aa2d0d23994d5c5de6aa
2020-11-06 07:26:04 -08:00
Thomas Orozco
184310158b mononoke/filestore: update fetch external API to 0.3 futures
Summary:
Like it says in the title. This required quite a lot of changes at callsites,
as you'd expect.

Reviewed By: StanislavGlebik

Differential Revision: D24731299

fbshipit-source-id: e58447e88dcc3ba1ab3c951f87f7042e2b03eb2c
2020-11-06 07:26:03 -08:00
Thomas Orozco
40e8cab560 mononoke/filestore: update metadata to futures 0.3
Summary:
This updates the metadata APIs in the filestore to futures 0.3 & async / await.
This changes the external API of the filestore, so there's quite a bit of churn
outside of that module.

Reviewed By: markbt

Differential Revision: D24727255

fbshipit-source-id: 59833f185abd6ab9c609c6bcc22ca88ada6f1b42
2020-11-06 07:26:03 -08:00
Lukas Piatkowski
3c3de9e954 rust-shed/futures_01_ext: rename futures_ext to futures_01_ext
Summary: As part of the effort to deprecate futures 0.1 in favor of 0.3 I want to create a new futures_ext crate that will contain some of the extensions that are applicable from the futures_01_ext. But first I need to reclame this crate name by renaming the old futures_ext crate. This will also make it easier to track which parts of codebase still use the old futures.

Reviewed By: farnz

Differential Revision: D24725776

fbshipit-source-id: 3574d2a0790f8212f6fad4106655cd41836ff74d
2020-11-05 06:07:16 -08:00
Mark Juggurnauth-Thomas
1e288e8ea4 fsnodes: clean-up new async code
Summary:
Now that fsnodes is async, convert more functions to use references, and tidy
up imports and type names.

Reviewed By: krallin

Differential Revision: D24726145

fbshipit-source-id: 75a619777f19754daf494a3743d26fa2e77aef54
2020-11-04 08:39:57 -08:00
Mark Juggurnauth-Thomas
d5b88409a4 fsnodes: convert fsnodes::mapping to new futures
Summary: This completely removes `futures-old` from `fsnodes`.

Reviewed By: krallin

Differential Revision: D24726147

fbshipit-source-id: f9d5d36664deb808185a6cb2f4b382ee762d0e25
2020-11-04 08:39:57 -08:00
Mark Juggurnauth-Thomas
866275e626 fsnodes: convert fsnodes::collect_fsnode_subentries to new futures
Reviewed By: krallin

Differential Revision: D24726148

fbshipit-source-id: 7e37156b73aaea22280b6e3322520c5eab9e71fe
2020-11-04 08:39:57 -08:00
Mark Juggurnauth-Thomas
320f0edfe5 fsnodes: change fsnodes::derive_fsnode to use new futures
Summary:
Update `fsnodes::derive_fsnode` and its immediate utility functions to use new style
futures and `async`/`.await` syntax.

Reviewed By: krallin

Differential Revision: D24726146

fbshipit-source-id: 0b0d5b1162a73568ef5c47db6e8252267e760e7f
2020-11-04 08:39:57 -08:00
Mark Juggurnauth-Thomas
6b8a832433 derived_data: change BonsaiDerivedMapping to use new futures
Summary:
This changes the methods from ones that return old `BoxFuture`s to an async method
using `async_trait`.

Reviewed By: krallin

Differential Revision: D24689506

fbshipit-source-id: 7b13010924369f81681e6590898af703c5423385
2020-11-03 09:15:18 -08:00
Mark Juggurnauth-Thomas
6a12bcc562 derived_data: change BonsaiDerived::derive_from_parents to use new futures
Summary:
This changes the trait method from one that returns an old `BoxFuture` to an async
method using `async_trait`.

Reviewed By: krallin

Differential Revision: D24686888

fbshipit-source-id: 0ac231cdbb60d256b6d5ad5aafbe8779b96905f3
2020-11-03 09:15:18 -08:00
Alex Hornby
55547c6cd4 mononoke: add BonsaiDerived::derive03
Summary:
Add BonsaiDerived::derive03 for new callsites that are 0.3/async aware.

Plan is to migrate callsites and then rename BonsaiDerived::derive03 to derive.

Reviewed By: StanislavGlebik

Differential Revision: D24389763

fbshipit-source-id: 4a6f351b9e0c5a2e9a9c47429764f88c47caff08
2020-10-27 02:37:41 -07:00