Commit Graph

12393 Commits

Author SHA1 Message Date
Xavier Deguillard
7ebfd3791f service: speedup glob handler by 26%
Summary:
Looking at Instruments, when issuing tons of glob queries to EdenFS, EdenFS
appears to be spending a very large amount of time adding tasks to the
UnboundedTaskExecutor. Since globs are expected to be fast, we can afford to
execute them inline, reducing this overhead and speeding up glob queries.

Reviewed By: chadaustin

Differential Revision: D31289485

fbshipit-source-id: 428fff9f5fea65073b2a061dc7070d63ae36d95d
2021-10-05 19:10:52 -07:00
Xavier Deguillard
0965da43b3 inodes: eliminate quadratic copies of GlobResult
Summary:
The globbing algorithm is recursive and returns its own glob results merged
with its children's glob results. The merging is done by simply copying the
children's glob result and returning it. What this means is that a single
GlobResult will be copied K times, with K being the recursion depth at which it
was created. This makes the total number of copies be O(K*N) with N the result
length.

Since we can simply avoid these copies by simply creating the GlobResult in a
shared vector, we can avoid the copies entirely at the expense of taking a
lock.

Reviewed By: chadaustin

Differential Revision: D31288036

fbshipit-source-id: ae8a98a01eab2ba7f23908d347d7a4ec199cdfab
2021-10-05 19:10:52 -07:00
Xavier Deguillard
2d6df0c676 inodes: return an ImmediateFuture from TreeInode::getOrLoadChild
Summary:
In the case where a child is already loaded, this allows the code to not
allocate a SemiFuture, which should benefit code that repeatly calls it on
already loaded inodes. One typical example is the globbing entry point that
needs to find the TreeInode where the glob needs to be applied on.

Reviewed By: chadaustin

Differential Revision: D31283398

fbshipit-source-id: 76f82d74f2a45ee2b3b9bf442d47c0a2262bced9
2021-10-05 19:10:51 -07:00
Xavier Deguillard
4d44482085 inodes: switch EdenMount::getInode to ImmediateFuture
Summary:
One layer about getChildRecursive is getInode, let's make this one use an
ImmediateFuture too.

Reviewed By: chadaustin

Differential Revision: D31283397

fbshipit-source-id: 8bc524bea857d6ec5bc045d6e3383d38133c3b38
2021-10-05 19:10:51 -07:00
Yan Soares Couto
0cd8e64c51 Use auto_wire on all api objects where it's possible
Summary:
This diff uses the helper proc macro added on the previous diff to simplify the code for dozens of api objects.

Over 1000 lines deleted :)

Examples of structs that couldn't be migrated:
- Wire structs that didn't rename the fields to numbers. (e.g. WireHistoryRequest) (would need some extra migration)
- enums  (not currently supported by the proc macro)
- Wire structs that didn't map directly to their non-wire counterparts (e.g. WireSnapshotState)

I added some comments with possible future improvements, but didn't pursue them right now as they are significantly less useful than this diff itself, which covers most of the cases.

Reviewed By: ahornby

Differential Revision: D31057140

fbshipit-source-id: 88a867ba2cdfedf6a96a8ca3718508073822b962
2021-10-05 16:32:03 -07:00
Yan Soares Couto
1e461b5028 Proc macro for default wire implementation
Summary:
This diff implements a proc macro that derives a "wire" object from a simple api obj for edenapi. It is enough to cover most of the wire objects and simplify code a lot.

Differences from initial proof of concept:
- Renamed `default_wire` to `auto_wire`. I'm happy to rename again if preferred.
- Fields must have `#[id(X)]` notation.
- Fields with default values are not serialized.
- Arbitrary implementation also is derived

This diff only uses this proc_macro on one Api Object, in order to make reviewing it easier, focusing on the implementation of the macro. The next diff uses this macro in all possible objects, actually doing the bulk of the refactoring.

Reviewed By: ahornby

Differential Revision: D31054734

fbshipit-source-id: d6136faf84492983ca69461fe243e830021b2f66
2021-10-05 16:32:03 -07:00
Zeyi (Rice) Fan
3785bf7ff2 config: add a new knob
Reviewed By: chadaustin

Differential Revision: D31163226

