Commit Graph

64 Commits

Author SHA1 Message Date
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
Stanislau Hlebik
af2ab0cf10 mononoke: store hydrated tree manifests in .hg
Reviewed By: krallin

Differential Revision: D26401093

fbshipit-source-id: e5050883b0e6f370a7cfbb5f46721aca7469dce1
2021-02-11 10:12:27 -08:00
Stefan Filip
0a308f9f84 update Cargo.toml after assert_matches update
Summary: cargo autocargo

Reviewed By: fanzeyi

Differential Revision: D26316542

fbshipit-source-id: f9e12a9d7b3b4e03a6f7b074ea2873ad6dcc82ad
2021-02-08 10:23:00 -08:00
Alex Hornby
fdb9ab5278 mononoke: fix reference to wrong tokio from mononoke_hg_sync_job test
Summary: Was accidentally picking up tokio 1.0 rather than tokio 0.2

Reviewed By: krallin

Differential Revision: D26201021

fbshipit-source-id: 177f42a9b7862510cfe996f6e46d155d8dab6123
2021-02-02 12:43:47 -08:00
Egor Tkachenko
1b473dcd9c Syncronise lfs entries during darkstorm backups
Summary: Sync job doesn't syncronize large files. For darkstorm backup sync lets make a special lfs verifier, which will upload files from origin blobstore into backup.

Reviewed By: StanislavGlebik

Differential Revision: D24991705

fbshipit-source-id: de668b7ad33ace3445f50cd9c92a678201ffb6f6
2021-02-01 11:23:47 -08:00
Iván Yesid Castellanos
e58c8e819c Removed static lifetime constants
Summary: removed the static lifetime constants in mononoke code source base

Reviewed By: krallin

Differential Revision: D26123507

fbshipit-source-id: 9e1689c42603bd17d44924f92219378340ab082b
2021-01-29 04:40:27 -08:00
Thomas Orozco
2768bb08d2 mononoke: hg sync job: only sync globalrevs for the publishing bookmark
Summary:
We want multiple bookmarks, but only one of them should assign new globalrevs,
so it follows that we shouldn't sync the counter when other bookmarks are being
moved.

This does that.

Reviewed By: ahornby

Differential Revision: D26076567

fbshipit-source-id: 0ccc311984d3379cb44ccf10cbcb90ac31b82ee3
2021-01-27 08:32:39 -08:00
Daniel Xu
5715e58fce Add version specificiation to internal dependencies
Summary:
Lots of generated code in this diff. Only code change was in
`common/rust/cargo_from_buck/lib/cargo_generator.py`.

Path/git-only dependencies (ie `mydep = { path = "../foo/bar" }`) are not
publishable to crates.io. However, we are allowed to specify both a path/git
_and_ a version. When building locally, the path/git is chosen. When publishing,
the version on crates.io is chosen.

See https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#multiple-locations .

Note that I understand that not all autocargo projects are published on crates.io (yet).
The point of this diff is to allow projects to slowly start getting uploaded.
The end goal is autocargo generated `Cargo.toml`s that can be `cargo publish`ed
without further modification.

Reviewed By: lukaspiatkowski

Differential Revision: D26028982

fbshipit-source-id: f7b4c9d4f4dd004727202bd98ab10e201a21e88c
2021-01-25 22:10:24 -08:00
Thomas Orozco
4dd3461824 third-party/rust: update Tokio 0.2.x to 0.2.24 & futures 1.x to 1.30
Summary:
When we tried to update to Tokio 0.2.14, we hit lots of hangs. Those were due
to incompatibilities between Tokio 0.2.14 and Futures 1.29. We fixed some of
the bugs (and others had been fixed and were pending a release), and Futures
1.30 have now been released, which unblocks our update.

This diff updates Tokio accordingly (the previous diff in the stack fixes an
incompatibility).

The underlying motivation here is to ease the transition to Tokio 1.0.
Ultimately we'll be pulling in those changes one or way or another, so let's
get started on this incremental first step.

