Commit Graph

12258 Commits

Author SHA1 Message Date
Zeyi (Rice) Fan
5704ad51f6 edenfs-client: switch to tokio 1.x
Reviewed By: andll

Differential Revision: D30704344

fbshipit-source-id: c09f8dad1bba78329b0b97bff85c08b19fe1e0f4
2021-09-07 13:31:02 -07:00
Zeyi (Rice) Fan
8616cd90b1 switch to new fbthrift_ext
Reviewed By: xavierd

Differential Revision: D30703434

fbshipit-source-id: 74c1c577a330913e411b58d3a128a28cfed621a2
2021-09-07 13:31:02 -07:00
Robert Grosse
ad2731099b Remove checkcodeglobpats from test runner
Summary:
I'm not sure what this was for, but it doesn't seem necessary, and removing it simplifies the code a lot, enabling us to make other improvements later.

This is an alternate, less ambitious version of https://www.internalfb.com/diff/D30620443.

Reviewed By: DurhamG

Differential Revision: D30674016

fbshipit-source-id: 17dee50b82c78d31e45492dc23826d8c3fe838e5
2021-09-07 11:43:18 -07:00
Durham Goode
443be3727d tests: condition test-advice-header.t on buck tests
Summary:
This test relies on Mononoke, so it fails for make local build/test,
which breaks hgbuild. Let's only enable it for buck tests.

Reviewed By: quark-zju

Differential Revision: D30782799

fbshipit-source-id: 4b543beeb248715702b9072d84cdb8211dcd4a9b
2021-09-07 11:37:56 -07:00
Mateusz Kwapich
27830555a1 allow recreating targets without removing the configs
Summary:
Currently there are two things preventing us from running add_sync_target
on existing target:
 * already existing bookmark
 * already existing config

Both need to be deleted to create new target. This diff removes the second
one to simplify code and make it easier to recreate the target (it's easy to
forget about manually removing the config as they otherwise don't need
human interventions).

Reviewed By: StanislavGlebik

Differential Revision: D30767613

fbshipit-source-id: f951c0e1ef9bde69d805dc911331fcdb220123f2
2021-09-07 11:33:18 -07:00
Durham Goode
f26bb33cd1 graft: remove large changelog scan
Summary:
This logic scans all the ancestors of the working copy that are not
ancestor of the graft source and checks their extras. With lazy changelog this
is extremely expensive. Let's just drop this logic.

Reviewed By: quark-zju

Differential Revision: D30734017

fbshipit-source-id: ca5606cea08efe10f29847970379d6bff4eb4aee
2021-09-07 11:00:56 -07:00
Mark Juggurnauth-Thomas
26cc4c4471 filenodes: store repo_id and update to new futures
Summary:
Update the `Filenodes` trait so that it doesn't require the repository id to be
passed in every method invocation.  In practice a filenodes instance can only
be used for a single repo, so it is safer for the implementation to store the
repository id.

At the same time, update the trait to use new futures and async-trait.

Reviewed By: yancouto

Differential Revision: D30729630

fbshipit-source-id: a1f80a299d9b0a99ddb267d1f7093f27cf21f1af
2021-09-07 07:44:28 -07:00
Mark Juggurnauth-Thomas
8e1f8affad mercurial_derived_data: make derivation not depend on BlobRepo
Summary:
Make the derivation process for mercurial changesets and manifests not depend
on `BlobRepo`, but instead use the repo attribute (`RepoBlobstore`) directly.
This will allow us to migrate to using `DerivedDataManager` in preparation
for removing `BlobRepo` from derivation entirely.

Reviewed By: yancouto

Differential Revision: D30729629

fbshipit-source-id: cf478ffb97a919c78c7e6e574580218539eb0fdf
2021-09-07 07:44:28 -07:00
Mark Juggurnauth-Thomas
5de3581a10 blame/deleted_files_manifest: make derivation not depend on BlobRepo
Summary:
Make the derivation process for blame and deleted files manifest not depend
on `BlobRepo`, but instead use the repo attribute (`RepoBlobstore`) directly.
This will allow us to migrate to using `DerivedDataManager` in preparation
for removing `BlobRepo` from derivation entirely.

A `BlobRepo` reference is still needed at the moment for derivation of the
unodes that these depend on.  That will be removed when `DerivedDataManager`
takes over co-ordination of derivation.

Reviewed By: yancouto

Differential Revision: D30729628

fbshipit-source-id: 4504abbe63c9bf036d69cb4341c75b13061fae18
2021-09-07 07:44:27 -07:00
Mark Juggurnauth-Thomas
49a8e9b323 fsnodes/skeleton_manifest: make derivation not depend on BlobRepo
Summary:
Make the derivation process for fsnodes and skeleton manifests not depend on
`BlobRepo`, but instead take the `DerivedDataManager` from the `BlobRepo` and
use that instead.  This is in preparation for removing `BlobRepo` from
derivation entirely.

Reviewed By: yancouto

Differential Revision: D30301855

fbshipit-source-id: a2ed1639526aad9ddbe8429988043f0499f7629c
2021-09-07 07:44:27 -07:00
Mark Juggurnauth-Thomas
7304cc49d3 unodes: make derivation not depend on BlobRepo
Summary:
Make the derivation process for unodes not depend on `BlobRepo`, but instead
take the `DerivedDataManager` from the `BlobRepo` and use that instead.  This
is in preparation for removing `BlobRepo` from derivation entirely.

Reviewed By: yancouto

Differential Revision: D30300408

fbshipit-source-id: c35e9e21366de74338f453aaf6be476e7305556d
2021-09-07 07:44:27 -07:00
Mark Juggurnauth-Thomas
81364c16e1 dangerous_override: override blobstore in derived data manager
Summary:
The derived data manager also has a reference to the repo blobstore.  This must
also be overridden when we override the blobstore.

Reviewed By: yancouto

Differential Revision: D30738354

fbshipit-source-id: b0e16ef810c5244cd056a3c9e5b9ceaaddb5ecea
2021-09-07 07:44:27 -07:00
Liubov Dmitrieva
4ad0258a94 modernise tests (removing disabling treemanifest)
Summary:
modernise tests (removing disabling treemanifest)

treemanifest is the default now, so it shouldn't be disabled unless absolutely necessary.

Also, if we would like to switch some of the tests to Mononoke, it shouldn't be disabled.

Only two tests left with it in commitcloud. Those two a bit harder to fix.

```
devvm1006.cln0 {emoji:1f440}   ~/fbsource/fbcode/eden/scm/tests
 [139] → rg 'disable treemanifest' | grep cloud
test-commitcloud-backup-bundlestore-short-hash.t:  $ disable treemanifest
test-commitcloud-backup.t:  $ disable treemanifest
```

Reviewed By: kulshrax

Differential Revision: D30278754

fbshipit-source-id: cf450084669c2b6b361cd34952bf986e913de1a8
2021-09-07 04:54:28 -07:00
CodemodService Bot
34fef0116f Daily common/rust/cargo_from_buck/bin/autocargo
Reviewed By: krallin

Differential Revision: D30771609

fbshipit-source-id: efd5474b1f189df318ef6f9323a66c18593f7323
2021-09-07 01:43:29 -07:00
Michael Samoylenko
e156bbd676 Allow more read-connection-types when creating SqlConnections
Summary:
I want to use `ReplicaFirst` read connection type since `ReplicaOnly` is a bit too restrictive.

We've had 2 MySQL SEVs this year when all the replicas went down crashing our services despite the primary instance working normally.
There was also a case when I've deleted too much rows at once and all replicas went down due to replication lag (I know better now)

RFC
- Yay or Nay?
- Should I expand `ReadConnectionType` to mirror all options of `InstanceRequirement`?
- Perhaps it's worth moving it into the `common/rust/shed/sql` crate?

I kept cleaning up all the usages out of this diff to keep the changes minimal for RFC

Differential Revision: D30574326

fbshipit-source-id: 1462b238305d47557372afe7763096c53df55f10
2021-09-06 14:40:47 -07:00
Stanislau Hlebik
4f8f705ae1 mononoke: allow using prefetched commits in segmented_changelog_seeder
Summary:
Segmented changelog seeder spends a significant chunk of time fetching
changesets. By saving them to file we can make reseeding significantly faster.

Reviewed By: farnz

Differential Revision: D30765374

fbshipit-source-id: 0e6adf12e334ad70486145173ae87c810880988a
2021-09-06 11:32:17 -07:00
Stanislau Hlebik
6eec03046b mononoke: introduce dump_public_changeset_entries
Summary:
In backfill_derived_data we had a way to prefetch a lot of commits at once, so
that backfill_derived_data doesn't have to do it on every startup.

I'd like to use the same functionality in segmented changelog seeder, so let's
move it to the separate binary.

Reviewed By: mitrandir77, farnz

Differential Revision: D30765375

fbshipit-source-id: f6930965b270cbaae95c3ac4390b3d367eaab338
2021-09-06 11:11:44 -07:00
Jan Mazur
5268cedad5 use X-FB-Validated-X2PAuth-Advice header when APE provides it
Summary: Let's print advice when request fails.

Reviewed By: krallin

Differential Revision: D30702879

fbshipit-source-id: 6fb907e6c57dc8383151116619ca894b9b3ea5bb
2021-09-06 08:42:36 -07:00
Meyer Jacobs
997d38fa06 scmstore: make ContentDataStore implementation local-only
Summary: ContentDataStore is meant to be implemented local-only. Fetching remotely seems to cause the issue observed in https://fb.workplace.com/groups/scm/permalink/4192991577417097/ (though I'm not quite sure why yet)

Reviewed By: kmancini

Differential Revision: D30744817

fbshipit-source-id: 68875a4912905f9b8f88cf4be804c5d988c3905d
2021-09-02 19:29:12 -07:00
Zeyi (Rice) Fan
934975a668 generate Cargo.toml - take 2
Summary: Original commit changeset: 025ea455c51b

Differential Revision: D30740404

fbshipit-source-id: 04c4c2b70105276d586c6aafe1e681549237071a
2021-09-02 17:00:33 -07:00
Genevieve Helsel
62fe933e4e disallow infinite recursion in redirect unmount
Summary: If the bind unmount fails in in the privhelper, theres a possibility of infinite recursion in this method. This adds a flag to indicate if we've tried the bind unmount before.

Differential Revision: D30732857

fbshipit-source-id: 6ee887d211977ee94c8e66531287f076a7e61a2c
2021-09-02 15:00:10 -07:00
Xavier Deguillard
cfd3dd4e0b apfs: retry apfs addVolume
Summary:
It sounds like macOS has a bug where an APFS subvolume may be falsely created.
Let's retry with the hope that the retry will succeed.

Differential Revision: D30657706

fbshipit-source-id: 60bc74f789a0d34b2be53073103b95474a9a18e6
2021-09-02 14:19:17 -07:00
Stanislau Hlebik
d08bf2b5c7 Back out "revlogindex: implement octopus merge support"
Summary:
Original commit changeset: d5aa2f18a02f

See https://www.internalfb.com/intern/testinfra/diagnostics/4503599694158597.844424967049391.1630548327/

For some reason these tests didn't run on original diff, we are still figuring
out why

Reviewed By: mitrandir77

Differential Revision: D30732364

fbshipit-source-id: 9f213766e7c440bb7ca131a127f5089698b6162e
2021-09-02 13:24:31 -07:00
Yipu Miao
6c5db887dd Regenerate rust file for eden
Summary: This is regenerated rust lib using the latest compiler

Reviewed By: krallin

Differential Revision: D30720130

fbshipit-source-id: 3d3389ec8504568fc356dda1577e1f7801cb7e96
2021-09-02 13:16:41 -07:00
Jeremy Fitzhardinge
e5e2c39f20 third-party/rust: update strum
Summary:
~~Also enable the `derive` feature so it isn't necessary to separately
depend on `strum_macros`.~~
This turns out to break a lot.

Reviewed By: dtolnay

Differential Revision: D30709976

fbshipit-source-id: a9181070b8d7a8489eebc9e94fa24f334cd383d5
2021-09-02 11:26:28 -07:00
Arun Kulshreshtha
1125a46864 edenapi: use Arc<Inner> pattern in Client
Summary: Move `edenapi::Client`'s internals to an `Arc<ClientInner>`. This makes the client `Clone`-able while sharing the same underlying state. This is particularly useful for scenarios where `Future`s or `Stream`s returned by the client need to hold a reference to the client itself (e.g., in order to issue subsequent HTTP requests).

Differential Revision: D30729803

fbshipit-source-id: c97e700c9e3702f818eb86ded1a46f920a55cfd1
2021-09-02 11:26:28 -07:00
Arun Kulshreshtha
bb090a45f5 edenapi: rename Fetch to Response
Summary: The `Fetch<T>` type has basically turned into the canonical type EdenAPI for all EdenAPI responses. Originally, this type was merely an implementation detail (essentially just a named tuple returned by the `fetch()` method, hence the name), but given its prominence in the API, the name is confusing. As we add more functionality and usage to this type, it makes sense to give it a more suitable name.

Differential Revision: D30730573

fbshipit-source-id: 7acd2a86b55bdfc186bd9110f6a99333df9d29d3
2021-09-02 11:26:28 -07:00
Arun Kulshreshtha
0ba2df7e1d edenapi: use more descriptive names for private methods
Summary:
Some of the method names used internally by `edenapi::Client` are a bit terse.

This was OK back when there were only handful of private methods which were used by a small number of API methods that were doing more or less the same thing (sending concurrent POST requests for a set of keys).

Today, there are way more API methods, most of which set up requests in different ways. As such, it makes sense to give these older private methods more explicit and descriptive names so that their intended usage is clear.

Differential Revision: D30729802

fbshipit-source-id: 5adfd8e7ba153df8c036e4dbb312f95b9b1d7335
2021-09-02 11:26:28 -07:00
Meyer Jacobs
4dfc576ea0 scmstore: forward repack calls for trees in addition to files
Summary: Allow repack to be called on treescmstore via the ContentStore shim like filescmstore is already supported.

Reviewed By: andll

Differential Revision: D30687145

fbshipit-source-id: 7559af08e98cfb22da6dbf45dc1746312b1e6d28
2021-09-02 11:26:28 -07:00
Meyer Jacobs
705d9b27c3 scmstore: implement LegacyStore for TreeStore
Summary:
Provide a basic implementation of the LegacyStore trait for TreeStore to allow repack calls to be forwarded to the fallback ContentStore for trees.

Repack will be removed entirely before contentstore is deleted, and the `unimplemented` methods are never called, so this should be safe.

Reviewed By: andll

Differential Revision: D30687136

fbshipit-source-id: d238d70fbf6be5c25c2e1c9610430a53d031bf3b
2021-09-02 11:26:27 -07:00
Zhengchao Liu
8fe7e16f7c log FS trace events with HiveLogger
Summary: This diff lets `FsEventLogger` send the sample through `HiveLogger`

Reviewed By: genevievehelsel

Differential Revision: D30305695

fbshipit-source-id: 88613dc6c74710cc0f33c44ce4e36c35c58e6406
2021-09-02 10:32:03 -07:00
Stanislau Hlebik
7d4c7fab26 mononoke: log changeset id when inserting mapping
Summary: Looks like it was lost during the last refactoring, let's add it back.

Reviewed By: farnz

Differential Revision: D30728456

fbshipit-source-id: 20c638b3c5a8664f2367f871cd29a793fd897de3
2021-09-02 09:28:39 -07:00
Arun Kulshreshtha
b9a95f33a3 http-client: implement seek() for Buffered and Streaming handlers
Summary:
Some users have reported errors of the form:
```
error.HttpError: [65] Send failed since rewinding of the data stream failed (seek callback returned error 2)
```