fbshipit-source-id: 96dcba2bd62a0ce879a92a94050873c5725adce4
2021-10-05 15:52:49 -07:00
Muir Manders
5eb5c5e7bb native status: support HGPLAIN color suppression
Summary:
Plus a minor refactoring to use the io::IsTty trait in edenfs_client::status instead of calling into libc directly.

This commit reintroduces 218f06a4e648 after reversion in e9ef7c2142d0. Windows build broke because I accidentally left a stray `#[cfg(unix)]` above unrelated use line.

Differential Revision: D31248594

fbshipit-source-id: ddee62d9dc4d0b99d2e67fe9b757748ab501e030
2021-10-05 11:03:33 -07:00
Jun Wu
d354aa787f edenapi: drop debug config eprint support
Summary:
Setting EDENSCM_LOG can achieve the same effect. So let's remove the redundant
logic. This also avoids overhead constructing the strings when tracing is off.

Reviewed By: yancouto

Differential Revision: D31359046

fbshipit-source-id: db53cc16f1efcf6111535090a3eadec19b888329
2021-10-05 09:47:19 -07:00
Yan Soares Couto
075a4a1148 filenodes: switch to manager-based derivation
Summary: Same as D30974102 (91c4748c5b) but for mercurial filenodes.

Reviewed By: markbt

Differential Revision: D31170597

fbshipit-source-id: fda62e251f9eb0e1b6b4aa950d93560b1ff81f67
2021-10-05 06:26:34 -07:00
Yan Soares Couto
ddba827364 Fix u64/i64 conversion in tests
Summary:
This fixes these tests (which are blocking the deployment):
```
FAILED	eden/mononoke/mononoke_types:mononoke_types-unittest - content_metadata::test::content_metadata_blob_roundtrip
FAILED	eden/mononoke/mononoke_types:mononoke_types-unittest - content_metadata::test::content_metadata_thrift_roundtrip
FAILED	eden/mononoke/mononoke_types:mononoke_types-unittest - file_contents::test::file_contents_blob_roundtrip
FAILED	eden/mononoke/mononoke_types:mononoke_types-unittest - file_contents::test::file_contents_thrift_roundtrip
```

They were broken since the update of quickcheck, as it now checks with big values for ints, which broke these tests as the code didn't do a good job of converting between u64/i64. This diff fixes that.

Usually, we just want to use `as` conversion everywhere. Thrift only stores i64. but it's fine to store a negative value that will correctly overflow back to the correct positive value of u64. In practice though, this shouldn't really happen, as these are sizes, and we're never getting anywhere near the u64 limit.

Using `TryInto` doesn't cause these overflows, but for just storage, it makes things work in less cases.

Reviewed By: krallin

Differential Revision: D31379001

fbshipit-source-id: feeb87a62148f97b3bd467e8c2ef2156c8e3329a
2021-10-05 05:57:45 -07:00
Juan Pablo Lopez
76060c7d5f Provide support for x2pagentd using unix socket
Summary: Establish a http connection to x2pagentd using a unix socket.

Reviewed By: mzr

Differential Revision: D31204332

fbshipit-source-id: d1f98dc0e4eae4fb918cd77a9571e1a2da7d7ed2
2021-10-05 04:01:33 -07:00
Mark Juggurnauth-Thomas
af7014bfe5 mononoke_api: ignore copy-replaced files when computing diff renames
Summary:
If a file is replaced by a move or copy from another file, we should ignore
this copy info when computing the renames in a diff.  If we do not, then we
will fail to include the deletion of the copy source in the case of a move, and
the copy information doesn't add anything anyway as the destination file will
just show as modified.

Reviewed By: mitrandir77

Differential Revision: D31180151

fbshipit-source-id: c89a8ae26a516fd958406bb967a587b3b6c36a48
2021-10-04 07:16:35 -07:00
Mark Juggurnauth-Thomas
053a54b7e8 bounded_traversal: fix warning
Reviewed By: yancouto

Differential Revision: D31339096

fbshipit-source-id: 422c078ae79ac668dd39386eaf64cf848b0a1aa8
2021-10-04 06:59:25 -07:00
Mark Juggurnauth-Thomas
8b21fe64fd git_types: switch to manager-based derivation
Summary: Switch derivation of Git trees to use the `DerivedDataManager`.

Reviewed By: yancouto

Differential Revision: D31303798

