Commit Graph

164 Commits

Author SHA1 Message Date
Stefan Filip
e656047533 segmented_changelog: remove SegmentedChangelogManager::save
Summary:
The manager was added as a high level abstraction for storing and loading a
SegmentedChangelog. It worked well when we had one configuration for
SegmentedChangelog. The problem now is that SegmentedChangelog has various
configurations. Storing and loading is an asymetric operation.

In contexts where we do storing we want to have used a specific configuration,
one that operates on an owned dag and has an IdMap that writes to the database.
Then, when running on the server we never store, our writes to the idmap are
in process only and the iddag is wrapped in layers that keep it up to date.

The manager would have to be too complicated to handle all these scenarios.
The solution here is to simplify the manager to cater to the server use case
and inline the logic for the saves where it is used (seeder and tailer).

Reviewed By: krallin

Differential Revision: D26921451

fbshipit-source-id: aedf4acf4bc8371a5d0b249f8bccd9447e85ae0a
2021-03-10 12:15:54 -08:00
Stefan Filip
b0c07b8206 segmented_changelog: add IdMapFactory
Summary:
At the same time remove SqlIdMapFactory. Consolidate the details surrounding
building the IdMap in this factory by moving the logic for caching and in
memory construction from the Manager to the factory.

Reviewed By: krallin

Differential Revision: D26708177

fbshipit-source-id: a6a7f6270c2508adf85f529eef2c75653d002cd0
2021-03-10 12:15:54 -08:00
Stefan Filip
8af7ce1b66 segmented_changelog: rename PeriodReloadDag to PeriodicReloadSegmentedChangelog
Summary:
Consolidating on the SegmentedChangelog suffix for the structures in the
`segmented_changelog` crate.

Reviewed By: quark-zju

Differential Revision: D26891996

fbshipit-source-id: 75192bed9cc073adfe7b82ac2b60516ac6629b76
2021-03-10 12:15:54 -08:00
Stefan Filip
d3cb6c746a segmented_changelog: rename PeriodicUpdateDag to PeriodicUpdateSegmentedChangelog
Summary:
Consolidating on the SegmentedChangelog suffic for the structures in the
`segmented_changelog` crate.

Reviewed By: quark-zju

Differential Revision: D26892000

fbshipit-source-id: 47c6ece8aa7ef13e3ea51bbe558655e3f61fdedf
2021-03-10 12:15:54 -08:00
Stefan Filip
1793560be7 segmented_changelog: rename OnDemandUpdateDag to OnDemandUpdateSegmentedChangelog
Summary:
Consolidating on the SegmentedChangelog suffix for the structures in the
`segmented_changelog` crate.

Reviewed By: quark-zju

Differential Revision: D26892003

fbshipit-source-id: ad1ccb8c359e7cd5b58d053aa13ed908252988b0
2021-03-10 12:15:53 -08:00
Stefan Filip
c990879414 segmented_changelog: rename Dag to OwnedSegmentedChangelog
Summary:
Consolidating on the SegmentedChangelog suffix for the structures in the
`segmented_changelog` crate.

Reviewed By: quark-zju

Differential Revision: D26891998

fbshipit-source-id: 86576a029f851e0ac4a6d6600a8839289c9f1f93
2021-03-10 12:15:53 -08:00
Stefan Filip
0154677db2 segmented_changelog: rename ReadDag to ReadOnlySegmentedChangelog
Summary:
Consolidating on the SegmentedChangelog suffix for the structures in the
`segmented_changelog` crate.

Reviewed By: quark-zju

Differential Revision: D26892002

fbshipit-source-id: df52027a7c20684c0d46b7adc80692d262b669d4
2021-03-10 12:15:53 -08:00
Stefan Filip
79877cd2da segmented_changelog: add segmented_changelog_delegate!
Summary:
The macro helps with implementing SegmentedChangelog interface for the
structures that rely on another SegmentedChangelog.

Reviewed By: quark-zju

Differential Revision: D26892001

fbshipit-source-id: 6e5f1f04b47f814cf7ed6fd67f4797c5270ba701
2021-03-10 12:15:53 -08:00
Stefan Filip
4af57904d2 segmented_changelog: rename DagBundle to SegmentedChangelogVersion
Summary:
Consolidating on SegmentedChangelog for the structures in the
`segmented_changelog` crate. We treat these structures as a specific kind of
dag and we name them specifically.
The `dag` crate can have the Dag structures. The `dag` crate generalizes the
graph concept. Dag for generalization, SegmentedChangelog for specific use.

The migration on the DB is simple. We will stop the tailer processes and copy
the data from `segmented_changelog_bundle` to `segmented_changelog_version`.
We will then update the jobs to an ephemeral package that uses
`segmented_changelog_version`. We will remove the old table a week later.

Reviewed By: quark-zju

Differential Revision: D26891997

fbshipit-source-id: e0061973942defa09493b4d23c89d2aaed40825a
2021-03-10 12:15:52 -08:00
Thomas Orozco
f5f78c4906 third-party/rust: update tokio & tokio-stream
Summary:
Pulling this for those 2 PRs:

- https://github.com/tokio-rs/tokio/pull/3547
- https://github.com/tokio-rs/tokio/pull/3576

Reviewed By: ahornby

Differential Revision: D26944216

fbshipit-source-id: ad67afa69cb291cfb1622cf4b2a10727a13d19cd
2021-03-10 11:01:28 -08:00
Andrey Chursin
0be8e8ce29 vfs: introduce AsyncVfs
Summary:
AsyncVfs provides async vfs interface.
It will be used in the native checkout instead of current use case that spawns blocking tokio tasks for VFS action

Reviewed By: quark-zju

Differential Revision: D26801250