These are caused by the fact that we're passing the HTTP request body directly to libcurl in memory rather than via a file, but we haven't implemented the `seek()` method necessary for libcurl to retransmit the data if needed. This diff implements the method.

Reviewed By: DurhamG

Differential Revision: D30654625

fbshipit-source-id: f21a067ad02ee540b86cf2e6eff2c6f08f45a3e4
2021-09-02 08:26:02 -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
Stanislau Hlebik
60d6172ea0 mononoke: make it possible to force reload segmented changelog
Summary:
At the moment when segmented changelog is updated and/or reseeded mononoke
servers can pick it up only once an hour (this is a current reload schedule)
or when mononoke server is restarted. However during production issues (see
attached task for an example) it would be great to have a way to force all
servers to reload segmented changelog.

This diff makes it possible to do so with a tunable. Once tunable changes its
value then monononoke servers almost immediately (subject to jitter) reload it.

This implementation adds a special loop that polls tunables value and reloads
if it changes. Note that in theory it could avoid polling and watch for configerator
changes instead, but it would be harder to implement and I decided that it's
not worth it.

Reviewed By: farnz

Differential Revision: D30725095

fbshipit-source-id: da90ea06715c4b763d0de61e5899dfda8ffe2067
2021-09-02 04:27:33 -07:00
Meyer Jacobs
9cdd1c0e96 scmstore: chunk prefetch calls to avoid OOM
Summary:
Previously, extremely large prefetch calls could cause an OOM if the requested files were all fetched remotely from EdenApi, in which case the memory would remain in use until the entire batch had been fetched.

With this change, at most 1000 EdenApi files will be held in memory at once (or 10GB of memory). This is a stop-gap solution, a better approach would be to avoid storing all EdenApi files in memory after a certain amount, or allow the batch fetching implementation to understand we're only prefetching, and thus avoid reading anything back from disk or storing EdenApi files in memory unnecessarily.

Reviewed By: andll

Differential Revision: D30686054

fbshipit-source-id: 022e353760c515961a8956f7958b43f429143971
2021-09-02 03:31:04 -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
Yipu Miao
d7afd687ea Rename fbthrift_ext to fbthrift_ext-02
Summary: Keep two versions of fbthrift_ext that one with tokio-0.2 and the other with tokio-1.x. This diff is just renaming.

Reviewed By: dtolnay

Differential Revision: D30558441

fbshipit-source-id: bfe7e96b95529f2745f635190df5118a0cb44014
2021-09-01 18:28:53 -07:00
Xavier Deguillard
69159f20d5 store: split the blob/tree/prefetch queue
Summary:
Having the same queue for all three makes the dequeue code overly complicated
as it needs to keep track of the kind of request that needs to be dequeued.
Incidently, the previous code had a bug where request in "putback" would be
requeued at the end of the queue, even though there were at the beginning of it
if they all had the same priorities.

This is theory should also improve the dequeue performance when the queue has a
mix of blobs/tree requests, but I haven't measured.

Reviewed By: genevievehelsel

Differential Revision: D30560490

fbshipit-source-id: b27e5429105c07e5f9eab482c12e5699ca3413f7
2021-09-01 14:29:27 -07:00
Xavier Deguillard
54de90fa1b service: background actual prefetch of files
Summary:
Since the background condition is before the actual prefetching of files,
specifying the background option would just glob files but not prefetch them
which is equivalent to prefetching all the trees.

Reviewed By: genevievehelsel

Differential Revision: D30618753

fbshipit-source-id: 5533b1c78d614342ac3341ce033795be3850750a
2021-09-01 14:29:27 -07:00
Meyer Jacobs
edad2caf13 scmstore: fix warnings on master
Summary:
It looks like a few scmstore changes landed with warnings (probably fixed higher up in the tree unification stack).

This change fixes those warnings.

Differential Revision: D30686092

fbshipit-source-id: d80625dea64f35683f815b58c83a3e5bb7cbdfa8
2021-09-01 11:26:24 -07:00
Durham Goode
81d2d0f010 sparse: fix sparse profile refreshes during hg commit
Summary:
When we remove a file from a sparse profile and commit the profile, it
should delete the file on disk. There's a bug where it doesn't actually delete
the file. This fixes it by passing the correct commit parents to the refresh
function.

Reviewed By: andll

Differential Revision: D30683677

fbshipit-source-id: 7f012faa99975d8270209f2962e7f9236890daed
2021-09-01 10:27:30 -07:00
Jun Wu
58ab76f9f0 dag: avoid excessive remote lookup during id reassignment
Summary:
Use `populate_missing_vertexes_for_add_heads` (added by D27630093 (f138b012e9)) to avoid
excessive lookups for non-master ids that remain in non-master.  The function
was used in two other `flush` cases, but missed the id reassignment case.  It
works basically by using the "discovery" logic to quickly rule out what's
missing and what's present (ex. if a root is missing in the server graph, then
all descendants of the root is missing).

Reviewed By: andll

Differential Revision: D30700451

fbshipit-source-id: 1f1cd88399dbffd4af75083fef1f3e363a5c60fe
2021-09-01 10:27:30 -07:00
Jun Wu
5baa4c5f51 dag: add test case to demonstrate excessive remote lookup during id reassignment
Summary: During reassigning non-master ids, it might trigger too many remote lookups.

Reviewed By: StanislavGlebik

Differential Revision: D30700452

fbshipit-source-id: 2483335e466c3de8a362f7b6a15fc4ba9e2693be
2021-09-01 10:27:30 -07:00
Jun Wu
7eb11cb392 revlogindex: implement octopus merge support
Summary:
Support octopus merge defined in the following format:

- The revlog flag has `1 << 12` set.
- Extra `stepparents` is set to `hexnode1,hexnode2,...` format.

This is mainly used to support revlog from stream clone.

Reviewed By: StanislavGlebik

Differential Revision: D30686450

fbshipit-source-id: d5aa2f18a02f5f0d7aa033210fb4f79b729c0d26
2021-09-01 09:25:33 -07:00
Jun Wu
b13579fdf9 revlogindex: extend ParentRevs to support more than 2 parents
Summary:
Extend the struct so we can support more than 2 parents.

The size of the sturct is now 16 bytes, from 8 bytes. This might have some
performance overhead.

Not using `Box<[u8]>` because that will make the struct 24 bytes.

Reviewed By: StanislavGlebik

Differential Revision: D30686451

fbshipit-source-id: c0f8d0472c7e578f34d771dacecffc91585650c3
2021-09-01 09:25:33 -07:00
Jun Wu
260c97cb09 dag: avoid remote lookup in one more case
Summary:
In `vertex_id_with_max_group(name, group)`, if `group` is master and the `name`
exists in the non-master group, then there is no need to lookup remotely because
a same name (vertex) cannot be present in both master and non-master group. In
that case, just return that the `name` does not exist in the master group.

Reviewed By: StanislavGlebik

Differential Revision: D30699215

fbshipit-source-id: 5170abe719aa7cc31533912e18bc0e21f133e1f4
2021-09-01 09:25:33 -07:00
Jun Wu
c713ce098b dag: add test of suboptimal flush reassignment with lazy graph
Summary:
Added a test about excessive remote lookups when flush() reassigns vertexes
from non-master to master.

Reviewed By: StanislavGlebik

Differential Revision: D30699214

fbshipit-source-id: 0547707764855ab9a563178740612b54df4a5fc9
2021-09-01 09:25:33 -07:00
Jun Wu
77b3a82755 dag: add more tracing logs
Summary: They are used to narrow down issues related to S242328.

Reviewed By: StanislavGlebik

Differential Revision: D30699216

fbshipit-source-id: 28f4f0bfadadb2dea5510878168c2d7b47a8641c
2021-09-01 09:25:33 -07:00
Arun Kulshreshtha
550ee2eafa http-client: add RequestInfo struct
Summary: Split out the request ID, URL, and HTTP method from `RequestContext` into a new `RequestInfo` struct, which can be cheaply cloned and included in the response returned to the caller. This enables the caller to correlate requests and responses, which is useful when working with many concurrent requests.

Reviewed By: DurhamG

Differential Revision: D30650365

fbshipit-source-id: 68efedcf852c91387450443ebe46062809633f10
2021-08-31 22:29:39 -07:00
Jun Wu
095232f7a8 pydag: export CheckIntegrity methods to Python
Summary:
Make it possible to call the CheckIntegrity APIs from Python such as:

  In [1]: cl.inner.checkuniversalids()
  Out[1]: []

  In [2]: cl.inner.checksegments()
  Out[2]: []

  In [3]: cl.inner.checkisomorphicgraph(cl.inner, cl.dageval(lambda: heads(mastergroup())))
  # take a while
  Out[3]: []

Reviewed By: andll

Differential Revision: D30682536

fbshipit-source-id: 23f280bf261def3d20d5f7dc15a48c2fc2d79d77
2021-08-31 21:26:47 -07:00
Jun Wu
41ef5198f5 hgcommits: delegate CheckIntegrity to inner structs
Summary: Expose CheckIntegrity features from segmented changelog.

Reviewed By: andll

Differential Revision: D30682538

fbshipit-source-id: 382c50719f7176f299c15d16ddaae3783cbae265
2021-08-31 21:26:47 -07:00
Jun Wu
4d4afdd72a dag: add delegate support for CheckIntegrity
Summary: This makes other crates easier to implement CheckIntegrity.

Reviewed By: andll

Differential Revision: D30682540

fbshipit-source-id: 4333f37fa7bafe55a8bee9f149b2f23a463c51af
2021-08-31 21:26:46 -07:00
Jun Wu
71a676472c revlogindex: impl dummy integrity checks for revlog
Summary:
Makes the revlog index provides dummy graph integrity checks so it can
be used as a generic object in the Python bindings.

Reviewed By: andll

Differential Revision: D30682542

fbshipit-source-id: 25c6e8640de46188d7bf45a927e11e0779a8ad40
2021-08-31 21:26:46 -07:00
Jun Wu
5bcfb8cda0 dag: impl check_isomorphic_graph for NameDag
Summary: Make it possible to check a graph against a reference graph.

Reviewed By: andll

Differential Revision: D30682539

fbshipit-source-id: 57db952dcda5656ff6000e9961448c9b64afbaf0
2021-08-31 21:26:46 -07:00
Jun Wu
2cc0389e8b dag: add static lifetime bound
Summary: Required to make the upcoming changes compile.

Reviewed By: andll

Differential Revision: D30682541

fbshipit-source-id: 3ed4cf4718a906638cba2ab4efce2e3ea5f11fee
2021-08-31 21:26:46 -07:00
Jun Wu
08efd9d167 dag: impl check_segments for NameDag
Summary: Make it possible to check segment integrity.

Reviewed By: andll

Differential Revision: D30644243

fbshipit-source-id: 24bb0c8c8c9394d688e3e9320e59268bc2a4ed3f
2021-08-31 21:26:46 -07:00
Jun Wu
fe0562eaec dag: impl check_universal_ids for NameDag
Summary: Make it possible to check universal ids externally.

Reviewed By: andll

Differential Revision: D30644242

fbshipit-source-id: f312ff59dbdf68e57c5249d57c5d44da0b10e398
2021-08-31 21:26:46 -07:00
Jun Wu
28721b23e3 dag: impl blank integrity check for NameDag
Summary: Blank code for implementing integrity check for NameDag.

Reviewed By: andll

Differential Revision: D30644245

fbshipit-source-id: 22b030893dda0f0ac4c1b3707e39a520b1f6e718
2021-08-31 21:26:46 -07:00
Jun Wu
91195dcb76 dag: define graph integrity check functions
Summary: This will be used to verify graph integrity later.

Reviewed By: andll

Differential Revision: D30644244

fbshipit-source-id: 0d22b70121da37c411adf17200a6c752fefa80ad
2021-08-31 21:26:46 -07:00
Genevieve Helsel
f90a988fb2 use HiveLogger in EdenLogviewWriter
Differential Revision: D29568132

fbshipit-source-id: a1ef159bfbb5ebacb50274ab68a1585a684e53c9
2021-08-31 17:28:23 -07:00
Zeyi (Rice) Fan
949f565aab Back out "generate Cargo.toml"
Reviewed By: genevievehelsel

Differential Revision: D30679584

fbshipit-source-id: 025ea455c51b5a485cc61abf405e7c06380093fd
2021-08-31 15:25:20 -07:00
Zeyi (Rice) Fan
79517ec184 generate Cargo.toml
Differential Revision: D30670348

fbshipit-source-id: 74655c060cdc584c63e334a22e169705878329b7
2021-08-31 12:28:09 -07:00
Simon Farnsworth
4d12f542a3 All rules for a treematcher must be typed
Summary: This breaks all use of `hg sparse`, because `.hg*` cannot be matched.

Reviewed By: mitrandir77

Differential Revision: D30666349

fbshipit-source-id: c06d1b798a57490f2e5560f178a2839ae5425146
2021-08-31 09:39:31 -07:00
Zeyi (Rice) Fan
0d53c14f66 temporarily remove existing Cargo.toml
Differential Revision: D30670349

fbshipit-source-id: 872f847a01ac6e2ff5dd21c5bd7f4a7aa563a494
2021-08-31 09:34:46 -07:00
Alex Hornby
f15eff2116 mononoke: introduce ManifoldOptions struct
Summary: We've got multiple manifold parameters now, two of which are Option<i64>, so lets create a struct to name them

Reviewed By: HarveyHunt

Differential Revision: D30305462

fbshipit-source-id: 44eee00d478e4485d074a14fcccec2f0f9572ecd
2021-08-31 09:34:46 -07:00
Mateusz Kwapich
a57cfdf804 include the program name in the error message
Summary:
This allows to quickly identify the program that emitted the error.

Per user feedback: https://fb.workplace.com/groups/clifoundation/posts/433922134631466

Reviewed By: StanislavGlebik

Differential Revision: D30604611

fbshipit-source-id: 712bc9f466c5a7b5c97a1b83a10fbe277341a300
2021-08-31 02:32:46 -07:00
Genevieve Helsel
c101e56dec add json option to version
Reviewed By: chadaustin

Differential Revision: D30555962

fbshipit-source-id: 50cf7afa0f30242a5d28b112bae04793e9b55ceb
2021-08-30 22:12:15 -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
Zhengchao Liu
f2eb6aee68 fix thread safety issues in ActivityRecorder CLI
Summary:
This addressed 2 thread safety issues:
1. holding strong reference to `EdenMount`
2. converting unowned `stringPiece` to `std::string`

Reviewed By: chadaustin

Differential Revision: D30657955

fbshipit-source-id: 870e972d9e0fe3897e021aeca77bf2db8c5fbb20
2021-08-30 19:30:08 -07:00
Gus Wynn
87a09132dc tokio -> 1.10
Reviewed By: dtolnay

Differential Revision: D30647831

fbshipit-source-id: 7094873ec5cfbf80cd7c3564fdd011268053b0d3
2021-08-30 15:55:16 -07:00
Genevieve Helsel
19e9cd2f7a allow specifying log path in eden debug log
Summary: Adds an option to print the path to the eden log file. Similar to `eden pid`, this can be used for shell one-liners.

Reviewed By: chadaustin

Differential Revision: D30558294

fbshipit-source-id: ca70addaef2093e10f0321bae0cff3b1bfc7dc75
2021-08-30 14:16:35 -07:00
Genevieve Helsel
fdb1fe42c6 turn eden debug logs upload into a flag
Summary: `eden debug log --upload` fits in better with the format of the other cli tools (rather than `eden debug log upload`)