fbshipit-source-id: 193f5d373a56a0d1099f49db76758227d15c3762
2021-10-04 06:59:25 -07:00
Mark Juggurnauth-Thomas
9aa5c6a64a dangerous_override: add overrides for derived data manager
Summary: Add overrides for changesets, filenodes and bonsai_hg_mapping in the derived data manager.

Reviewed By: yancouto

Differential Revision: D31378456

fbshipit-source-id: b1faa543ca65fa041d2d0ddc908ea5fb950d023a
2021-10-04 06:59:25 -07:00
Jan Mazur
083a9ad35c Vendor curl-sys crate with patched curl
Summary:
Vendoring this patch: https://github.com/curl/curl/pull/7737 to curl-sys rust crate. On windows the hg client is using curl that's bundled with sys-curl. I need this patch to have unix domain sockets working in hg client on windows.

I had to manually vendor https://raw.githubusercontent.com/mzr/curl/57e7ec4dbe4dd2831de51f2644879387d2ea7b44/docs/INSTALL because reindeer didn't do it. IDK why.

oss-eden-{darwin,linux,windows}-getdeps fail with:
```
FAILED: eden/scm/lib/backingstore/CMakeFiles/rust_backingstore.cargo eden/scm/lib/backingstore/debug/libbackingstore.a eden/scm/lib/backingstore/release/libbackingstore.a
cd /data/sandcastle/temp/fbcode_builder_getdeps/shipit/eden/eden/scm/lib/backingstore && /data/sandcastle/temp/fbcode_builder_getdeps/installed/cmake-hQhVzQT-WzFKTeqXjLxo5lLi8IG4_MjX2-YRqptCUVs/bin/cmake -E remove -f /data/sandcastle/temp/fbcode_builder_getdeps/shipit/eden/eden/scm/lib/backingstore/Cargo.lock && /data/sandcastle/temp/fbcode_builder_getdeps/installed/cmake-hQhVzQT-WzFKTeqXjLxo5lLi8IG4_MjX2-YRqptCUVs/bin/cmake -E env CARGO_TARGET_DIR=/data/sandcastle/temp/fbcode_builder_getdeps/build/eden/eden/scm/lib/backingstore CARGO_HOME=/data/sandcastle/temp/fbcode_builder_getdeps/build/eden/_cargo_home cargo build --release -p backingstore --features fb
    Blocking waiting for file lock on package cache
    Blocking waiting for file lock on package cache
error: failed to calculate checksum of: /data/sandcastle/boxes/eden-trunk-hg-fbcode-fbsource/third-party/rust/vendor/curl-sys-0.4.45+curl-7.78.0/curl/docs/INSTALL
Caused by:
  failed to open file `/data/sandcastle/boxes/eden-trunk-hg-fbcode-fbsource/third-party/rust/vendor/curl-sys-0.4.45+curl-7.78.0/curl/docs/INSTALL`
Caused by:
  No such file or directory (os error 2)
```

Not idea how to fix this. Seems related to the fact that reindeer didn't vendor docs/INSTALL.

# EDIT:
# It might been caused by some bug in hg. now it's fine
# The failure in oss-eden-linux-getdeps looks unrelated (something with rocksdb)

Reviewed By: krallin

Differential Revision: D31370778

fbshipit-source-id: a1245f8cb6b58f5765e34c95dfd78325a8e6e457
2021-10-04 03:13:50 -07:00
Yan Soares Couto
afaadd87cf Add tests for a few missing wire types
Summary:
There were a few Wire objs that didn't have tests because they didn't implement Arbitrary. I added simple implementations for them.

I did it mostly for the request/response types, as they have the other types inside them.

Reviewed By: markbt

Differential Revision: D31019959

fbshipit-source-id: edf283fd79a40b794c89db79c026f1bcaf834a9f
2021-10-01 14:43:33 -07:00
Yan Soares Couto
1a78607026 Add snapshots for wire types and simplify tests
Summary:
This diff adds snapshot tests for most eden api wire types, while at the same time making the testing code much smaller, including tests for "wire" and "serialize" roundtrips.

## Context:
The previous diff had added an easy way to add snapshot tests. This stack aims to simplify the wire protocol code needed to create/modify an endpoint. A good thing to do before that is to add snapshot tests to all wire types, so that if we change them in a refactor, we're confident they still work exactly the same. This will also be useful when a type is changed in the future.

