Commit Graph

1929 Commits

Author SHA1 Message Date
Jun Wu
b2534c7d68 dag: update overlay_map_next_id on flush
Summary:
During flush, there could be newly added vertexes in the master group,
overlay_map_next_id needs to be updated accordingly so lazy lookup
can still work. This is especially needed when the non-master group
needs to be re-assigned.

Reviewed By: andll

Differential Revision: D30314051

fbshipit-source-id: cce7080f62aec2617b8f3d7194864df41dfff7e0
2021-08-16 14:24:48 -07:00
Jun Wu
6bf7d34f3a dag: avoid invalid state in fast pull path
Summary:
In case anything went wrong in the pull fast path, preserve `self` as unchanged
to avoid possible issues.

Reviewed By: andll

Differential Revision: D30314052

fbshipit-source-id: 127a7aeda8f27f7862d1ad92847c2e911131b4b4
2021-08-16 14:24:48 -07:00
Jun Wu
762be86dbe dag: add tracing logs for clone and pull
Summary:
Will be used in tests to check what data is inserted into IdMap during clone or
pull.

Reviewed By: andll

Differential Revision: D30314054

fbshipit-source-id: 8a58473ef3d85263985c1be8a6c57a9a10b3fdb4
2021-08-16 12:51:04 -07:00
Jun Wu
599406df26 dag: add a way to skip flushing certain vertexes fetched remotely
Summary:
In rare cases, the local IdMap might miss parents of draft roots.
This provides a way to emulate that in tests.

Reviewed By: andll

Differential Revision: D30314050

fbshipit-source-id: 09983604bf3259e62a41224a579774265ae0b272
2021-08-16 12:51:04 -07:00
Jun Wu
67ccb97d45 dag: add more failpoints on some errors
Summary: This would help investigate some errors.

Reviewed By: andll

Differential Revision: D30314057

fbshipit-source-id: 070e75cf0a39180c544b49c9ed1292d8536040fa
2021-08-16 12:51:04 -07:00
Yan Soares Couto
7a1085d2ac Add validation that only snapshots can contain untracked/missing files
Summary:
- This diff adds validation so that changesets that are not snapshots cannot have untracked or missing files.
- It removes the THIS IS A SNAPSHOT commit message.
- It makes the snapshot created by `hg snapshot createremote` be an actual snapshot.

Differential Revision: D30159184

fbshipit-source-id: 976968c0c2222f950a4a937aa805b25dc07c9207
2021-08-16 09:19:06 -07:00
Yan Soares Couto
c1e83d3dbd snapshot: Also upload new files, untracked, and removed
Summary:
This diff makes the snapshot command upload all types of files that were missing (added/untracked/missing/deleted), using the new types of file changes added on the previous diff.

Next steps:
- Add some indicator to Bonsai Changeset saying it is a snapshot. Verify only snapshots can have certain file changes (untracked/missing).
- Upload the files and the changeset inside an ephemeral bubble instead of in the main blobstore
- Start writing the `snapshot restore` command

Differential Revision: D30137673

fbshipit-source-id: 555238f1d64a5438cde35a843043884a939de4fe
2021-08-16 09:19:05 -07:00
Meyer Jacobs
65bceaf5e5 manifest-tree: implement TryFrom for directly converting from a serialized manifest tree entry to a manifest::List
Summary: Allow `manifest-tree::Entry` to be constructed directly by other crates, and introduce a `TryFrom` conversion to `manifest::List::Directory`. This will be used by the scmstore `BackingStore` implementation to avoid having to rely on the `TreeStore` trait, which does not support batching.

Reviewed By: kulshrax

Differential Revision: D30282738

fbshipit-source-id: 590350dd53217fa8a181e91b194abca753a8adbe
2021-08-12 19:37:20 -07:00
Meyer Jacobs
5048cf3e0f scmstore: add new results adapter to FileStore
Summary: Add a new results adapter for `FileStore` (which will probably become the primary method of consuming batch errors in the future), which iterates over all keys, and explicitly encodes not found with `Option`, separate from the outer `Result`.

Reviewed By: kulshrax

Differential Revision: D30254000

fbshipit-source-id: 074c6ac4c279fdf72078dca17231e58d0c704956
2021-08-12 19:37:20 -07:00
Meyer Jacobs
c5b59696e9 scmstore: add method for getting local-only TreeStore
Summary:
Add a `local` method to `TreeStore` like the one on `FileStore` which returns a `TreeStore` with only the local subset of backends.