Reviewed By: farnz

Differential Revision: D25952428

fbshipit-source-id: b753195a1ffb404e0b0975eb7002d6d67ba100c2
2021-01-25 08:06:55 -08:00
Radu Szasz
5fb5d23ec8 Make tokio-0.2 include test-util feature
Summary:
This feature is useful for testing time-dependent stuff (e.g. it
allows you to stop/forward time). It's already included in the buck build.

Reviewed By: SkyterX

Differential Revision: D25946732

fbshipit-source-id: 5e7b69967a45e6deaddaac34ba78b42d2f2ad90e
2021-01-18 10:38:08 -08:00
Alex Hornby
2d0b7db627 mononoke: allow cmdlib init_logging to return a Result
Summary: Allow us to return arg parsing errors rather than panicing

Reviewed By: krallin

Differential Revision: D25837626

fbshipit-source-id: 87e39de140b1dcd3b13a529602fdafc31233175d
2021-01-14 09:52:40 -08:00
Egor Tkachenko
11dd72d6c5 Add unbundlereplay command
Summary:
Unbundlereplay command was not implemented in the mononoke but it is used by sync job. So let's add this command here
together with additional integration test for sync between 2 mononoke repos. In addition I'm adding non fast forward bookmark movements by specifying key to sync job.

Reviewed By: StanislavGlebik

Differential Revision: D25803375

fbshipit-source-id: 6be9e8bfed8976d47045bc425c8c796fb0dff064
2021-01-07 20:36:26 -08:00
Daniel Xu
1e78d023e7 Update regex to v1.4.2
Summary: Update so libbpf-cargo doens't need to downgrade regex version.

Reviewed By: kevin-vigor

Differential Revision: D25719327

fbshipit-source-id: 5781871a359f744e2701a34df1931f0c37958c27
2020-12-29 22:59:52 -08:00
Aida Getoeva
8b93f52b71 mononoke/mysql: use single static shared connection pool
Summary:
The correct workflow for using a multi-threaded connection pool for multiple DBs is to have a single shared pool for all the use-cases. The pool is smart enough to maintain separate "pools" for each DB locator and limit them to maximum 100 conn per key.

In this diff I create a `OnceCell` connection pool that is initialized once and reused for every attempt to connect to the DB.
The pool is stored in `MononokeAppData` in order to bind its lifetime to the lifetime of Mononoke app. Then it is passed down as a part of `MysqlOptions`.  Unfortunately this makes `MysqlOptions` not copyable, so the diff also contains lots of "clones".

Reviewed By: ahornby

Differential Revision: D25055819

fbshipit-source-id: 21f7d4a89e657fc9f91bf22c56c6a7172fb76ee8
2020-12-17 15:46:30 -08:00
Aida Getoeva
e9f3284b5b mononoke/mysql: make mysql options not copyable
Summary:
In the next diff I'm going to add Mysql connection object to `MysqlOptions` in order to pass it down from `MononokeAppData` to the code that works with sql.
This change will make MysqlOptions un-copyable.

This diff fixed all issues produced by the change.

Reviewed By: ahornby

Differential Revision: D25590772

fbshipit-source-id: 440ae5cba3d49ee6ccd2ff39a93829bcd14bb3f1
2020-12-17 15:46:30 -08:00
Pavel Aslanov
0fc5c3aca7 convert BlobRepoHg to new type futures
Summary: Convert all BlobRepoHg methods to new type futures

Reviewed By: StanislavGlebik

Differential Revision: D25471540

fbshipit-source-id: c8e99509d39d0e081d082097cbd9dbfca431637e
2020-12-17 07:45:26 -08:00
Stefan Filip
2193b84b43 autocargo: regen
Summary: Regen autocargo

Reviewed By: quark-zju

Differential Revision: D25409963