## How this makes tests easier
- In order to create snapshot tests, we need example objects to test with. Luckily we already use a framework for generating example objects (quickcheck::Arbitrary), so the idea here is to use that to make snapshot tests as automatic as possible.
- At the same time, the "wire" and "serialize" roundtrip tests (which also used Arbitrary), can also be made more automatic.

Now, using a simple helper, `auto_wire_tests!(WireObjectName)`, it is possible to derive all three types of tests automatically. This makes the current code smaller, and safer as we now have the additional safety provided by snapshot tests.

## Observations
- Not all wire types had tests implemented for them (I assume because it was too much work doing so, and might have done that myself in the past), I only moved the ones that already had. I'll do another pass and add remaining objects on a following diff.
- There are a couple actual non-refactor changes. I'll add comments explaining those.
- quickcheck crate is using quite an old version. I tried updating but it snowballed into something much more complicated, so I kept using the old version. We'll need to get to it at some point, though.

Reviewed By: markbt

Differential Revision: D31019233

fbshipit-source-id: 30c4a90848d0a5dcaffb89b9a0cd1cebfe4ace55
2021-10-01 14:43:32 -07:00
Yan Soares Couto
30cc107728 Add snapshot test for 2 wire objects
Summary:
This diff adds a way to do snapshot tests in SC, by simply calling a macro. It uses that as an example on two wire objects to show it works.

Motivation:
- Using snapshot testing in wire object will make it super clear what changes are happening on the wire format, which is useful to prevent breakages. (see quip)
- I'm going with approach #3 from proposal, but both #2 and #3 would need snapshot testing.

How?
- I'm using [insta](https://docs.rs/insta/1.8.0/insta/), a rust crate for snapshot testing. Unfortunately it depends on some cargo-specific stuff that doesn't work with buck, but I was able to get it working without patching the package by bypassing the Cargo dependent stuff.
- Insta also provides some cargo exensions on top of it to compare snapshots, which we can't have, so I made it clear on the test errors (see test plan) how to update the snapshots (via flag).

Future
- On future diffs I'll add a snapshot test for all the wire objects, this just adds to a first few to show it works and set up the plumbing.
- Writing objects manually for snapshot tests for **every** wire object would be a large amount of code, and troublesome when adding new (specially big) wire objects. We already have wire objects implementing `Arbitrary`, so I think it should be possible to use this to generate simple snapshot tests on automatically generated objects. (It will need some extra work to make sure they are created consistently.)

Reviewed By: markbt

Differential Revision: D30958077

fbshipit-source-id: 3d8663e7897e5f6eb4b97c24f47b37ef2f138e5a
2021-10-01 14:43:32 -07:00
Genevieve Helsel
d9afd277b7 disable test_mount_state_during_unmount_with_in_progress_checkout on eden-asic-build-and-test
Summary: TSIA

Reviewed By: xavierd

Differential Revision: D30825961

fbshipit-source-id: e920e4e30289fbdcea4cd6d52e6f4d2dfbd3409d
2021-10-01 14:07:24 -07:00
Andrey Chursin
ae684f3993 explicit Hash20 instead of Hash [proxy hash removal 2/n]
Summary:
This is fairly mechanical diff that finalizes split of Hash into ObjectId and Hash20.

More specifically this diff does two things:
* Replaces `Hash` with `Hash20`
* Removes alias `using Hash = Hash20`

Reviewed By: chadaustin

Differential Revision: D31324202

fbshipit-source-id: 780b6d2a422ddf6d0f3cfc91e3e70ad10ebaa8b4
2021-10-01 12:43:26 -07:00
Mark Juggurnauth-Thomas
0430014575 edenfs-client: specify spawner
Summary:
A spawner type is required for new thrift clients, specify the noop one for now.

This also requires regenerating the generated thrift libraries.

Reviewed By: yancouto

Differential Revision: D31338518

fbshipit-source-id: cbecf3ec6f9678918ca459c19f1cc160214fadfd
2021-10-01 11:35:17 -07:00
Jun Wu
2fd0fc5aaf pullcreatemarkers: disable pullcreatemarkers in pull command
Summary:
We now use post-pull hook to mark commits as landed:

  hooks.post-pull.marklanded=hg debugmarklanded

