Commit Graph

7158 Commits

Author SHA1 Message Date
Katie Mancini
2d6fd038e9 Make TreeInode::prefetch metadata prefetching aware
Summary:
Readdir tries to be smart and prefetch the metadata for each of the children.
But this uses the old path to read metadata for files which can cause eden to
download the blob. When metadata prefetching is turned on in the backing store
it is better to leave this to metadata prefetching to the backing store.

Reviewed By: wez

Differential Revision: D23476876

fbshipit-source-id: 41cc5e6f423f19adb18581564c069c12621b6c1b
2020-09-10 13:29:36 -07:00
Zeyi (Rice) Fan
dec1cc3fb2 handle non-empty directory when creating redirections
Summary:
This diff fixes a bug on Windows when the redirection target is a non-empty directory. As seen in P141872812

This doesn't make the exception go away but generate a more meaningful error message so the user can act on it.

Reviewed By: xavierd

Differential Revision: D23605233

fbshipit-source-id: 2d2bde0e9cd94323a6537ebcec29a4c15868806d
2020-09-10 09:20:03 -07:00
Viet Hung Nguyen
4a6351c8a2 mononoke/repo_import: check dependent systems for small repo,
Summary: Once we start to move the bookmark for the large repo commits, small repo commits should also start to appear for the dependent systems (e.g. Phabricator) through back-syncing. This diff adds this functionality to see if the commits have been recognised by the tools.

Reviewed By: StanislavGlebik

Differential Revision: D23566994