fbshipit-source-id: bb26c4fc8acac82f4b55bb3f2f3964a6d0b64014
2021-03-05 21:47:51 -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
Alex Hornby
8d74e200e8 rust: async shed/sql Transaction apis
Summary: Now the queries macros are asynced, lets do the same with the Transaction api exposed from them.

Reviewed By: krallin

Differential Revision: D26730195

fbshipit-source-id: 278753a5d0401f602ce50519138164bb5e49d550
2021-03-04 01:52:42 -08:00
Alex Hornby
98802f349d mononoke: remove sql01::queries from segmented_changelog
Summary: Migrate to the std futures version of sql::queries!

Reviewed By: krallin

Differential Revision: D26700360

fbshipit-source-id: 9ed2664d522bde8d0e923142357ca876a7de2613
2021-03-04 01:52:41 -08:00
Alex Hornby
2ff9ad0fea rust: async sql queries macros
Summary:
Async the query macros.  This change also migrates most callsites, with a few more complicated ones handle as separate diffs, which temporarily use sql01::queries in this diff.

With this change the query string is computed lazily (async fn/blocks being lazy) so we're not holding the extra memory of query string as well as query params for quite as long.  This is of most interest for queries doing writes where the query string can be large when large values passed (e.g. Mononoke sqlblob blobstore )

Reviewed By: krallin

Differential Revision: D26586715

fbshipit-source-id: e299932457682b0678734f44bb4bfb0b966edeec
2021-03-04 01:52:41 -08:00
Thomas Orozco
ef7045e818 common/rust: use fbinit-tokio
Summary:
This diffs add a layer of indirection between fbinit and tokio, thus allowing
us to use fbinit with tokio 0.2 or tokio 1.x.

The way this works is that you specify the Tokio you want by adding it as an
extra dependency alongside `fbinit` in your `TARGETS` (before this, you had to
always include `tokio-02`).

If you use `fbinit-tokio`, then `#[fbinit::main]` and `#[fbinit::test]` get you
a Tokio 1.x runtime, whereas if you use `fbinit-tokio-02`, you get a Tokio 0.2
runtime.

This diff is big, because it needs to change all the TARGETS that reference
this in the same diff that introduces the mechanism. I also didn't produce it
by hand.

Instead, I scripted the transformation using this script: P242773846

I then ran it using:

```
{ hg grep -l "fbinit::test"; hg grep -l "fbinit::main"  } | \
  sort | \
  uniq | \
  xargs ~/codemod/codemod.py \
&&  yes | arc lint \
&& common/rust/cargo_from_buck/bin/autocargo
```

Finally, I grabbed the files returned by `hg grep`, then fed them to:

```
arc lint-rust --paths-from ~/files2 --apply-patches --take RUSTFIXDEPS
```

(I had to modify the file list a bit: notably I removed stuff from scripts/ because
some of that causes Buck to crash when running lint-rust, and I also had to add
fbcode/ as a prefix everywhere).

Reviewed By: mitrandir77

Differential Revision: D26754757

fbshipit-source-id: 326b1c4efc9a57ea89db9b1d390677bcd2ab985e
2021-03-03 04:09:15 -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
David Tolnay
92f96c6555 Format fbsource with rustfmt-2.0.0-rc.2
Reviewed By: zertosh

Differential Revision: D26711985

fbshipit-source-id: 68e6482d041846bc0215b0984c03ef5fed043ebc
2021-02-27 18:46:09 -08:00
Stefan Filip
66bf868681 segmented_changelog: add PeriodicReloadDag
Summary:
This dag periodically reloads the dag from storage.

It currently loads a simple dag that has no update logic because that is what
the manager returs. It's not relevant for this code.

This is probably the last piece before we refactor construction to take a
SegmentedChangelogConfig. To be seen how much will be strict types and how much
will be Arc<dyn SegmentedChangelog>.

Reviewed By: krallin

Differential Revision: D26681458

fbshipit-source-id: 6056d00db6f25616e8158278702f9f4120b92121
2021-02-26 10:14:06 -08:00
Stefan Filip
2584a55dce segmented_changelog: add test_seeder_tailer_and_manager
Summary: There were no unit test for SegmentedChangelogManager so I added one.

Reviewed By: krallin

Differential Revision: D26681459

fbshipit-source-id: 40ceefe7b89043ae6d2c4d31a2adf504245161fb
2021-02-26 10:14:05 -08:00
Stefan Filip
48d4c643cb segmented_changelog: add tests::SegmentedChangelogExt
Summary:
A placeholder for convenience functions.
Right not it has a proxy for the head of the dag.

Reviewed By: krallin

Differential Revision: D26681457

fbshipit-source-id: 6856abbf2685407f96701ea5a508342373503360
2021-02-26 10:14:05 -08:00
Stefan Filip
f1596ef101 segmented_changelog: add PeriodicUpdateDag
Summary:
An OnDemandUpdateDag can now track a bookmark. Every given period it will
query the changeset of the bookmark and incrementally build the dag.

Reviewed By: krallin

Differential Revision: D26656765

fbshipit-source-id: 95057863b5201f9632c654be5544922c7538f974
2021-02-25 15:32:45 -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
Stefan Filip
9ac01a19b4 segmented_changelog_tailer: load bookmark and update period from repo config
Summary:
Using the newly update configuration options

(Note: this ignores all push blocking failures!)

Reviewed By: quark-zju

Differential Revision: D26628453

fbshipit-source-id: 11852e3ed1dc9207b78f994542aa0a251edbbb01
2021-02-24 16:51:51 -08:00
Stefan Filip
bf85eb884f segmented_changelog: add benchmark for ConcurrentMemIdMap
Summary:
Simple test that can give us an intuition for how the ConcurrentMemIdMap should
perform.

Reviewed By: krallin

Differential Revision: D26601378