So there is no need to mark them inside the pull command. In fact, it seems
something is wrong (phases aren't invalidated properly?) so that the
pullcreatemarkers logic might actually hide commits during pull incorrectly:

  commit 1e964a4302c03e5ae48e5b85b0fc0bf27f847b09
  Author: metalog <metalog@example.com>
  Date:   Tue Sep 28 17:29:49 2021 +0000

      pull
      Parent: a4511a83cf862cc7216c15d83a3f4ff9d3b3241b
      Transaction: pullcreatemarkers

      RootId: 18d81a1531ecea65affe83c25804c790cac57c59

  diff --git a/visibleheads b/visibleheads
  index eb58137..da5f45a 100644
  --- a/visibleheads
  +++ b/visibleheads
  @@ -1,16 +1,6 @@
   v1
  -e82de77adcc261cb306dafeb6cbe15f26f7de768
  -91cf8c4b47e433acbe3f774e608eee42a3ad089d
   8c071e5aa26d920f1b88c4b1cd10f6e946d4312a
   536ff436cde4ec53d74c02ae2c5ed6f60609e01a
  -e49b834a6ff9b61a95a743d22703dc6634f2918c
  -c53b65542d4583ae82835144ac7f72dce7a6f335
   1010312ed7ac683c5e97ad765cdbcb4927ddf62c
  -a563a5f35d2df4c54ba1fe2401aa1cd929a218bf
  -55c0c7483c6cd85114a9be587d11c87aaceaeff4
  -74079567b677c5799b6c67855683ec346ebc3cce
   33b5fd6055da2284cf5224f70e1bb9791ed87641
  -ec221dff2393793f7b1e11ea9f9e9ea87b79da1f
  -cc466614d43a6af24520b7a81653435f4a614fbb
   2d7466be885e757d2d41630a3148fd31f5199ffa
  -226c8136603dcbcc408133a2122e93fc045527fa

As we're here, document some other config options existed in the code.

Reviewed By: DurhamG

Differential Revision: D31295709

fbshipit-source-id: e26c728215a209ab5dfaee7a84daece8197a1cc4
2021-10-01 11:13:32 -07:00
Xavier Deguillard
68bbbc8123 inodes: switch TreeInode::getChildRecursive to ImmediateFuture
Summary:
With the lookup processor now returning an ImmediateFuture, we can focus on its
caller, starting with getChildRecursive.

Reviewed By: chadaustin

Differential Revision: D31283396

fbshipit-source-id: 97abc57b9efe3540c5770aa952995c257e6eda4b
2021-10-01 10:43:06 -07:00
Xavier Deguillard
b613cf82f6 inodes: make LookupProcessor use ImmediateFuture
Summary:
While profiling glob queries sent by Buck, I noticed that EdenFS spends almost
as much time resolving the inode to perform the glob on as EdenFS takes to
actually perform the glob. Futures related overhead shows up as predominent,
thus let's convert these to ImmediateFuture to speed this up.

Reviewed By: chadaustin

Differential Revision: D31283395

fbshipit-source-id: 7355ddf7498f722ed8ec2989f010a28fb15c293f
2021-10-01 10:43:05 -07:00
Xavier Deguillard
8c26a8ffe5 immediatefuture: speed up by 40%
Summary:
While std::variant is convenient, they are both slow to compile, and the
compiler cannot optimize it as well as a manually written tagged union. Since
ImmediateFuture is performance critical for EdenFS, let's use a tagged union
and speed them up by an additional 40%.

Reviewed By: chadaustin

Differential Revision: D31272296

fbshipit-source-id: e34be4489a596d3577b3bd900a1f20d6c7d8b693
2021-10-01 10:43:05 -07:00
Xavier Deguillard
5b5157ab51 immediatefuture: split get with and without timeout
Summary:
The max duration would cause UBSAN failures due to folly's SemiFuture code
multiplying the value which understandably cannot be represented. Splitting the
function is easy and avoids the problem entirely.

Reviewed By: genevievehelsel

Differential Revision: D31272297

fbshipit-source-id: c15ca70ad771c11b4f68bb9974422c0986d4928b
2021-10-01 10:43:05 -07:00
Xavier Deguillard
0505b5f1d6 benchmarks: add a search root for glob benchmark
Summary:
When Buck is using the EdenFS globber, the searchRoot argument is set, thus
let's add a new argument to the benchmark to simulate a Buck workflow.

Reviewed By: chadaustin, genevievehelsel

Differential Revision: D31283399

fbshipit-source-id: 5e32b2aceb6090e26e88cf7f0d163448d56107d4
2021-10-01 10:43:05 -07:00
Andrey Chursin
0af2511a3f separate out ObjectId [proxy hash removal 1/n]
Summary:
The goal of this stack is to remove Proxy Hash type, but to achieve that we need first to address some tech debt in Eden codebase.

For the long time EdenFs had single Hash type that was used for many different use cases.

One of major uses for Hash type is identifies internal EdenFs objects such as blobs, trees, and others.

We seem to reach agreement that we need a different type for those identifiers, so we introduce separate ObjectId type in this diff to denote new identifier type and replace _some_ usage of Hash with ObjectId.

We still retain original Hash type for other use cases.

Roughly speaking, this is how this diff separates between Hash and ObjectId:

**ObjectId**:
* Everything that is stored in local store(blobs, trees, commits)

**Hash20**:
* Explicit hashes(Sha1 of the blob)
* Hg identifiers: manifest id and blob hg ig

For now, in this diff ObjectId has exactly same content as Hash, but this will change in the future diffs. Doing this way allows to keep diff size manageable, while migrating to new ObjectId right away would produce insanely large diff that would be both hard to make and review.

There are few more things that needs to be done before we can get to the meat of removing proxy hashes:

1) Replace include Hash.h with ObjectId.h where needed
2) Remove Hash type, explicitly rename rest of Hash usages to Hash20
3) Modify content of ObjectId to support new use cases
4) Modify serialized metadata and possibly other places that assume ObjectId size is fixed and equal to Hash20 size