Differential Revision: D30557691

fbshipit-source-id: 32e47e1487703560f2adb5f0f79f1002d29eea93
2021-08-30 14:16:35 -07:00
Durham Goode
0b0d631f3b pathmatcher: add native UnionMatcher
Summary:
In a previous diff we made sparse matchers become union matchers, since
they are a collection of each individual sparse profiles matcher. In order to
maintain the performance benefits of having sparse computations run on
non-python matchers, we need to update the matcher extractor to support union
matchers.

Reviewed By: quark-zju

Differential Revision: D30588256

fbshipit-source-id: 15014be844e1d713e19ae8f2959d947516b4e3c7
2021-08-30 11:47:07 -07:00
Durham Goode
690ab244da sparse: add version helper function
Summary:
We were copy/pasting metadata.get("version", "1") everywhere. Let's
make it a helper function.

Differential Revision: D30586162

fbshipit-source-id: ff6a9706f1970f84ffeb7de0e1362c3ba507fc00
2021-08-30 11:47:07 -07:00
Durham Goode
af11572e75 sparse: prevent v2 profiles from stepping on each other
Summary:
Sparse profiles should be roughly scoped around the files needed to
work on a certain product. If an engineer needs to work on multiple products
they should be able to enable multiple profiles.

Previously, multiple v2 profiles would be combined into an ordered list of
include/exclude rules, which meant that profiles enabled later could exclude
files included by the earlier profiles.

To fix this, let's treat each profile separately and create a matcher for each.
We then combine these into a union matcher, which means we're guaranteed to have
all the files that each profile specifies.

Differential Revision: D30586161

fbshipit-source-id: 2e04cfdba670ffce381a7c041706f315775ad7b0
2021-08-30 11:47:07 -07:00
Durham Goode
e14a32ade8 sparse: store profile on SparseConfig instead of profile name
Summary:
In a future diff we'll process sparse profiles differently at the
matcher creation level. To do so we need to expose the profile object to that
layer. Let's do it by storing the profile instead of just the profile name.

Differential Revision: D30586163

fbshipit-source-id: d90343b4101c43fbd838512289362aca7c3f816a
2021-08-30 11:47:07 -07:00
Jun Wu
b46cd66401 debugsegmentgraph: change level default to 0
Summary: Not every repo has non-empty level 3 segments.

Differential Revision: D30615947

fbshipit-source-id: 27e416ed17cc383dd5287127fc589dd6ccddcb7e
2021-08-30 11:03:30 -07:00
Jun Wu
39cc0769c1 debugsegmentgraph: vertex_name failure is not fatal
Summary:
With lazy changelog, it is possible that `vertex_name` is unable to translate
an id to name in non-async context. Do not treat it as errors.

Differential Revision: D30615948

fbshipit-source-id: 4e7abd77c6eb116db00e25489685563b7cf78a9c
2021-08-30 11:03:30 -07:00
Jun Wu
2b4788bcdc debugsegmentgraph: use shared .hg path
Summary: The segments is stored in the shared `.hg`, not in the local repo `.hg`.

Differential Revision: D30615949

fbshipit-source-id: 9d2b7c1ce245553a2df070b066429fbcead5d827
2021-08-30 11:03:30 -07:00
Xavier Deguillard
f79379aefc revisionstore: reduce lock scope in AuxStore
Summary:
Similarly to the previous diff, reducing the lock scope will improve
concurrency leading to higher performance in EdenFS.

Reviewed By: andll

Differential Revision: D30595787

fbshipit-source-id: 1d52e4a8d362f7e2e3e18c2a57a3ebb7628f549e
2021-08-28 03:25:54 -07:00
Xavier Deguillard
c9ee3b5209 revisionstore: reduce lock scope in IndexedLogHistoryStore
Summary:
Similarly to the previous diff, let's not hold any read/write locks when not
needed. This will improve concurrency of the code.

Reviewed By: andll

Differential Revision: D30595786

fbshipit-source-id: 6ea6c689e4deca713051a9f3611647334c528bc7
2021-08-28 03:25:54 -07:00
Xavier Deguillard
67a1666547 revisionstore: reduce indexedlogdatastore lock duration
Summary:
In the context of EdenFS, during a prefetch operation, EdenFS will call into
the revisionstore (via the backingstore) from multiple threads and use the
ContentStore::prefetch method in each of them with batches of keys.

Unfortunately, the IndexedLogDatastore lock is write held both when serializing
fetched data and when writing to the underlying IndexedLog. The serialization
part can be fairly CPU intensive as it will compress data with LZ4, but doesn't
require the lock to be held. If a concurrent get_missing call to the
IndexedLogDatastore is made, that will thus wait for the compression to
complete, reducing overall concurrency and fetching speed.

Reviewed By: andll

Differential Revision: D30583566

fbshipit-source-id: 06f5f4988c1bc911ae155189317232b54915a5cf
2021-08-28 03:25:54 -07:00
Meyer Jacobs
44d6d6ce5b scmstore: update BackingStore to support scmstore
Summary: Add a new `BackingStore` implementation based on `scmstore` instead of `ContentStore` and allow the backend to be selected with the `scmstore.backingstore` config.

Reviewed By: andll

Differential Revision: D29672974

fbshipit-source-id: dc6b8662903bcfc941b586544aad487de6b8c956
2021-08-27 15:11:35 -07:00
Meyer Jacobs
85ebb18136 scmstore: introduce StoreValue trait
Summary: Introduce a new `StoreValue` trait, implemented for `StoreFile`, for use in `CommonFetchState`, which will be shared between `TreeStore` and `FileStore`.

Reviewed By: kulshrax

Differential Revision: D30295987

fbshipit-source-id: 862349980befa13cb3d420ee617e4fe5464d890a
2021-08-27 14:51:44 -07:00
Meyer Jacobs
13423a9ba0 scmstore: introduce StoreAttrs trait
Summary: Introduce a new `StoreAttrs` trait, implemented for `FileAttributes`, for use in `CommonFetchState`, which will be used by both `TreeStore` and `FileStore`.

Reviewed By: kulshrax

Differential Revision: D30295969

fbshipit-source-id: 603242fe08bea72035b1b1d0f37c46514e1fb92b
2021-08-27 14:51:44 -07:00
Meyer Jacobs
3663d5a706 scmstore: move FetchResults and FetchErrors to top level
Summary: Refactoring in preparation for updating `TreeStore` to match `FileStore`

Reviewed By: andll

Differential Revision: D30295957

fbshipit-source-id: 0f1677311eb2578d8e0dae12c07a1599edc3b500
2021-08-27 14:51:44 -07:00
Meyer Jacobs
d5ea0f5024 scmstore: rename FileStoreFetch to FetchResults and make it generic
Summary: Making `FetchResults` generic in preparation for using it with trees too.

Reviewed By: andll

Differential Revision: D30286592

fbshipit-source-id: a48cf2dbcdcc2c4b8a102eaa02ac465c367c6793
2021-08-27 14:51:43 -07:00
Meyer Jacobs
d66b308db5 scmstore: move file-specific metrics into separate module
Summary: I'll be adding metrics to the `TreeStore` soon, so I'm refactoring code that will be shared between files and trees. This change moves the non-file-specific metrics types up to the top-level `scmstore` module, rather than inside `scmstore::file`.

Reviewed By: andll

Differential Revision: D30284933

fbshipit-source-id: 31f48312bca8d75d4893220cd189b9735a37a5a0
2021-08-27 14:51:43 -07:00
Jun Wu
1875a663b1 metalog: add tracing logs
Summary: Helps figure out what happens to metalog internally.

Differential Revision: D30563249

fbshipit-source-id: 10323d36d762edda93206dd01c88d1f0d8abdf8d
2021-08-27 13:44:03 -07:00
Jun Wu
6aefe85ce8 util: replace faultinjection with failpoint
Summary:
The failpoint feature supports more complex injections, such as sleep, or fail
after a few times. There is no need to keep the adhoc faultinjection feature.

Differential Revision: D30495223

fbshipit-source-id: b5613811e489a5a52e9c0dd1ebf1096c848a402b
2021-08-27 13:44:03 -07:00
Zhengchao Liu
aa4566ece6 check hgcache before enqueue import tree request
Summary: Currently, tree imports are queued regardless of whether they are in the `hgcache`. This adds unnecessary delay, especially if the queue is busy (importer takes a long time and causes queue to backlog). This diff adds the logic to check if the tree is in `hgcache` before enqueuing a tree import request.

Reviewed By: xavierd

Differential Revision: D30514871

fbshipit-source-id: eb23f64b7f059832571f957fb67d18c3821d2844
2021-08-27 13:08:59 -07:00
Gus Wynn
6a75141b86 add panic-message
Summary:
this library is a more general version of the `panic_unpack` lib I
made in fbcode. I made this library, its mit-apache licensed

Reviewed By: dtolnay

Differential Revision: D30607308

fbshipit-source-id: ee4fad3924fdae021753055cd3fd88c99cb99512
2021-08-27 12:09:29 -07:00
Jun Wu
3562880804 pyfail: module to use FAILPOINTS in Python
Summary:
This allows us to insert FAILPOINTS in Python so we can use sleep, return error
etc.

Differential Revision: D30495224

fbshipit-source-id: aef56d03bc32eefb69573cfa586aa63a301edffc
2021-08-27 11:30:55 -07:00
Jan Mazur
fa742950a3 remove need for repo_name in hooks configerator config
Summary:
I abandoned D30603353 in favor of this one because
its_cleaner

We don't need repo name in every hook, just 2 of them.

This will allow us to have predefined, named hook configs that are repo-agnostic. E.g. when repositories are similar, they could share one set of hook configs in configerator.
There were two hooks that had repo_name in configerator hook config: verify_integrity and verify_reviewed_by

Reviewed By: StanislavGlebik

Differential Revision: D30605229

fbshipit-source-id: c310b16b564808d0dc0909d21cc3521a57e06fad
2021-08-27 10:45:32 -07:00
Durham Goode
86dd972294 tests: remove test-perftrace.t
Summary: The result is too flakey now that we've introduced threading.

Reviewed By: andll

Differential Revision: D30607733

fbshipit-source-id: f8bfa2a57d427731fb4ac3011f4364190a83b771
2021-08-27 10:19:05 -07:00
Xavier Deguillard
49619add41 store: allow extracting a slice of the Hash stored in HgProxyHash
Summary:
Some code in the HgDatapackStore is overly complicated due to the fact that
revHash returns a owned Hash and this forces the code to thus copy it onto a
temporary vector. By having a method that can directly return a slice to the
hash, this issue disappears, thus let's add it.

Reviewed By: chadaustin

Differential Revision: D30582458

fbshipit-source-id: dc102117bc82ab72378293c0abfe9acfd862e9e6
2021-08-27 10:05:48 -07:00
Michael Samoylenko
d972c278ce Rm deprecated mysql connection factory
Summary: Cleaned up all remaining usages of this deprecated API in CTP codebase

Differential Revision: D30517771

fbshipit-source-id: 6b2c7fb6c569bf5a928a7eec60fdd890baad312f
2021-08-27 06:06:30 -07:00
Stanislau Hlebik
cf0380dccb mononoke: fix handling of mutable renames in fastlog
Summary:
Handling of mutable renames was incorrect for two reasons:
1) We didn't add an entry to history graph, so only a single changeset before
rename was returned. That was easy to "fix" (just add a new entry to history
graph), but...
2) ...all history operations now have to use a different path (the source of
the rename path).

To fix it let's track not just the changeset id, but also the path for the
given changeset id. Since the path can potentially be large I wrapped it into
Arc to avoid expensive clones.

Differential Revision: D30576342

fbshipit-source-id: a99f6269c34b0a0c626104ec47c9392f984328fb
2021-08-27 05:58:31 -07:00
Yan Soares Couto
475ebe8c17 Use fetch_snapshot endpoint from restore command
Summary:
This diff calls the `/:repo/snapshot` EdenApi endpoint added on D30514854 (ab17c4d181) from the `hg snapshot restore` command.

For now, it just prints the parent of the snapshot, but in next diffs it will update to it and restore the dirty changes.

Reviewed By: StanislavGlebik

Differential Revision: D30517984

fbshipit-source-id: e1381eaed561a7184ee02ab99d0282f11a1d944f
2021-08-27 03:40:57 -07:00
Yan Soares Couto
5e34a79748 Add bindings for fetch_snapshot endpoint
Summary: This diff adds the `fetch_snapshot` method to the EdenApi trait, implements it for talking with the EdenApi service, and also adds python bindings for ease of use from python.

Reviewed By: StanislavGlebik

Differential Revision: D30517973

fbshipit-source-id: 41c24ba25040b397b7d739c2885a47acfb9100d2
2021-08-27 03:40:57 -07:00
Andrey Chursin
aae0a37a7f use metadata cache to skip hash recalculation
Summary:
I noticed that every time we fetch blob from hg, we calculate sha hash and put it into metadata table.
Both calculating sha1 of content and writing it to rocks is fairly expensive, and it would be nice if we can skip doing so in some cases.

In this diff I use inexpensive cache check to see if we already calculated metadata for given blob and skip recalculation

In terms of performance, it reduces blob access time in hot case from **0.62 ms to 0.22 ms**.
[still need to do some testing with buck, but I think this should not block the diff since it seem farily trivial]

This is short-medium term fix, the longer term solution will be keeping hashes in mercurial and fetching them via eden api, but this will take some time to implement

Reviewed By: chadaustin, xavierd

Differential Revision: D30587132

fbshipit-source-id: 3b24ec88fb02e1ea514568b4e2c8f9fd784a0f10
2021-08-26 17:30:17 -07:00
Durham Goode
b519a52161 tests: fix test-perftrace.t
Summary: This is blocking hgbuild.

Reviewed By: quark-zju

Differential Revision: D30585308

fbshipit-source-id: 68efca01e39eac2a329bb7ef88e9fd9086c15607
2021-08-26 13:52:22 -07:00
Xavier Deguillard
87545e26b2 benchmarks: add HgImportRequestQueue::dequeue benchmark
Summary: Similarly to the enqueue benchmark, let's have a dequeue benchmark.

Differential Revision: D30560489

fbshipit-source-id: ae18f7e283e4bab228aaa0f58bff2e6f2cfa3021
2021-08-26 12:28:51 -07:00
Xavier Deguillard
edfc14fa97 store: use Hash instead of HgProxyHash to speedup enqueue 1.6x
Summary:
In order to enqueue and find an element in a hash table, the key needs to be
hashed. Hashing a HgProxyHash relies on hashing a string which is significantly
more expensive than hashing a Hash directly. Note that they both represent the
same data and thus there shouldn't be more collisions.

Reviewed By: chadaustin

Differential Revision: D30520223

fbshipit-source-id: 036007c445c28686f777aa170d0344346e7348b0
2021-08-26 12:28:50 -07:00
Xavier Deguillard
f3dc469957 store: remove an allocation in enqueue to speed it up 1.25x
Summary:
Allocations are expensive, especially when done under a lock as this increase
the critical section, reducing the potential concurrency. While this yields to
a 1.25x speedup, this is more of a sideway improvement as the allocation is now
done prior to enqueuing. This also means that de-duplicating requests is now
more expensive, as no allocation would be done before, but at the same time,
de-duplication is the non-common code path, so the tradeoff is worthwhile.

Reviewed By: chadaustin

Differential Revision: D30520228