fbshipit-source-id: ae8f2ada6fc08eef806f3ece72a6c1c2f011ac32
2021-02-23 11:12:18 -08:00
Thomas Orozco
cd180d742f mononoke/segmented_changelog: fix up land race
Summary: I removed tokio-compat yesterday but this landed at the same time and uses it.

Reviewed By: mitrandir77, StanislavGlebik

Differential Revision: D26605246

fbshipit-source-id: 189f485bc8bc3018abb3e9290953eba14bd178de
2021-02-23 03:34:24 -08:00
Stefan Filip
89bb87ef20 segmented_changelog: add in process updating segmented changelog configuration
Summary:
Adding a new configuration that instantiates SegmentedChangelog by downloading
a dag from a prebuilt blob. It then updates in process.

Reviewed By: krallin

Differential Revision: D26508428

fbshipit-source-id: 09166a3c6de499d8813a29afafd4dfe19a19a2a5
2021-02-22 18:17:21 -08:00
Stefan Filip
c6fe0565ec segmented_changelog: add OverlayIdMap
Summary:
I am not sure if this too abstract. It might be. This however has separation of
concerns :)
The goal here is to end up with an in memory IdMap that we write to and read
from first. For things that are not found in the in memory IdMap we fall back
to the SqlIdMap. We'll end up with something like:
`OverlayIdMap(ConcurrentMemIdMap, SqlIdMap)`

Reviewed By: quark-zju

Differential Revision: D26417642

fbshipit-source-id: b2b310306db4dc9fc3427bbf50b19366160882a9
2021-02-22 18:17:21 -08:00
Stefan Filip
b8c6580054 segmented_changelog: add ConcurrentMemIdMap
Summary:
The `MemIdMap` is not a valid `IdMap` implementation because it takes `&mut
self` when doing inserts. Wrapping the IdMap in a `RwLock` allows us to
implement the `IdMap` trait.

Reviewed By: krallin

Differential Revision: D26417643

fbshipit-source-id: cb5e3513841fa1dd7c8b8004ce7b2fe1467983d7
2021-02-22 18:17:21 -08:00
Stefan Filip
84017abe21 segmented_changelog: update OnDemandUpdateDag to have smaller critical sections
Summary:
The on demand update code we have is the most basic logic that we could have.
The main problem is that it has long and redundant write locks. This change
reduces the write lock strictly to the section that has to update the in memory
IdDag.

Updating the Dag has 3 phases:
* loading the data that is required for the update;
* updating the IdMap;
* updating the IdDag;

The Dag can function well for serving requests as long as the commits involved
have been built so we want to have easy read access to both the IdMap and the
IdDag. The IdMap is a very simple structure and because it's described as an
Arc<dyn IdMap> we push the update locking logic to the storage.  The IdDag is a
complicated structure that we ask to update itself. Those functions take
mutable references. Updating the storage of the iddag to hide the complexities
of locking is more difficult. We deal with the IdDag directly by wrapping it in
a RwLock. The RwLock allows for easy read access which we expect to be the
predominant access pattern.

Updates to the dag are not completely stable so racing updates can have
conflicting results. In case of conflics one of the update processes would have
to restart. It's easier to reason about the process if we just allow one
"thread" to start an update process. The update process is locked by a sync
mutex. The "threads" that fail the race to update are asked to wait until the
ongoing update is complete. The waiters will poll on a shared future that
tracks the ongoing dag update. After the update is complete the waiters will go
back to checking if the data they have is available in the dag. It is possible
that the dag is updated in between determining that the an update is needed and
acquiring the ongoing_update lock. This is fine because the update building
process checks the state of dag before the dag and updates only what is
necessary if necessary.

Reviewed By: krallin

Differential Revision: D26508430

fbshipit-source-id: cd3bceed7e0ffb00aee64433816b5a23c0508d3c
2021-02-22 18:17:21 -08:00
Stefan Filip
40e4c736f4 segmented_changelog: add ReadDag
Summary:
This structure is going to be useful to implement the SegmentedChangelog
functionlity for the OnDemandDag as we move forward with separate objects for
the iddag and the idmap rather than a direct dependency on a Dag object.

Reviewed By: quark-zju

Differential Revision: D26508429

fbshipit-source-id: 9116f1c82d301e8e5b726966abd2add2e32765d6
2021-02-22 18:17:20 -08:00
Stefan Filip
954595a6bc segmented_changelog: move build_incremental to update module
Summary:
Moving all update logic to `dag::update`.
Additional minor changes: removing Dag::build and spliting build_incremental
around the mutable update section of iddag.

Reviewed By: krallin

Differential Revision: D26508427

fbshipit-source-id: 984259d2f199792fcf0635dd3100ec39260fd3ed
2021-02-22 18:17:20 -08:00
Stefan Filip
1b2bf258ae segmented_changelog: break the update function into pieces
Summary:
This is going to be useful when we update the InProcessDag on the server. As
opposed to taking a lock for everything we will be able to take a short lock
to update the IdMap and then a short lock to update the IdDag.

Reviewed By: krallin

Differential Revision: D26417621

fbshipit-source-id: 43f342d384f1be80dcfe721de659ac3ce9dd0e7b
2021-02-22 18:17:20 -08:00
Thomas Orozco
097e4ad00c mononoke: remove tokio-compat (i.e. use tokio 0.2 exclusively)
Summary:
The earlier diffs in this stack have removed all our dependencies on the Tokio
0.1 runtime environment (so, basically, `tokio-executor` and `tokio-timer`), so
we don't need this anymore.

We do still have some deps on `tokio-io`, but this is just traits + helpers,
so this doesn't actually prevent us from removing the 0.1 runtime!

Note that we still have a few transitive dependencies on Tokio 0.1:

- async-unit uses tokio-compat
- hg depends on tokio-compat too, and we depend on it in tests