Reviewed By: chadaustin

Differential Revision: D31316477

fbshipit-source-id: 0d5e4460a461bcaac6b9fd884517e129aeaf4baf
2021-10-01 10:25:46 -07:00
Yan Soares Couto
648dea3cfc Add sampling of location_to_hash endpoint
Summary:
https://pxl.cl/1Qh3j
This is the most called edenapi endpoint by far. If we sample logging of it, we can increase the retention of the scuba table.

if we wish, it's possible to not change retention for some "non-trivial" requests, but I haven't done that.

Reviewed By: liubov-dmitrieva

Differential Revision: D31277391

fbshipit-source-id: ee19e9daa4cd39c5d3eac1063e82aa40fc108bc7
2021-10-01 03:37:51 -07:00
Yan Soares Couto
1d9afdf9fb Use short gotham request id to save storage space
Summary:
This is used to uniquely identify requests in gotham. It's logged to output, on errors, and on Scuba.

Problem: On scuba, this packs very badly, as it is a large string (36 chars), unique for all requests.

Solution: Let's get a prefix of it, it should reduce size used on scuba. Got a prefix of size 5.

This affects both LFS and EdenApi.

Pros:
- Reduces size
- Very easy fix

Cons:
- More chance of conflict. The space of this id is 16^5 = 10^6. There will surely be conflicts, but maybe that's not a huge deal?

Alternative: Using 8 digits, that's about 4bi ids, which will reduce conflicts significantly in exchange for more space.

Why not use an int id (example: u64), or using other characters in id (not only hex): This would reduce the size of data significantly, but has drawbacks:
- For int, would require a big refactoring, as everything assumes the id to be string. Specially since this goes through client-server, might be complicated.
- Not just getting a prefix means more processing on each request, and means we need to recalculate it everytime.
- Size reduction might not be that big, as scuba already packs stuff pretty well.

Reviewed By: krallin

Differential Revision: D31305547

fbshipit-source-id: 23f6b6cb7de5b7a090864db414d4d71cd68c4946
2021-10-01 03:37:51 -07:00
Yan Soares Couto
da13975a4f Fix quickcheck update breakages
Summary: D31115820 (ae87b82eaf) updated quickcheck, but there's some stuff we need to fix forward. This diff fixes the remaining failures I could find.

Reviewed By: farnz

Differential Revision: D31305392

fbshipit-source-id: a6684d47833bc0fd933751c13cdd71392cb1833b
2021-10-01 03:37:51 -07:00
Liubov Dmitrieva
b09728399c use hg cloud upload command if usehttpupload enabled
Summary:
use `hg cloud upload` command if usehttpupload enabled

For few users who opted out of cloud sync, we should use `hg cloud upload` command instead of `hg cloud backup` if usehttpupload enabled