fbshipit-source-id: 99dea65e828f9c896fdfca6b308106554c989282
2021-08-26 12:28:50 -07:00
Xavier Deguillard
882713319c store: use an F14 map to speed up HgImportRequestQueue::enqueue 1.3x
Summary: The F14 hashmap are significantly faster than the std::unordered_map.

Reviewed By: chadaustin

Differential Revision: D30520225

fbshipit-source-id: d986908c5eac17f66ae2c7589f134c430a3c656e
2021-08-26 12:28:50 -07:00
Xavier Deguillard
a3d6554a8c store: speed up HgImportRequestQueue::enqueue 1.5x
Summary:
When turning on the native prefetch, EdenFS will enqueue tons of blob requests
to the import request queue. The expectation is then that the threads will
dequeue batch of requests and run them. What is being observed is however
vastly different: the dequeued batches are barely bigger than 10, far lower
than the batch capacity, leading to fetching inefficiencies. The reason for
this is that enqueuing is too costly.

The first step in making enqueuing less costly is to reduce the number of times
the lock needs to be acquired by moving the de-duplication inside the enqueue
function itself. On top of reducing the number of times the lock is held, it
also halves the number of allocation done under the lock.

Reviewed By: chadaustin

Differential Revision: D30520226

fbshipit-source-id: 52f6e3c1ec45caa5c47e3fd122b3a933b0448e7c
2021-08-26 12:28:50 -07:00
Xavier Deguillard
7eb4db22db store: convert back some SemiFuture to Future
Summary:
It turns out that we do want to use a Future to make sure that the tracebus and
watches are completed on the producer and not on the consumer of the future. We
could use a `.via(inline executor)` but the code becomes less readable, so
let's just revert the diff.

Reviewed By: chadaustin

Differential Revision: D30545721

fbshipit-source-id: 524033ab4dbd16be0c377647f7f81f7cd57c206d
2021-08-26 12:28:50 -07:00
Durham Goode
c6a987f3ea sparse: support hg sparse files --rev $REV
Summary:
I need to be able to run 'hg sparse files $PROFILE' in an Eden checkout
for a Sandcastle job that analyzes sparse profiles. We can't run 'hg sparse' at
all in Eden repos, so instead I run it in the backing repo. But that repo is
checked out to the null commit, so let's support --rev on 'hg sparse files' so I
can inspect an arbitrary rev.

Differential Revision: D30561529

fbshipit-source-id: 93b46caa9b63637bf4d63d5438bd23cbffb3983a
2021-08-26 10:03:10 -07:00
Harvey Hunt
14941cc830 mononoke: Remove lfs rollout tier
Summary:
This config option was used to slowly roll out LFS for a repo.
However, it is no longer used and can therefore be removed.

Reviewed By: StanislavGlebik

Differential Revision: D30511880

fbshipit-source-id: 59fe5925cc203aa609488fdf8ea29e9ff65ee862
2021-08-26 09:22:28 -07:00
Durham Goode
da91e21b0c tests: fix test-sparse-profiles-v2.t
Summary: Apparently OSX has different ls -R output than linux.

Reviewed By: singhsrb

Differential Revision: D30566611

fbshipit-source-id: 2f232b12d1971bea18c7131c1ec82244252527c7
2021-08-26 07:51:46 -07:00
Yan Soares Couto
ab17c4d181 Endpoint for fetching snapshot info
Summary:
This adds a new endpoint to EdenApi: `/:repo/snapshot`.

It fetches information about a snapshot (for now, parents and files).

This will be used by the `hg snapshot restore` command.
- Parent will be used to do a normal "hg update" to it
- File changes will be used to apply the working state file changes on top of it.

Reviewed By: ahornby

Differential Revision: D30514854

fbshipit-source-id: b6c6930410cf15fe874eca1fce54314e5011512a
2021-08-26 07:24:37 -07:00
Yan Soares Couto
dd03d5f5cb snapshot: Shell for restore command + integration test
Summary:
Very basic shell for the `hg snapshot restore` command.

For now just reads the id and prints it to stdout. Next diffs will add functionality to it.

Reviewed By: StanislavGlebik

Differential Revision: D30449567

fbshipit-source-id: 9f4e0bb284dff7e6ffb4398942f3247a09511933
2021-08-26 07:24:37 -07:00
Yan Soares Couto
4dfa969065 Use EdenApiHandler on complete trees endpoint
Summary:
This refactors the complete_trees endpoint to use the abstraction added on D30451710.

This one needed some extra refactoring, the reason why I separated it on its own diff:
- It was the only endpoint that also returned HTTP 400 errors, as well as 500.
- I made the handler trait return a custom error that may be 400 or 500 errors, but the default is 500 and like anyhow Error, errors automatically convert to that to make the happy path very simple
- Also added a type aliasing that makes the return type simpler to look at.
- Then moved this endpoint to use EdenApiHandler, while keeping the previous behaviour of return 400 error when the path is wrong.

Reviewed By: StanislavGlebik

Differential Revision: D30483501

fbshipit-source-id: 5cb4cd7f3fc2bbdafb9f0e6a78739086c829eee1
2021-08-26 07:24:37 -07:00
Yan Soares Couto
8584a0202b Use EdenApiHandler on most endpoints
Summary:
This diff refactors most endpoints to use the new abstraction added on D30451710.

There are still a few endpoints that couldn't be refactored (see summary of previous diff).

Reviewed By: StanislavGlebik

Differential Revision: D30483500

fbshipit-source-id: ea2cc24afb119bf63a45a6f4bf48706a004743cc
2021-08-26 07:24:37 -07:00
Yan Soares Couto
2db1bfef21 Make handlers return stream and refactor 4 endpoints
Summary:
Uses the abstraction built on D30451710 to make more endpoints simpler. It needed to be made a little more generic by using streams instead of `Vec`.

Some endpoints can't be migrated as of now:
- hash_to_location and trees as they a custom CBOR stream. We might want to implement a similar abstraction that can deal with custom cbor stream, though since it's just two endpoints, maybe we should just move them to the same as the others, if possible.
- revlog_data as it doesn't use the Wire format. This seems like it's just legacy, and should probably be moved to use the wire format, though the transition is tricky.
- Some endpoints have no input, and this assumes input is a wire cbor struct.
- Some endpoints don't output a stream, but just a cbor object, that will need a different EdenApiHandler trait but it's doable.

The rest seem to be possible to migrate with current abstractions.

Reviewed By: StanislavGlebik

Differential Revision: D30453597

fbshipit-source-id: 0d1068021e83f3e1143f3bc9ee68d20e4c34cb50
2021-08-26 07:24:36 -07:00
Yan Soares Couto
af35e3eaac Make endpoints simpler and easier to create (moved 1 use)
Summary:
While I was creating EdenAPI endpoints, I noticed that there was quite a bit of duplicated code in it, for example, the logic to read things from inside a request and write a response.

It also needed several "manual" steps to create a new one, and though types made it hard to make a mistake, it was still possible, as nothing guaranteed you were using the same types everywhere. This diff aims to fix all of that.

Creating an endpoint, before:
1. Create handler function, that receives `State` and returns `TryIntoResponse`, by copying from other functions the initial/final handling, which includes adding some handler info, parsing path and query string extraction, creating a repo context and parsing the wire request.
2. Write a PathExtractor struct by copying the other structs, it must take a repo parameter.
3. Create a new variant in EdenApiMethod and update related methods.
2. From the handler function, convert stuff and call your inner logic function, that actually is different on all endpoints.
3. Write a wrapper for your wrapper, with can be done using `define_handler!`
4. Call `route.post(URL)`, don't forget to use the same Path/QueryStringExtractors.

Creating an endpoint, now:
1. Write a struct that implements `EdenApiHandler`, in which you specify the HTTP method, endpoint, and inner logic.
3. Create a new variant in EdenApiMethod and update related methods.
3. Call `Handlers::setup::<YourHandler>(route)`

This makes it easier to create a new endpoint and harder to make mistakes while doing so. It could be even easier with some procedural macro dark magic, but this is already pretty good and simple.

**On this diff, I only refactor one of the endpoints, to make it easier to review the new "refactor logic", on the next diffs I'll move more endpoints**

Reviewed By: StanislavGlebik

Differential Revision: D30451710

fbshipit-source-id: 9de4de483d4a755bfceafb6d52ec79bbf3f3b5e7
2021-08-26 07:24:36 -07:00
Stanislau Hlebik
97fc49aa62 mononoke: fix reload of tunables if a field was deleted
Summary:
Currently we have a problem in tunables - if a tunables was added, and then
removed, then value of tunable is not renewed until the binary is restarted.
This is not great - it makes reverts harder (e.g. if a diff added "tunable =>
true", then reverting the diff won't make any difference until the server is
restarted. So in order to revert the value of the tunable we'd need to write a
diff that does "tunable => false" or restart the binaries, neither of which is
great).

This is counter-intutivite, and this diff fixes it. From what I can tell, this
problem affected only strings/bools/ints - per repo variable weren't affected.

Reviewed By: Croohand

Differential Revision: D30544003

fbshipit-source-id: 353970a259a7faa0682866aae9a5699b8a783b22
2021-08-26 02:58:55 -07:00
Stanislau Hlebik
9765ab95b2 mononoke: support multiple derived data types in backfill_derived_data single
Summary: It's convenient to be able to derive multiple derived data types at once

Reviewed By: mitrandir77

Differential Revision: D30545263

fbshipit-source-id: 79ba541981af1340a59145f44a2f7d5a54cc28e1
2021-08-26 02:18:25 -07:00
TJ Ryan
3157913b92 Fix incorrect fburl in jf/eden phabricator graphQL utils
Summary:
fburl.com/botsdiffs is a random diff
fburl.com/botdiffs is the wiki

Differential Revision: D30547647

fbshipit-source-id: 337d6457cb6403f11fbbc9654f3d34f50d69b0e5
2021-08-26 01:00:46 -07:00
Durham Goode
f28fbde887 manifest: make BFS iteration async and parallel
Summary:
Sparse profile change computation is quite slow, since globs mean it
has to iterate over a large portion of the tree even if the sparse profile
change is small. Let's make the BFS async and parallel.

Reviewed By: andll

Differential Revision: D30554961

fbshipit-source-id: bce461ad0b21d1dab1013cf3f501b5744b295c30
2021-08-25 23:32:57 -07:00
Durham Goode
3c1e7ac330 pymatcher: extract pure Rust matchers when possible
Summary:
Avoiding the GIL can speed up tree diff/iteration a lot. Let's extract
the pure Rust matcher when possible. We also convert a Python differencematcher
into a rust DifferenceMatcher when possible, since that is the core use case for
sparse profile change computation.

Reviewed By: andll

Differential Revision: D30553727

fbshipit-source-id: 41d2f13130da18a55f64f9f0f047825bd24144c6
2021-08-25 23:32:57 -07:00
Durham Goode
cb3b28bc5d manifest: make matchers Sync
Summary:
In a future diff we'll make tree BFS iteration async and parallel. To
do so we need the matchers to be Send/Sync. Let's update the types for now.

Reviewed By: andll

Differential Revision: D30553731