This isn't the end of the world though, we can live with that :)

Reviewed By: ahornby

Differential Revision: D26544410

fbshipit-source-id: 24789be2402c3f48220dcaad110e8246ef02ecd8
2021-02-22 09:22:42 -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
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
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
Stefan Filip
93c1231c55 segmented_changelog: update hash_to_location to gracefully handle unknown hashes
Summary:
One of the primary use cases for hash_to_location is translating user provided
hashes. It is then perfectly valid for the hashes that are provided to not
exist.  Where we would previously return an error for the full request if a
hash was invalid, we now omit the hash from the response.

Reviewed By: quark-zju

Differential Revision: D26389472

fbshipit-source-id: c59529d43f44bed7cdb2af0e9babc96160e0c4a7
2021-02-11 12:17:35 -08:00
Stefan Filip
9c6b9af8e0 segmented_changelog: add SegmetedChangelog::changeset_id_to_location
Summary:
Get the graph location of a given commit identifier.

The client using segmented changelog will have only a set of identifiers for
the commits in the graph. The client needs a way to translate user input to
data that it has locally.  For example, when checking out an older commit by
hash the client will have to retrieve a location to understand the place in the
graph of the commit.

Reviewed By: quark-zju

Differential Revision: D26289623

fbshipit-source-id: 4192d91a4cce707419fb52168c5fdff53ac3a9d0
2021-02-10 10:19:03 -08:00
Stefan Filip
f256b5b752 segmented_changelog: add IdMap::find_many_vertexes
Summary: Batch variation for `find_vertex`. Useful for batching hash to location.

Reviewed By: quark-zju

Differential Revision: D26289618

fbshipit-source-id: b5e642d77715651f44acf64b5eb07529301a493f
2021-02-10 10:19:03 -08:00
Stefan Filip
8117a681e8 segmented_changelog: add guardrail to location_to_changeset_id
Summary:
If `location_to_changeset_id` somehow does not get a vector with one element
it will panic and our server will stop immediately. Not great for a server.
Changes are low but we already return `anyhow::Result` so no big pain here.

Reviewed By: quark-zju

Differential Revision: D26180417

fbshipit-source-id: 6986f3fdd0b34f7c2606162bc35aacb9857ea04c
2021-02-09 11:31:31 -08:00
Stefan Filip
78bc732d5e segmented_changelog: use dag_types::Location for location
Summary:
We had individual fields for location components. This change will make it
easier for people to read through the code. This completes the integration
of the Location struct.

Reviewed By: quark-zju

Differential Revision: D26162272

fbshipit-source-id: 76259578430bac88317afb1935f63e06b6e8284e
2021-02-09 11:31:31 -08:00
Stefan Filip
fe4e0be42e commit: use dag_types::Location for location_to_hash
Summary:
This is removing `edenapi::CommitLocation` in order to use
`dag_types::Location`.

First, `edenapi::CommitLocation` has a `count` field and `dag_types::Location`
does not. I find `count` to be difficult to attach to a more general structure.
In practice `edenapi::CommitLocation` is replaced by `CommitLocationToHashRequest`.
On top of the request we have the batch object: `CommitLocationToHashRequestBatch`.

Second, `edenapi::CommitLocation` did not have Wire types, the new structures do.

Reviewed By: quark-zju

Differential Revision: D26159865

fbshipit-source-id: f2508e123e11988726868c7f439a2ed186afce5c
2021-02-09 11:31:30 -08:00
Stefan Filip
65794e7c5b segmented_changelog: update SegmentedChangelogBuilder to always consume self
Summary:
In the public API at least. A public method will consume the builder. If some
code wants to call multiple methods using the same configuration, they can
safely clone the builder to get a second instance.

SegmentedChangelogBuilder needs to pass references internally to build
individual components otherwise it would have to clone itself excessively.
This pattern leaked towards public methods too. Some tests use this builder too
and they use some crate public methods that need to be defined using
references. I don't know if we should remove that dependency. Anyway, the
Builder is hopefully easier to use now.

Reviewed By: quark-zju

Differential Revision: D26152066

fbshipit-source-id: 63285e200d8e9fde06fede03773b7d4c02e9cea7
2021-02-01 11:44:03 -08:00
Stefan Filip
5bf8012412 segmented_changelog: add caching to IdMap
Summary:
Caching for the IdMap to speed things up.
Values for a key do not change. The IdMap is versioned for a given Repository.
We use the version of the IdMap in the generation of the cache keys. We set the
"site version" to be the IdMap version.

Reviewed By: krallin

Differential Revision: D26121498

fbshipit-source-id: 7e82e40b818d1132a7e86f4cd7365dd38056348e
2021-01-29 16:41:42 -08:00
Thomas Orozco
6c6f698e99 mononoke/segmented_changelog: fix leader fallbacks being the wrong way around
Summary:
We have fallback logic to go to the leader if the data we want is missing in
the replica, but right now it's backwards so we go to the leader to find data
we actually *did* find in the replica (and we don't go to the leader for
missing data).

Reviewed By: sfilipco

Differential Revision: D26103898

fbshipit-source-id: 535abab2a3093165f1d55359d102a7a7cb542a9c
2021-01-27 12:29:06 -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
ce85f95e55 mononoke: add choice of direction to bulkops
Summary: When scrubbing repos it is preferable to scrub newest data first.  This diff adds Direction::NewestFirst to bulkops for use in scrubbing and updates existing call sites to Direction::OldestFirst so as not to change behaviour

Reviewed By: StanislavGlebik

Differential Revision: D25742279

fbshipit-source-id: 363a4854b14e9aa970b2c1ec491dcaccac7a6ec9
2021-01-11 10:55:39 -08:00
Alex Hornby
48ec577119 mononoke: remove ChangesetBulkFetch trait
Summary: There is only one implementation of the trait so remove it and use that impl directly.  Removing the trait  makes it simpler to work on bulkops in the rest of this stack.