Reviewed By: markbt

Differential Revision: D31205919

fbshipit-source-id: 7619e7b299e19a7626782e7b3c1a69e7cd7dbc1b
2021-10-01 03:14:28 -07:00
Mateusz Kwapich
8ca8816fdd fix the semaphore deadlock
Summary:
Somehow before this fix I've seen us runing out of semaphores and deadlocking
because not freeing semaphores immediately after finishing running the
function requiring git repo.

Reviewed By: mojsarn

Differential Revision: D31310626

fbshipit-source-id: ba12b2d4918ecc30ca0aa6ff011176f7634badf9
2021-10-01 02:33:43 -07:00
Jeremy Fitzhardinge
66e1fc5370 rust: rerun autocargo after thrift/rust changes
Summary: Need this for cargo check/rust-analyzer to work.

Reviewed By: guswynn

Differential Revision: D31319911

fbshipit-source-id: ebd3fa72d8fc3667391a2067f95cab9e5f53301f
2021-09-30 17:40:04 -07:00
Jonathan Keljo
542e84d8fc Enable unbounded_depth feature for serde_json
Summary: I'm parsing some deeply-nested JSON, and it's running into the limit. This feature enables a potential footgun, but even with the feature enabled you have to add code to reach for said footgun.

Reviewed By: jsgf

Differential Revision: D31284743

fbshipit-source-id: 00ea5d7d7db8bdeb878d48fe390831f39e007409
2021-09-30 14:56:43 -07:00
Jun Wu
9d3faf8af5 smartset: avoid using outdated rev<->node mapping or nameset
Summary:
When calling `changelog.idmap`, it takes a snapshot of the IdMap.

When flushing the changelog, the IdMap might change. Some Ids might get
re-assigned.

For code (phases?) that keeps the `nameset` for a while the idmap might become
out-dated after a changelog flush. That might be a cause of removing visible
heads incorrectly.

Let's change `_torev` and `_tonode` to properties so they always take the
"latest" idmap snapshot.

Reviewed By: DurhamG

Differential Revision: D31296057

fbshipit-source-id: 1b3fec5d21649eab772ab3a150a3182a18b94edf
2021-09-30 10:28:35 -07:00
Jeremy Fitzhardinge
f5451a34bc scs: turn all comments into doc comments
Summary:
Use `///` for comments so they're converted
into doc comments so that they'll be rendered in the Rust docs (eg
https://www.internalfb.com/intern/rustdoc/eden/mononoke/scs/if:source_control-rust/source_control/client/trait.SourceControlService.html,
or hover docs in vs code).  It's already pretty well documented, so it
would be nice to take advantage of it.

Reviewed By: krallin

Differential Revision: D31288804

fbshipit-source-id: 9f2b3e0966832791c6ce39574cafdc71f8c032dd
2021-09-30 09:42:06 -07:00
Stanislau Hlebik
7221a52147 mononoke: add new idx flag
Summary:
It was added on the client side in D30686450 (7eb11cb392) to handle octopus merges correctly,
let's add it on mononoke as well, otherwise new_streaming_clone fails to parse
a revlog.

Reviewed By: mitrandir77

Differential Revision: D31305651

fbshipit-source-id: 976d7fdb8775f859e4732fd8a68f9b28f04ce4f9
2021-09-30 07:01:03 -07:00
Jan Mazur
21bb613c25 unix domain socket support for httpclient.HTTPConnection
Summary: This implements unix socket support for mercurial's HTTPConnection so commitcloud can use it.

Reviewed By: ahornby

Differential Revision: D31229256

fbshipit-source-id: a610c3c34be608ac2d9b41f3a7b6b62b44227b94
2021-09-30 05:56:44 -07:00
Qinfan Wu
dbac51105d Fix broken builds caused by rand upgrade
Summary:
A previous commit updated `rand` from 0.7 to 0.8. One breaking change introduced was that `Alphanumeric` now samples `u8` instead of `char`.

See https://docs.rs/rand/0.7.3/rand/distributions/struct.Alphanumeric.html and https://docs.rs/rand/0.8.4/rand/distributions/struct.Alphanumeric.html.

Reviewed By: bolinfest

Differential Revision: D31298553