fbshipit-source-id: 7dbbe420aeb30248bf43d3a96a9aa6a47bb2b0be
2020-12-08 18:30:24 -08:00
Thomas Orozco
16bac45a07 mononoke/bonsai_globalrev_mapping: set perf counters
Summary:
Like it says in the title. This is helpful to measure the number of SQL queries
we make. This required actually threading in a CoreContext, which we didn't
have before.

Reviewed By: StanislavGlebik

Differential Revision: D25336069

fbshipit-source-id: 35677c55550e95b5126de29c2a824b4eda32092c
2020-12-07 08:23:19 -08:00
Thomas Orozco
1ec5537e9e mononoke/bonsai_globalrev_mapping: update to futures 0.3
Summary: Like it says in the title.

Reviewed By: StanislavGlebik

Differential Revision: D25333450

fbshipit-source-id: 49ad4b1964a4dfd9f3e0108fa421d451ef905256
2020-12-07 08:23:18 -08:00
Alex Hornby
935a7ddfc8 mononoke: remove the need to pass in cachelib settings twice
Summary:
Previously needed to pass in cachelib settings once to MononokeAppBuilder and once to parse_and_init_cachelib.

This change adds a MononokeClapApp and MononokeMatches that preserve the settings, thus preventing the need to pass them in twice (and thus avoiding possible inconsistency)

MononokeMatches uses MaybeOwned to hold the inner ArgMatches, which allows us to hold both the usual reference case from get_matches and an owned case for get_matches_from which is used in test cases.

Reviewed By: krallin

Differential Revision: D24788450

fbshipit-source-id: aad5fff2edda305177dcefa4b3a98ab99bc2d811
2020-12-02 07:27:23 -08:00
Alex Hornby
f077f69408 mononoke: move expected_item_size_byte into CachelibSettings
Summary:
Move expected_item_size_byte into CachelibSettings, seems like it should be there.

To enable its use also exposes a parse_and_init_cachelib method for callers that have different defaults to default cachelibe settings.

Reviewed By: krallin

Differential Revision: D24761024

fbshipit-source-id: 440082ab77b5b9f879c99b8f764e71bec68d270e
2020-12-02 00:47:22 -08:00
Alex Hornby
a2247dc41c mononoke: rename MononokeApp to MononokeAppBuilder
Summary:
It has a build() method and later in stack it will build a mononoke
specific type rather than the clap::App

Differential Revision: D25216827

fbshipit-source-id: 24a531856405a702e7fecf54d60be1ea3d2aa6e7
2020-12-01 11:45:00 -08:00
Stanislau Hlebik
561ff43310 mononoke: add --use-hg-server-bookmark-value-if-mismatch option to hg sync job
Summary:
At the moment if we try to sync a bookmark entry but from_cs_id of bookmark
entry doesn't match the value of the bookmark on hg servers then the sync will
fail.
Let's add an option that in the case of this mismatch sets from_cs_id to the
current value on hg servers.

Reviewed By: krallin

Differential Revision: D25242172

fbshipit-source-id: 91180fb86f25d10c9ba2b78d7aa18ed0a52d13a5
2020-12-01 05:58:23 -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
Stanislau Hlebik
550d331981 mononoke: remove unused code
Reviewed By: mitrandir77

Differential Revision: D25187055

fbshipit-source-id: 8faf2398e0407f56cf133feeb0da2812e27acaad
2020-11-30 07:51:08 -08:00
Stanislau Hlebik
80967e0c6a mononoke: fix clippy in hg sync job
Reviewed By: mitrandir77

Differential Revision: D25186814

fbshipit-source-id: 6258289cbf6ba349f1c1ba542e6bc81e94007fb9
2020-11-30 07:51:08 -08:00
Stanislau Hlebik
59c5f80b75 mononoke: add bundle combining to hg sync job
Summary:
This diff adds bundle combining to hg sync job. See motivation for doing that in D25168877 (cebde43d3f).