fbshipit-source-id: 82a441a0caa86b65ca7eaea7283bbbbbb79d5c88
2021-08-25 23:32:57 -07:00
Durham Goode
ec7f6fe57d [hg pymatcher: add a base matcher extraction API
Summary:
In a future diff we'll want to extract matchers into their pure Rust
forms when possible. Let's create a helper function for matcher extraction. In a
later diff we'll make this function smart.

Reviewed By: andll

Differential Revision: D30553730

fbshipit-source-id: 0612a3be54f0286308fc4c43d9a2e5e9aa431a16
2021-08-25 23:32:57 -07:00
Durham Goode
03f1abd8d3 matcher: add Rust DifferenceMatcher
Summary:
In a later diff we'll be making sparse profile change computation use a
pure Rust matcher. To do so, we need to be able to represent a difference
matcher in Rust.

Reviewed By: andll

Differential Revision: D30553729

fbshipit-source-id: df2194bbacaa7924bafbfc33e00f25e524df4613
2021-08-25 23:32:57 -07:00
Durham Goode
3e589d86c6 manifest: remove left vs right store during tree diff
Summary:
The diff algorithm kept track of left vs right stores, and applied the
left vs right tree lookups to the appropriate store. In reality we only ever
have one store, so we're just wasting cycles doing two sequential lookups. Let's
just get rid of the distinction.

Reviewed By: andll

Differential Revision: D30553726

fbshipit-source-id: 72de95d298dad71dc04728d5140b4d489073a33c
2021-08-25 23:32:57 -07:00
Durham Goode
155865bc35 treemanifest: moving diff fetching to a background thread
Summary:
When testing hg checkout with an empty cache, I noticed the tree
diff'ing phase would alternate between downloading data and doing cpu work. This
implied it was all synchronous. This diff speeds it up by doing the downloading
on a background thread, while the main thread does the actual diff.

Ideally we'd make the actual diff itself parallel as well, but the tree
structure is a tree of semi-mutable references, which would require a larger
refactoring.

Reviewed By: andll

Differential Revision: D30553728

fbshipit-source-id: 4ea953909827cf1ec4fd67ac297f63bfadd67483
2021-08-25 23:32:56 -07:00
Durham Goode
a09ffe8cde pyrevisionstore: fix unused variable warnings
Summary: A previous diff introduced these.

Reviewed By: andll

Differential Revision: D30559639

fbshipit-source-id: a23cc91c4584baf1fa0c0a8334ad28c799c726be
2021-08-25 18:33:49 -07:00
Katie Mancini
6b315d5578 setup buck integration testing
Reviewed By: scottcao, xavierd

Differential Revision: D30003787

fbshipit-source-id: fcf387ba37a7443fdbf56520e387fc008be0bf37
2021-08-25 17:32:14 -07:00
Zeyi (Rice) Fan
d7ce016f8e regenerate Cargo.toml
Reviewed By: jsgf

Differential Revision: D30555920

fbshipit-source-id: c460bc2614b23255dfcc4ea62e34230eec779b83
2021-08-25 16:41:21 -07:00
Xavier Deguillard
cba417e57e service: revert "normalize mount point in Thrift endpoints"
Summary:
This change has the unintended effect of causing any Thrift calls to
potentially issue a recursive EdenFS call due to symlink resolution requiring
running `readlink` on the root of the repo itself.

Fixing this isn't really possible, thus let's revert the change altogether, we
can force clients to issue a realpath before issuing EdenFS Thrift calls.

Reviewed By: kmancini

Differential Revision: D30550796

fbshipit-source-id: 9494c8e08c8af2392eeb344879f156cb56f93ea6
2021-08-25 14:54:58 -07:00
Xavier Deguillard
f5d10f0c59 store: document HgImportRequestQueue::stop
Summary:
The documentation allows for not having to test in enqueue if the queue is
still running: if called in the destructor of the owner, no enqueue can
logically happen, and thus we do not need to protect against it.

Reviewed By: chadaustin

Differential Revision: D30520227

fbshipit-source-id: 9d6280ccd7fe875cd06b0746151a2897d1f98d61
2021-08-25 14:20:56 -07:00
Xavier Deguillard
752a67e5cd benchmarks: add a benchmark for HgImportRequestQueue::enqueue
Summary:
When trying to push thousands of requestst to the queue, the dequeue side only
manage to pull batches of ~10 requests at most. Let's measure the cost of
enqueue to optimize it.

Reviewed By: chadaustin

Differential Revision: D30503110

fbshipit-source-id: d06ae6741b13b831fa3711fb2dd0e38c3e54193c
2021-08-25 14:20:56 -07:00
Stanislau Hlebik
4ea84db606 mononoke: don't fail if too many commits were pushed by hg sync job
Summary:
If hg sync job is pushing a commit, then we have no choice but to accept it,
even if it's too big. So let's not fail if too many commits are pushed.

Reviewed By: ahornby

Differential Revision: D30535025

fbshipit-source-id: eb607a8fbd691d6591ad990e0920411b1ad2f09c
2021-08-25 13:55:48 -07:00
Genevieve Helsel
07add0808e return 0 if skipping predictive fetch
Reviewed By: kmancini

Differential Revision: D30546084

fbshipit-source-id: 69b3ab3260e5d3ca56a1b8abd533f793f5d4b62f
2021-08-25 12:39:55 -07:00
Mateusz Kwapich
7cbf978d0d Back out "treemanifest: moving diff fetching to a background thread"
Summary:
Original commit changeset: b4d12a0de8af

Back out "[hg] pymatcher: extract pure Rust matchers when possible"

This is needed to revert D29971824 (13614c3ed4) which makes lots of mononoke tests time out (T99068634). I'm not
sure where the bug is so I'll leave the fix up to DurhamG

Reviewed By: StanislavGlebik

Differential Revision: D30540881

fbshipit-source-id: 73ed2b7b63d33fbe3a76ee93d86241e37c4b2dd0
2021-08-25 09:44:23 -07:00
Mateusz Kwapich
9fc04082d0 Back out "manifest: remove left vs right store during tree diff"
Summary:
Original commit changeset: edd0b9fb7821

Back out "[hg] pymatcher: extract pure Rust matchers when possible"

This is needed to revert D29971824 (13614c3ed4) which makes lots of mononoke tests time out (T99068634). I'm not
sure where the bug is so I'll leave the fix up to DurhamG

Reviewed By: StanislavGlebik

Differential Revision: D30540880

fbshipit-source-id: 8cac18ae17531ec72f255f35a62b0e5337f9d36e
2021-08-25 09:44:23 -07:00
Mateusz Kwapich
a566768ea2 Back out "matcher: add Rust DifferenceMatcher"
Summary:
Original commit changeset: 2f04db619a20

Back out "[hg] pymatcher: extract pure Rust matchers when possible"

This is needed to revert D29971824 (13614c3ed4) which makes lots of mononoke tests time out (T99068634). I'm not
sure where the bug is so I'll leave the fix up to DurhamG

Reviewed By: StanislavGlebik

Differential Revision: D30540885

fbshipit-source-id: ef0d07b60a76cd4efaf29fb93424a5231d6e6ebf
2021-08-25 09:44:23 -07:00
Mateusz Kwapich
15264b9142 Back out "[hg pymatcher: add a base matcher extraction API"
Summary:
Original commit changeset: 8fdfa87bfc16

Back out "[hg] pymatcher: extract pure Rust matchers when possible"

This is needed to revert D29971824 (13614c3ed4) which makes lots of mononoke tests time out (T99068634). I'm not
sure where the bug is so I'll leave the fix up to DurhamG

Reviewed By: StanislavGlebik

Differential Revision: D30540882

fbshipit-source-id: 1db5b4f22ee5b5479fc444554f61e189760fee6b
2021-08-25 09:44:23 -07:00
Mateusz Kwapich
8ae49c3430 Back out "manifest: make matchers Sync"
Summary:
Original commit changeset: ff201a014ca1

Back out "[hg] pymatcher: extract pure Rust matchers when possible"

This is needed to revert D29971824 (13614c3ed4) which makes lots of mononoke tests time out (T99068634). I'm not
sure where the bug is so I'll leave the fix up to DurhamG

Reviewed By: StanislavGlebik

Differential Revision: D30540883

fbshipit-source-id: a9511690462b3137f21316e5f682f07e61cb5a48
2021-08-25 09:44:23 -07:00
Mateusz Kwapich
36c679cdb8 Back out "pymatcher: extract pure Rust matchers when possible"
Summary:
This is needed to revert D29971824 (13614c3ed4) which makes lots of mononoke tests time out (T99068634). I'm not
sure where the bug is so I'll leave the fix up to DurhamG

Reviewed By: StanislavGlebik

Differential Revision: D30540884

fbshipit-source-id: 4e209fccf1c94c871aa9652ee733e7ce0eaf4279
2021-08-25 09:44:23 -07:00
Mateusz Kwapich
69d3da3cab Back out "manifest: make BFS iteration async and parallel"
Summary:
This reverts D30168108 (058fff364d) which makes lots of mononoke tests time out (89 tests according to bisect tool, see T99069004). I'm not
sure where the bug is so I'll leave the fix up to DurhamG

Original commit changeset: 4e0de01c6ef7

Reviewed By: StanislavGlebik

Differential Revision: D30539931

fbshipit-source-id: 8b5772299d1c06b0ef2bd73465576373095c6f61
2021-08-25 09:44:23 -07:00
Mateusz Kwapich
d745491438 new tool preprare the delete commit for history fixup
Summary:
As explained in previous diff summary - we need to make those deletions
before we can fixup history. This diff adds relevant args to megarepo tool.

Reviewed By: StanislavGlebik

Differential Revision: D30456464

fbshipit-source-id: 894e27750684f86e18184e3b98beeda8dfb5b53d
2021-08-25 06:25:22 -07:00
Mateusz Kwapich
92ce782001 add a new function to handle history fixup deletes
Summary:
In one of our large repos the files were synced using ad-hoc scripts between
the repos before the megarepo. This made the history and blame full of
irrelevant commit messages like "sync from repo x". The new functionality will
allow us to re-merge those files with correct histories. To do that we need to
delete the:
 * files with wrong history from master branch
 * all other files from the source branch with correct history - so only those
   are merged in

As an optimisation we're not removing the files that are the same on both
branches from branch with correct history. This will make the merge bonsai
smaller while keeping the history the same (at least when unode v2s are
enabled).

Reviewed By: StanislavGlebik

Differential Revision: D30456465

fbshipit-source-id: f14e8caf8e104c8d8069edc098cfe6419bbe407e
2021-08-25 06:25:22 -07:00
Mateusz Kwapich
f7897461e2 change the merge validation logic to allow same paths if the files are the same
Summary:
The current logic in megarepo merge tool command (which creates arbitrary
merges in the repo) checks if there's intersection between the manifest leaf
entries of both commits. This doesn't allow the merges where there are exactly
same files on both side of merge.

I've updated the logic to look at fsnode manifest diff. As the old futures code
was harder to work with I've updated the code I worked with to async/await.

NOTE: I think that both new and old logic lack one important check: file vs
directory conflicts. We should address this separately.

Reviewed By: StanislavGlebik

Differential Revision: D30456466

fbshipit-source-id: 70303e8ff8ff9a42e5dcff5c1fe6e4912910d4d9
2021-08-25 06:25:22 -07:00
Simon Farnsworth
afb70f4913 update hook that prevents megarepo merges to use a revset
Summary: Generalise the hook slightly; instead of relying on a specified file, use a revset, which opens this out to more use cases (e.g. blocking revisions in fbsource that aren't on our `master` branch)

Reviewed By: StanislavGlebik

Differential Revision: D30511155

fbshipit-source-id: 6b73c7c3e6caf2d670632110619eacb7b6216355
2021-08-25 05:28:35 -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
Durham Goode
e7a30924eb sparse: add debug command for comparing v1 and v2 results
Summary:
Adds a helper "hg debugsparseprofilev2 $PROFILE" command that prints
out the difference in files matched by the profile using v1 and v2. This is
useful when migrating a profile to v2 and checking you haven't broken anything.

Reviewed By: kulshrax

Differential Revision: D30303868

fbshipit-source-id: 1b1d8b197470692fa13457ecb4c9344104b6d9c0
2021-08-24 18:28:47 -07:00
Durham Goode
66463771d7 sparse: add v2 sparse profile that respects include/exclude ordering
Summary:
v1 sparse profiles had excludes always take precedence over includes.
This made it hard to use and resulted in sparse profiles that were too wide.

Let's add a v2 sparse profile that respects the order of include/exclude rules.

Reviewed By: andll

Differential Revision: D30284698

fbshipit-source-id: 6765b8487695ec6cc7f8027e4da98ca65957b5d0
2021-08-24 18:28:47 -07:00
Durham Goode
32928affc9 sparse: force treematcher for sparse matcher
Summary:
In a future diff we'll want to handle ordered lists of include/exclude
rules. To do so we need to use the treematcher. Note, this means we can't use
regular expressions for sparse matchers now, but there's only one occurrence of
that in production.

Reviewed By: andll

Differential Revision: D30284700

fbshipit-source-id: c379e1feb233baee8c5ba2e1f57017b72ecaa835
2021-08-24 18:28:47 -07:00
Durham Goode
2ec000c877 sparse: express include/exclude in terms of ordered rules
Summary:
Currently excludes always take precedence over includes in sparse
configs. In a later diff we want to make this more flexible. To start with
though, let's refactor config loading to use a more "rules" oriented structure.
Excludes will still take precedence over includes, but will do so by being later
in the rule list. This will allow us to start changing rule ordering in a later
diff.

Reviewed By: andll

Differential Revision: D30284699

fbshipit-source-id: 955c016d67e22fce6b26ba7b8e1ffacc931989c8
2021-08-24 18:28:47 -07:00
Durham Goode
20e20b6f03 sparse: add strongly typed sparse config types
Summary:
Previously the SparseConfig type was abused to mean three things:
1. The non-recursive contents of .hg/sparse
2. The non-recursive contents of a sparse profile.
3. The recursively expanded contents of enabled sparse rules and profiles.

In a later diff we'll be changing how includes/excludes work to make it more
flexible, and this reuse of the same type makes it complicated.

So let's split it into three distinct types. Later diffs will change them so
they aren't so similar. In doing so, we also slightly change the way sparse
profiles are loaded, to load them recursively.

Reviewed By: andll

Differential Revision: D30284701

fbshipit-source-id: f908ba167a04f9863ab75e1cd6a94027fa64607e
2021-08-24 18:28:47 -07:00
Pyre Bot Jr
2b5216e31c suppress errors in fbcode/eden - batch 1
Differential Revision: D30514057

fbshipit-source-id: fba38e972f6dad2ad9e6f2d89a2eef06cf4e2872
2021-08-24 14:30:57 -07:00
Stanislau Hlebik
139cedb239 mononoke: add retries in add_sync_target derived data derivations
Summary:
add_sync_target might need to derive a lot of data, and it takes a long time to
do it. We don't have any resumability, so if it fails for any reason, then we'd
need to start over.

For now let's just retry a few times so that we don't have to start over
because of flakiness

Reviewed By: mitrandir77

Differential Revision: D30511785

fbshipit-source-id: 1a9c5e62db366022ad487ed108dd41b1dea4caa2
2021-08-24 09:19:16 -07:00
Yan Soares Couto
f2044fede9 edenapi: Make python-aware rust code minimal for uploadsnapshot
Summary:
This diff starts making the python binding layer simpler. It's better to make the python-aware Rust code as simple as possible, to make reusability easier.

This diff moves the `uploadsnapshot` functionality to a "pure-rust" file, and makes it in an easily extensible way, so that when adding more functionality we don't end up with a huge file with everything.

Reviewed By: ahornby

Differential Revision: D30429524

fbshipit-source-id: e46e71a8993917720ab38b50a8c967564ac82fb6
2021-08-24 09:02:27 -07:00
Yan Soares Couto
36219cb445 snapshot: Handle files that were deleted but still exist
Summary:
This fixes a small bug in snapshots, as noted in the `TODO` comment I deleted.

If you `hg rm` a file and then replace it with something else, we want that to be uploaded to the snapshot as well.

These types of files are uploaded as "UntrackedChange", which is a bit confusing but correct, it means the file was deleted and now there are untracked changes in it (similar to how if a file is marked as "untracked deletion" but it didn't exist, it means it was `hg add`ed and then locally deleted)

Differential Revision: D30398143

fbshipit-source-id: dbd316fbcdc0e9b1781c5c967eb12c02805f4361
2021-08-24 09:02:27 -07:00
Yan Soares Couto
b415a104ec edenapi: Allow upload tokens for bubbles
Summary:
Objects (for now, files and changesets) can be in the persistent or ephemeral blobstore (in any of the bubbles). This diff makes it so `UploadToken`s can reflect that.

Nicely, for objects in persistent blobstore, this shouldn't affect the size of anything shipped on the wire, as its serialisation gets skipped.

 ---

An unrelated but similar problem I noticed is that `UploadToken`s don't capture the repo the object was uploaded to. So it is theoretically possible to upload something in one repo and "prove" to mononoke that it was uploaded to another repo (well, once signatures are actually used). This seems very hard to actually do in practice without bad intent (or even with it), so I'm not sure if it's something we want to fix.

Reviewed By: StanislavGlebik

Differential Revision: D30396437

fbshipit-source-id: e278cd73061d3aaf7e3353236503d239a366ed5d
2021-08-24 09:02:27 -07:00
Yan Soares Couto
60fe0523fe snapshot: Upload file content to ephemeral blobstore
Summary:
The snapshot itself is uploaded to ephemeral blobstore, but before this diff, file content was still uploaded to the persistent one.

Server side logic to upload to bubble was already added some time ago, but we needed the client part of it.

There is a slight bug, since the logic to upload files still checks if the file was already uploaded in the **persistent** blobstore, so if it's there it won't be uploaded again to the ephemeral blobstore. This is fixed on the next diff (D30396437).

Differential Revision: D30396432

fbshipit-source-id: e6e5ec299ec5323503eedba32956569e16f3eb50
2021-08-24 09:02:26 -07:00
Yan Soares Couto
b8a184318a snapshot: Upload tracked and untracked deletions
Summary:
Before this diff, only file changes (tracked or untracked) were stored in the changeset.

This diff makes it so deletions and untracked deletions are also stored in the changeset.

Differential Revision: D30373960

fbshipit-source-id: 4c1c40f4028e03a7858ce7ce55d385e02b672fc4
2021-08-24 09:02:26 -07:00
Yan Soares Couto
f8682958ac Accept bubble in admin bonsai-fetch
Summary:
This diff adds the `--bubble` argument to the `admin bonsai-fetch` command, which is useful to look at changesets stored in a bubble.

It also does some BlobRepo refactoring to this command, by building a smaller `BonsaiFetchContainer` object, instead of `BlobRepo`, and uses changes from D30368261 (6ed51f5514) to make that possible.

Reviewed By: StanislavGlebik

Differential Revision: D30370983

fbshipit-source-id: fb99d2f4534fed94c040a0f9ce371d7843114f51
2021-08-24 09:02:26 -07:00
Yan Soares Couto
70849ea36a Upload snapshot to ephemeral blobstore
Summary:
This diff makes snapshots be uploaded to the ephemeral blobstore.

Given the previous diffs which implemented a "repo view" and piped bubble id to edenapi server, on this diff I do some BlobRepo refactoring which allows CreateChangeset to use repo view instead of BlobRepo to save the snapshot changeset.

Reviewed By: StanislavGlebik

Differential Revision: D30370980

fbshipit-source-id: b1a6a7d9d061dd09d6973c0a6942c22e86387f4a
2021-08-24 09:02:26 -07:00
Yan Soares Couto
13eb987739 Add bubble_id to bonsai changeset create
Summary:
In order to store the snapshots in the ephemeral blobstore, we'll need to pass the bubble via the eden api call.

This diff adds the plumbing for that, by adding bubble_id to the EdenAPI, though for now it doesn't do anything with the value.

Reviewed By: StanislavGlebik

Differential Revision: D30370981

fbshipit-source-id: 88f114798c9f8fd14acfdeed07e8796e6c3470fb
2021-08-24 09:02:26 -07:00
Durham Goode
058fff364d manifest: make BFS iteration async and parallel
Summary:
Sparse profile change computation is quite slow, since globs mean it
has to iterate over a large portion of the tree even if the sparse profile
change is small. Let's make the BFS async and parallel.

Reviewed By: andll

Differential Revision: D30168108

fbshipit-source-id: 4e0de01c6ef7fe53f881bed722c8b406090091ef
2021-08-24 07:55:25 -07:00
Durham Goode
9c66c8abf5 pymatcher: extract pure Rust matchers when possible
Summary:
Avoiding the GIL can speed up tree diff/iteration a lot. Let's extract
the pure Rust matcher when possible. We also convert a Python differencematcher
into a rust DifferenceMatcher when possible, since that is the core use case for
sparse profile change computation.

Reviewed By: andll

Differential Revision: D30168109

fbshipit-source-id: 2466abf3362e947d1caf8769cca6b6fd54409b8d
2021-08-24 07:55:25 -07:00
Durham Goode
2122f33bcc manifest: make matchers Sync
Summary:
In a future diff we'll make tree BFS iteration async and parallel. To
do so we need the matchers to be Send/Sync. Let's update the types for now.

Reviewed By: andll

Differential Revision: D30168110

fbshipit-source-id: ff201a014ca1a34f0d03ca7b5b7e038c170a8354
2021-08-24 07:55:25 -07:00
Durham Goode
28bc9b6e92 [hg pymatcher: add a base matcher extraction API
Summary:
In a future diff we'll want to extract matchers into their pure Rust
forms when possible. Let's create a helper function for matcher extraction. In a
later diff we'll make this function smart.

Reviewed By: andll

Differential Revision: D30168106

fbshipit-source-id: 8fdfa87bfc1617bd5bfabc3e4b0870b64e8cf8fe
2021-08-24 07:55:25 -07:00
Durham Goode
1fa8727690 matcher: add Rust DifferenceMatcher
Summary:
In a later diff we'll be making sparse profile change computation use a
pure Rust matcher. To do so, we need to be able to represent a difference
matcher in Rust.

Reviewed By: andll

Differential Revision: D30168107

fbshipit-source-id: 2f04db619a20226ee5e8b2688df754d907f8b8c6
2021-08-24 07:55:25 -07:00
Durham Goode
ec2dc5f8d0 manifest: remove left vs right store during tree diff
Summary:
The diff algorithm kept track of left vs right stores, and applied the
left vs right tree lookups to the appropriate store. In reality we only ever
have one store, so we're just wasting cycles doing two sequential lookups. Let's
just get rid of the distinction.

Reviewed By: andll

Differential Revision: D30132762

fbshipit-source-id: edd0b9fb7821851cd93df1f17fbf75319cad5813
2021-08-24 07:55:25 -07:00
Durham Goode
13614c3ed4 treemanifest: moving diff fetching to a background thread
Summary:
When testing hg checkout with an empty cache, I noticed the tree
diff'ing phase would alternate between downloading data and doing cpu work. This
implied it was all synchronous. This diff speeds it up by doing the downloading
on a background thread, while the main thread does the actual diff.

Ideally we'd make the actual diff itself parallel as well, but the tree
structure is a tree of semi-mutable references, which would require a larger
refactoring.

Reviewed By: quark-zju

Differential Revision: D29971824

fbshipit-source-id: b4d12a0de8af8e18e8a420d43088663a795db5f8
2021-08-24 07:55:25 -07:00
Durham Goode
002028bf81 manifest: remove reference and lifetimes from traversal structures
Summary:
Now that Link's have Arc<> under the hood, they can be copied. So we
don't need to store references in the traversal structures. This will make
upcoming parallelization changes much easier.

Reviewed By: andll

Differential Revision: D30132763

fbshipit-source-id: ff758de248f578fa7948982d8aa392ae8f034766
2021-08-24 07:55:25 -07:00
Durham Goode
36300e4522 manifest: convert Link to contain an Arc
Summary:
We want to make tree traversals parallelized, but to do that it needs
to be safe to hand different parts of the tree to different threads. The current
structure involves the tree being a straight forward tree of
`Link->BTreeMap<Path, Link>` and the algorithms largely act on references to
Link's. This diff converts Link to actually contain an inner Arc, so in later
diffs we can stop using references and then start sending trees across threads.

Note: The change affects the mutability pattern for trees in an unusual way. See
code comments for details.

Note: The inner-Arc pattern was used (instead of wrapping Link's in Arc) because
generally don't want the Link's to be clonable and we want to avoid the
accidental clones that Arc allows.

Reviewed By: andll

Differential Revision: D30132761

fbshipit-source-id: 8a47b88fc27993420af3d486cbf4e80209cdb3ac
2021-08-24 07:55:24 -07:00
Durham Goode
d836b25947 treemanifest: release the gil during treemanifest diff
Summary:
In a future diff we want to parallel parts of the treemanifest diff
(like the fetching of data). To do so, we need to release the gil so other
threads can use it.

Reviewed By: kulshrax

Differential Revision: D29971827

fbshipit-source-id: 2869c24f9096497024e19ce13c8ed1ace9b660c3
2021-08-24 07:55:24 -07:00
Durham Goode
014816c056 checkout: change checkout matcher to not hold the gil
Summary:
In a later diff we'll make tree diff'ing parallel, so we need the gil
to not be held. Let's switch to a matcher that acquires the gil on demand
instead of relying on it to be held.

Reviewed By: quark-zju

Differential Revision: D30132764

fbshipit-source-id: f06a6c5b76be7b39bf15b74639427324a55b82ed
2021-08-24 07:55:24 -07:00
Durham Goode
1111c18e06 treemanifest: change diff's matcher to not hold the gil
Summary:
In a future diff we want to start allowing a background thread to fetch
tree data while the diff algorithm is running. To do so, we need the gil to not
be held during the diff algorithm. But, the diff algorithm needs to run the
matcher, and the matcher may be in Python. So let's introduce a new matcher
wrapper that acquires the gil.

In the future we should get rid of the python matchers entirely, which will
eliminate this problem.

Reviewed By: kulshrax

Differential Revision: D29971826

fbshipit-source-id: 8a9ba0ea65a0b4748e39178cdf4a08c922755b02
2021-08-24 07:55:24 -07:00
Durham Goode
2617997931 treemanifest: store the treemanifest behind a RwLock
Summary:
In a future diff we'll want to run the treemanifest diff algorithm on a
separate thread from Python, so Python can be used for fetching from a parallel
thread. To do this, we need the tree to be accessible across threads, so let's
put it behind an Arc<RwLock<>>.

Reviewed By: quark-zju

Differential Revision: D29971825

fbshipit-source-id: 6b3ef1025eb7840b905bf60785e05da96980a2d7
2021-08-24 07:55:24 -07:00
Durham Goode
a6f012d779 treemanifest: use Rust store's directly in treemanifest
Summary:
Previously treemanifest kept a reference to the Python store, and any
call would have to go up to Python then come back down to Rust. Since our stores
are now 100% Rust (at least at the top layer), let's just downcast it to the
appropriate Rust store and store that instead.

This helps in a future diff where we want to access the store without taking the
gil.

Reviewed By: kulshrax

Differential Revision: D29971828

fbshipit-source-id: 77ff11897045282c9e6a6029b126dcdd20c8e9db
2021-08-24 07:55:24 -07:00
Aida Getoeva
9684eb8627 mononoke/multiplex: log blob size and multiplex id
Summary:
The diff introduces several small changes:
* It adds logging for the blob size, which can be useful to analyze latency of the `put`/`get` operations.
* Logging of the multiplex id as a multiplexed blobstore configuration used.
* I also added sampling for the `get`/`is_present` with the same rate as is used in blobstore trace table (it seems reasonable to me). `put` is not sampled, because it's not in the blobstore trace. Errors and "some failed others none" are not sampled either.
* Also some small refactoring to make the code look better.

Reviewed By: StanislavGlebik

Differential Revision: D30490848

fbshipit-source-id: a4fef8a1f1f7622054c75afbe09fe4a55d44ac19
2021-08-24 05:44:08 -07:00
Stanislau Hlebik
f4a09e9e63 mononoke: print more info about binary file in admin
Summary: It's useful for debugging

Reviewed By: ahornby

Differential Revision: D30511142

fbshipit-source-id: 33d48658e8aff2a1b1cb074e2bbcab71b971aeb0
2021-08-24 05:29:09 -07:00
Jessica Vandebon
2bad9e8b15 add global killswitch for predictive prefetch profiles
Summary: Added a kill switch to enable/disable predictive prefetch profiles similar to the existing one for regular prefetch profiles (D24803728 (7dccb8a49f)). This can be set manually in a user's config or via the cli `eden prefetch-profile disable-predictive/enable-predictive` commands.

Reviewed By: genevievehelsel

Differential Revision: D30404139

fbshipit-source-id: 01900f4030ef6991124f89a67ea404ff2f07ffeb
2021-08-23 17:55:09 -07:00
Jessica Vandebon
9116cc0eb4 add edenfsctl command to turn predictive prefetch profiles on/off
Summary:
Added eden prefetch-profile activate-predictive/deactivate-predictive subcommands to activate and deactivate predictive prefetch profiles. This will update the checkout config to indicate if predictive prefetch profiles are currently active or not, and stores the overridden num_dirs if specified on activate (--num-dirs N). If activate is called twice with different num_dirs, the value is updated (only one is stored). Unless --skip-prefetch is specified, a predictive prefetch with num_dirs globs (or the default inferred in the daemon) is run.

 Also added fetch-predictive [--num-dirs N], which will:
1. if num_dirs is specified: fetch num_dirs globs predictively
2. if num_dirs is not specified, and predictive fetch is active: get the active num_dirs from the checkout config and fetch globs predictively
3. if num_dirs is not specified, and predictive fetch is not active: fetch the default num_dirs (inferred in the daemon)

Added --if-active to fetch-predictive. If set, fetch will not run if predictive prefetch profiles have not been activated (predictive-prefetch-active in checkout-config). Used for post pull hook.

Reviewed By: genevievehelsel

Differential Revision: D30306235

fbshipit-source-id: ba02c2bc976128704c8ab0c3d567637265b7c95d
2021-08-23 17:55:08 -07:00
Alex Barouski
1c21efc176 Updating url to 2.2.2
Summary:
Part of Rust-analyzer update.

Updated the affected sources (migrage from Url#into_string to Into#into

Reviewed By: jsgf

Differential Revision: D30344564

fbshipit-source-id: fc3ccbe25d7b3d9369a01dfb6b7f8e6a200a7083
2021-08-23 15:59:20 -07:00
Jessica Vandebon
381f9a9e94 minor smartservice updates for consistency with predictive fetch thrift endpoint in daemon
Summary:
Made changes to ensure that numResults is always a 32 bit unsigned int, and startTime and endTime are 64 bit unsigned ints. This is to ensure consistency across the smartservice and the endpoint in the daemon.

Also, updated the scuba query in the smartservice to only consider dirs with > 1 access (may update this later to accept a configurable lower bound on access count, but for now, including access=1 doesn't make sense).

Reviewed By: genevievehelsel

Differential Revision: D30396526

fbshipit-source-id: 10e7bd969928da91ab29d413280a1ff956db438c
2021-08-23 15:16:31 -07:00
Xavier Deguillard
70e58cb755 store: inline HgQueuedBackingStore::recordFetch
Summary:
This is now only used in HgQueuedBackingStore::logBackingStoreFetch, and
manually inlining it allows for the lock to be taken once instead of once per
path, reducing the number of times the lock needs to be acquired.

Differential Revision: D30494771

fbshipit-source-id: 2d59d0343e48051e4d9c4fc196e66bcb79e7ac71
2021-08-23 15:09:05 -07:00
Zhengchao Liu
4fdca8e9ff report imports queue time through fb303
Summary: While `eden trace hg` already prints queue time when it's over 1ms, this diff adds fb303 counters for import tree/block queue time so that we can have the percentiles.

Reviewed By: xavierd

Differential Revision: D30492275

fbshipit-source-id: 3601aeb9b51b2f55f189a0e0a753fd6ef29d7341
2021-08-23 14:20:58 -07:00
Zhengchao Liu
c7f0cb8deb collect tree imports in batch instead of waiting sequentially
Summary: Currently, the store loops through the requests, calls HgImporter, then waits with `getTry`. This diff makes the change to kickoff all tree imports from HgImporter then waits for future fulfillment with `collectAll`.

Reviewed By: xavierd

Differential Revision: D30486459

fbshipit-source-id: 918e52be818a2064cf04d24f455d23c1ca618434
2021-08-23 14:20:57 -07:00
Jun Wu
02186a91c9 tests: stabilize test-debugdynamicconfig.t
Summary:
The `zz_` name could be part of `$TESTTMP`, breaking the test like:

    --- test-debugdynamicconfig.t
    +++ test-debugdynamicconfig.t.err
    @@ -183,21 +183,71 @@
       > other_key=other_bar
       > EOF
       $ hg config --debug | grep zz_
    +  repo: bundle.mainreporoot=$TESTTMP/shared_copy
    +  /private/var/folders/0w/zz_4pgdn32lf_sk3l95ktz2m000xbj/T/hgtests.1j5nyfi4/child1/.hgrc:52: commitcloud.hostname=testhost
    +  /private/var/folders/0w/zz_4pgdn32lf_sk3l95ktz2m000xbj/T/hgtests.1j5nyfi4/child1/.hgrc:54: commitcloud.servicetype=local
    +  /private/var/folders/0w/zz_4pgdn32lf_sk3l95ktz2m000xbj/T/hgtests.1j5nyfi4/child1/.hgrc:56: commitcloud.servicelocation=$TESTTMP
    +  /private/var/folders/0w/zz_4pgdn32lf_sk3l95ktz2m000xbj/T/hgtests.1j5nyfi4/child1/.hgrc:58: commitcloud.token_enforced=False
    +  /private/var/folders/0w/zz_4pgdn32lf_sk3l95ktz2m000xbj/T/hgtests.1j5nyfi4/child1/.hgrc:60: commitcloud.remotebookmarkssync=True
    +  $TESTTMP/shared_copy/.hg/hgrc:5: configs.validatedynamicconfig=True
    ...

Stabilize it by using more complex patterns.

Reviewed By: kulshrax

Differential Revision: D30415779

fbshipit-source-id: ab522b763c1bf6b8a343296282e51566a7f973f1
2021-08-23 13:18:09 -07:00
Jun Wu
47a8e83ccd transaction: track old metalog root as parent
Summary:
This allows us to get more insights on race condition (ex. pull reverts part of
what cloud sync did) issues.

Reviewed By: andll

Differential Revision: D30415135

fbshipit-source-id: c99ce77d2748e503aea523e485be5b7a57ee8b98
2021-08-23 13:18:09 -07:00
Jun Wu
0ad57fb0c1 metalog: update a misleading text
Summary: The "this" and "other" changed should be swapped.

Reviewed By: andll

Differential Revision: D30415134

fbshipit-source-id: 7c14294c6a5926547960e236983879f3c6b746bd
2021-08-23 13:18:09 -07:00
Xavier Deguillard
dff7a4b49e store: deduplicate HgQueuedBackingStore::logBackingStoreFetch a bit
Summary:
Instead of having 2 functions with one taking a single proxy hash, and the
other taking a vector, we can simply have a single function taking a
`folly::Range` and pass a range of one for the single proxy hash case.

Reviewed By: chadaustin

Differential Revision: D30490724

fbshipit-source-id: 5d57f5a5ffc2a5085369c61a2318edd54b24b448
2021-08-23 13:11:51 -07:00
Joe Knox
16996f562f Include all prefix tags in myparenttitleprefix
Summary:
Many diffs include multiple tags as prefixes, however the current implementation only greedily takes prefix as the substring up to ']'.

## Issues
Current behaviour for
- **non-tag right bracket:** `My fake diff title with [link]()` -> `My fake diff title with [link]`
- **multiple tags:** `[hg][extensions] fake diff title` -> `[hg]`

## Solution
Use regex to capture all prefix tags:
```
(?:\[.*?\])+
```

## Explanation
- Non capturing group ( `(?: ... )` )
  - matching the open bracket ( `\[` )
  - and any character as few times as necessary (lazy) ( `.*?` )
  - and the closing bracket ( `\]` )
- matching the group as many times as needed (greedy) ( `+` )

Also note `re.match()` matches from the beginning of the string (unlike `re.search()`)

Reviewed By: ronmrdechai

Differential Revision: D30415867

fbshipit-source-id: e09d4e6d2759d0106d41d1a5d4e607ec34eef3fa
2021-08-23 12:24:43 -07:00
Xavier Deguillard
8127fe0b4b store: make isRecordingFetch_ a relaxed atomic
Summary:
By default, atomics are using the most strict memory ordering forcing barriers
to be used. Since this atomic doesn't need any ordering, we can make it
relaxed.

Reviewed By: chadaustin

Differential Revision: D30459630

fbshipit-source-id: ff50aac919031d9bae8b870b41a6134331546a5f
2021-08-23 11:05:03 -07:00
Xavier Deguillard
ae518f2784 store: devirtualize BackingStore::recordFetch
Summary:
The recordFetch is an implementation detail of a BackingStore and thus we don't
need to explicitely make it virtual.

Differential Revision: D30459635

fbshipit-source-id: 34f847ca906f81924c99c26b4e8af646e91fd735
2021-08-23 11:05:03 -07:00
Xavier Deguillard
98235fe149 store: speed up batching by checking the access logging config only once
Summary:
When prefetching a large number of blobs, repeatly checking whether we should
log accesses to files can become expensive. Since the state of the config isn't
expected to change in the entire batch, we can simply test it once and bail if
logging isn't enabled.

Reviewed By: chadaustin

Differential Revision: D30458698

fbshipit-source-id: b48b9e0ad24585a76d8ce5948f5831db27e08eab
2021-08-23 11:05:03 -07:00
Xavier Deguillard
8a6c320d1e config: remove telemetry:log-object-fetch-path
Summary: Looks like we never use this, thus let's simply remove it.

Differential Revision: D30454812

fbshipit-source-id: 28242a2144da4bab9d24debc1a60eeebcdcbaad5
2021-08-23 11:05:02 -07:00
Xavier Deguillard
6f1f1ba653 store: on prefetch query RocksDB concurrently
Summary:
When a prefetch request is transformed into many blob requests, we query
RocksDB sequentially for all the proxy hashes, this can be quite expensive and
is also far less efficient than querying RocksDB concurrently with all the
hashes.

As a bonus, this also futurize the code a bit.

Reviewed By: chadaustin

Differential Revision: D30454068

fbshipit-source-id: 5fd238b752a662919e739451c0c1e92f66919ebf
2021-08-23 11:05:02 -07:00
Xavier Deguillard
86fe6e5486 store: convert some futures to semifuture
Summary:
Since these are always used as SemiFuture, let's simply make them SemiFuture
from the get go.

Differential Revision: D30452901

fbshipit-source-id: b0863f363ce0cdb921a73d02c43fc82c1614a3dc
2021-08-23 11:05:02 -07:00
Xavier Deguillard
fe0ea26fdf store: avoid copying proxy hashes during prefetch
Summary:
Looking at strobelight when performing an `eden prefetch` shows that a lot of
time is spent copying data around. The list of hash to prefetch is for instance
copied 4 times, let's reduce this to only one time when converting Hash to a
ByteRange.

Reviewed By: chadaustin

Differential Revision: D30433285

fbshipit-source-id: 922e6e5c095bd700ee133e9bb219904baf2ae1ac
2021-08-23 11:05:02 -07:00
Xavier Deguillard
f23abe309f store: reduce critical section for HgImportRequestQueue::markImportAsFinished
Summary:
Once the request has been dequeued, we no longer need to hold the lock, thus
let's release it to allow other threads to enqueue/dequeue requests.

Differential Revision: D30409797

fbshipit-source-id: a527c67a6bd9f47da5a3930364fd8fae0d1bc427
2021-08-23 11:05:02 -07:00
Stanislau Hlebik
82bd59f916 mononoke: optimization to avoid always fetching generation number on gen num traversal
Summary:
In vast majority of cases I expect file/directory history to be linear i.e. no
merges. In that case there's no need to fetch generation number.

Since fetching generation number can trigger reads from db I'd rather avoid
doing that if that's not necessary, and this is what this diff does - it
doesn't start fetching generation numbers while we have a linear history.

Reviewed By: mitrandir77

Differential Revision: D30483093

fbshipit-source-id: 526fd33619c70cc4e0bb033a0048250b650fb2be
2021-08-23 08:35:39 -07:00
Stanislau Hlebik
f9e4525fc1 mononoke: add ordering by gen num in fastlog
Summary:
To be precise, it's ordering by generation number and parent order i.e. we'd
like to show first parents ahead of second parents.
Note that parent ordering is very basic at the moment, and won't always order
commits correctly when both parents have the same generation numbers. We can
improve it in the future, but I believe it shouldn't be a big issue now.

Reviewed By: mitrandir77

Differential Revision: D30483089

fbshipit-source-id: 67e13b5757831d652b57d6ad42b6135005a0b621
2021-08-23 08:35:39 -07:00
Stanislau Hlebik
059e2e051a mononoke: remove history variable from visit function
Summary:
There were two variables that controlled the output of `list_file_history` -
one was `history` variable, another was `bfs`. `history` variable got all
immediate ancestors, and bfs was used to fetch new ancestors.

This split makes it hard to add generation number ordering, so in this diff I
suggest to remove `history` variable altogether and just use `bfs` to control
the order of the history.

Reviewed By: mitrandir77

Differential Revision: D30483094

fbshipit-source-id: 0a4cac771383e17e61f58354a30d4e6db7e6547f
2021-08-23 08:35:39 -07:00
Stanislau Hlebik
1954a74e8e mononoke: make TraversalOrder functions async
Summary:
They will need to become async in the next diffs, let's make them async now to
make next diffs smaller

Reviewed By: mitrandir77

Differential Revision: D30483091

fbshipit-source-id: 8174a2d4618a7dd2721d00d7acd7d700bd57afd1
2021-08-23 08:35:39 -07:00
Stanislau Hlebik
1efa377abb mononoke: add TraversalOrder and use it instead of VecDeque
Summary:
In the next diffs I'd like to make it possible to change the ordering of
commits - currently we only support "bfs order", while I'd like to add
"generation number order".

Reviewed By: mitrandir77

Differential Revision: D30483090

fbshipit-source-id: 82d5a14b26495f5583ca38793023ce3521682237
2021-08-23 08:35:39 -07:00
Stanislau Hlebik
fc6a547559 mononoke: add deny(warnings) for fastlog crate
Reviewed By: mitrandir77

Differential Revision: D30483092

fbshipit-source-id: ffa4a631d7c843f9974df576264ff08daf574652
2021-08-23 08:35:39 -07:00
Stanislau Hlebik
1a319853a3 mononoke: add a binary that can sync changesets to hg servers
Summary:
Simple binary that can be used for syncing changesets to hg servers. It's very
simple - it just moves a bookmark, and then wait until hg sync job syncs it
(obviously it means that if sync job is not running, then it isn't going to be
synced).

It also supports syncing only a straight line of commits with no merges -
merges add complexity here, so I decided to not deal with this complexity for
now.

Reviewed By: mitrandir77

Differential Revision: D30447234

fbshipit-source-id: e4624586e4fc53212c1b13a2cd622aa9474a20b8
2021-08-23 04:59:18 -07:00
Yan Soares Couto
fa62db64d2 Create EphemeralRepoView and Ephemeral Changesets impl
Summary:
This diff is a step towards uploading snapshots to the ephemeral blobstore.

It adds:
- EphemeralChangesets implementation. This is the trait used for storing changesets, and also their generation numbers. Here we are using a SQL table to store mappings between snapshots and bubbles, as well as their generation number. It fetches information from the blobstore as well, which is different from "non-snapshots" as well, but this can be later optimised to use another table if necessary.
- EphemeralRepoView, a container that has a changesets object and a repo_blobstore, both of which first check the ephemeral blobstore, and then the persistent blobstore, and are useful for dealing with snapshots.

Reviewed By: StanislavGlebik

Differential Revision: D30370979

fbshipit-source-id: bf8e1d3c111d307c1ffbad56e1255a77a4871591
2021-08-23 04:28:24 -07:00
Jun Wu
c59cc4ae9f treemanifest: remove prefetchdraftparents
Summary:
It's `O(tr.get('nodes'))`, which does not scale. With BFS prefetch, it's not
that slow if the tree isn't prefetched. It has already been disabled for major
repos D23912965, and causes slowness with lazy changelog (see below).

Reviewed By: StanislavGlebik

Differential Revision: D30454407

fbshipit-source-id: 8027b5e5f1ee09a5f1ffe98a638585345464dd3d
2021-08-20 22:05:25 -07:00
David Tolnay
147e621791 third-party/rust: Update to inherent 1.0
Reviewed By: zertosh

Differential Revision: D30462614

fbshipit-source-id: b8c4001df41f5786855c2c787d661c4418dfe622
2021-08-20 17:40:25 -07:00
Yipu Miao
52cd0a0e60 Let SetPathRootId support file
Summary: This will let ```SetPathRootId``` suppose files

Reviewed By: chadaustin

Differential Revision: D29978308

fbshipit-source-id: df22af8bce4a707a7db51ef543c0e3e78cdcef06
2021-08-20 17:11:23 -07:00
Yipu Miao
5a7f08e073 Rename setPathRootId to setPathObjectId
Summary: This diff renames ```SetPathRootId``` to ```SetPathObjectId``` as we want to support BLOB

Reviewed By: chadaustin

Differential Revision: D30404536

fbshipit-source-id: f34446ec20aeaf87f5f61e29e421a9bceb0b2a4a
2021-08-20 17:11:23 -07:00
Yipu Miao
ff67f9214e Pass getTreeEntryForRootId to ObjectStore
Summary: This will add the same getTreeEntryForRootId to ObjectStore

Reviewed By: chadaustin

Differential Revision: D29920475

fbshipit-source-id: 15bfc6a2ba70cce2095dfcf1f434fd7087605e04
2021-08-20 17:11:23 -07:00
Yipu Miao
a721dd3ef3 Add getTreeEntryForRootId API to BackingStore to get a tree entry by RootId
Summary: Add a new method to backingstore so we can get TreeEntry by rootID

Reviewed By: chadaustin

Differential Revision: D29889482

fbshipit-source-id: 93e63624e75c7d559c4de6f68821a8efa0e0c184
2021-08-20 17:11:23 -07:00
Muir Manders
a75c3e60e3 revset: fix nth ancestor revset w/ multiple bases
Summary: The nth ancestor revset was crashing with multiple base revisions, e.g. "(. + .^)~". Fix variable shadowing issue in revset.ancestorspec.

Differential Revision: D30375233

fbshipit-source-id: 37a78bf1000a40872600e587733a84029f68343b
2021-08-20 12:27:16 -07:00
Zhengchao Liu
05e3a6e23c fix cleanup-apfs handling no stale apfs volume
Summary: This is an untended pop and would throw if there is no stale apfs volumes (and would remove one less volume if there are stale volumes).

Reviewed By: xavierd

Differential Revision: D30432642

fbshipit-source-id: 193d9c15f393a66bc8b43b5f31579c1fe972a7f1
2021-08-20 11:50:58 -07:00
Arun Kulshreshtha
422c57a963 http-client: restructure response interface
Summary:
Restructure the interface of `http-client::AsyncResponse` to make it easier to avoid misuse.

Specifically, both async and non-async responses now consist of two parts: a head (represented by the new `Head` type) and a body. This solves the problem of being able to access the response headers while consuming the response body: there is now an `into_parts` method on `AsyncResponse` that returns `(Head, AsyncBody)`, decoupling ownership of the parts. This approach was inspired by `hyper::Response`.

Previously, this was accomplished by allowing the body to be moved out of the response and replaced with an empty body. This meant that subsequent calls could incorrectly receive an empty body.

Additionally, `AsyncBody` is now an actual type (instead of an alias) which exposes `raw` and `decoded` methods for accessing the body stream. This makes it very explicit what's happening under the hood, and also minimizes the chance of the user forgetting to decode the response.

The new interface looks like:

```
(head, body) = res.into_parts();

// Choose one of the following:
let decoded_content = body.decoded(); // Automatically decompressed content.
let cbor_content = body.cbor(); // Content as deserialized CBOR entries.
let raw_content = body.raw(); // Raw on-wire content.

// Can still access response headers and status.
let status = head.status();

```

One-line usage is still possible with this interface:
```
let content = res.into_body().decoded().try_concat().await?;
```

Reviewed By: yancouto

Differential Revision: D30436322

fbshipit-source-id: 59911afc34b356a9e3295828ac63da5e295f77a6
2021-08-20 10:35:17 -07:00
Arun Kulshreshtha
c44f8687a2 lfs: use http-client's decompression
Summary: Now that Mercurial's `http-client` crate has built-in support for decompressing responses, use that instead of manually doing it in the LFS code.

Reviewed By: andll

Differential Revision: D30269969

fbshipit-source-id: 9189aa1193e947625c1c98735303e0e038b88901
2021-08-19 17:43:50 -07:00
Arun Kulshreshtha
2c83187fb8 http-client: add support for decoding compressed responses
Summary:
In order to support compressed EdenAPI responses, Mercurial's `http-client` needs to be able to understand the `Content-Encoding` response header.

Since we're using libcurl under the hood, ordinarily we'd just need to set `CURLOPT_ACCEPT_ENCODING`, which sets the `Accept-Encoding` header in the request, and causes libcurl to automatically decompress the response.

Unfortunately, it seems that the Rust bindings build libcurl in a way without support for modern compression algorithms like `zstd` and `brotli`. (When I tested it, it seemed to only support `gzip` and `deflate`.) Since we explicitly want to support `zstd` compression, we have no choice but to decompress the received data ourselves.

Reviewed By: andll

Differential Revision: D30267341

fbshipit-source-id: 8627471ec38669fd9836622cd127423c67f2458e
2021-08-19 17:43:49 -07:00
Arun Kulshreshtha
dc08440427 http-client: add getters for response fields
Summary: Add getters for accessing the fields of `Response` and `AsyncResponse`, and make the fields private. This will make it easier to add support for automatic content decompression.

Reviewed By: yancouto

Differential Revision: D30270216

fbshipit-source-id: 8717f127775286ae799df6bcbe0c47b3aa46aa8d
2021-08-19 17:43:49 -07:00
Xavier Deguillard
8ae999ac82 service: remove stray semi-colon
Differential Revision: D30415624

fbshipit-source-id: 176a5b200c19d9f5ec40d2ee8d54d94b12aa8d00
2021-08-19 15:13:48 -07:00
Xavier Deguillard
a9cfd737ac store: do not sanitize the RelativePath stored in ProxyHash
Summary:
The RelativePath is always built from a valid valid one, thus re-validating it
is not necessary.

Reviewed By: chadaustin

Differential Revision: D30410686

fbshipit-source-id: 3e46359f68b1693a0a2af310466fc73d105cf2c0
2021-08-19 15:13:48 -07:00
Zhengchao Liu
11882829af add allowlisted configs to FS trace event logging
Summary:
This adds allowlisted configs to FS trace event sample, which would facilitate A/B testing and parameter tuning. For example, if we want to verify if a larger `hg:import-batch-size` would speed up read operations, we can:
1. split users into two groups, one having size of 16 and another having 32.
2. make sure `hg:import-batch-size` is included in `telemetry:request-sampling-config-allowlist` config.
3. wait for events to populate and compare the durations.

Reviewed By: xavierd

Differential Revision: D30322855

fbshipit-source-id: b3cbdcb64f78d35b8708948db495b2d956cab327
2021-08-19 14:21:52 -07:00
Zhengchao Liu
432d674649 sample FS trace events for logging
Summary:
The current fb303 counters only report aggregated latency while we want to track Eden performance under different version, os, channel, and configs. So I am setting up a new logging mechanism for this purpose.

This diff introduces the class `FsEventLogger` for sampling and logging. There are 3 configs introduced by this diff. The configs are reloaded every 30 minutes.
1. `telemetry:request-sampling-config-allowlist`
A list of config keys that we want to attach to scuba events.

2. `telemetry:request-samples-per-minute`
Max number of events logged to scuba per minute per mount.

3. `telemetry:request-sampling-group-denominators`
* Each type of operation has a "sampling group" (defaulted to 0, which is dropping all).
* We use this sampling group as index to look up its denominator in this config.
* The denominator is then used for sampling. e.g. `1/x` of the events are send to scuba, if we haven't reached the cap specified by #2.

Example workflow:
1. receive tracing event
2. look up denominator of the sampling group of the operation type
3. sample based on the denominator
4. check that we have not exceeded the logging cap per min
5. create sample and send to scribe

Reviewed By: xavierd

Differential Revision: D30288054

fbshipit-source-id: 8f2b95c11c718550a8162f4d1259a25628f499ff
2021-08-19 14:21:52 -07:00
Mateusz Kwapich
e1c8ec4567 new hook to prevent pre-megarepo updates
Summary:
For large megarepos that are result of merging multiple smaller repos
navigating to pre-merge history is usually not what user wants. The checkout
will be slow (in non-edenfs repos), the tooling that expects some repo
structure won't work etc.

Reviewed By: StanislavGlebik

Differential Revision: D30394205

fbshipit-source-id: 23fc4fc31bf01d4cc14f6e3baa1e1165a26a1896
2021-08-19 11:52:48 -07:00
Zhengchao Liu
2e2b9755cf add helper command for deleting stale APFS volumes
Summary:
This adds the `eden redirect cleanup-apfs` command for deleting stale APFS volumes.
* An APFS is considered as stale if it's not currently mounted and not considered as under any of the checkouts managed by the eden instance.
* The command prints the list of such volumes and uses the APFS util to delete them if the user confirms.

Note: as the command is local to an eden instance, it will list not-mounted APFS volumes of a checkout managed by another eden instance as stale. This should rarely happen as in production we expect there to be a single eden instance. The prompt would also let the user abort if something is wrong.

Reviewed By: chadaustin

Differential Revision: D29940980

fbshipit-source-id: e784cb54d20198bb1f74cd5f15cee0e7546b227c
2021-08-19 11:17:59 -07:00
Zeyi (Rice) Fan
0333c3d21c cli: fix long path handling in edenfsctl rm on Windows
Summary: `edenfsctl rm` often breaks down due to long path on Windows. This diff fixes that issue.

Reviewed By: xavierd

Differential Revision: D30380003

fbshipit-source-id: e10faa357df932bdb49d7c62d04d9504c7885768
2021-08-18 16:35:33 -07:00
Xavier Deguillard
b2d658e98d store: speedup EdenAPI blob prefetch
Summary:
By default, a prefetch will always go through the Mercurial importer, but
when store:use-eden-native-prefetch is set, prefetch is simply pushing tons of
blob requests to the HgQueuedBackingStore, and the internal batching takes care
of efficiently fetching.

The one drawback is that prior to pushing a blob request to the queue, getBlob
will query Mercurial to see if a blob is present locally. In the context of a
FUSE access, this is totally expected as this allows for low latency blob
access. But for a prefetch call, throughput matters significantly more and the
local check can negatively affect this.

Reviewed By: genevievehelsel

Differential Revision: D30404965

fbshipit-source-id: 113883993fa641caf7095a5bc8b7dd802f33348d
2021-08-18 15:57:46 -07:00
Xavier Deguillard
819660a10d store: add a comment regarding EdenAPI in the batching code
Summary:
As I'm looking through the code, it took me a bit of time to fully grasp what
the commented code was for, document it for future readers.

Reviewed By: chadaustin

Differential Revision: D30399723

fbshipit-source-id: bdf448b725192d7541b1d7de7e043ff97700dbce
2021-08-18 12:16:05 -07:00
Xavier Deguillard
7ad8a1b6c6 store: remove dead HgBackingStore::getBlob
Summary: This is never called, no need to keep it around.

Reviewed By: chadaustin

Differential Revision: D30399722

fbshipit-source-id: bbc169141b58976031fcae224f24ea23897c6f21
2021-08-18 12:16:05 -07:00
Xavier Deguillard
92e8e76b06 store: replace throwing exceptions with static_assert
Summary:
If a wrong type is passed in, an exception would be thrown at runtime, while
the static_assert would fire at compiled time, reducing the time to find the
error for the developer.

Reviewed By: chadaustin

Differential Revision: D30398255

fbshipit-source-id: fd021f96063565f83c55a9bf3f175bf879afa6ed
2021-08-18 12:16:05 -07:00
Zeyi (Rice) Fan
64ea813b8a doctor: warn about legacy overlay type
Summary: This diff teaches eden doctor to generate a warning when user has SQLite overlay repo on disk and asking them to migrate.

Reviewed By: chadaustin

Differential Revision: D30345721

fbshipit-source-id: 95796ca77979f034904b87e3a38f149baddd720a
2021-08-18 12:08:28 -07:00
Xavier Deguillard
5538bc6dd5 refresh datastore if root tree is not found locally
Summary:
This is a re-submit of D29915585 (6c5c7055ce), I've merely fixed the bug that it introduced,
thus the credit goes to markbt. Below is the original commit message:

If Mercurial asks EdenFS to update to a commit that it has just created, this
can cause a long delay while EdenFS tries to import the commit.

EdenFS needs to get the trees out of the Hg data store.  But these also won't
know about the new trees until the data store is refreshed or synced.

To fix this, call the refresh method on the store if we fail to find the tree,
and try again.  To make this work, we must first only look locally. To keep
things simple, we only do this for the root tree.

However, currently indexedlogdatastore doesn't actually do anything when you
ask it to refresh.

To fix these, we call flush(),  which actually does a sync operation and loads
the latest data from disk, too.

Reviewed By: chadaustin

Differential Revision: D30387805

fbshipit-source-id: 3fdbd27b306f03df53b68a0bcc5ee5dc140326bb
2021-08-18 11:29:53 -07:00
David Tolnay
cf16f0b157 Add nested-values feature to slog
Reviewed By: zertosh

Differential Revision: D30387633

fbshipit-source-id: 27b1d601a73abf522d835c2f857d5a621c2b693b
2021-08-18 10:47:58 -07:00
Yan Soares Couto
6ed51f5514 Remove old futures from cmdlib/futures.rs
Summary:
These functions were used heavily, and used old futures.

That meant a lot of uselessly copied stuff, and harder interop.

I also took the opportunity to pass `CoreContext` around as a reference, and did some BlobRepo refactoring to use attribute traits where possible.

Reviewed By: StanislavGlebik

Differential Revision: D30368261

fbshipit-source-id: 2e63677601fafa3c2e3d9d3340df0a5f31a19a11
2021-08-18 09:31:43 -07:00
Jessica Vandebon
48629a5aca extend top dirs predictive prefetch option to support optional parameter specification
Summary:
The SmartPlatform service that queries for a user's most used directories allows optional parameters of: os, startTime, endTime, and sandcastleAlias instead of user. This diff extends the current predictive prefetch option which queries based on the current user, mount repository, and a default numResults, to allow specification of all parameters including the optional ones.

If a user and/or repo is not specified these are determined from the server state and mount, respectively. If numResults is not specified, a default value is used (predictivePrefetchProfileSize, currently 10,000).

For sandcastle aliases, we check if the SANDCASTLE_ALIAS environment variable is set, and if so, use the value as a parameter. If a sandcastle alias is specified, the smartservice will ignore the user and query based on the alias, otherwise a user is assumed.

Differential Revision: D30160507

fbshipit-source-id: 174797f0a6f840bb33f669c8d1bb61d76ff7a309
2021-08-18 06:42:17 -07:00
Stanislau Hlebik
410f2bfc94 mononoke: make it possible to force unodev2 behaviour everywhere
Reviewed By: mitrandir77

Differential Revision: D30368035

fbshipit-source-id: c697138cbf4564a80361fde450aad4f2948eb7ed
2021-08-18 00:38:36 -07:00
Stanislau Hlebik
38bcc731be mononoke: fix build
Summary: There was a land race.

Differential Revision: D30390470

fbshipit-source-id: 70cb73c25aea7dd04c08e2af9609ea1fa33d6988
2021-08-18 00:38:36 -07:00
Pyre Bot Jr
886752f9d0 suppress errors in fbcode/eden - batch 1
Differential Revision: D30369366

fbshipit-source-id: 203e060fb1065d1f6475a08884c0db512984a91e
2021-08-17 19:11:40 -07:00
Xavier Deguillard
ee80b1a67f integration: use count metric instead of rate
Summary:
The rate metric can be unreliable, and in some environment is never updated by
the time it is read by the test. Since this test cares about the number of
events, using count is a better metric, and more reliable.

Differential Revision: D30377128

fbshipit-source-id: f10c656567e3a3c07b66ecc6fc563a53199e3088
2021-08-17 17:29:33 -07:00
Robbin Xu
0af6c0031f Revert D30351289: Add nested-values feature to slog
Differential Revision:
D30351289 (637bd00002)

Original commit changeset: b6c1c896b06c

fbshipit-source-id: c226f283a744170bb6bc2ed0b00e59249f9392c3
2021-08-17 16:33:26 -07:00
Matt Smith
637bd00002 Add nested-values feature to slog
Summary:
The diff is giant, but it's just a one-line change to add the
nested-values feature to slog, we just have a whole bunch of projects dependent
on slog.

Reviewed By: dtolnay

Differential Revision: D30351289

fbshipit-source-id: b6c1c896b06cbdf23b1f92c0aac9a97aa116085d
2021-08-17 15:28:16 -07:00
Chad Austin
8e0d52f163 thriftformat
Summary: Apply automated reformatting to our Thrift files.

Reviewed By: zertosh

Differential Revision: D30372146

fbshipit-source-id: a2fe363a6a17026078d11540b5e9359d097fb56c
2021-08-17 11:30:55 -07:00
David Tolnay
1ae4fb3039 Update to new configerator client
Summary: `//common/rust/shed/cached_config` is the center of a dependency graph that all only uses old configerator because cached_config uses it. This diff switches all of these over to the new client.

Reviewed By: farnz

Differential Revision: D30357631

fbshipit-source-id: 9a9df74096aa38a06371c6bc787245af71175e48
2021-08-17 11:02:08 -07:00
Yan Soares Couto
1d639f5a93 derived_data: introduce DerivedDataManager
Summary:
The `DerivedDataManager` will manage the ordering of derivation for derived
data, taking into account dependencies between types as well as the topological
ordering of the repository.  It will replace the free functions in
`derived_data` as well as much of the `utils` crate.

This is the first step: it introduces the manager, although currently it only takes
over management of the derived data lease.

Reviewed By: mitrandir77

Differential Revision: D30281634

fbshipit-source-id: 04c3a34d97ea02cc8c26d34096cca341e800da9b
2021-08-17 10:30:07 -07:00
Yan Soares Couto
be8daaa23c derived_data: make mapping not depend on BlobRepo
Summary:
In preparation for the derived data manager, ensure that derived data
mappings do not require a `BlobRepo` reference.

The main use for this was to log to scuba.  This functionality is extracted out
to the new `BonsaiDerivedMappingContainer`, which now contains just enough
information to be able to log to scuba.

Reviewed By: mitrandir77

Differential Revision: D30135447

fbshipit-source-id: 1daa468a87f297adc531cb214dda3fa7fe9b15da
2021-08-17 10:30:07 -07:00
Stanislau Hlebik
dc8bf342da mononoke: set mutable renames while creating move commits
Reviewed By: mitrandir77

Differential Revision: D30338443

fbshipit-source-id: de5e39aad224c29cfe0bbdce011624037811aa36
2021-08-17 08:01:28 -07:00
Stanislau Hlebik
995a0a1bd5 mononoke: introduce DirectoryMultiMover
Summary:
We have mover only for files, and it doesn't quite work for directories - at
the very least directory can be None (i.e. root of the repo).

In the next diffs we'll start recording files and directories renames during
megarepo operations, so let's DirectoryMultiMover as a preparation for that.

Reviewed By: mitrandir77

Differential Revision: D30338444

fbshipit-source-id: 4fed5f50397a7d3d8b77f23552921d515a684604
2021-08-17 08:01:28 -07:00
Simon Farnsworth
bd66f8a79b Add megarepo API to create a release branch point
Summary:
AOSP megarepo wants to create release branches from existing branches, and then update configs to follow only release-ready code.

Provide the primitive they need to do this, which takes an existing commit and config, and creates a new config that tracks the same sources. The `change_target_config` method can then be used to shift from mainline to release branch

Reviewed By: StanislavGlebik

Differential Revision: D30280537

fbshipit-source-id: 43dac24451cf66daa1cd825ada8f685957cc33c1
2021-08-17 06:56:29 -07:00
Egor Tkachenko
51367815cd Moving thrift targets
Summary:
I was adding thrift fiddle support to my derivation service like this https://www.internalfb.com/intern/wiki/Rust-at-facebook/Thrift/Writing_a_Rust_Thrift_Server/#thrift-fiddle and run into errors with generated thrift code P439166788. After searching a little bit I came across the post in Thrift Users group with this comment https://fb.workplace.com/groups/thriftusers/posts/497757970933620/?comment_id=498850394157711
So in this diff I'm moving all `thrift_library` targets into the directory together with .thrift file itself.

Reviewed By: ahornby

Differential Revision: D30300919

fbshipit-source-id: bb2d7e2a98d6ba783e6249963b3a1dfcd6d62669
2021-08-17 06:49:44 -07:00
Stanislau Hlebik
06b34ca66e mononoke: use mutable_renames in fastlog
Summary:
Let's make it possible to query mutable renames from fastlog. For now this is a
very basic support i.e. we don't support middle-of-history renames, blame is
not supported etc.

Mutable rename logic is gated by a tunable, so we can roll it back quickly in
case of problems.

Reviewed By: ahornby

Differential Revision: D30279932

fbshipit-source-id: 0e8e329e8ab4d4980ab401bd103e6c97419d0f67
2021-08-17 01:18:59 -07:00