fbshipit-source-id: 5d0d588550f17bac5ca4788748ec3f873398bf35
2021-09-29 23:09:58 -07:00
Egor Tkachenko
0bfc399700 Map requests to shared future for derivation.
Summary:
We want to reduce duplicated work. Since requests will be consistently hashed, each instance of service will receive some set of requests from multiple clients. By storing requests together with shared future derivation, any client can get the state of derivation.
In addition upon receiving requests we can clean up the map to remove already completed futures so the map will not grow indefinitely.

Reviewed By: StanislavGlebik

Differential Revision: D30776322

fbshipit-source-id: 961055f8b3328378451edd677506d7e716a9afd2
2021-09-29 16:10:04 -07:00
Muir Manders
e50031478a runlog: include progress information
Summary:
Now the runlog for an hg command invocation includes any progress bar metadata. I repurposed the existing rust progress thread to also upate the runlog progress (only if it has changed).

To avoid race conditions with the main thread writing the final "exit" runlog entry, updating the runlog progress is a no-op if the runlog's exit code has already been set.

Reviewed By: quark-zju

Differential Revision: D31065260

fbshipit-source-id: 181661cb06ab2910d8a0e41f5aa767528eb234f5
2021-09-29 16:05:37 -07:00
Muir Manders
2b956bae49 hgcommands: start of "runlog" command tracking
Summary:
The runlog's purpose is to store live information for every hg invocations. Users/VSCode will access the runlog data to see details about active hg commands.

In this initial commit I've added basic start/end updates to the runlog. The only current storage option is JSON files written to ".hg/runlog/<random ID>". Cleanup of the files will be added later. In the future I may look at sqlite as an alternative.

Set runlog.enable=True to turn on the runlog.

Reviewed By: quark-zju

Differential Revision: D31065258

fbshipit-source-id: 3ff29e1b8473f7e0b6b0d02537d1f18c2c5026fb
2021-09-29 16:05:37 -07:00
Zeyi (Rice) Fan
b76da76b9b tweak error message on Windows when repo is not mounted to avoid confusing people
Summary:
The old message was a little misleading as in some case EdenFS was running while it couldn't mount the repository. Mercurial will still tell the user that EdenFS is not running. It is not accurate.

The new message is trying to cover this case to avoid confusing people.

Reviewed By: zhengchaol

Differential Revision: D31278947

fbshipit-source-id: dd3e599654390269b6cf31d8842105970cb29cc0
2021-09-29 15:40:02 -07:00
Victor Gao
ae87b82eaf update rand and quickcheck
Summary:
This updates the following crates to their latest versions:
- `rand`: 0.7 => 0.8
- `quickcheck`: 0.9 => 1.0

Both crates introduced some breaking changes, so affected clients had to be fixed accordingly. Most changes are rather mechanical and shouldn't change the existing logic. In addition, a few buggy property tests were uncovered, presumably due to `quicktest` becoming smarter with its choice of inputs in the newer version, and the fixes are included in this diff.

Reviewed By: yancouto

Differential Revision: D31115820

fbshipit-source-id: 60a61dfac3236fd93cd4f03b86506654d81d330f
2021-09-29 13:59:49 -07:00
Zeyi (Rice) Fan
d20657bfc4 integration: teach integration test to arrange real edenfsctl via environ
Reviewed By: xavierd

Differential Revision: D30819280

fbshipit-source-id: de14ccb13ddec8ce90b0fa7d2aa987ea50f14d43
2021-09-29 10:02:09 -07:00
Zeyi (Rice) Fan
3921cd1872 cli_rs: fix health test, enable Rust edenfsctl in tests
Summary: This diff fixes some integration test errors after enabling the new edenfsctl.

Reviewed By: xavierd

Differential Revision: D30789741

fbshipit-source-id: 02d74defc41def4fb6ea0cc4694f944b4c0044e2
2021-09-29 10:02:09 -07:00
Zeyi (Rice) Fan
8a4fc086bc cli_rs: hide incomplete commands, fix help message
Summary:
Some detail polishing.

Incomplete commands are commented out. Help messages are now printed correctly. Fixed a small behavior divergence in `eden config` (`to_string_pretty` uses multi-line string instead of escaping characters).

Reviewed By: xavierd

Differential Revision: D30547011

fbshipit-source-id: 98d323744ce7a7fc989cbf79dd07ed8af3cee09d
2021-09-29 10:02:09 -07:00