Main struct here is BookmarkLogEntryBatch. This struct helds a vector of BookmarkUpdateLogEntry that were combined (they are used mostly for logging) and also it contains parameters necessary for producing the bundle, notably from/to changeset ids and bookmarks. This struct has try_append method that decides whether it's possible to combine bundles or not.

Reviewed By: mitrandir77

Differential Revision: D25186110

fbshipit-source-id: 77ce91915f460db73d8a996efe415954eeea2476
2020-11-30 07:51:08 -08:00
Pavel Aslanov
ac33b17233 convert globalrev related methods to new futures
Summary: convert globalrev related methods to new futures

Reviewed By: ahornby

Differential Revision: D25196171

fbshipit-source-id: 10c31f5869b9dd803955a7755d74b31ba1d8f7c5
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
Stanislau Hlebik
cebde43d3f mononoke: refactoring to allow combining bundles in the sync job
Summary:
In the next diff I'd like to allow hg sync job to combine a few bookmark update log entries and send a single bundle for all of them. The goal is to reduce the lag between mononoke and hg servers.

We've already made an attempt to implement bundle combining some time ago, hence why we have things like CombinedBookmarkUpdateLogEntry. However it was never really used in prod - back then the only way to sync a bundle from mononoke to hg servers was to replay a bundle that client has pushed to us, and combining bundles like that was tricky.

Now it's different, because hg sync job has the logic to generates the bundles itself rather than re-use the bundle that client has pushed to us. This makes implementing bundle combinging easier.

This diff doesn't add the actual bundle combining, but it does the refactoring that makes it easier. In particular:
1) Old logic for combining bundles was removed - it was never really used anyway.
1) prepare_bundles() function was added - this function takes a vector of BookmarkUpdateLogEntry and returns a vector of CombinedBookmarkUpdateLogEntry. The idea is to move bundle combining logic from main function to BundlePreparer class, since it has better knowledge of how to do bundle combining (in particular, it knows whether sync job re-uses existing bundle or generates it)
1) prepare_single_bundle() was changed - instead of taking bookmark name, from/to changeset id from BookmarkUpdateLogEntry, it now requires passing them explicitly. This makes adding bundle combining easier in the next diff.

Reviewed By: mitrandir77

Differential Revision: D25168877

fbshipit-source-id: 2935d1795925b4bf0456b9221e2f76ce3987cbd0
2020-11-27 02:21:50 -08:00
Stanislau Hlebik
966d33a84f mononoke: asyncify prepare_single_bundle
Reviewed By: aslpavel

Differential Revision: D25185096

fbshipit-source-id: 4a61420cdf01ceb7e64592c515271459c27114b3
2020-11-27 02:21:50 -08:00
Stanislau Hlebik
d856af393a mononoke: asyncify BundlePreparer constructor
Reviewed By: aslpavel

Differential Revision: D25185048

fbshipit-source-id: 251bca9e6693151e889520e0a40a8051e824d4f7
2020-11-27 02:21:49 -08:00
Stanislau Hlebik
f10d77ce5d mononoke: continue asyncifying main hg sync job loop
Reviewed By: aslpavel

Differential Revision: D25184859

fbshipit-source-id: 7cdc4a2676ee04d8832dc5fd60072cadf5474a18
2020-11-27 02:21:49 -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
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
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
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
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
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
Lukas Piatkowski
2a779e82d8 mononoke/mercurial_bundles: use futures 0.3 in Bundle2Item
Summary: This is a step towards modernizing unbundle crate to use futures 0.3.

Reviewed By: farnz

Differential Revision: D24682963

fbshipit-source-id: 55c17fd699846a24647a23ea1c22888407643dfd
2020-11-03 00:12:21 -08:00
Simon Farnsworth
fb9283c378 Remove old-style futures from cmdlib::args and fix up build failures
Summary: The more we remove, the easier it'll be to remove the last few problem cases.

Reviewed By: StanislavGlebik

Differential Revision: D24592052

fbshipit-source-id: de6371305991d54bf2802fd904850b49aeb11bbd
2020-10-30 11:55:15 -07:00