Summary:
Note: this is a re-land of D44623815, which was was reverted because of a land race with D44626072
In particular this fixes `FlattenUnordered` having a nasty deadlock, but also
some other bugs:
```
# 0.3.28 - 2023-03-30
* Update to syn 2. This raises MSRV of utility crates to 1.56. (#2730, #2733)
* Fix bug in `FlattenUnordered` (#2726, #2728)
# 0.3.27 - 2023-03-11
* Add `TryFlattenUnordered` (#2577, #2590, #2606, #2607)
* Add `AbortHandle::is_aborted` (#2710)
* Add `AbortRegistration::handle` (#2712)
* Make `BiLock` strict-provenance compatible (#2716)
# 0.3.26 - 2023-01-30
* Add `Either::as_pin_mut` and `Either::as_pin_ref` (#2691)
* Add `Shared::ptr_eq` and `Shared::ptr_hash` (#2691)
* Implement `FusedStream` for `Buffered` (#2676)
* Implement `FusedStream` for all streams in `ReadyChunks` (#2693)
* Fix bug in `FuturesOrdered::push_front` (#2664)
* Remove `Fut::Output: Clone` bounds from some `Shared` methods (#2662)
* Remove `T: Debug` bounds from `Debug` implementations of `mpsc` and `oneshot` types (#2666, #2667)
# 0.3.25 - 2022-10-20
* Fix soundness issue in `join!` and `try_join!` macros (#2649)
* Implement `Clone` for `sink::Drain` (#2650)
# 0.3.24 - 2022-08-29
* Fix incorrect termination of `select_with_strategy` streams (#2635)
# 0.3.23 - 2022-08-14
* Work around MSRV increase due to a cargo bug.
```
Reviewed By: zertosh
Differential Revision: D44632588
fbshipit-source-id: bdd87cb02b3aef63a65b1f9b852579225adfedbd
Summary:
In Rust 1.68.0, the `useless_conversion` clippy lint [got smarter](https://github.com/rust-lang/rust-clippy/pull/10020).
Fix all instances of that lint in Mononoke.
Reviewed By: markbt
Differential Revision: D44378069
fbshipit-source-id: acfd6c77c6a400830c378b4040661323e7232441
Summary: Collect construction of cache handlers into a single cache handler factory. This moves code that is scattered across the codebase into a single cache handler constructor. We will use this to better control when caches are enabled and which caches are in use.
Reviewed By: RajivTS
Differential Revision: D43410855
fbshipit-source-id: cb38ec7a03673fcbdb7e3e381e7bae4fe9c0d626
Summary: The `newfilenodes` crate implements its own no-op and mock memcache handler. Switch to using the memcache handler's versions.
Differential Revision: D43410857
fbshipit-source-id: adf973924fa70c33794eb02370a19a14317d4960
Summary: The `newfilenodes` crate implements its own mock cache, rather than using the common one via the cachelib handler. Change to using the common one.
Differential Revision: D43410858
fbshipit-source-id: 915255a67dc545e7678a9283fb81ddbe1c820b55
Summary: The `newfilenodes` crate has wrappers around `FilenodeInfo` and `FilenodeRange`, however these are no longer necessary and can be removed.
Differential Revision: D43410859
fbshipit-source-id: 08171581f6fdda3b711aa0c04996c90231328710
Summary:
The `FilenodeRangeResult` type conflates two concepts: a range being too large, and the result of filenodes lookups being unavailable because filenodes are disabled.
Replace it with `FilenodeResult<FilenodeRange>`, keeping the notion of whether or not filenodes are disabled to `FilenodeResult`, and handling this concept always through that.
The type was also pointlessly generic. It almost always contained `Vec<FilenodeInfo>`, except in a couple of places where that is easily removed, so remove the generic parameter.
Differential Revision: D43410852
fbshipit-source-id: 6be34555b8b56b72d2ea4b071fb03c64648e8406
Summary: Currently fetching a tunable (except by repo ones) returns the default value when the tunable is not set. This can be error prune as it doesn't enforce handling the not set case and makes it awkward to set default values, it's also not consistent with the by repo tunables which return an option instead. This diff changes tunable fetching to make it return an option, and adds a .unwrap_or_default() at every callsite to maintain the current behaviour.
Reviewed By: yancouto
Differential Revision: D43123305
fbshipit-source-id: 32cb69ba78d52bc22979250c6e16edd1800cd1de
Summary:
On the rest of this stack, I plan to also add caching for queries, not only retrying. So let's name this more appropriately.
This macro will be our generic layer on top of SQL that we can use to add generic features for all our SQL queries, in some way similar to how we add a bunch of stuff on top of Manifold/blobstores.
Reviewed By: RajivTS
Differential Revision:
D40553047
LaMa Project: L1122763
fbshipit-source-id: 96abc7f477b82db9018fbf7b512b020aeb0e282d
Summary: Make it not necessary to implement both variants since non-sharded can be derived from sharded (which was what newfilenodes was doing manually).
Reviewed By: liubov-dmitrieva
Differential Revision: D40637482
fbshipit-source-id: 1e3495a9792e6e253e46a93179bb34dd6e00055b
Summary: We always have at least one connection, so let's guarantee it on compile time. Some places did manual checks on runtime, now that's not necessary anymore!
Reviewed By: liubov-dmitrieva
Differential Revision: D40637483
fbshipit-source-id: 057f6464a016b6c2fa196e6b83db6e7cbc05756d
Summary:
Context: See D40105656
With the rest of the stack adding all necessary features to the `queries_with_retry!` macro, we can now move all use cases from Mononoke to use it!
Next steps:
- Retry more SQL error codes
- Maybe customize retry attempts/delay
Reviewed By: mitrandir77
Differential Revision: D40181860
fbshipit-source-id: 7a1b67d9af26efb6410b125e9fdfc13d874d40f0
Summary:
Context: See D40105656
This diff makes the `query_with_retries!` macro actually try to retry errors. To do that it uses our `retry` library, for which I added new features in D40105659.
For now, this only retries on errors 1914-1916, see [error descriptions](https://www.internalfb.com/intern/sv/DBCLIENT_MYSQL_WARNING_TEXT/?query=DBCLIENT_MYSQL_WARNING_TEXT). This happens on admission control failures, which should be ok to retry a couple times.
Retries wait a long time, 10-15s, but that's good to avoid overwhelming SQL and making things worse.
Reviewed By: RajivTS
Differential Revision: D40105655
fbshipit-source-id: 14cbf223d9779fa01c07543bef1ad3fca8590463
Summary: This is the latest version number [on crates](https://crates.io/crates/fbinit_macros/0.1.2).
Reviewed By: jsgf
Differential Revision: D40536148
fbshipit-source-id: 86fc58f09cdb716e2aed8571a8ddee65f5dfc844
Summary: This release makes async trait methods work better with rust-analyzer's "go to definition" and other IDE functionality.
Reviewed By: zertosh
Differential Revision: D40532047
fbshipit-source-id: 1871d1819ebe1aab0846b0135f051c45e6e8821b
Summary: D39418421 (a1593af094) prematurely upgraded `thiserror`. Various projects in fbcode use nightly features including std::backtrace but the current fbcode Rust toolchain is 1.63.0, in which the backtrace API is different from the API of the latest nightlies.
Reviewed By: quark-zju
Differential Revision: D39562441
fbshipit-source-id: d1f8a993ec776cf82b1736b242bd4466def21230
Summary:
I ran `arc clippy-check //eden/mononoke/...` and the handled the type of errors like in the title with clippy's suggestion.
I didn't use a global regex over files. I only made changes in lines and files that clippy complained about.
Reviewed By: yancouto
Differential Revision: D38246419
fbshipit-source-id: a474de9de28363ff3f04904f8a488e35b8eabce1
Summary:
Context: I am upgrading rustfmt in D35234535.
---
This diff contains all the formatting changes which are idempotent between the old and the new version of rustfmt. It's generated by formatting with the new rustfmt, then formatting immediately again with the old rustfmt. If there are any big changes in here, that's code that old rustfmt used to crash on but new rustfmt handles correctly.
Separating out this part of the changes prior to flipping the rustfmt version switch globally allows the amount of code that needs to be landed atomically to be smaller, since this diff is independent and can land at any point before the rest of the stack.
---
Reviewed By: zertosh
Differential Revision: D35234531
fbshipit-source-id: 2ab036e03d602f6385992283c2b04381550ebae7
Summary: I'm going to use TTLs in Mutable Renames caching. Make it work
Reviewed By: mitrandir77
Differential Revision: D34527803
fbshipit-source-id: 3b53ee4e89153814981dcb68b838ee86f5ac7388
Summary:
The published `terminfo` crate has a WTFPL license which is forbidden from being used by Meta.
{F687594009}
However the WTFPL allows forking and relicensing, so I've gone ahead and relicensed the same code as dual MIT OR Apache 2.0 for fbsource to use. We can patch the properly licensed code in place of all transitive dependencies on the `terminfo` crate, as they have the same public Rust API.
The relevant changes: 9b4e1c6aae
Reviewed By: metajack
Differential Revision: D33190944
fbshipit-source-id: 0a9002b8799b5ceeaca3c20a211f15beec5a407f
Summary:
You can't run Autocargo right now, it fails with:
```
Error: File CargoTomlPath { file: PathInFbcode("configerator/structs/data_access_policies/upf/eval/Cargo.toml"), dir: PathInFbcode("configerator/structs/data_access_policies/upf/eval") } is covered by both ctp and pxl projects
```
This is affecting me (on Buck2) since some of our dependencies use Autocargo
for their Cargo.tomls and those are now missing some dependencies (notably,
`below` needs `nix`). This also affects people trying to vendor crates:
https://fb.workplace.com/groups/rust.language/permalink/7625318880849994/https://fb.workplace.com/groups/rust.language/permalink/7577471608968055/
This diff fixes it, and regenerates Cargo.tomls as a result.
Note: I'm not sure exactly what "pxl" is, but it seems to be owned by the team working on data access so that's a better home for that crate than ctp.
Reviewed By: ahornby
Differential Revision: D33428045
fbshipit-source-id: f3feab3ae04069672040423c145c69a58445ef96
Summary: 0.27 onwards has support for large tuples so can remove patch
Reviewed By: farnz
Differential Revision: D33100620
fbshipit-source-id: 68348b16113043826dfb253acc64048d01bba7d1
Summary: The change is in upstream slog-syslog release 0.13.0 so we can remove the patch
Reviewed By: jsgf
Differential Revision: D33099611
fbshipit-source-id: a30b89179d18cbd7b3d9dbe6ac8a461b143b01c0