fbshipit-source-id: 2f6f3b9099bb864fec6a488064abe1abe7f06813
2020-09-10 05:46:35 -07:00
Lukasz Piatkowski
1d2340782a mononoke/integration: exclude the most flaky tests (#55)
Summary: Pull Request resolved: https://github.com/facebookexperimental/eden/pull/55

Reviewed By: farnz

Differential Revision: D23622449

Pulled By: lukaspiatkowski

fbshipit-source-id: 79e1895f2c6191a2968d0cff226a38ba47188431
2020-09-10 03:26:09 -07:00
Simon Farnsworth
1f7d61a04f Teach mononoke_admin blobstore-fetch to save the raw contents to a file
Summary: Useful when looking into blobstore corruption - you can compare all the blobstore versions by manual fetchees.

Reviewed By: krallin

Differential Revision: D23604436

fbshipit-source-id: 7b56947b0188536499514bae6615c6e81b9106c3
2020-09-10 02:29:48 -07:00
Simon Farnsworth
4754357f62 Asyncify more of blobstore_fetch admin command
Summary: Going to add more features, so simplify by asyncifying first

Reviewed By: krallin

Differential Revision: D23604437

fbshipit-source-id: 52b2b372e4d3fbf1d59168c6c11311d9edf4ff0f
2020-09-10 02:29:48 -07:00
Simon Farnsworth
89e30973ff Report write errors when scrubbing
Summary: When we're scrubbing blobstores, it's not actually a success state if a scrub fails to write. Report this back to the caller - no-one will usually be scrubbing unless they expect repair writes to succeed, and a failure is a sign that we need to investigate further

Reviewed By: mitrandir77

Differential Revision: D23601541

fbshipit-source-id: d328935af9999c944719a6b863d0c86b28c54f59
2020-09-10 02:29:47 -07:00
Lukasz Piatkowski
c044f1669a mononoke/integration tests: deal with bash issues on tests (#50)
Summary:
One test was fixed earlier by switching MacOS to use modern version of bash, the other is fixed here by installing "nmap" and using "ncat" from within it on both linux and mac.

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

Reviewed By: krallin

Differential Revision: D23599695

Pulled By: lukaspiatkowski

fbshipit-source-id: e2736cee62e82d1e9da6eaf16ef0f2c65d3d8930
2020-09-10 01:56:54 -07:00
Arun Kulshreshtha
54641e8d1b edenapi_server: remove extraneous fields/methods from RequestContext
Summary: Remove unused fields and superfluous methods from `RequestContext`.

Reviewed By: singhsrb

Differential Revision: D23619076

fbshipit-source-id: 0fc42d6c29a8bb5c197d3559baa497a9e6e9c825
2020-09-09 22:43:31 -07:00
Durham Goode
f5a2347fbb py3: fix Mononoke Python 3 test failures
Summary:
Fixes a few issues with Mononoke tests in Python 3.

1. We need to use different APIs to account for the unicode vs bytes difference
for path hash encoding.
2. We need to set the language environment for tests that create utf8 file
paths.
3. We need the redaction message and marker to be bytes.  Oddly this test still
fails with jq CLI errors, but it makes it past the original error.

Reviewed By: quark-zju

Differential Revision: D23582976

fbshipit-source-id: 44959903aedc5dc9c492ec09a17b9c8e3bdf9457
2020-09-09 18:31:04 -07:00
Xavier Deguillard
ed4021b8e3 revisionstore: disallow reading LFS pointers from packfiles
Summary:
For repositories that have the old-style LFS extension enabled, the pointers
are stored in packfiles/indexedlog alongside with a flag that signify to the
upper layers that the blob is externally stored. With the new way of doing LFS,
pointers are stored separately.

When both are enabled, we are observing some interesting behavior where
different get and get_meta calls may return different blobs/metadata for the
same filenode. This may happen if a filenode is stored in both a packfile as an
LFS pointers, and in the LFS store. Guaranteeing that the revisionstore code is
deterministic in this situation is unfortunately way too costly (a get_meta
call would for instance have to fully validate the sha256 of the blob, and this
wouldn't guarantee that it wouldn't become corrupted on disk before calling
get).

The solution take here is to simply ignore all the lfs pointers from
packfiles/indexedlog when remotefilelog.lfs is enabled. This way, there is no
risk of reading the metadata from the packfiles, and the blob from the
LFSStore. This brings however another complication for the user created blobs:
these are stored in packfiles and would thus become unreadable, the solution is
to simply perform a one-time full repack of the local store to make sure that
all the pointers are moved from the packfiles to to LFSStore.

In the code, the Python bindings are using ExtStoredPolicy::Ignore directly as
these are only used in the treemanifest code where no LFS pointers should be
present, the repack code uses ExtStoredPolicy::Use to be able to read the
pointers, it wouldn't be able to otherwise.

Reviewed By: DurhamG

Differential Revision: D22951598

fbshipit-source-id: 0e929708ba5a3bb2a02c0891fd62dae1ccf18204
2020-09-09 18:27:42 -07:00
Stefan Filip
1c172c9008 lfs: use hg-http built client for network requests
Summary: This client provides automatic metrics collection.

Reviewed By: kulshrax

Differential Revision: D23577871

fbshipit-source-id: 137299222a20bc8e4d52c3321febbb91d861b236
2020-09-09 17:35:49 -07:00
Stefan Filip
046db98222 edenapi: use hg-http built client for network requests
Summary:
hg-http's built client should provide integration with Mercurial's stats
collection mechanisms.

Reviewed By: kulshrax

Differential Revision: D23577867

fbshipit-source-id: 93c777021bc347511322269d678d6879710eed3e
2020-09-09 17:35:48 -07:00
Stefan Filip
c1ab6a4e92 http-client: add stats reporting hook
Summary:
Add `with_stats_reporting` to HttpClient. It takes a closure that will be
called with all `Stats` objects generated. We then use this function in
the hg-http crate to integrate with the metrics backend used in Mercurial.

Reviewed By: kulshrax

Differential Revision: D23577869

fbshipit-source-id: 5ac23f00183f3c3d956627a869393cd4b27610d4
2020-09-09 17:35:48 -07:00
Stefan Filip
008d0c82df metrics: use the hgmetrics bindings for incrementing counters
Summary: Rust based metrics so that even Rust libraries can write metrics.

Reviewed By: quark-zju

Differential Revision: D23577870

fbshipit-source-id: b19904968d9372c8ce19775fb37c7af53a370ea5
2020-09-09 17:35:48 -07:00
Stefan Filip
de9b34e83a bindings: add pyhgmetrics to bind the hg-metrics crate
Summary: Exposing the hg-metrics crate to the Python application.

Reviewed By: quark-zju

Differential Revision: D23577875

fbshipit-source-id: 1d919160f8514ae8bfcb0171a0c9d1d9d0de80e6
2020-09-09 17:35:48 -07:00
Stefan Filip
7f72a04c0e metrics: crate for collecting metrics
Summary:
We start off simple here. Python only really has counters so we only implement
counters. There are a lot of options on how to improve this and things get
slightly complicated when we look at the how ecosystem and fb303. Anyway,
simple start.

Reviewed By: quark-zju

Differential Revision: D23577874

fbshipit-source-id: d50f5b2ba302d900b254200308bff7446121ae1d
2020-09-09 17:35:48 -07:00
Stefan Filip
ead17552cf metrics: treat slash '/' as metric delimiter
Summary:
Slash is probably the standard metric delimiter nowadays. Since we don't have
that many metrics I think that it makes sense to look at slash as the
standard metric delimiter going forward.
This diff updates parsing of metric names to treat both '_' and '/' as
delimiters.

Reviewed By: quark-zju

Differential Revision: D23577876

fbshipit-source-id: 03997b1285df9c52d6e2837b5af5372deb69b133
2020-09-09 17:35:48 -07:00
Stefan Filip
4ad9091598 thrift: update thrift types
Summary: autogenerated by `make local`

Reviewed By: quark-zju

Differential Revision: D23577872

fbshipit-source-id: 6ca98fd865c3b3bc3a00d8126ce20b59110f8118
2020-09-09 17:35:48 -07:00
Liubov Dmitrieva
321f4dfb31 add hg cloud switch command to simplify switching between
Summary:
The command is easier to use than `hg cloud join --switch`.

Also highlight the workspace name in the output of `hg cloud status`

Reviewed By: mitrandir77

Differential Revision: D23601507

fbshipit-source-id: 74eb17c9366a9dbe96881c8e3e0705619fadb3d6
2020-09-09 14:04:57 -07:00
Viet Hung Nguyen
0c84fb7a2b mononoke/mononoke_types: implement deserialize for typed_hashes
Summary:
typed_hash only implements serialize. Because of this, if we want to serialize a struct that contains e.g changesetid(s), we can't deserialize it later. This diff adds deserialize implementation for typed_hashes.
Implementation is similar to HgNodeHash's: https://fburl.com/diffusion/r3df5iga

Reviewed By: krallin

Differential Revision: D23598925

fbshipit-source-id: 4d48b75eb8a01028e6e2d9bcc1ae20051a97b7fb
2020-09-09 11:35:38 -07:00
Pavel Aslanov
897ec3d6d8 verify that received files have the correct size
Summary:
Streaming clone implementation did not check that received files have the corrects. This change addresses it.

Before this change if connection was interrupted for whatever reason client would treat fetch of changeset as successful and proceed with cloning operations, but later checks would report corruption of internal state of hg data. This is based on user [report](https://fb.workplace.com/groups/scm/permalink/3177150312334567/)

Reviewed By: quark-zju, krallin

Differential Revision: D23572058

fbshipit-source-id: d740b45ca217cd6db0a65e01aabc2ba9a4835221
2020-09-09 11:32:38 -07:00
Saurabh Singh
384c4f61fa fix the Windows build
Reviewed By: sfilipco

Differential Revision: D23601358

fbshipit-source-id: c5a33286b7468882bbedb3e8fe85f66a8f9db0e2
2020-09-09 10:39:35 -07:00
Arun Kulshreshtha
de7f7ab4fe http-client: rename crate
Summary: The Mercurial codebase uses hyphens in crate names rather than underscores. This is similar to the convention favored by the larger Rust community, though it is different from Mononoke, which uses underscores. While we'll probably need to eventually settle on a consistent convention for all of projects in the Eden SCM repo, for now, `http_client` should be made consistent with the adjacent crates.

Reviewed By: sfilipco

Differential Revision: D23585721

fbshipit-source-id: d2e690d86815be02d7b8d645198bcd28e8cbd6e0
2020-09-09 10:12:50 -07:00
Xavier Deguillard
99a1771351 notifications: compile on Windows
Summary:
While it's unlikely to work properly (it uses /bin/sh), it compiles properly on
Windows, so let's include it in the build.

Reviewed By: wez

Differential Revision: D23520368

fbshipit-source-id: 267ba04f98f5dacc81e1772f86f5ad43c846815d
2020-09-09 09:33:35 -07:00
Stanislau Hlebik
b5f1e53cd6 mononoke: use logical number of cpus in our runtime
Summary:
We are using older version of tokio which spawns as many threads as we have
physical cores instead of the number of logical cores. It was fixed in
https://github.com/tokio-rs/tokio/issues/2269 but we can't use it yet because
we are waiting for another fix to be released -
https://github.com/rust-lang/futures-rs/pull/2154.

For now let's hardcode it in mononoke

Reviewed By: krallin

Differential Revision: D23599140

fbshipit-source-id: 80685651a7a29ba8938d9aa59770f191f7c42b8b
2020-09-09 09:25:40 -07:00
Pavel Aslanov
f87db3eecf move existing changeset derivation logic to mercurial_derived_data
Summary:
This change move logic associated with mercurial changeset derivation to `mercurial_derived_data` crate.

NOTE: it is not converted to derived data infrastructure at this point, it is a preparation step to actually do this

Reviewed By: farnz

Differential Revision: D23573610

fbshipit-source-id: 6e8cbf7d53ab5dbd39d5bf5e06c3f0fc5a8305c8
2020-09-09 07:56:32 -07:00
David Tolnay
e83e05ff25 Update formatter to rustfmt 2.0
Reviewed By: zertosh

Differential Revision: D23591028

fbshipit-source-id: f458503fc2b9c25023fa1643eca5e166882a4811
2020-09-09 07:52:34 -07:00
David Tolnay
0cb8a052f5 Update formatter to rustfmt 2.0
Reviewed By: zertosh

Differential Revision: D23591021

fbshipit-source-id: e664aa2fdd3aaa457796a59080be6b94f604a112
2020-09-09 07:52:33 -07:00
Lukasz Piatkowski
c983dc96fe mononoke/integration tests: fix using private certs during Mac tests with hg (#53)
Summary:
The Mac integration test workflow already installs a modern curl that fixes https://github.com/curl/curl/issues/4801, but it does so after "hg" is built, so "hg" uses the system curl libraries, which fails when used with a certificate not present in keychain.

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

Reviewed By: krallin

Differential Revision: D23597285

Pulled By: lukaspiatkowski

fbshipit-source-id: a7b8b6ae55ce338bfb9946a852cbb6b929e73203
2020-09-09 07:28:09 -07:00
Simon Farnsworth
9b9607b02e Have manual_scrub continue on errors, writing out files to let you retry instead
Summary:
There are blobs that fail to scrub and terminate the process early for a variety of reasons; when this is running as a background task, it'd be nice to get the remaining keys scrubbed, so that you don't have a large number of keys to fix up later.

Instead of simply outputting to stdout, write keys to one of three files in the format accepted on stdin:

1. Success; you can use `sort` and `comm -3` to remove these keys from the input dat, thus ensuring that you can continue scrubbing.
2. Missing; you can look at these keys to determine which blobs are genuinely lost from all blobstores, and fix up.
3. Error; these will need running through scrub again to determine what's broken.

Reviewed By: krallin

Differential Revision: D23574855

fbshipit-source-id: a613e93a38dc7c3465550963c3b1c757b7371a3b
2020-09-09 07:25:13 -07:00
Simon Farnsworth
aa2df38491 Improve errors on scrub failure
Summary:
With three blobstores in play, we have issues working out exactly what's wrong during a manual scrub. Make the error handling better:

1. Manual scrub adds the key as context for the failure.
2. Scrub error groups blobstores by content, so that you can see which blobstore is most likely to be wrong.

Reviewed By: ahornby, krallin

Differential Revision: D23565906

fbshipit-source-id: a199e9f08c41b8e967d418bc4bc09cb586bbb94b
2020-09-09 07:25:13 -07:00
Harvey Hunt
06941b4fad mononoke: Don't sort bookmark names using SQL
Summary:
Sorting bookmark names can be expensive for the MySQL server. As we
don't rely on the ordering of bookmark names when requesting all bookmarks,
remove the sorting.

I've not modified the `Select.*After` queries as they are used for pagination,
which does rely on the order of bookmark names. Further, any queries for
bookmarks that have a limit other than `std::u64::MAX` will remain sorted.

Reviewed By: ahornby

Differential Revision: D23574741

fbshipit-source-id: 79e07b64bb8bb34229c429bdf885c5144963f140
2020-09-09 07:08:26 -07:00
Lukasz Piatkowski
2b65fabc17 mononoke/integration tests: remove non-existent test-traffic-replay.t from exclusion list (#54)
Summary: Pull Request resolved: https://github.com/facebookexperimental/eden/pull/54

Reviewed By: ahornby

Differential Revision: D23597167

Pulled By: lukaspiatkowski

fbshipit-source-id: 1bc92ff32384a02ef019778a20c44634addadf25
2020-09-09 07:00:54 -07:00
Stanislau Hlebik
f0d44ef2aa mononoke: remove copy-paste when creating cs args factories
Reviewed By: krallin

Differential Revision: D23596215

fbshipit-source-id: b4f89ac56e033b0c976a001575f5862819f552a4
2020-09-09 05:45:30 -07:00
Lukasz Piatkowski
c9bbf63cab mononoke/integration tests: handle case-sensitive related tests (#49)
Summary:
The test-blobimport.t creates few files that are conflicting in a case insensitive file system, so make them differ by changing number of underscores in one of the files.

test-pushrebase-block-casefolding.t is directly testing a feature of case sensitive file system, so it cannot be really tested on MacOS

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

Reviewed By: farnz

Differential Revision: D23573165

Pulled By: lukaspiatkowski

fbshipit-source-id: fc16092d307005b6f0c8764c1ce80c81912c603b
2020-09-09 03:53:32 -07:00
Stanislau Hlebik
66fbdf72c7 mononoke: add sampling for redacted accesses
Summary:
Previously we were not logging a redacted access if previous access was logged
less < MIN_REPORT_TIME_DIFFERENCE_NS ago. That doesn't work well with our
tests.

Let's instead add a sampling tunable.

Reviewed By: krallin

Differential Revision: D23595067

fbshipit-source-id: 47f6152945d9fdc2796fd1e74804e8bcf7f34940
2020-09-09 02:51:41 -07:00
Pavel Aslanov
32e162c197 move function used by mercurial_derived_data into a separate crate
Summary: Moving some of the functionality (which is required for mercurial changeset derivation) into a separate crate. This is required to convert mercurial changeset to derived data to avoid circular dependency it would create otherwise.

Reviewed By: StanislavGlebik

Differential Revision: D23566293

fbshipit-source-id: 9d30b4b3b7d8a922f72551aa5118c43104ef382c
2020-09-09 02:48:09 -07:00
Lukasz Piatkowski
379065faab eden/scm: remove leftover of tokio-core after tokio 0.2 migration (#52)
Summary: Pull Request resolved: https://github.com/facebookexperimental/eden/pull/52

Reviewed By: krallin

Differential Revision: D23594074

Pulled By: lukaspiatkowski

fbshipit-source-id: 776c02418f4951321887f566bac8b76c9da8bcc1
2020-09-09 02:32:49 -07:00
Xavier Deguillard
1392af4423 service: do not special case WSAEADDRINUSE on bind
Summary:
In some very rare scenario, we're seeing bind fail due to WSAEADDRINUSE, and
I'm suspecting that a connect race is going on, where connect creates the file
on disk while a bind is ongoing. Since at this point there is no way for
another EdenFS process to be alive due to the fs lock being held, there is no
way for the socket to be already bound to another EdenFS process. Thus, we can
remove the special case.

Reviewed By: genevievehelsel

Differential Revision: D23591009

fbshipit-source-id: 094a7926aa9ac45ea9dea5646000aa287a9b5b7a
2020-09-08 21:18:04 -07:00
Zeyi (Rice) Fan
5e02a93e91 eden-client: move to use tokio 0.2 socket transport
Summary: No more tokio-core! More `async/await`.

Reviewed By: kulshrax

Differential Revision: D23586509

fbshipit-source-id: b2e766ddb7575bc96963432f0c8582b4370b19aa
2020-09-08 20:24:26 -07:00
Genevieve Helsel
6a9395dff2 fix command line parsing tests on mac
Summary: These are now not working on mac due to the Catalina upgrade, so fixing here to be multi platform compatible by just following our same steps for path resolution.

Reviewed By: wez

Differential Revision: D23582015

fbshipit-source-id: e813986f5523bb721a4f01679559380c2348b98c
2020-09-08 18:43:05 -07:00
Zeyi (Rice) Fan
01315a9bbc fix SpawnedProcess ERROR_BAD_LENGTH
Summary: This fixes the `The program issued a command but the command length is incorrect` error we have been seeing in EdenFS Windows.

Reviewed By: wez

Differential Revision: D23589264

fbshipit-source-id: 72478a653ff07fca81c163bab12c0fd33f6a0a67
2020-09-08 18:25:04 -07:00
Zeyi (Rice) Fan
a6a73ec6b6 switch to tokio 0.2 transport
Summary:
This diff adds a `SocketTransport` implementation that no longer uses legacy `tokio-core` based futures but `tokio-tower` and `tower-service` for processing Thrift requests.

The old implementation is renamed to `SocketTransportLegacy` for better transitioning.

Reviewed By: dtolnay

Differential Revision: D20019196

fbshipit-source-id: 3bee684e9254bf1a81669ef0d2c2262a55e75daa
2020-09-08 17:53:57 -07:00
Zeyi (Rice) Fan
26c8020522 explicitly specify features for tokio-util
Summary: This is needed in a later diff that requires "codec" feature from `future-util`.

Reviewed By: dtolnay

Differential Revision: D23575630

fbshipit-source-id: e9cdf11b6ec05e5f2744da6b6efd8cb7bf08b212
2020-09-08 17:53:56 -07:00
Saurabh Singh
858dbc6861 tests: fix 'test-remotefilelog-undesired-file-logging.t'
Reviewed By: DurhamG

Differential Revision: D23589645

fbshipit-source-id: 350bab980baa811824d7c4fd36d689a5a3395dd8
2020-09-08 17:36:35 -07:00
Xavier Deguillard
1f94f8d652 win: add eden.exe to the package
Summary:
One of the difference between linux/macOS and Windows is that `edenfsctl` needs
to be used while `eden` works on the other platforms. This forces both users to
change their habit, and all the scripts at FB to be changed to take edenfsctl
into consideration.

Reviewed By: chadaustin

Differential Revision: D23550567

fbshipit-source-id: de2b0853137409e595a0012ca9286c37208b98a1
2020-09-08 16:33:55 -07:00
Kostia Balytskyi
39d1cd8a47 synced_commit_mapping: add get which returns a vec
Summary:
This method is a future of synced-commit-mapping: there can be multiple query
results and we should make a decision of whether it is acceptable for the
business logic in the business logic, rather than pick a random one.

In later diffs I will introduce the consumers for this method.

Reviewed By: mitrandir77

Differential Revision: D23574165

fbshipit-source-id: f256f82c9848f54e5096c6e50d42600bfd260081
2020-09-08 13:36:04 -07:00
Kostia Balytskyi
8e2b7754c4 synced_commit_mapping: rename get into get_one
Summary:
Another preparatory step for the actuall mapping model fix. This just renames
`get` method into a `get_one` to emphasize it's use-case and to ease the search later.

At the end of this change, I expect there to be no use-cases for `get_one` and expect is to be gone.

Reviewed By: mitrandir77

Differential Revision: D23574116

fbshipit-source-id: f5015329b15f3f08961006607d0f9bf10f499a88
2020-09-08 13:36:04 -07:00
Kostia Balytskyi
688309059b commit_rewriting: extract existing commit_sync_outcome into a file
Summary: This is just preparatory extraction to make further work more convenient.

Reviewed By: mitrandir77

Differential Revision: D23574077

fbshipit-source-id: 352ca8ac62bae4fd8fcb980da05c95ce477a414e
2020-09-08 13:36:04 -07:00