Required for `BackingStore` implementation.

Reviewed By: kulshrax

Differential Revision: D30253980

fbshipit-source-id: 142f2d88454826ff9cb9c34f30b7d21bf62b297c
2021-08-12 19:37:20 -07:00
Meyer Jacobs
47fd500315 scmstore: allow overriding edenapi config
Summary: Add a new method, `edenapi_override`, to the `TreeStore` and `FileStore` builders for use in the `BackingStore` implementation.

Reviewed By: kulshrax

Differential Revision: D30253837

fbshipit-source-id: 4a42e83621fb2634024e4ee8529c26aeae0256a4
2021-08-12 19:37:20 -07:00
Meyer Jacobs
d4e6c15939 scmstore: collect API usage metrics
Summary:
Instrument all the fetching-related legacy API implementations (ie, not `get_logged_fetches` and `get_shared_mutable`) to track the number of calls, keys, and single-key calls.

This introduces an additional lock acquisition to each of these implementations (and it'd be awkward to merge it with the one in `fetch`), but I think that's probably fine.

For APIs which do not support a variable number of keys, I use `.call(0)` so we simply track the total number of API calls.

Reviewed By: DurhamG

Differential Revision: D30003444

fbshipit-source-id: 8756d2669ca038b3f6a08e211e44e8ccb9251312
2021-08-12 19:37:19 -07:00
Meyer Jacobs
d9a885a6df scmstore: track FileStore write errors
Summary:
Adds tracking of FileStore write errors.

Write batches will still abort after the first failure as written.

Reviewed By: DurhamG

Differential Revision: D29997203

fbshipit-source-id: e1cc2ffc4a8d97ca935a7fc9aab30bde3dc548b2
2021-08-12 19:37:19 -07:00
Meyer Jacobs
34dfc6d1f7 scmstore: refactor FileStore write_batch method
Summary: Refactor the `FileStore::write_batch` method, extracting the various write cases into other methods.

Reviewed By: DurhamG

Differential Revision: D29997096

fbshipit-source-id: 8efac4b2efa2e2225d39583a5c6893efc5096fec
2021-08-12 19:37:19 -07:00
Meyer Jacobs
57503f2632 scmstore: add write metrics
Summary: Adds new write metrics tracking to filescmstore, also replacing the existing LFS pointer write metric.

Reviewed By: DurhamG

Differential Revision: D29996487

fbshipit-source-id: f5be5ccc431a9162c9e737510283a543e5b948a2
2021-08-12 19:37:19 -07:00
Meyer Jacobs
c4033dace0 scmstore: count contentstore batch errors more accurately
Summary:
Previously errors from `prefetch` weren't counted. With this change I move calculating the pending keys out of the `inner` method, making it easier to handle all batch error metrics from `?` calls right beside the existing `other_errors` call.

This is probably how I'll structure the other methods too, though it's still a little subtle - currently the batch errors only come from `prefetch`, but if batch errors were returned after the `drain` call (which always drains the vector, even if you don't consume the whole iterator), the second `pending.len()` call could incorrectly report 0. To address this, I could separate out the "single key fetching" part of the method, or just let it be understood that you should repeatedly call `pop` in such cases.

Reviewed By: DurhamG

Differential Revision: D29995789

fbshipit-source-id: 09753081c5e7076b83cb26fdddb949205ad7cd43
2021-08-12 19:37:19 -07:00
Meyer Jacobs
9bc0a013b6 scmstore: standardize contentstore metrics with other fetch metrics
Summary: Previously, contentstore metrics were tracked as a special case. Now that I'm tracking metrics on each backend, I've standardized the contentstore metrics to match.

Reviewed By: DurhamG

Differential Revision: D29995500

fbshipit-source-id: 3133dca5912d9cd6c26bd88d9aeb6a572f6eca40
2021-08-12 19:37:19 -07:00
Arun Kulshreshtha
ce4416de6b edenapi: increase low speed time limit to 2 minutes
Summary:
Increase [CURLOPT_LOW_SPEED_TIME](`https://curl.se/libcurl/c/CURLOPT_LOW_SPEED_TIME.html`) because users were hitting low speed timeouts during normal usage.

2 minutes was arbitrarily chosen, but it seems unlikely that we'd have situations where connections legitimately sit idle for more than 2 minutes. (If it turns out we do, that would be a bit concerning.)

This diff also updates the config option to specify the time in seconds instead of milliseconds because libcurl only supports second-level precision when specifying `CURLOPT_LOW_SPEED_TIME`. The config option name has been updated to explicitly include the unit to avoid confusion.

Differential Revision: D30272017

fbshipit-source-id: 0ae5e912c0dafc897fe19de3ea8e5aeb4ed8459c
2021-08-12 11:18:08 -07:00
Andrey Chursin
95e0e87c97 metrics: add println renderer
Summary: This renderer simply outputs select metris to the stdout

Reviewed By: DurhamG

Differential Revision: D30145591

fbshipit-source-id: e68efc8f808ca038dd89cd6ea4a74b33bae083fc
2021-08-10 14:11:23 -07:00
Andrey Chursin
4493282b9c progress: allow to customize units of time series
Reviewed By: DurhamG

Differential Revision: D30137294

fbshipit-source-id: f75dc3e433007f42093c70f5c2f52c4cd012a165
2021-08-10 14:11:23 -07:00
Andrey Chursin
a0612b6bf7 progress: fix division by zero
Reviewed By: yancouto

Differential Revision: D30137301

fbshipit-source-id: 0f23c1bde6f2b4b0e28e326287607b4f42ec0cb0
2021-08-10 14:11:23 -07:00
Andrey Chursin
a767d3c269 edenapi: metric for inflight files and requests
Reviewed By: DurhamG

Differential Revision: D30137296

fbshipit-source-id: 0277fb3b88268defd72573f6711d2a39b3f8db44
2021-08-10 14:11:23 -07:00
Andrey Chursin
e27843a48a metrics: add entrance wrapper for the futures
Summary: This wrapper keep guards until future is complete

Reviewed By: DurhamG

Differential Revision: D30137298

fbshipit-source-id: 552363031ecc2c408791f6c0963dafad840154b7
2021-08-10 14:11:23 -07:00
Andrey Chursin
5869046e48 edenapi: remove unnecessary async from Client::fetch
Summary:
Client::fetch was async method for no reason(it does not contain any awaits)
This diff removes async and makes it clear that fetch only prepares futures but does not itself contain async code

Reviewed By: DurhamG

Differential Revision: D30137299

fbshipit-source-id: 87f80cf906bbea856f9f54b88a3609d0aad03a73
2021-08-10 14:11:23 -07:00
Andrey Chursin
4ac3d5b47b metrics: init metrics render when hg starts
Reviewed By: DurhamG

Differential Revision: D30137300

fbshipit-source-id: f3510415d643fcb57b39a870af8b9622e239c9f0
2021-08-10 14:11:22 -07:00
Andrey Chursin
46b99410db metrics: implement metrics renderer into iosample bar
Summary: This allow to render metrics in the real time, similar to how we render network usage

Reviewed By: DurhamG

Differential Revision: D30137295

fbshipit-source-id: 8843b574971c1ccaaae0727be6f9d46d1d90625f
2021-08-10 14:11:22 -07:00
Andrey Chursin
89fb80e0da metrics: read render config from env variable
Summary: See docstring to init_from_env for the description

Reviewed By: quark-zju

Differential Revision: D30137304

fbshipit-source-id: ad3fb5e0cbb52ca405959eb0d394f5a2c9761ad9
2021-08-10 14:11:22 -07:00
Andrey Chursin
ceee800b6e metrics: add render crate
Reviewed By: quark-zju

Differential Revision: D30137303

fbshipit-source-id: c5202b34b006137ec137ca1ac6c2092d1c0f708b
2021-08-10 14:11:22 -07:00
Andrey Chursin
6a626ace30 metrics: add entrance counter
Summary: This allows to count number of parallel operations, like parallel entrance to some fn or parallel requests

Reviewed By: quark-zju

Differential Revision: D30137297

fbshipit-source-id: 74585dcab353091619a0a1f217548121079b463c
2021-08-10 14:11:21 -07:00
Andrey Chursin
ff9705b787 metrics: add Counters and Registry
Reviewed By: quark-zju

Differential Revision: D30137302

fbshipit-source-id: 4e144783b13a7114f71529aa9404301a7adad077
2021-08-10 14:11:21 -07:00
Andrey Chursin
7fc4e6a9b8 metrics: add metrics crate
Reviewed By: yancouto

Differential Revision: D30113372

fbshipit-source-id: f3761e36e40efbd97a700d209135cb9939486b76
2021-08-10 14:11:20 -07:00
Johan Schuijt-Li
a7ae42d3ca move to common shared directory
Summary: Allow this to be used by more utilities.

Reviewed By: DurhamG

Differential Revision: D29958512

fbshipit-source-id: b6a1a7017102a4ff4ad252246d3252903bbb793f
2021-08-10 10:27:16 -07:00
Johan Schuijt-Li
01938aa168 rename to a more generic name
Summary: Prepare before moving to a common directory

Reviewed By: StanislavGlebik

Differential Revision: D29958513

fbshipit-source-id: 48c04a9bf6e8c3800b3f187e7741d240ecff9e9c
2021-08-10 10:27:16 -07:00
Jun Wu
d1ef12b2c6 dag: use local cache for _batch lookups
Summary: This removes some redundant lookups when using the `*_batch` APIs.

Reviewed By: andll

Differential Revision: D30094155

fbshipit-source-id: f64702a09f67b67a10a2d51545f3b6940e80022f
2021-08-09 17:05:33 -07:00
Jun Wu
7a65847bb0 dag: add tests about suboptimal local cache for remote lookups
Summary: The test exposes issues that the local cache isn't used in some cases.

Reviewed By: andll

Differential Revision: D30094158

fbshipit-source-id: 0122154b8bd2f9d321e248720632e28b6ca0559e
2021-08-09 17:05:33 -07:00
Jun Wu
cac695802f dag: add failpoints for resolving ids or vertexes remotely
Summary:
Similar to D29888937 (8cb3d3dd75). This helps getting the Rust traceback of why certain
code path gets triggered.

Reviewed By: andll

Differential Revision: D30094157

fbshipit-source-id: ef5bacbf4612ed115fd631056f6c004fe6d1d93f
2021-08-09 17:05:33 -07:00
Jun Wu
5caa1688ed dag: add a tracing log for inserting into the overlay map
Summary: This will be used to debug some over fetching issues.

Reviewed By: andll

Differential Revision: D30094159

fbshipit-source-id: cfbdff497fbf53f97f1c957bf77c25e26ee79286
2021-08-09 17:05:33 -07:00
Jun Wu
c971369c84 dag: further reduce remote lookups calculating "definitely missing" vertexes
Summary:
See the added comments. In some cases we can avoid remote lookups. This would
help make commit/amend more offline friendly.

Reviewed By: DurhamG

Differential Revision: D30004908

fbshipit-source-id: 94fbc7934a1eb3ae1058d8c542211a885d5ad8e6
2021-08-09 17:05:33 -07:00
Jun Wu
ca41a68c6d dag: add failpoints for not found errors
Summary:
Similar to D30094157. This is helpful to get a Rust backtrace on "not found"
errors. This is useful because the Python traceback might not have Rust
stack.

Ideally, it'd be better if we can integrate backtrace into the error types.
However, the stdlib backtrace is still unstable and the thirdparty backtrace
seems too heavyweight.

Reviewed By: DurhamG

Differential Revision: D30123355

fbshipit-source-id: 7af76422143340194d8499a75e8ed65e9bf1fcae
2021-08-09 14:13:34 -07:00
Jun Wu
da6ca568b0 indexedlog: turn some panic into errors
Summary:
We have seen slicing panics on NFS, like:

  thread 'main' panicked at 'range end index 14079379 out of range for slice of length 0', eden/scm/lib/indexedlog/src/log/mod.rs:1678:14

Possibly when some files were stale or out of sync (ex. `log` got shorter than
expected somehow) due to NFS weirdness (bad locking?). Let's make them Rust
errors instead of panics for easier error reporting and investigation.

Reviewed By: DurhamG

Differential Revision: D30166177

fbshipit-source-id: 25cbd9c178b24580c176fe9469362fe0020ede95
2021-08-09 13:32:16 -07:00
Liubov Dmitrieva
3dbac2ff63 commitcloud CLEAN UP remove last bits code with interngraph proxy
Summary:
commitcloud CLEAN UP: remove last bits code related to an old interngraph commit cloud proxy

The configs are not used, the service_url in scm daemon is not used, the interngraph proxy is not used

Reviewed By: singhsrb

Differential Revision: D30160471

fbshipit-source-id: 07fee2b8733afa29659467cb296df3b47fe1b54b
2021-08-09 07:17:44 -07:00
Durham Goode
1ae4201155 checkout: remove unused imports
Summary: These were accidentally left over from a previous diff.

Reviewed By: singhsrb

Differential Revision: D30133799

fbshipit-source-id: 311f746848fc823a6fbae9e58bafda6641104b1e
2021-08-06 08:19:05 -07:00
Liubov Dmitrieva
fe8ed9d28c file upload: pass content size as a parameter
Summary:
file upload: pass content size as a parameter

We shouldn't rely on body size, because it will not allow us to build compression and also it won't allow us to implement streaming.

Reviewed By: yancouto

Differential Revision: D30100887

fbshipit-source-id: c16f79fa71fe320f61d15e1328b67026f586a1dc
2021-08-06 05:37:05 -07:00
Jun Wu
4e7987e9f9 cpython-ext: avoid io::Error::raw_os_error unless kind is None
Summary:
On Windows, EPIPE's raw os error might be 232, different from libc::EPIPE (32).
That means the Python world cannot check the errno properly to hide the EPIPE
error message. Fix it by reading io::ErrorKind first, and fallback to
raw_os_error.

Reviewed By: yancouto

Differential Revision: D30118006

fbshipit-source-id: b34a2142b24714e68d11a03a0771a5f9c037ed0f
2021-08-05 16:32:50 -07:00
Zeyi (Rice) Fan
9972bda5dd Back out "refresh datastore if root tree is not found locally"
Summary:
Original commit changeset: 34fe02ddf580

We are seeing reports of EdenFS only showing partial directories to our user. Local testing shows this commit seems to be causing the issue. Reverting it for now.

Reviewed By: kmancini

Differential Revision: D30136949

fbshipit-source-id: 7fcc81506c132055a5b639a383b8c9be68118dc5
2021-08-05 14:08:42 -07:00
Zeyi (Rice) Fan
a7bd38624d Back out "provide path for trees when fetching from the datapack store"
Summary: Original commit changeset: d9631ea37b5f

Reviewed By: kmancini

Differential Revision: D30136950

fbshipit-source-id: b56c8666c0d7b6fbd7801ad8a7d9f5a6160544b1
2021-08-05 14:08:42 -07:00
Jun Wu
c016c76db9 dag: reduce remote lookup calculating "definitely missing" vertexes
Summary:
Practically only checking the "root" vertexes is also "correct". Let's do
that to reduce some remote lookups.

Reviewed By: andll

Differential Revision: D30004909

fbshipit-source-id: e46e8ee6b072270b860c5275b13f1e2103ef2b6a
2021-08-05 12:49:46 -07:00
Jun Wu
607be999e1 hgcommands: avoid deadlock setting up fail points in different threads
Summary:
It turns out that D30052693 (fd10938296) was not enough. The FailScenario cannot be setup
from different threads too.  Doing that would cause deadlock. So let's avoid
that too.

Reviewed By: DurhamG

Differential Revision: D30124930

fbshipit-source-id: 0095bcf5ad3a99831d9b9c75a1e9f2c50729819b
2021-08-05 10:01:44 -07:00
Yan Soares Couto
cd8fde2864 Simplify server bonsai changeset upload
Summary:
This simplifies both client and server code to make bonsai changeset uploading be simpler for snapshots, as we only need a single commit, no mutations, etc.

This will make it easier to validate the bonsai changeset on the next diff.

It is fine to change both client and server as this code is not still in production, so we don't need to worry about rollout order.

Reviewed By: StanislavGlebik

Differential Revision: D30044542

fbshipit-source-id: d14bf58d671bc3bb5ff54b07c21f1781a043e0cf
2021-08-05 09:29:45 -07:00
Yan Soares Couto
f64520a312 On lookup call, return file size metadata
Summary:
This diff addresses [this comment](https://www.internalfb.com/diff/D29849964 (4bde7b7488)?dst_version_fbid=244353817531864&transaction_fbid=342353780770798).

- It removes the bit of code in `process_files_upload` that adds file size to the metadata.
- In order for this not to break the bonsai upload, I made it so the lookup call returns upload tokens with file size when looking up a file.
- Took the opportunity to do some refactoring
  - Consolidated duplicated functions in `convert_file_to_content_id`, and added some helpful From implementations to make calling it more ergonomic.
  - `convert_file_to_content_id` now doesn't fail when the file doesn't exist, instead returns option (also fixed the callsite)

Reviewed By: liubov-dmitrieva

Differential Revision: D30016963

fbshipit-source-id: aae8a085d7a207e50679bb1210277a9e21a32de8
2021-08-05 09:29:45 -07:00