Reviewed By: farnz

Differential Revision: D25804021

fbshipit-source-id: 22fe797cf87656932d383ae236f2f867e788a832
2021-01-07 08:18:50 -08:00
Stefan Filip
65054f2044 segmented_changelog: add comments around IdMap insert expectations
Summary:
Comments for why we don't need a lock when updating the SqlIdMap with multiple
writers. Structure can definitely be improved but I'll live with this for a
short time.

No fundamental change in logic. I added extra checks to the insert function and
changed from an optimistic insert race logic to a pessimistic version. I
explain in the comments that it's to have an easier time reasoning about what
happens and that theoretically doesn't matter.

Reviewed By: quark-zju

Differential Revision: D25606290

fbshipit-source-id: ea21915fc797fe759b3fe481e8ad9e8cb594fb6a
2020-12-23 16:51:08 -08:00
Stefan Filip
5f6d1a2c61 edenapi: add full_idmap_clone endpoint
Summary:
The end goal is to have clients using a sparse IdMap. There is still some work
to get there though. In the mean time we can test repositories that don't use
any revlogs. The current expections for those repositories are that they have
a full idmap locally.

Reviewed By: quark-zju

Differential Revision: D25075341

fbshipit-source-id: 52ab881fc9c64d0d13944e9619c087e0d4fb547c
2020-12-08 18:30:24 -08:00
Stefan Filip
3afaeb858a segmented_changelog: add SegmentedChangelog::full_idmap_clone_data
Summary:
The client dag cannot currently be instantiated with a sparse idmap (aka
universal commit idmap). Is should be usable with a full idmap.  To test
repositories that use segmented changelog exclusively we add the capability of
cloning the full idmap.

I currently see StreamCloneData as an experiment. I am open to suggestions
around what structure we should have for the regular long term clone endpoint.
That said, I am leaning towards converting clone_data to return
StreamCloneData.  Overall, Segmented Changelog has a few knobs that influence
how big the IdMap ends up being so the code that is more flexible will be more
useful long term.  To add to that, we transform data higher in the stack using
streaming and this data does similar fetching, it seems that we should have a
stream idmap exposed by clone_data.

Reviewed By: quark-zju

Differential Revision: D24966338

fbshipit-source-id: 019b363568e3191280bd5ac09fc15062711e5523
2020-12-08 18:30:24 -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
Stefan Filip
4b9dc9074f segmented_changelog: measure runs/failures/duration for updates
Summary: Basic observability for how the segmeted changelog update process is performing.

Reviewed By: krallin

Differential Revision: D25108739

fbshipit-source-id: b1f406eb0c862464b186f933d126e0f3a08144e4
2020-12-01 17:29:23 -08:00
Stefan Filip
b2aac949cf cmds: update segmented-changelog-tailer to run on a list of repos
Summary:
The update of the segmented changelog is light weight enough that we can
consider all repositories sharing a common tailer process. With all
repositories sharing a single tailer the the maintenance burden will be lower.

Things that I am particularly unsure about are: tailer configuration setup and
tailer structure. With regards to setup, I am not sure if this is more or less
than what production servers do to instantiate. With regards to structure, I
think that it makes a lot of sense to have a function that takes a single repo
name as parameter but the configuration setup has an influence on the details.
I am also unsure how important it is to paralelize the instantiation of the
blobrepos.

Finally, it is worth mentioning that the SegmentedChangelogTailer waits for
`delay` after an update finishes rather than on a period. The benefit is that
we don't have large updates taking down a process because we schedule the same
large repo update too many timer. The drawback is that scheduling gets messed
up over time and multiple repo updates can end up starting at the same time.

Reviewed By: farnz

Differential Revision: D25100839

fbshipit-source-id: 5fff9f87ba4dc44a17c4a7aaa715d0698b04f5c3
2020-12-01 17:29: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
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
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
Stefan Filip
3ffb223968 config: add SegmentedChangelog that downloads dag for functionality
Summary:
Under this configuration SegmentedChangelog Dags (IdDag + IdMap) are always
downloaded from saves. There is no real state kept in memory.

It's a simple configuration and somewhat flexible with treaks to blobstore
caching.

Reviewed By: krallin

Differential Revision: D24808330

fbshipit-source-id: 450011657c4d384b5b42e881af8a1bd008d2e005
2020-11-11 22:53:38 -08:00
Stefan Filip
3446a65526 segmented_changelog: add SegmentedChangelog::clone_data
Summary:
Constructs and returns `CloneData<ChangesetId>`. This object can then be used
to bootstrap a client dag that speaks bonsai commits.
Short term we are going to be using this data in the Mercurial client which
doesn't use bonsai. Hg MononokeRepo will convert it.

Long term we may decide that we want to download cached artifacts for
CloneData.  I don't see an issue getting there, I see this as a valid path
forward that cuts down on the configuration required to get to the cached
artifacts.  All that said, I think that using whatever dag is available in
memory would be a viable production option.

Reviewed By: krallin

Differential Revision: D24717915

fbshipit-source-id: 656924abb4bbfa1a11431000b6ca6ed2491cdc74
2020-11-11 22:53:37 -08:00
Stefan Filip
59d8ccf690 segmented_changelog: add SegmentedChangelogManager
Summary: The SegmentedChangelogManager abstracts saving and loading Dags. This is currently used in the tailer and seeder processes. It will also be used to load dags while the server is running.

Reviewed By: krallin

Differential Revision: D24717925

fbshipit-source-id: 30dff7dfc957f455be6cf733b20449c804511b43
2020-11-11 22:53:37 -08:00
Mark Juggurnauth-Thomas
0eb32649a6 segmented_changelog: resync autocargo
Summary: The `dag` dependency now generates a `for-tests` feature requirement.

