Commit Graph

53 Commits

Author SHA1 Message Date
Jeremy Fitzhardinge
113060beb1 third-party/rust: bump all the tracing packages
Summary:
This includes recent changes:
- `skip_all` in #[instrument] https://github.com/tokio-rs/tracing/pull/1548
- NoSubscriber no-op Subscriber https://github.com/tokio-rs/tracing/pull/1549
- Box/Arc Layer (https://github.com/tokio-rs/tracing/pull/1536 +
  https://github.com/tokio-rs/tracing/pull/1547)
- log filtering fixes https://github.com/tokio-rs/tracing/pull/1543

Local: force `log` and `log-always` features off. This removes the
`enable-trace-logging` flag from smartplatform/reconciler.

Reviewed By: guswynn

Differential Revision: D30906032

fbshipit-source-id: fdc3e4e29a39e9e181d9f4ff017e6b3e16acdcd8
2021-09-15 16:52:25 -07:00
Jeremy Fitzhardinge
cbceb08640 third-party/rust: local patch to tracing-subscriber
Summary:
Add impls for Layer for Box/Arc<L: Layer> and <dyn Layer>. Also a pile of other
updates in git which haven't been published to crates.io yet, including proper
level filtering of trace events being fed into log.

Reviewed By: dtolnay

Differential Revision: D30829927

fbshipit-source-id: c01c9369222df2af663e8f8bf59ea78ee12f7866
2021-09-09 22:38:25 -07:00
David Tolnay
5e9b8cd4b2 third-party/rust: Update thiserror from 1.0.23 to 1.0.29
Summary:
Release notes:

- https://github.com/dtolnay/thiserror/releases/tag/1.0.24
- https://github.com/dtolnay/thiserror/releases/tag/1.0.25
- https://github.com/dtolnay/thiserror/releases/tag/1.0.26
- https://github.com/dtolnay/thiserror/releases/tag/1.0.27
- https://github.com/dtolnay/thiserror/releases/tag/1.0.28
- https://github.com/dtolnay/thiserror/releases/tag/1.0.29

The pertinent feature is 1.0.29 adding support for inferred trait bounds on error types that contain generic type parameters. I remember someone asking for this in fbcode but I forget what project it was for.

```
use thiserror::Error;

#[derive(Error, Debug)]
pub enum MyError<E, F, G> {
    #[error("thing {0} ({0:?})")]
    Variant(E),
    #[error("some error")]
    Delegate(#[source] SomeError<F>),
    #[error("err 0o{val:o}")]
    Octal { val: G },
}
```

```
// generated

impl<E, F, G> std::error::Error for MyError<E, F, G>
where
    SomeError<F>: std::error::Error + 'static,  //'
    Self: std::fmt::Debug + std::fmt::Display;

impl<E, F, G> std::fmt::Display for MyError<E, F, G>
where
    E: std::fmt::Debug + std::fmt::Display,
    G: std::fmt::Octal;
```

Reviewed By: zertosh

Differential Revision: D30758449

fbshipit-source-id: b3afe08fe8c8affa26693df9cbb63e04632ea1d3
2021-09-08 20:49:35 -07:00
Thomas Orozco
35e3466031 third-party/rust: update daemonize to 0.5
Summary:
Like it says in the title, this updates us to use Daemonize 0.5, though from
Github and not Crates.io, because it hasn't been released to the latter yet.

The main motivation here is to pull in
https://github.com/knsd/daemonize/pull/39 to avoid leaking PID files to
children of the daemon.

This required some changes in `hphp/hack/src/facebook/hh_decl`  and `xplat/rust/mobium` since the way to
run code after daemonization has changed (and became more flexible).

Reviewed By: ndmitchell

Differential Revision: D30694946

fbshipit-source-id: d99768febe449d7a079feec78ab8826d0e29f1ef
2021-09-02 06:27:03 -07:00
Thomas Orozco
0d2bfbeccd Update autocargo component on FBS:master
Summary:
Manual component version update
Bump Schedule: https://www.internalfb.com/intern/msdk/bump/?schedule_fbid=342556550408072
Package: https://www.internalfb.com/intern/msdk/package/181247287328949/
Oncall Team: rust_foundation
NOTE: This build is expected to expire at 2022/09/01 09:14AM PDT
---------
New project source changes since last bump based on D30663071 (08e362a355e0a64a503f5073f57f927394696b8c at 2021/08/31 03:47AM -05):
| 2021/08/31 04:41AM -05 | generatedunixname89002005294178 | D30665384 | [MSDK] Update autocargo component on FBS:master |
| 2021/08/31 07:14PM PDT | kavoor | D30681642 | [autocargo] Make cxx-build match version of cxx |
| 2021/09/01 04:05PM BST | krallin | D30698095 | autocargo: include generated comment in OSS manifests |
---------

build-break (bot commits are not reviewed by a human)

Reviewed By: farnz

Differential Revision: D30717040

fbshipit-source-id: 2c1d09f0d51b6ff2e2636496cf22bcf781f22889
2021-09-02 02:33:56 -07:00
David Tolnay
ba87c55127 third-party/rust: Patch mockall_derive to fix nondeterminism failures in Conveyor
Summary:
The mockall crate's `automock` attribute previously created nondeterministic output, which leads to frequent random "Found possibly newer version of crate" failures in Buck builds that involve cache.

The affected trait in Conveyor is:

https://www.internalfb.com/code/fbsource/[4753807291f7275a061d67cead04ea12e7b38ae2]/fbcode/conveyor/common/just_knobs/src/lib.rs?lines=13-23

which has a method with two lifetime parameters. Mockall's generated code shuffled them in random order due to emitting the lifetimes in HashSet order. The generated code would randomly contain one of these two types:

`Box<dyn for<'b, 'a> FnMut(&str, Option<&'a str>, Option<&'b str>) -> Result<bool> + Send>`

`Box<dyn for<'a, 'b> FnMut(&str, Option<&'a str>, Option<&'b str>) -> Result<bool> + Send>`

Reviewed By: jsgf

Differential Revision: D30656936

fbshipit-source-id: c1a251774333d7a4001a7492c1995efd84ff22e5
2021-08-30 21:12:18 -07:00
CodemodService Bot
0a375b8e5d Daily common/rust/cargo_from_buck/bin/autocargo
Reviewed By: StanislavGlebik

Differential Revision: D30535840

fbshipit-source-id: a941161547246c1e9aac0735a1994f20389ce1ae
2021-08-25 03:07:04 -07:00
Thomas Orozco
de5b8e2dcb rust: ignore metadata-sys rules in Autocargo
Summary:
Autocargo only allows 1 rust-library per Cargo.toml, but right now we have 3
per Thrift library so that doesn't work:

https://www.internalfb.com/intern/sandcastle/log/?instance_id=27021598231105145&step_id=27021602582167211&step_index=13&name=Run%20config

There's little benefit in Autocargo-ifying those rules anyway since they're of
use to Thrift servers and this doesn't work at all in our OSS builds, so let's
just see if we can just noop them. That'll make the crate not exist at all as a
dep, but even considering that it exists only to link to a C++ library that
Autocargo doesn'tk now how to build anyway, that seems OK?

drop-conflicts

Reviewed By: markbt

Differential Revision: D30304720

fbshipit-source-id: 047524985b2dadab8610267c05e3a1b3770e84e6
2021-08-13 10:43:40 -07:00
Stanislau Hlebik
1d0c535123 mononoke: support reading streaming changelog chunks with tag
Reviewed By: ahornby

Differential Revision: D30015772

fbshipit-source-id: ca19f41b95ce0db43895b3c53009538d5712e239
2021-08-10 05:13:54 -07:00
Alex Hornby
2f28c4121c rust: remove chashmap from cargo vendoring
Summary: Previous diffs switched all our usage from chashmap to dashmap as dashmap upstream is more responsive. Now remove chashmap from the cargo vendoring.

Reviewed By: dtolnay

Differential Revision: D30046522

fbshipit-source-id: 111ef9375bd8095f8b7c95752ecbc1988fb0438d
2021-08-04 07:31:08 -07:00
Stanislau Hlebik
5e8e82fba8 mononoke: add "tag" to streaming_changelog_chunks
Reviewed By: krallin

Differential Revision: D30015700

fbshipit-source-id: df8b61a69d781e1e8d7ab2e2cbaa148c4859cb97
2021-08-02 10:33:44 -07:00
Arun Kulshreshtha
14d8c051c1 third-party/rust: remove patch from curl and curl-sys
Summary:
The patches to these crates have been upstreamed.

allow-large-files

Reviewed By: jsgf

Differential Revision: D29891894

fbshipit-source-id: a9f2ee0744752b689992b770fc66b6e66b3eda2b
2021-07-26 15:00:16 -07:00
CodemodService Bot
0a402ce760 Daily common/rust/cargo_from_buck/bin/autocargo
Reviewed By: krallin

Differential Revision: D29841733

fbshipit-source-id: c9da8e0324f402f3b9726f2733b51de56abde8f6
2021-07-22 09:22:41 -07:00
Xavier Deguillard
41897e3acc third-party: patch os_info to properly support Centos Stream
Summary:
This is just updating the os_info crate to my fork with a fix for Centos
Stream: https://github.com/stanislav-tkach/os_info/pull/267

Reviewed By: quark-zju

Differential Revision: D29410043

fbshipit-source-id: 3642e704f5a056e75fee4421dc59020fde13ed5e
2021-06-25 21:07:33 -07:00
Andrew Gallagher
05cf7acd77 object-0.25.3: patch SHT_GNU_versym entsize fix
Summary:
Pull in a patch which fixes writing out an incorrect entsize for the
`SHT_GNU_versym` section:
ddbae72082

Reviewed By: igorsugak

Differential Revision: D29248208

fbshipit-source-id: 90bbaa179df79e817e3eaa846ecfef5c1236073a
2021-06-21 09:31:49 -07:00
Andres Suarez
845128485c Update bytecount
Reviewed By: dtolnay

Differential Revision: D29213998

fbshipit-source-id: 92e7a9de9e3d03f04b92a77e16fa0e37428fe2fb
2021-06-17 19:50:32 -07:00
CodemodService Bot
4c4dfd45ad Daily common/rust/cargo_from_buck/bin/autocargo
Reviewed By: krallin

Differential Revision: D29158387

fbshipit-source-id: 48a0b590e01083d762bbed2b7e272cbefc72641f
2021-06-16 04:50:15 -07:00
Alex Hornby
4457092322 rust: revert zstd crates
Summary: revert the zstd crates back to previous version

Reviewed By: johansglock

Differential Revision: D29038514

fbshipit-source-id: 3cbc31203052034bca428441d5514557311b86ae
2021-06-11 04:39:54 -07:00
Alex Hornby
f89dbebae8 rust: update zstd bindings to 1.5.0
Summary: Update to latest version.  This includes a patch to async-compression crate from [my PR updating it](https://github.com/Nemo157/async-compression/pull/125), I will remove once the crate is released.

Reviewed By: mitrandir77

Differential Revision: D28897019

fbshipit-source-id: 07c72f2880e7f8b85097837d084178c6625e77be
2021-06-08 07:57:29 -07:00
CodemodService Bot
254d2a37ad Daily common/rust/cargo_from_buck/bin/autocargo
Reviewed By: krallin

Differential Revision: D28928316

fbshipit-source-id: 6da6c9a5321d722a3dfd816b49f3994df98c7471
2021-06-07 02:19:59 -07:00
Thomas Orozco
846a983d67 thrift/lib/rust: update to Bytes 1.x
Summary:
Like it says in the title. The API between Bytes 1.x has changed a little bit,
but the concepts are basically the same, so we just need to change the
callsites that were calling `bytes()` and have them ask for `chunk()` instead.

This diff attempts to be as small as it can (and it's already quite big). I
didn't attempt to update *everything*: I only updated whatever was needed to
keep `common/rust/tools/scripts/check_all.sh` passing.

However, there are a few changes that fall out of this. I'll outline them here:

## `BufExt`

One little caveat is the `copy_to_bytes` we had on `BufExt`. This was
introduced into Bytes 1.x (under that name), but we can't use it here directly.

The reason we can't is because the instance we have is a `Cursor<Bytes>`, which
receives an implementation of `copy_from_bytes` via:

```
impl<T: AsRef<[u8]>> Buf for std::io::Cursor<T>
```

This means that implementation isn't capable of using the optimized
`Bytes::copy_from_bytes` which doesn't do a copy at all. So, instead, we need
to use a dedicated method on `Cursor<Bytes>`: `copy_or_reuse_bytes`.

## Calls to `Buf::to_bytes()`

This method is gone in Bytes 1.x, and replaced by the idiom
`x.copy_to_bytes(x.remaining())`, so I updated callsites of `to_bytes()`
accordingly.

## `fbthrift_ext`

This set of crates provides transports for Thrift calls that rely on Tokio 0.2
for I/O. Unfortunately, Tokio 0.2 uses Bytes 0.5, so that doesn't work well.

For now, I included a copy here (there was only one required, when reading from
the socket). This can be removed if we update the whole `fbthrift_ext` stack to
Bytes 1.x. fanzeyi had been wanting to update this to Tokio 1.x, but was blocked on `thrift/lib/rust` using Bytes 0.5, and confirmed that the overhead of a copy here is fine (besides, this code can now be updated to Tokio 1.x to remove the copy).

## Crates using both Bytes 0.5 & Bytes 1.x

This was mostly the case in Mononoke. That's no coincidence: this is why I'm
working on this. There, I had to make changes that consist of removing Bytes
0.5 to Bytes 1.x copies.

## Misuse of `Buf::bytes()`

Some places use `bytes()` when they probably mean to use `copy_to_bytes()`. For
now, I updated those to use `chunk()`, which keeps the behavior the same but
keeps the code buggy. I filed T91156115 to track fixing those (in all
likelihood I will file tasks for the relevant teams).

Reviewed By: dtolnay

Differential Revision: D28537964

fbshipit-source-id: ca42a614036bc3cb08b21a572166c4add72520ad
2021-05-20 09:44:41 -07:00
Alex Hornby
da5dac311b rust: remove patch for async-compression
Summary: Upstream crate has landed my PR for zstd 1.4.9 support and made a release, so can remove this patch now.

Reviewed By: ikostia

Differential Revision: D28221163

fbshipit-source-id: b95a6bee4f0c8d11f495dc17b2737c9ac9142b36
2021-05-05 12:20:34 -07:00
Toan Mai
410f7c5c61 Imported a mysql_common patch to support FromRow for tuples up to arity 16 (#23)
Summary:
Pull Request resolved: https://github.com/facebookexperimental/rust-shed/pull/23

Pull Request resolved: https://github.com/facebookincubator/resctl/pull/8081

Pull Request resolved: https://github.com/facebookexperimental/eden/pull/82

Imported a mysql_common patch to support FromRow for tuples upto arity 16
Context: https://fburl.com/zfnw7r86

Followed the guide: https://www.internalfb.com/intern/wiki/Rust-at-facebook/Managing_fbsource_third-party_with_Reindeer/#maintaining-local-change

Reviewed By: marcelogomez

Differential Revision: D28094262

fbshipit-source-id: fed48e3950e8a3ba3d7a15407522167e5ae41a98
2021-05-05 10:32:48 -07:00
Thomas Orozco
9c7aa6aaf7 third-party/rust: remove patches for Tokio 0.2 & Hyper 0.2
Summary:
We used to carry patches for Tokio 0.2 to add support for disabling Tokio coop
(which was necessary to make Mononoke work with it), but this was upstreamed
in Tokio 1.x (as a different implementation), so that's no longer needed. Nobody
else besides Mononoke was using this.

For Hyper we used to carry a patch with a bugfix. This was also fixed in Tokio
1.x-compatible versions of Hyper. There are still users of hyper-02 in fbcode.
However, this is only used for servers and only when accepting websocket
connections, and those users are just using Hyper as a HTTP client.

Reviewed By: farnz

Differential Revision: D28091331

fbshipit-source-id: de13b2452b654be6f3fa829404385e80a85c4420
2021-04-29 08:07:45 -07:00
Thomas Orozco
ffed22260d third-party/rust: remove Gotham 0.2
Summary:
This used to be used by Mononoke, but we're now on Tokio 1.x and on
corresponding versions of Gotham so it's not needed anymore.

Reviewed By: farnz

Differential Revision: D28091091

fbshipit-source-id: a58bcb4ba52f3f5d2eeb77b68ee4055d80fbfce2
2021-04-29 08:07:45 -07:00
Alex Hornby
bc85aade21 rust: update to zstd to 0.7.0+zstd.1.4.9
Summary:
Update the zstd crates.

This also patches async-compression crate to point at my fork until upstream PR https://github.com/Nemo157/async-compression/pull/117 to update to zstd 1.4.9 can land.

Reviewed By: jsgf, dtolnay

Differential Revision: D27942174

fbshipit-source-id: 26e604d71417e6910a02ec27142c3a16ea516c2b
2021-04-22 14:34:06 -07:00
Alex Hornby
45f521ddde mononoke: enable default patch.crates-io for internal Cargo.tomls
Reviewed By: quark-zju

Differential Revision: D27915811

fbshipit-source-id: 3f830def66c1c5f0569925c42cc8335ee585e0e7
2021-04-22 10:59:42 -07:00
Stanislau Hlebik
0450243694 mononoke: fix sql query for streaming changelog
Summary:
Previously this query failed because it tried to convert bytes to int, and our
mysql wrapper doesn't support that.
Let's cast it instead

Reviewed By: krallin

Differential Revision: D27736863

fbshipit-source-id: 66a7cb33c0f623614f292511e18eb62e31ea582f
2021-04-13 11:15:00 -07:00
Stanislau Hlebik
fb4c1544b9 mononoke: add update command to streaming changelog
Summary:
This command can be used to update already existing streaming changelog.
It takes a newly cloned changelog and updates the new streaming changelog
chunks in the database.

The biggest difference from "create" command is that we first need to figure
out what's already uploaded to streaming changelog. For that two new methods
were added SqlStreamingChunksFetcher.

Reviewed By: farnz

Differential Revision: D27045386

fbshipit-source-id: 36fc9387f621e1ec8ad3eb4fbb767ab431a9d0bb
2021-03-16 03:29:54 -07:00
Stanislau Hlebik
480a0e9ef7 mononoke: start moving streaming changelog logic to rust
Summary:
Our current straming changelog updater logic is written in python, and it has a
few downsides:
1) It writes directly to manifold, which means it bypasses all the multiplexed
blobstore logic...
2) ...more importantly, we can't write to non-manifold blobstores at all.
3) There are no tests for the streaming changelogs

This diff moves the logic of initial creation of streaming changelog entry to
rust, which should fix the issues mentioned above. I want to highligh that
this implementation only works for the initial creation case i.e. when there are no
entries in the database. Next diffs will add incremental updates functionality.

Reviewed By: krallin

Differential Revision: D27008485

fbshipit-source-id: d9583bb1b98e5c4abea11c0a43c42bc673f8ed48
2021-03-12 14:46:30 -08:00
Stanislau Hlebik
f7e3a55184 mononoke: allow using streaming clone with sqlite
Summary:
Previously it was possible to use streaming clone only with xdb table. This
diff changes it

Reviewed By: farnz

Differential Revision: D27008486

fbshipit-source-id: b8d51832dd62b4343b36c3a7a96b83a327056025
2021-03-12 06:44:00 -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
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
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
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
Thomas Orozco
ae83446c36 mononoke/repo_client: remove 0.1 tokio timeout from streaming clone
Summary:
Like it says in the title. This one was pretty easy to just convert to 0.3
futures so I did so.

Reviewed By: StanislavGlebik

Differential Revision: D26485577

fbshipit-source-id: 76c751c1004288dda1d7b62866979c9228e0ef34
2021-02-19 07:00:52 -08:00
Thomas Orozco
fc48f40f4a mononoke: update futures_ext name in repo_client
Summary: I'd like to use the 0.3 version here so let's get this cleaned up.

Reviewed By: StanislavGlebik

Differential Revision: D26485583

fbshipit-source-id: 1d1ff8e75888e6d874d21195cae7600f171321ac
2021-02-19 07:00:50 -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
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
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
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
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
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
Pavel Aslanov
fffcf5b966 utility to keep streaming clone data warm
Summary: This is streaming clone warmup binary as per https://fb.quip.com/hfuBAdYnzr9M

Reviewed By: StanislavGlebik

Differential Revision: D23347029

fbshipit-source-id: f187a2f3529a7eae5998bab199228bfbe6057e6e
2020-09-01 07:13:33 -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
Simon Farnsworth
b1c85aaf4b Switch Blobstore to new-style futures
Summary:
Eventually, we want everything to be `async`/`await`; as a stepping stone in that direction, switch the remaining lobstore traits to new-style futures.

This just pushes the `.compat()` out to old-style futures, but it makes the move to non-'static lifetimes easier, as all the compile errors will relate to lifetime issues.

Reviewed By: krallin

Differential Revision: D22183228

fbshipit-source-id: 3fe3977f4469626f55cbf5636d17fff905039827
2020-06-26 03:54:42 -07:00
Lukas Piatkowski
7033889eac mononoke/repo_client: make repo_client buildable in OSS
Summary:
There are few related changes included in this diff:
- backsyncer is made public
- stubs for SessionContext::is_quicksand and scuba_ext::ScribeClientImplementation
- mononoke/hgproto is made buildable

Reviewed By: krallin

Differential Revision: D21330608

fbshipit-source-id: bf0a3c6f930cbbab28508e680a8ed7a0f10031e5
2020-05-06 06:11:02 -07:00
Mistral Orhan Jean-Pierre Contrastin
5fe820dd06 Expose ctime from Blobstore::get() in mononoke
Summary:
- Change get return value for `Blobstore` from `BlobstoreBytes` to `BlobstoreGetData` which include `ctime` metadata
- Update the call sites and tests broken due to this change
- Change `ScrubHandler::on_repair` to accept metadata and log ctime
- `Fileblob` and `Manifoldblob` attach the ctime metadata
- Tests for fileblob in `mononoke:blobstore-test` and integration test `test-walker-scrub-blobstore.t`
- Make cachelib based caching use `BlobstoreGetData`

Reviewed By: ahornby

Differential Revision: D21094023

fbshipit-source-id: dc597e888eac2098c0e50d06e80ee180b4f3e069
2020-05-06 00:55:07 -07:00
Mark Thomas
640f272598 migrate from sql_ext::SqlConstructors to sql_construct
Summary:
Migrate the configuration of sql data managers from the old configuration using `sql_ext::SqlConstructors` to the new configuration using `sql_construct::SqlConstruct`.

In the old configuration, sharded filenodes were included in the configuration of remote databases, even when that made no sense:
```
[storage.db.remote]
db_address = "main_database"
sharded_filenodes = { shard_map = "sharded_database", shard_num = 100 }

[storage.blobstore.multiplexed]
queue_db = { remote = {
    db_address = "queue_database",
    sharded_filenodes = { shard_map = "valid_config_but_meaningless", shard_num = 100 }
}
```

This change separates out:
* **DatabaseConfig**, which describes a single local or remote connection to a database, used in configuration like the queue database.
* **MetadataDatabaseConfig**, which describes the multiple databases used for repo metadata.

**MetadataDatabaseConfig** is either:
* **Local**, which is a local sqlite database, the same as for **DatabaseConfig**; or
* **Remote**, which contains:
    * `primary`, the database used for main metadata.
    * `filenodes`, the database used for filenodes, which may be sharded or unsharded.

More fields can be added to **RemoteMetadataDatabaseConfig** when we want to add new databases.

New configuration looks like:
```
[storage.metadata.remote]
primary = { db_address = "main_database" }
filenodes = { sharded = { shard_map = "sharded_database", shard_num = 100 } }

[storage.blobstore.multiplexed]
queue_db = { remote = { db_address = "queue_database" } }
```

The `sql_construct` crate facilitates this by providing the following traits:

* **SqlConstruct** defines the basic rules for construction, and allows construction based on a local sqlite database.
* **SqlShardedConstruct** defines the basic rules for construction based on sharded databases.
* **FbSqlConstruct** and **FbShardedSqlConstruct** allow construction based on unsharded and sharded remote databases on Facebook infra.
* **SqlConstructFromDatabaseConfig** allows construction based on the database defined in **DatabaseConfig**.
* **SqlConstructFromMetadataDatabaseConfig** allows construction based on the appropriate database defined in **MetadataDatabaseConfig**.
* **SqlShardableConstructFromMetadataDatabaseConfig** allows construction based on the appropriate shardable databases defined in **MetadataDatabaseConfig**.

Sql database managers should implement:

* **SqlConstruct** in order to define how to construct an unsharded instance from a single set of `SqlConnections`.
* **SqlShardedConstruct**, if they are shardable, in order to define how to construct a sharded instance.
* If the database is part of the repository metadata database config, either of:
    * **SqlConstructFromMetadataDatabaseConfig** if they are not shardable.  By default they will use the primary metadata database, but this can be overridden by implementing `remote_database_config`.
    * **SqlShardableConstructFromMetadataDatabaseConfig** if they are shardable.  They must implement `remote_database_config` to specify where to get the sharded or unsharded configuration from.

Reviewed By: StanislavGlebik

Differential Revision: D20734883

fbshipit-source-id: bb2f4cb3806edad2bbd54a47558a164e3190c5d1
2020-04-02 05:27:16 -07:00