Reviewed By: sfilipco, krallin

Differential Revision: D24888944

fbshipit-source-id: 6da646d71ae99118dcdc33673565056462a4c8ad
2020-11-11 09:31:42 -08:00
Stefan Filip
18a6d2aef3 segmented_changelog: update sql query for last idmap entry
Summary:
MySQL doesn't like that the idmap table is renamed to `inner`. For good reason,
inner is a keyword, best to rename it.

Reviewed By: ahornby

Differential Revision: D24568914

fbshipit-source-id: 7a3790e835931b29658c7652cc89069c6b9b5bab
2020-10-29 17:40:19 -07:00
Stefan Filip
1089012b05 segmented_changelog: add SegmentedChangelogBuilder::with_blobrepo
Summary:
I avoided this function because it interacts in a weird ways with dependencies.
At this point I am no longer concerned about that and it can help us simplify
some code.
Looking ahead I think that we will refactor things into having fewer
dependencies.

Reviewed By: krallin

Differential Revision: D24555935

fbshipit-source-id: 994b25d90da491bb5cc593b6c33085790c4fb322
2020-10-29 17:40:19 -07:00
Stefan Filip
2391173a3f segmented_changelog: add segmented changelog tailer command
Summary:
The command reads the last SegmentedChangelog that was saved for a repository
and updates head to match a given bookmark (master).

Right now this is just a command that works on one repository. Follow up
changes will look at deployment options and handling multiple repositories.

Reviewed By: krallin

Differential Revision: D24516438

fbshipit-source-id: 8f04f9426c2f2d7748c5363d2dbdf9f3acb79ddd
2020-10-29 17:40:19 -07:00
Stefan Filip
07200876bb segmented_changelog: account for iddag lag in incremental build
Summary:
I initially saw the incremental build as something that would be run in places
that had IdMap and IdDag stored side by side in process. I am reconsidering
to use incremental build in the tailing process to keeps Segmented Changelog
artifacts up to date.

Since we update the IdMap before we update the IdDag, it is likely that we
will have runs that only update the IdMap and fail to update IdDags. This diff
adds a mechanism for the IdDag to catch up.

Reviewed By: krallin

Differential Revision: D24516440

fbshipit-source-id: 3a99248451d806ae20a0ba96199a34a8a35edaa4
2020-10-29 17:40:19 -07:00
Stefan Filip
a30217fe1b segmented_changelog: context and debug derives for easier debugging
Summary:
Nice to have things for debugging.

This isn't an exhaustive list of places that we could add context too. I'll
probably look to complete the list after the current changes are done.

Reviewed By: krallin

Differential Revision: D24516437

fbshipit-source-id: 7f29e7afde5a5918aea419181d786f48da9b8b14
2020-10-29 17:40:19 -07:00
Stefan Filip
7f274cf1ff segmented_changelog: style updates to segmented changelog seeder
Summary: Style.

Reviewed By: krallin

Differential Revision: D24516439

fbshipit-source-id: 11582b25e86b20c3e27a4ac4c299119f0b3c72a0
2020-10-29 17:40:19 -07:00
Stefan Filip
d1229b7fad segmented_changelog: update iddag store key to blake2
Summary:
The general goal is to allign segmented changelog blobstore usage with the
general pattern in Mononoke.

Reviewed By: quark-zju

Differential Revision: D24605796

fbshipit-source-id: 808985609f74ebc45f3fcc57583e55f3af9bce1d
2020-10-29 17:40:18 -07:00
Stefan Filip
2207e27ce0 segmented_changelog: replace sql log tables with scuba
Summary:
From an OSS perspective, I think that the log tables have a place. However for
daily use perspective, next to scuba they don't add much except retention and
instead feel more heavy weight to manage. This change probably simplifies
things and makes the Segmented Changelog component easier to maintain.

Reviewed By: krallin

Differential Revision: D24213548

fbshipit-source-id: 48a4ea57e3f3911c3bf82b0cc51f118d72119e19
2020-10-09 11:17:03 -07:00
Stanislau Hlebik
5251028e61 mononoke: fix build
Summary: looks like we got land time conflict

Reviewed By: krallin

Differential Revision: D24196362

fbshipit-source-id: 27da83a2f86cc7fe5f59fe583d4b719f69df0248
2020-10-08 12:23:19 -07:00
Stefan Filip
fa0c15ab87 cmds: add segmented_changelog seeder
Summary:
Mononoke command for running the SegmentedChangelogSeeder for an existing
repository. The result is going to be a new IdMap version in the metadata
store and a new IdDag stored in the the blobstore resulting in a brand new
SegmentedChangelog bundle.

Reviewed By: krallin

Differential Revision: D24096963

fbshipit-source-id: 1eaf78392d66542d9674a99ad0a741f24bc2cb1b
2020-10-08 09:43:47 -07:00
Stefan Filip
aeae90f1ee segmented_changelog: add SegmentedChangelogSeeder
Summary:
The SegmentedChangelogSeeder has the role of constructing a new IdMap for a
given repository. That would happen when a repository is onboarded or when
algorithm improvements are made.

This change comes with small refactoring. We had the Dag which did a bit of
everything. Now the on_demand_update and the seeder functionalities are in
their separate files. The tests from `dag.rs` were moved to the `tests.rs` and
updated to use the seeder and on_demand_update structures.

`SegmentedChangelogSeeder::run` is the main logic added in this diff.

Reviewed By: quark-zju

Differential Revision: D24096965

fbshipit-source-id: 0f655e8c226ca0051f3e925342e92b1e7979aab2
2020-10-08 09:43:47 -07:00
Stefan Filip
225c4083da segmented_changelog: add IdDagSaveStore
Summary:
The IdDagStore provides the ability to save and later load prebuilt instances
of the IdDag.
This is going to be used in the clone API where we send one of these blobs to
the client. It is also going to be used by servers starting up.
Right now the serialization is naive, relying on serde::Serialize. The key
schema would provide the means for evolving the serialization format in cases
where we would require breaking changes.

Reviewed By: quark-zju

Differential Revision: D24096967

fbshipit-source-id: 2c883e5e82c05bec03c429c3c2a2d545170a8c05
2020-10-08 09:43:46 -07:00
Stefan Filip
6883e90d30 segmented_changelog: add IdMap, IdDag, Bundle version stores
Summary:
This IdMapVersionStore determines which is the latest IdMapVersion that commit
"tailing" processes should use when building new Dag bundles.  The "seed"
process will update the versions of the IdMap. The plan for the "seed" process
is to write a new IdMap version to Sql then update the store with a new entry.
New "tailer" processes will then start to use the newly built IdMapVersion.
The tailing processes that will build fresh IdDags for general consumption.
These IdDags will be used by the clone operation. These dags will also be used
by servers instances spinning up.
DagBundles specify (id dag version, id map vession). This pair specified a
prebuilt Segmented Changelog that is ready to be loaded.

Reviewed By: quark-zju

Differential Revision: D24096968

fbshipit-source-id: 413f49ed185a770a73afd17dfbc952901ab53b42
2020-10-08 09:43:46 -07:00
David Tolnay
0cb8a052f5 Update formatter to rustfmt 2.0
Reviewed By: zertosh

Differential Revision: D23591021

fbshipit-source-id: e664aa2fdd3aaa457796a59080be6b94f604a112
2020-09-09 07:52:33 -07:00
Stefan Filip
3f0b08e46f segmented_changelog: add version field to IdMap
Summary:
The version is going to be used to seamlessly upgrade the IdMap. We can
generate the IdMap in a variety of ways. Naturally, algorithms for generating
the IdMap may change, so we want a mechanism for updating the shared IdMap.

A generated IdDag is going to require a specific IdMap version. To be more
precise, the IdDag is going to specify which version of IdMap it has to be
interpreted with.

Reviewed By: quark-zju

Differential Revision: D23501158

fbshipit-source-id: 370e6d9f87c433645d2a6b3336b139bea456c1a0
2020-09-03 16:33:20 -07:00
Stefan Filip
58a4821fe3 segmented_changelog: add IdMap trait with SqlIdMap implementation
Summary:
Separate the operational bits of the IdMap from the core SegmentedChangelog
requirements.

I debaded whether it make sense to add repo_id to SqlIdMap. Given the current
architecture I don't see a reason not to do it. On the contrary separating
two objects felt convoluted.

Reviewed By: quark-zju

Differential Revision: D23501160

fbshipit-source-id: dab076ab65286d625d2b33476569da99c7b733d9
2020-09-03 16:33:20 -07:00
Stefan Filip
f3c353edbc segmented_changelog: change idmap module from file to directory
Summary:
Planning to add a trait for core idmap functionality (that's just translating
cs_id to vertex and back). The current IdMap will then be an implementation of
that trait.

Reviewed By: quark-zju

Differential Revision: D23501159

fbshipit-source-id: 34e3b26744e4b5465cd108cca362c38070317920
2020-09-03 16:33:20 -07:00
Stefan Filip
e57b1f9265 segmented_changelog: add on-demand updating dag implementation
Summary:
The Segmented Changelog must be built somewhere. One of the simplest deployments
of involves the on-demand update of the graph. When a commit that wasn't yet
processed is encountered, we sent it to processing along with all of it's
ancestors.

At this time not much attention was paid to the distinction of master commit
versus non-master commit. For now the expectation is that only commits from
master will exercise this code path. The current expectation is that clients
will only call location-to-hash using commits from master.
Let me know if there is an easy way to check if a commit is part of master.
Later changes will invest more in handling non-master commits.

Reviewed By: aslpavel

Differential Revision: D23456218

fbshipit-source-id: 28c70f589cdd13d08b83928c1968372b758c81ad
2020-09-02 17:20:42 -07:00
Stefan Filip
d50e09a41d segmented_changelog: add SegmentedChangelogBuilder
Summary:
This builders implements SqlConstruct and SqlConstuctFromMetadataDatabaseConfig
to make handling the Sql connection for IdMap consistent with what happens in
Mononoke in general.

Reviewed By: aslpavel

Differential Revision: D23456219

fbshipit-source-id: 6998afbbfaf1e0690a40be6e706aca1a3b47829f
2020-09-02 17:20:42 -07:00
Stefan Filip
66706d77c5 segmented_changelog: add SegmentedChangelog trait
Summary:
The trait provides two methods for location to hash translation. The first
returns a single hash and is existing functionality. The second returns a
list of hashes and represents new functionality. This diff also adds this
functionality to the Dag structure which is currently the only real
implementation for SegmentedChangelog.

Reviewed By: aslpavel

Differential Revision: D23456215

fbshipit-source-id: 0c2ca91672cf23129342c585f98446c0ebbdf7ef
2020-09-02 17:20:41 -07:00
Jun Wu
6fd7a2e582 dag: use concrete error types
Summary:
This is more complex than previous libraries, mainly because `dag` defines APIs
(traits) used by other code, which might raise error type not interested
by `dag` itself. `BackendError::Other(anyhow::Error)` is currently used to
capture types that do not fit in `dag`'s predefined error types.

Reviewed By: sfilipco

Differential Revision: D22883865

fbshipit-source-id: 3699e14775f335620eec28faa9a05c3cc750e1d1
2020-08-06 12:31:57 -07:00
Jun Wu
8d0f48c4da dag: rename some anyhow::Result to dag::Result
Summary:
Prefix some `Result` with `dag::Result`. Since `dag::Result` is just
`anyhow::Result` for now, this does not change anything but makes
it more compatible with upcoming changes.

Reviewed By: sfilipco

Differential Revision: D22883864

fbshipit-source-id: 95a26897ed026f1bb8000b7caddeb461dcaad0e7
2020-08-06 12:31:57 -07:00
Stefan Filip
2f3e569120 mononoke_api: add segmented changelog location to hash translation
Summary:
This functionality is going to be used in EdenApi. The translation is required
to unblock removing the changelog from the local copy of the repositories.
However the functionality is not going to be turned on in production just yet.

Reviewed By: kulshrax

Differential Revision: D22869062

fbshipit-source-id: 03a5a4ccc01dddf06ef3fb3a4266d2bfeaaa8bd2
2020-08-04 11:22:39 -07:00
Arun Kulshreshtha
5f0181f48c Regenerate all Cargo.tomls after upgrade to futures 0.3.5
Summary: D22381744 updated the version of `futures` in third-party/rust to 0.3.5, but did not regenerate the autocargo-managed Cargo.toml files in the repo. Although this is a semver-compatible change (and therefore should not break anything), it means that affected projects would see changes to all of their Cargo.toml files the next time they ran `cargo autocargo`.

Reviewed By: dtolnay

Differential Revision: D22403809

fbshipit-source-id: eb1fdbaf69c99549309da0f67c9bebcb69c1131b
2020-07-06 20:49:43 -07:00
Stefan Filip
422c84b659 mononoke: monitor replication lag in segmented_changelog::IdMap
Summary:
The (re)construction process for the IdMap will generate millions of rows
to be inserted in our database. We want to throttle the inserts so that
the database doesn't topple over.

Reviewed By: ikostia

Differential Revision: D22104349

fbshipit-source-id: 73b7c2bab12ae0cd836080bcf1eb64586116e70f
2020-07-01 18:18:55 -07:00
Jeremy Fitzhardinge
35b292ce9d eden: manual dependency fixes
Summary:
Tooling can't handle named_deps yet, but it can warn about them

P133451794

Reviewed By: StanislavGlebik

Differential Revision: D22083499

fbshipit-source-id: 46de533c19b13b2469e912165c1577ddb63d15cd
2020-06-17 17:55:04 -07:00
Jeremy Fitzhardinge
1b4edb5567 eden: remove unused Rust dependencies
Summary:
Remove unused dependencies for Rust targets.

This failed to remove the dependencies in eden/scm/edenscmnative/bindings
because of the extra macro layer.

Manual edits (named_deps) and misc output in P133451794

Reviewed By: dtolnay

Differential Revision: D22083498

fbshipit-source-id: 170bbaf3c6d767e52e86152d0f34bf6daa198283
2020-06-17 17:55:03 -07:00
Lukas Piatkowski
07e0427eb4 mononoke: make segmented_changelog OSS buildable
Reviewed By: krallin

Differential Revision: D21980974

fbshipit-source-id: 60e8f0e78b2bd654e5109b39c85f08ee5b3e9490
2020-06-12 06:54:32 -07:00
Jeremy Fitzhardinge
d03da109c7 mononoke: fix some little lints
Reviewed By: StanislavGlebik

Differential Revision: D22004427

fbshipit-source-id: 1418f91a3322ef3a3ff620c4e17745fc765dc971
2020-06-12 01:33:20 -07:00
Stefan Filip
c06de91150 mononoke: add tracking for SQL connection usage
Summary: Incrementing CoreContext::perf_counters().

Reviewed By: krallin

Differential Revision: D21875162

fbshipit-source-id: 0187034c3004efb86d74ce23ddf61a2b469efc61
2020-06-11 12:38:49 -07:00
Stefan Filip
754c1d00c0 mononoke: add counters to segmented changelog calls
Summary: Title.

Reviewed By: krallin

Differential Revision: D21875163

fbshipit-source-id: e7c50e30d10a4d192edb082c0cabe290c4e6d29a
2020-06-11 12:38:49 -07:00
Stefan Filip
0bb787d892 mononoke: add batch query capability to segmented changelog IdMap
Summary:
Useful for keeping the insert logic working nicely even when we double insert
or have other inconsistencies.

Reviewed By: krallin

Differential Revision: D21853048

fbshipit-source-id: 958cbc0435f330749c5aae1ea0f41ecd03b01468
2020-06-11 12:38:48 -07:00
Mark Thomas
76bff4c32d segmented_changelog: fix warnings
Reviewed By: sfilipco

Differential Revision: D21998893

fbshipit-source-id: f0b8d82ec4937263fbe0db2e626a3847118e5b08
2020-06-11 10:55:31 -07:00
Stefan Filip
da6a88756e mononoke: add IdMap::insert_many
Summary: Bulk insertion to the SQL backed IdMap.

Reviewed By: StanislavGlebik

Differential Revision: D21655847

fbshipit-source-id: 937cb910edbe399fed4e6b0c4013e18378cea82f
2020-06-02 19:17:53 -07:00
Stefan Filip
134a7a425c mononoke: update SegmentedChangelog building to pick up where it left off
Summary:
Instead of always building from scratch, continue assiging Vertexes and
Segments from the last commit that was processed.

Reviewed By: StanislavGlebik

Differential Revision: D21634699

fbshipit-source-id: 9f8b890dcf65c59a66651343f0ccc1487efc2394
2020-06-02 19:17:53 -07:00
Stefan Filip
e44681e307 mononoke: add IdMap::get_last_entry
Summary: Useful for determining where an incremental building step left off.

Reviewed By: StanislavGlebik

Differential Revision: D21634698

fbshipit-source-id: e9b0473003c529d5c934754f1ece23df69c4be66
2020-05-26 07:37:11 -07:00