Commit Graph

11823 Commits

Author SHA1 Message Date
Genevieve Helsel
935e3f1798 add allowlist for file access logging based on alias env variable
Reviewed By: kmancini

Differential Revision: D29944537

fbshipit-source-id: 8cdb39275fe0511806a993a3eb9d7affbe8dd96d
2021-07-29 17:25:43 -07:00
Jan Mazur
dc5f4fe428 add get_nonempty to match truthiness of empty string in Python
Summary:
It comes in handy sometimes, especially when we're unsetting (shadowing) configs in command line like `--config abcd.efgh= hg blah`.

I'm not changing existing behavior because this might break something but we sometimes rely on the fact that `bool("") == False`.

Reviewed By: markbt

Differential Revision: D29934620

fbshipit-source-id: fbc1231d88e00e1d887ffbba2d71e03a30653426
2021-07-29 16:25:33 -07:00
David Tolnay
aa8152f1dd Make thrift-generated dyn async traits future compatible
Summary:
The use of dyn traits of the Thrift-generated server traits was emitting future compatibility warnings with recent versions of rustc, due to a fixed soundness hole in the trait object system:

```
error: the trait `x_account_aggregator_if::server::XAccountAggregator` cannot be made into an object
     |
     = this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
```

This diff pulls in https://github.com/dtolnay/async-trait/releases/tag/0.1.51 which results in the Thrift-generated server traits no longer hitting the problematic pattern.

Reviewed By: zertosh

Differential Revision: D29979939

fbshipit-source-id: 3e6e976181bfcf35ed453ae681baeb76a634ddda
2021-07-29 16:25:33 -07:00
Muir Manders
e24a3a8f0c nativecheckout: improve progress indicator
Summary:
The "Calculating" step corresponds to comparing manifests to determine what files have changed. Previously it was just a spinner with no concept of progress. I've tweaked it to display the current tree depth as we are planning. This gives the user something to derive progress from. Depth refers to the directory depth as the checkout plan breadth-first searches across the current tree and destination tree. The time required to diff the two trees is normally proprotional to the depth of the repo, so this is a decent indicator.

Note that there is no "total" set for the progress bar since the max or average depth of a repo doesn't seem readily available. We can add that in the future to provide a true progress bar.

Reviewed By: andll

Differential Revision: D29948994

fbshipit-source-id: bdb5d7a868345d66b9812c2e56159bbf66e6daff
2021-07-29 16:25:32 -07:00
Zeyi (Rice) Fan
8fecfaa301 windows: manually detect file type
Summary: Boost is not happy when it encounters UNIX domain socket file on Windows. Let's detect the file type manually instead of using boost.

Reviewed By: xavierd

Differential Revision: D29974282

fbshipit-source-id: e11558abdbc565014189ae763a5b3fb5486d38d7
2021-07-29 16:25:32 -07:00
Zeyi (Rice) Fan
66fb59dd92 use processor factory to avoid segfault on Windows
Reviewed By: xavierd

Differential Revision: D29978277

fbshipit-source-id: 4baf828e7a0309759fc90ce65857519d82619b0b
2021-07-29 16:25:32 -07:00
Liubov Dmitrieva
8e99088d58 Update backup state in hg cloud upload command
Summary:
Update backup state in `hg cloud upload` command

The backup state is used by `hg sl`, so it would be nice to keep it up-to-date after `hg cloud upload` command, similar to old `hg cloud backup`.

Also, we should add heads what we filtered in order to update the backup state correctly.

So, it will now returned list of uploaded heads as nodes (including filtered) and list of failed commits as nodes (not only heads).

Reviewed By: markbt

Differential Revision: D29878296

fbshipit-source-id: 5848e9f86175fbdc56db123cf7ba0d5fc51273b0
2021-07-29 12:11:57 -07:00
Muir Manders
c5a3dbfdb9 nativecheckout: detect unchanged sparse profile
Summary: If the "update" destination sparse profile is identical to the current sparse profile, we now pass "None" to checkoutplan, allowing it to avoid slow call to with_sparse_profile_change. Updating across a small number of commits still took a while due to the unnecessary futzing with sparse profiles.

Reviewed By: andll

Differential Revision: D29949015

fbshipit-source-id: d6fc2ceb7776cd2f2ee42f3dc5b8358f770a7947
2021-07-29 12:05:53 -07:00
Xavier Deguillard
09f97fa27a store: diff should respect the mount case sensitivity
Summary:
During a diff operation, files that have a case change should not reported as
changed for case insensitive mount. This is a follow up to D29150552 (37ccaa9231) where the
TreeInode code was taught to ignore case changes for case insensitive mounts.

Reviewed By: kmancini

Differential Revision: D29952464

fbshipit-source-id: e5fa8eccc1c1984a680838fd8589a0278989d9d0
2021-07-29 11:29:42 -07:00
Stanislau Hlebik
95e9e913bf mononoke: use shared error to improve error messages when inserting into the blobstore sync queue
Summary:
We didn't  print underlying causes of insertion failure. The reason we didn't was because
```
let s = format!("failed to insert {}", err);
```

used `{}`, and in order to print caused we need either `{:#}` or {:?}` - see https://docs.rs/anyhow/1.0.42/anyhow/struct.Error.html#display-representations.

However krallin suggested that we can achieve the same by  by converting the error to SharedError instead of stringifying it. Let's do that instead.

Reviewed By: krallin

Differential Revision: D29985083

fbshipit-source-id: 8ae3abcfc4db9ef62581a3e20462eb6bbfb401b6
2021-07-29 11:13:05 -07:00
Jun Wu
e0b3d491b7 test-eager-exchange: skip part that is incompatible on Windows
Summary:
On Windows the path separator (slash) is different. Let's skip part of the test
for now.

Reviewed By: andll

Differential Revision: D29980940

fbshipit-source-id: c45fe9f5f3b3ffe6d4d8eb209fa5572149db8d0e
2021-07-29 10:42:32 -07:00
Andrey Chursin
46c8b5ad09 debughiddencommit: do not print hash if failed to upload to cloud
Summary:
D29933694 (7652fc3d4a) introduced error code on failure to debughiddencommit, but was still printing hash, which might confuse some automation
It is expectation that hash that is printed by debughiddencommit is uploaded to commit cloud, so printing hash when upload failed does not make sense

Reviewed By: kulshrax

Differential Revision: D29967801

fbshipit-source-id: f88b80326c6c424492a493d106962cecd58239f6
2021-07-29 10:33:05 -07:00
Arun Kulshreshtha
7846b21dd5 edenapi: ensure http.convert-cert gets set
Summary:
The `http.convert-cert` option is normally set globally for each Mercurial process via an event handler (created at startup) that sets the option for every `http_client::Request`.

However, the `edenapi` crate can be used outside of Mercurial (such as by EdenFS), in which case these global HTTP options will no longer be applied.

Given that this particular option is essential for EdenAPI to work at all, this diff makes the EdenAPI `Builder` explicitly set it.

Reviewed By: xavierd

Differential Revision: D29971619

fbshipit-source-id: 186c7f2ffdcfbdc8d7fb43b8fda0eb6aa918c0b8
2021-07-29 10:10:15 -07:00
Mark Juggurnauth-Thomas
0fc1697815 rust: fix compiler warnings
Summary:
Warnings in Rust code can often indicate real problems, so it's important to
keep the build warning-free.  This fixes all warnings where the fix is obvious.

Reviewed By: liubov-dmitrieva

Differential Revision: D29933213

fbshipit-source-id: d1a418c1a70630a2aa1a5740fcbafc66ce8bdf91
2021-07-29 10:01:02 -07:00
Mark Juggurnauth-Thomas
bb35aa1ae8 provide path for trees when fetching from the datapack store
Summary:
While not strictly necessary, we should be providing the correct `Key` for
trees when fetching them from the Hg datapack store.  Pass the `path` through
to the backing store so it can be used to construct the `Key` for the tree.

Reviewed By: DurhamG

Differential Revision: D29933214

fbshipit-source-id: d9631ea37b5ffa3f7051112d12cf3161c7c677ef
2021-07-29 10:01:02 -07:00
Mark Juggurnauth-Thomas
6c5c7055ce refresh datastore if root tree is not found locally
Summary:
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: DurhamG

Differential Revision: D29915585

fbshipit-source-id: 34fe02ddf5804be425d9cabe1a56069f22e5e4d4
2021-07-29 10:01:02 -07:00
Mark Juggurnauth-Thomas
02c0bfc9e3 make hg inform edenfs of newly created root manifests
Summary:
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 resolve the commit to a root manifest.  It does this via the
import helper, but the import helper won't know about the commit until it is
restarted, which takes a long time.

To fix this, we add an optional "root manifest" parameter to the checkout or
reset parents thrift calls.  This allows the Mercurial client to inform EdenFS
of the root manifest that it already knows about, allowing EdenFS to skip this
step.

Reviewed By: chadaustin

Differential Revision: D29845604

fbshipit-source-id: 61736d84971cd2dd9a8fdaa29a1578386246e4bf
2021-07-29 10:01:02 -07:00
Zhengchao Liu
8f58e523cd synchronize getClient in scs metadata importer
Reviewed By: kmancini

Differential Revision: D29794557

fbshipit-source-id: e8e09c9aea994fad649af5119f3d8e42e12f5417
2021-07-29 09:56:24 -07:00
Stanislau Hlebik
eb55bb4284 mononoke: make sure multiplexed blobstore write succeeds if all underlying
Summary:
We had somewhat inconsistent behaviour in multiplexed blobstore:
1) If on_put handlers are too slow (i.e. they are slower than all blobstores) then we
succeed as soon as all blobstores were successful (regardless of the value of
minimum_successful_writes). It doesn't matter if on_put handlers fail or
succeed, we've already returned success to our user.
2) However if all writes to the queue quickly fail, then we return a failure
even if writes to all blobstore were successful.

#2 seems like a change in behaviour from an old diff D17421208 (9de1de2d8b), and not a
desirable one - if blobstore sync queue is unavailable and it responds with
failures quickly, then blobstore writes will always fail even if all blobstores
are healthy.

So this diff makes it so that we always succeed if all blobstore puts were
successful, regardless of success or failures of on_put handlers.

Reviewed By: liubov-dmitrieva

Differential Revision: D29985084

fbshipit-source-id: 64338d552be45a70d9b1d16dfbe7d10346ab539c
2021-07-29 08:37:53 -07:00
Yan Soares Couto
e2a7bc89db Move SCS tests out of OSS
Reviewed By: StanislavGlebik

Differential Revision: D29940309

fbshipit-source-id: ca22a2b47265f92f4e6bd29f8c5959511f8bad04
2021-07-29 05:36:40 -07:00
Stanislau Hlebik
03f5a60109 mononoke: log resulting cs_id from megarepo calls
Summary: It's useful for debugging

Reviewed By: mojsarn

Differential Revision: D29960133

fbshipit-source-id: e026b473b4a9fecebe41f2fff22dd57d514e51ab
2021-07-29 02:33:58 -07:00
Stanislau Hlebik
da4c040209 mononoke: use bookmark subscription in derived data tailer
Summary:
At the moment we read all bookmarks from leader database all the time. This is
quite wasteful for repos with large number of repos. Let's instead use
BookmarksSubscription - it uses bookmarks update log to read only bookmark that
changed

Reviewed By: krallin

Differential Revision: D29964975

fbshipit-source-id: 1cd8bc61c363e8254f0663139f90fef24b9df93e
2021-07-29 02:09:58 -07:00
Stanislau Hlebik
90ec89c6ae mononoke: track idle time in derived data tailer
Summary:
It's nice to now how much time tailer spends deriving things, and how long it's
idling. It can hint us on how much head room we have.

Reviewed By: farnz

Differential Revision: D29963128

fbshipit-source-id: 179c140d20f1097e7059a13549e39ae63ffd8198
2021-07-29 02:09:58 -07:00
Stanislau Hlebik
fbcb42a51f mononoke: remove dry_run functionality from backfill_derived_data
Summary:
It wasn't really ever used, and it's quite complicated and unnecessary. Let's
just remove it

Reviewed By: krallin

Differential Revision: D29963129

fbshipit-source-id: d31ec788fe31e010dcc8f110431f4e4fbda21778
2021-07-29 02:09:58 -07:00
Liubov Dmitrieva
a67aef1a16 fix debughiddencommit command for LFS
Summary:
fix `debughiddencommit` command for LFS

There was an issue with the current implementation. It was hidden too early.

backup.backup logic triggers lfs upload but because lfs extension is not enabled, it goes to

remotefilelog.uploadblobs. This function contains the following code:

```
def uploadblobs(repo, nodes):
    toupload = []
    for ctx in repo.set("%ln - public()", nodes):
        for f in ctx.files():
            if f not in ctx:
                continue

            fctx = ctx[f]
            toupload.append((fctx.path(), fctx.filenode()))
    repo.fileslog.contentstore.upload(toupload)
```

The revset doesn't work for commits.

Reviewed By: markbt

Differential Revision: D29960636

fbshipit-source-id: 8c746c5b0484678e9e988105e980381a0172b38c
2021-07-29 02:03:57 -07:00
Xavier Deguillard
fbbc345561 inodes: remove unused statement
Summary:
There is no need to obtain the PrjfsChannel twice, especially if the first one
is unused.

Reviewed By: fanzeyi

Differential Revision: D29977555

fbshipit-source-id: 56428eae84a6abd8689b4f997173e0aa1501aede
2021-07-28 19:00:52 -07:00
Stanislau Hlebik
b9ce9c0933 mononoke: make sync_changeset return result immediately if it was computed
Summary:
Just as with D29874802 and D29848377, let's make sure if the same
sync_changeset request was sent again then we would return the same result.

Reviewed By: mojsarn

Differential Revision: D29876414

fbshipit-source-id: 91c3bd38983809da8ce246f44066204df667bb12
2021-07-28 10:03:26 -07:00
Stanislau Hlebik
34f0396fa0 mononoke: move bookmark in sync_changeset conditionally
Summary:
# Goal of the stack

There goal of this stack is to make megarepo api safer to use. In particular, we want to achieve:
1) If the same request is executed a few times, then it won't cause corrupt repo in any way (i.e. it won't create commits that client didn't intend to create and it won't move bookmarks to unpredictable places)
2) If request finished successfully, but we failed to send the success to the client, then repeating the same request would finish successfully.

Achieving #1 is necessary because async_requests_worker might execute a few requests at the same time (though this should be rare). Achieveing #2 is necessary because if we fail to send successful response to the client (e.g. because of network issues), we want client to retry and get this successful response back, so that client can continue with their next request.

In order to achieve #1 we make all bookmark move conditional i.e. we move a bookmark only if current location of the bookmark is at the place where client expects it. This should help achieve goal #1, because even if we have two requests executing at the same time, only one of them will successfully move a bookmark.

However once we achieve #1 we have a problem with #2 - if a request was successful, but we failed to send a successful reply back to the client then client will retry the request, and it will fail, because a bookmark is already at the new location (because previous request was successful), but client expects it to be at the old location (because client doesn't know that the request was succesful). To fix this issue before executing the request we check if this request was already successful, and we do it heuristically by checking request parameters and verifying the commit remapping state. This doesn't protect against malicious clients, but it should protect from issue #2 described above.

So the whole stack of diffs is the following:
1) take a method from megarepo api
2) implement a diff that makes bookmark moves conditional
3) Fix the problem #2 by checking if a previous request was successful or not

# This diff

Now that we have target_location in sync_changeset() method,
let's move bookmark in sync_changeset conditionally, just as in D29874803 (5afc48a292).

This would prevent race conditions from happening when the same sync_changeset
method is executing twice.

Reviewed By: krallin

Differential Revision: D29876413

fbshipit-source-id: c076e14171c6615fba2cedf4524d442bd25f83ab
2021-07-28 10:03:26 -07:00
Stanislau Hlebik
c5162598f0 mononoke: add target_location to sync_changeset method
Summary:
# Goal of the stack

There goal of this stack is to make megarepo api safer to use. In particular, we want to achieve:
1) If the same request is executed a few times, then it won't cause corrupt repo in any way (i.e. it won't create commits that client didn't intend to create and it won't move bookmarks to unpredictable places)
2) If request finished successfully, but we failed to send the success to the client, then repeating the same request would finish successfully.

Achieving #1 is necessary because async_requests_worker might execute a few requests at the same time (though this should be rare). Achieveing #2 is necessary because if we fail to send successful response to the client (e.g. because of network issues), we want client to retry and get this successful response back, so that client can continue with their next request.

In order to achieve #1 we make all bookmark move conditional i.e. we move a bookmark only if current location of the bookmark is at the place where client expects it. This should help achieve goal #1, because even if we have two requests executing at the same time, only one of them will successfully move a bookmark.

However once we achieve #1 we have a problem with #2 - if a request was successful, but we failed to send a successful reply back to the client then client will retry the request, and it will fail, because a bookmark is already at the new location (because previous request was successful), but client expects it to be at the old location (because client doesn't know that the request was succesful). To fix this issue before executing the request we check if this request was already successful, and we do it heuristically by checking request parameters and verifying the commit remapping state. This doesn't protect against malicious clients, but it should protect from issue #2 described above.

So the whole stack of diffs is the following:
1) take a method from megarepo api
2) implement a diff that makes bookmark moves conditional
3) Fix the problem #2 by checking if a previous request was successful or not

# This diff

We already have it for change_target_config, and it's useful to prevent races
and inconsistencies. That's especially important given that our async request
worker might run a few identical sync_changeset methods at the same time, and
target_location can help process this situation correctly.

Let's add target_location to sync_changeset, and while there I also updated the
comment for these fields in other methods. The comment said

```
// This operation will succeed only if the
// `target`'s bookmark is still at the same location
// when this operation tries to advance it
```

This is not always the case - operation might succeed if the same operation has been
re-sent twice,  see previous diffs for more explanationmotivation.

Reviewed By: krallin

Differential Revision: D29875242

fbshipit-source-id: c14b2148548abde984c3cb5cc62d04f920240657
2021-07-28 10:03:26 -07:00
Stanislau Hlebik
c9473f74f6 mononoke: make change_target_config return result immediately if it was computed
Summary:
# Goal of the stack

There goal of this stack is to make megarepo api safer to use. In particular, we want to achieve:
1) If the same request is executed a few times, then it won't cause corrupt repo in any way (i.e. it won't create commits that client didn't intend to create and it won't move bookmarks to unpredictable places)
2) If request finished successfully, but we failed to send the success to the client, then repeating the same request would finish successfully.

Achieving #1 is necessary because async_requests_worker might execute a few requests at the same time (though this should be rare). Achieveing #2 is necessary because if we fail to send successful response to the client (e.g. because of network issues), we want client to retry and get this successful response back, so that client can continue with their next request.

In order to achieve #1 we make all bookmark move conditional i.e. we move a bookmark only if current location of the bookmark is at the place where client expects it. This should help achieve goal #1, because even if we have two requests executing at the same time, only one of them will successfully move a bookmark.

However once we achieve #1 we have a problem with #2 - if a request was successful, but we failed to send a successful reply back to the client then client will retry the request, and it will fail, because a bookmark is already at the new location (because previous request was successful), but client expects it to be at the old location (because client doesn't know that the request was succesful). To fix this issue before executing the request we check if this request was already successful, and we do it heuristically by checking request parameters and verifying the commit remapping state. This doesn't protect against malicious clients, but it should protect from issue #2 described above.

So the whole stack of diffs is the following:
1) take a method from megarepo api
2) implement a diff that makes bookmark moves conditional
3) Fix the problem #2 by checking if a previous request was successful or not

# This diff

Same as with D29848377 - if result was already computed and client retries the
same request, then return it.

Differential Revision: D29874802

fbshipit-source-id: ebc2f709bc8280305473d6333d0725530c131872
2021-07-28 10:03:26 -07:00
Stanislau Hlebik
47e92203dc mononoke: make add_sync_target return result immediately if it was computed
Summary:
# Goal of the stack

There goal of this stack is to make megarepo api safer to use. In particular, we want to achieve:
1) If the same request is executed a few times, then it won't cause corrupt repo in any way (i.e. it won't create commits that client didn't intend to create and it won't move bookmarks to unpredictable places)
2) If request finished successfully, but we failed to send the success to the client, then repeating the same request would finish successfully.

Achieving #1 is necessary because async_requests_worker might execute a few requests at the same time (though this should be rare). Achieveing #2 is necessary because if we fail to send successful response to the client (e.g. because of network issues), we want client to retry and get this successful response back, so that client can continue with their next request.

In order to achieve #1 we make all bookmark move conditional i.e. we move a bookmark only if current location of the bookmark is at the place where client expects it. This should help achieve goal #1, because even if we have two requests executing at the same time, only one of them will successfully move a bookmark.

However once we achieve #1 we have a problem with #2 - if a request was successful, but we failed to send a successful reply back to the client then client will retry the request, and it will fail, because a bookmark is already at the new location (because previous request was successful), but client expects it to be at the old location (because client doesn't know that the request was succesful). To fix this issue before executing the request we check if this request was already successful, and we do it heuristically by checking request parameters and verifying the commit remapping state. This doesn't protect against malicious clients, but it should protect from issue #2 described above.

So the whole stack of diffs is the following:
1) take a method from megarepo api
2) implement a diff that makes bookmark moves conditional
3) Fix the problem #2 by checking if a previous request was successful or not

# This diff

If a previous add_sync_target() call was successful on mononoke side, but we
failed to deliver this result to the client (e.g. network issues), then client
would just try to retry this call. Before this diff it wouldn't work (i.e. we
just fail to create a bookmark because it's already created). This diff fixes
it by checking a commit this bookmark points to and checking if it looks like
it was created by a previous add_sync_target call. In particular, it checks
that remapping state file matches the request parameters, and that config
version is the same.

Differential Revision: D29848377

fbshipit-source-id: 16687d975748929e5eea8dfdbc9e206232ec9ca6
2021-07-28 10:03:26 -07:00
Stanislau Hlebik
e17e77eea3 mononoke: add repo_id parameter when finding abandoned requests
Summary:
Addressing comment from
https://www.internalfb.com/diff/D29845826 (f4a078e257)?transaction_fbid=1017293239127849

Reviewed By: krallin

Differential Revision: D29955591

fbshipit-source-id: a99bdd9dd8181e5cba54944d4957ce56b8ecb4f3
2021-07-28 06:23:31 -07:00
Yan Soares Couto
963e703210 Deduplicate uploads of raw file blobs
Summary:
When uploading exactly the same file more than once, let's only upload each blob once.

This is already done on the function that also uploads filenodes, but not here.

Reviewed By: liubov-dmitrieva

Differential Revision: D29941483

fbshipit-source-id: ef8509223a11816c1b6f1e7f376d05b96f074340
2021-07-28 04:26:44 -07:00
Liubov Dmitrieva
7652fc3d4a return non zero error code if we failed to upload commits or backup an ephemeral commit.
Summary: return non zero error code if we failed to upload commits or backup an ephemeral commit.

Reviewed By: andll

Differential Revision: D29933694

fbshipit-source-id: dd7fdb020c1d0c5bbd04cb22edb41a33470e0ebd
2021-07-28 03:56:59 -07:00
Yan Soares Couto
cc498b04c4 Use common response for methods with upload tokens
Summary:
There were 3 places that use the same type of response:
```
Response {
   index: usize,
   token: UploadToken,
}
```

This diff merges all of them by using a single `UploadTokensResponse`. I'm still using aliases (`use as`) for all of them, if desired I can rename everywhere to use the actual type `UploadTokensReponse`.

Reviewed By: liubov-dmitrieva

Differential Revision: D29878626

fbshipit-source-id: 92af2d4c40eae42edd0a8594642ef0b816df4feb
2021-07-28 02:16:35 -07:00
Yan Soares Couto
4bde7b7488 Use bonsai changeset upload on client
Summary:
## High level goal

This stack aims to add a way to upload commits directly using the bonsai format via edenapi, instead of using the hg format and converting on server.

The reason this is necessary is that snapshots will be uploaded on bonsai format directly, as hg format doesn't support them. So this is a stepping stone to do that, first being implemented on commit cloud upload, as that code already uses eden api, and later will be used by the snapshotting commands.

## This diff

This diff actually ties everything together from the stack and makes it work end to end. By creating the following client side changes:
- Add some config to use the bonsai format when uploading via EdenApi. The config is disabled by default.
- Add wrapper around new uploadfileblobs method (from D29799484 (8586ae1077))
- Getting the correct data to call the bonsai changeset upload endpoint created on D29849963 (b6548a10cb)
  - Some fields are String and not bytes
  - Some fields are renamed
  - File size and type can be acquired from file context. file content id, which is also required, is obtained as a response from the uploadfileblobs method: Behaviour added on D29879617 (9aae11a5ab)

Reviewed By: liubov-dmitrieva

Differential Revision: D29849964

fbshipit-source-id: a039159f927f49bbc45d4e0160ec1d3a01334eca
2021-07-28 02:16:35 -07:00
Jia Chen
b742a447e2 Switch eden to new Pyre backend
Summary: This project has custom stubs that contain type errors. We'll need to fix them so the switch to new Pyre backend won't create any regressions.

Reviewed By: dkgi

Differential Revision: D29953374

fbshipit-source-id: f54d25682d6b01eed4867eab6823e29ddb95e754
2021-07-27 22:39:51 -07:00
Zhengchao Liu
cd044d60cf make NotFetched as the default RequestContext origin
Summary: Addresses feedback on {D29805637 (067abe2d55)}.

Reviewed By: chadaustin

Differential Revision: D29951945

fbshipit-source-id: 36f33de9762634e99d898ffdd64dfbd9e7ea9323
2021-07-27 21:23:38 -07:00
Xavier Deguillard
2a2a269d17 integration: fix pull_test with getdeps
Summary:
We need to set the infinitepush path too so that the Mercurial autopull code
won't try to pull from Mononoke

Reviewed By: genevievehelsel

Differential Revision: D29943227

fbshipit-source-id: a67dbfe97e7ab46dee885d9ec91a4d194dc2bd37
2021-07-27 16:16:30 -07:00
Stanislau Hlebik
ad0c9b7e2c mononoke: add more scuba logging to async request worker
Summary: It's nice to understand what's going on

Reviewed By: liubov-dmitrieva

Differential Revision: D29846694

fbshipit-source-id: 7551199ef4529e45c0eb23f79c0cc4a71ba54d0f
2021-07-27 14:12:54 -07:00
Stanislau Hlebik
f4a078e257 mononoke: make sure async megarepo requests are picked up by another worker if current worker dies
Summary:
High-level goal of this diff:
We have a problem in long_running_request_queue - if a tw job dies in the
middle of processing a request then this request will never be picked up by any
other job, and will never be completed.
The idea of the fix is fairly simple - while a job is executing a request it
needs to constantly update inprogress_last_updated_at field with the current
timestamp. In case a job dies then other jobs would notice that timestamp
hasn't been updated for a while and mark this job as "new" again, so that
somebody else can pick it up.
Note that it obviously doesn't prevent all possible race conditions - the worker
might just be too slow and not update the inprogress timestamp in time, but
that race condition we'd handle on other layers i.e. our worker guarantees that
every request will be executed at least once, but it doesn't guarantee that it will
be executed exactly once.

Now a few notes about implementation:
1) I intentionally separated methods for finding abandoned requests, and marking them new again. I did so to make it easier to log which requests where abandoned (logging will come in the next diffs).

2) My original idea (D29821091) had an additional field called execution_uuid, which would be changed each time a new worker claims a request. In the end I decided it's not worth it - while execution_uuid can reduce the likelyhood of two workers running at the same time, it doesn't eliminate it completely. So I decided that execution_uuid doesn't really gives us much.

3) It's possible that there will be two workers will be executing the same request and update the same inprogress_last_updated_at field. As I mentioned above, this is expected, and request implementation needs to handle it gracefully.

Reviewed By: krallin

Differential Revision: D29845826

fbshipit-source-id: 9285805c163b57d22a1936f85783154f6f41df2f
2021-07-27 14:12:53 -07:00
Stanislau Hlebik
9271300067 mononoke: mark some fields as nullable
Summary:
Currently they got zeros by default, but having NULL here seems like a nicer
option.

Reviewed By: krallin

Differential Revision: D29846254

fbshipit-source-id: 981d979055eca91594ef81f0d6dc4ba571a2e8be
2021-07-27 14:12:53 -07:00
Stanislau Hlebik
3b7d6bdfae mononoke: bring long_running_request_queue in sync with what we have in prod
Reviewed By: krallin

Differential Revision: D29817070

fbshipit-source-id: 37b029e74c54df7ff5a7bd4a1c8ef3f85fff127c
2021-07-27 14:12:53 -07:00
Stanislau Hlebik
8cd6278de9 mononoke: implement ensure_ancestors_of option for bookmarks
Summary:
This option would let us tell that a given bookmark (or bookmarks if they are
specified via a regex) is allowed to move only if it stays an ancestor of a
given bookmark.
Note - this is a sev followup, and we intend to use it for */stable bookmarks
(e.g. fbcode/stable, fbsource/stable etc). They are always intended to be an
ancestor of master

Reviewed By: krallin

Differential Revision: D29878144

fbshipit-source-id: a5ce08a09328e6a19af4d233c1a273a5e620b9ce
2021-07-27 12:47:22 -07:00
Muir Manders
3b281295b9 amend: fix file mixup during "--to" rebase
Summary:
When rebasing during "amend --to", we were mixing up file contents when there was more than a single merged file in a three way merge. The cause was a lambda within a loop closing over a loop variable.

Also suppress the "merging some/file.c" message if the result of the three way merge is identical to the "local" version of the file. It is confusing to see unexpected "merging" messages.

Reviewed By: DurhamG

Differential Revision: D29940097

fbshipit-source-id: 5a4c19279c14209268359939fbf91f164c791b2e
2021-07-27 12:26:42 -07:00
Xavier Deguillard
628ba1b62d utils: fix race in SpawnedProcess::threadedCommunicate
Summary:
TSAN complains that pipes_ is read and written in different threads without
proper synchronization. To avoid this, we can simply close the FileDescriptor
without removing it from the pipes map as this achieve the same result: it
notifies the reader that the endpoint is closed.

Differential Revision: D29924043

fbshipit-source-id: be92630799bb5c78089dbe85f9c2f02f937300bc
2021-07-27 07:32:42 -07:00
Yan Soares Couto
5ee6cc870b Read parents hgid from blobrepo when not local
Summary:
## High level goal

This stack aims to add a way to upload commits directly using the bonsai format via edenapi, instead of using the hg format and converting on server.

The reason this is necessary is that snapshots will be uploaded on bonsai format directly, as hg format doesn't support them. So this is a stepping stone to do that, first being implemented on commit cloud upload, as that code already uses eden api, and later will be used by the snapshotting commands.

## This diff

This diff fixes the bonsai changeset upload endpoint, by making it get the changesets for the parents using hgids by querying them from blobrepo. The inner map is not enough as the bottom of the stack always has a parent outside of the stack.

Reviewed By: liubov-dmitrieva

Differential Revision: D29880356

fbshipit-source-id: b6b5428159e8c74f5a910f39dadb98aa10c78542
2021-07-27 05:46:41 -07:00
Yan Soares Couto
9aae11a5ab Return indexed content ids on uploadfileblobs call
Summary:
## High level goal

This stack aims to add a way to upload commits directly using the bonsai format via edenapi, instead of using the hg format and converting on server.

The reason this is necessary is that snapshots will be uploaded on bonsai format directly, as hg format doesn't support them. So this is a stepping stone to do that, first being implemented on commit cloud upload, as that code already uses eden api, and later will be used by the snapshotting commands.

## This diff

Modifies `uploadfileblobs_py` API method so that it returns the indexed UploadToken's. This will be used on the client code to get the content ids from the upload files, which are necessary to specify when storing the commit in Bonsai format. This is calculated in Rust when uploading the files, and we reuse the result so it doesn't need to be calculated again.

It reuses the `UploadHgFilenodeResponse` struct, which has the exact same format it needs. That is a bit ugly, and its refactored in D29878626.

Reviewed By: liubov-dmitrieva

Differential Revision: D29879617

fbshipit-source-id: 4e7bda1e1160da11c83f43002530fd1aba08d46d
2021-07-27 05:46:41 -07:00
Yan Soares Couto
793b2d85b1 Add bonsai upload to eden api py ext
Summary:
## High level goal

This stack aims to add a way to upload commits directly using the bonsai format via edenapi, instead of using the hg format and converting on server.

The reason this is necessary is that snapshots will be uploaded on bonsai format directly, as hg format doesn't support them. So this is a stepping stone to do that, first being implemented on commit cloud upload, as that code already uses eden api, and later will be used by the snapshotting commands.

## This diff

This diff adds the new endpoint to the API that can be acessed via python code, and in turn calls the api implemented on the last diff.

Reviewed By: liubov-dmitrieva

Differential Revision: D29849962

fbshipit-source-id: 5a2a674aef1edd3b0d95cb2b45b02ef9c20aca48
2021-07-27 05:46:41 -07:00
Yan Soares Couto
db66a87ab0 Add bonsai upload to EdenApi trait
Summary:
## High level goal

This stack aims to add a way to upload commits directly using the bonsai format via edenapi, instead of using the hg format and converting on server.

The reason this is necessary is that snapshots will be uploaded on bonsai format directly, as hg format doesn't support them. So this is a stepping stone to do that, first being implemented on commit cloud upload, as that code already uses eden api, and later will be used by the snapshotting commands.

## This diff

This diff adds a trait method to call the endpoint added on D29849963.

It's mostly boilerplate, calling the correct endpoint, converting types from/to wire.

Reviewed By: liubov-dmitrieva

Differential Revision: D29849965

fbshipit-source-id: 4a821e965fe4319fddd8e13b13ed4de5b7f86e93
2021-07-27 05:46:41 -07:00
Yan Soares Couto
b6548a10cb Add upload bonsai changeset endpoint
Summary:
## High level goal

This stack aims to add a way to upload commits directly using the bonsai format via edenapi, instead of using the hg format and converting on server.

The reason this is necessary is that snapshots will be uploaded on bonsai format directly, as hg format doesn't support them. So this is a stepping stone to do that, first being implemented on commit cloud upload, as that code already uses eden api, and later will be used by the snapshotting commands.

## This diff

This diff creates an endpoint on eden api which uploads a commit using the bonsai format.

It also adds all the necessary types to represent a bonsai commit (basically the same as hg commit, but no manifests, and a bit more detail on how each file changed) via the wire, and related boilerplate.

Reviewed By: liubov-dmitrieva

Differential Revision: D29849963

fbshipit-source-id: 2ff44d53874449ae4373a0135a60ead40c541309
2021-07-27 05:46:40 -07:00
Yan Soares Couto
8586ae1077 Add upload_fileblobs function
Summary:
## High level goal

This stack aims to add a way to upload commits directly using the bonsai format via edenapi, instead of using the hg format and converting on server.

The reason this is necessary is that snapshots will be uploaded on bonsai format directly, as hg format doesn't support them. So this is a stepping stone to do that, first being implemented on commit cloud upload, as that code already uses eden api, and later will be used by the snapshotting commands.

## This diff

Uploads file contents without uploading filenodes. Will be used for uploading a
commit in bonsair format instead of mercurial format via EdenAPI.

This is basically the same method as before D29549091 (d327996144).

Reviewed By: liubov-dmitrieva

Differential Revision: D29799484

fbshipit-source-id: 136c058ebcd814f39c5b903f5d8bfef7ff6005dc
2021-07-27 05:46:40 -07:00
Stanislau Hlebik
30395f41e2 mononoke: print latest error when reading megarepo configs
Summary: It makes it easier to understand what went wrong

Reviewed By: krallin

Differential Revision: D29894836

fbshipit-source-id: 1bc759067350b823d388fcab9a8cee41da4423af
2021-07-27 02:13:09 -07:00
Stanislau Hlebik
5dcc30a4b1 mononoke: fix megarepo logging to use correct method name
Reviewed By: krallin

Differential Revision: D29894709

fbshipit-source-id: 3f33df57cd0c32b40eb55dc02ef3820138a423d0
2021-07-27 02:13:09 -07:00
Genevieve Helsel
5a34dd506f perserve missing env var edenfs environment
Reviewed By: kmancini

Differential Revision: D29802351

fbshipit-source-id: 861a2a160721e4ded01dc120c9f42bccdd839fb8
2021-07-26 20:39:28 -07:00
Xavier Deguillard
dd29533b60 test: verify that EdenFS can be started in the fsck tests
Summary:
If for some reason EdenFS cannot be started, we shouldn't attempt to run the
fsck tests as these would always fail.

Reviewed By: genevievehelsel

Differential Revision: D29918436

fbshipit-source-id: 6e4a01a747157427e5c1028084e32cef8066c96a
2021-07-26 20:07:19 -07:00
Zhengchao Liu
fbe154d28e report fsck progress correctly
Summary: This affects all platforms but more noticeable on Mac that tons of 100% printed (e.g. P409794954), probably due to some weirdness with cursor.

Reviewed By: fanzeyi

Differential Revision: D29922276

fbshipit-source-id: 987f6b9ef5a8a4ab738aa6edbd617184bbcb2d1c
2021-07-26 19:25:05 -07:00
Zhengchao Liu
b51e5d07f8 introduce NfsRequsetContext
Summary: As title. `RequsetContext` allows us to track metrics such as latency and count.

Reviewed By: genevievehelsel

Differential Revision: D29835813

fbshipit-source-id: 6b85fc8f11923f530fce6d871fa2253db21bfa98
2021-07-26 16:04:03 -07:00
Jun Wu
0ef56b6554 dag: respect missing cache on vertex_id_batch
Summary:
Previously the missing vertex cache was ignored by vertex_id_batch.
Respecting it can help reduce remote lookups.

Reviewed By: andll

Differential Revision: D29889457

fbshipit-source-id: 0469b1e61c42ad31e0dd486ab7c752bf4aeeba5c
2021-07-26 15:23:40 -07:00
Jun Wu
606e07e9f7 dag: reuse caches if dag does not change on disk
Summary:
This will help remove some unnecessary cache invalidations, and help avoid
remote lookups.

Reviewed By: andll

Differential Revision: D29889458

fbshipit-source-id: e9a36b227c3b2c7f6b9830a8b27f5a16e363c94e
2021-07-26 15:23:40 -07:00
Jun Wu
e0d9c0e457 dag: add some tracing logs
Summary: Added some dag::cache tracing logs to check cache status.

Reviewed By: andll

Differential Revision: D29889459

fbshipit-source-id: 41a4af1ad5d187164d954f1602b8c7a2d3bacaf8
2021-07-26 15:23:39 -07:00
Jun Wu
64c0d7e986 dag: expose version in namedag states
Summary:
This will be used to detect if the NameDag was changed between reloads,
and decide whether we need to invalidate caches or not.

Reviewed By: andll

Differential Revision: D29888938

fbshipit-source-id: 377879bd8d28c92feca80c025613a65139ccb866
2021-07-26 15:23:39 -07:00
Jun Wu
1c4cf6a5ec indexedlog: introduce version concept to MultiLog
Summary:
The version gets bumped on writing to disk.

This makes it easier for callsites to detect whether there are changes to the
MultiLog. It will be used by the upcoming changes.

Reviewed By: andll

Differential Revision: D29888939

fbshipit-source-id: 278887cd59c85e49f606334529a27557a4bc1dc5
2021-07-26 15:23:39 -07:00
Jun Wu
08c596b72e hgcommands: setup fail points
Summary: Setup fail points so `FAILPOINTS` can work.

Reviewed By: andll

Differential Revision: D29888940

fbshipit-source-id: 4e6f98ed0a1c1410d6992f92ff810b5ef64ba76e
2021-07-26 15:23:39 -07:00
Jun Wu
8cb3d3dd75 dag: add fail points on opening namedag
Summary:
It turns out that the namedag was opened multiple times. Add a fail point to
help figure out the callsite.

The `fail` crate allows something like:

  FAILPOINTS="dag-namedag-open=1*sleep(1)->return"
  FAILPOINTS="dag-namedag-open=1*sleep(1)->panic"

Meaning that the first open causes 1ms sleep, and the second
causes an error (turns into a Python backtrace), or a panic (turns into a Rust
backtrace with RUST_BACKTRACE=1).

Reviewed By: andll

Differential Revision: D29888937

fbshipit-source-id: b1644d7196f68262523ab9a5fc4fb110a4cc0062
2021-07-26 15:23:39 -07:00
Jun Wu
1dc90d221e changelog2: do not check tip remotely on add
Summary:
Previously it checks whether the new hash exists remotely, which makes offline
commit impossible.

`tip` is not that important. Just do a local check instead.

Reviewed By: andll

Differential Revision: D29834904

fbshipit-source-id: 94924591a5827942f428b74231b4494999856361
2021-07-26 15:23:39 -07:00
Jun Wu
6eb00586c8 test-eager-exchange: show remote lookups for commit or amend
Summary: Show that lazy changelog makes it impossible to commit or amend offline.

Reviewed By: andll

Differential Revision: D29834907

fbshipit-source-id: a268be05947cbf215cff1471a25dba72447bafec
2021-07-26 15:23:39 -07:00
Jun Wu
99c4b3b47d hgcommits: add a way to inject failure on resolving names remotely
Summary:
Similar to D29440143 (38f3ceafbc), add a way to disable resolving names by setting
a limit using `EDENSCM_REMOTE_NAME_THRESHOLD`.

This is useful to figure out callsite that tries to resolve names that
are previously unknwon, ex. newly generated commit hashes.

Reviewed By: andll

Differential Revision: D29834906

fbshipit-source-id: 9b6161bd62a026fa5a37e1cda9912bcb8bca6971
2021-07-26 15:23:39 -07:00
Arun Kulshreshtha
14d8c051c1 third-party/rust: remove patch from curl and curl-sys
Summary:
The patches to these crates have been upstreamed.

allow-large-files

Reviewed By: jsgf

Differential Revision: D29891894

fbshipit-source-id: a9f2ee0744752b689992b770fc66b6e66b3eda2b
2021-07-26 15:00:16 -07:00
Xavier Deguillard
2afd2b223e inodes: use getUnsafePath on checkout conflicts
Summary:
On Windows, there a commonly occuring issue where a checkout operation would
crash EdenFS as a conflict is being added for an unlinked inode, thus
triggering the XCHECK in the addConflict method.

From looking at the code, the comment that claims that inodes cannot be
unlinked during checkout isn't entirely accurate: EdenFS will unlink inodes
during checkout when their content changed. The code itself should properly
remove the unlinked inode from its parent TreeInode and thus I haven't fully
figured out the exact series of event that leads to a conflict being added for
an unlinked inode. Since the asumption from the comment is invalid, it should
be safe to not assert that the inode shouldn't be unlinked and use
InodeBase::getUnsafePath instead of InodeBase::getPath

Reviewed By: kmancini

Differential Revision: D29241901

fbshipit-source-id: 4239df576b3cbf716fb336fd4d6542939337a297
2021-07-26 14:14:57 -07:00
Xavier Deguillard
ca62644013 inodes: add InodeBase::getUnsafePath
Summary:
In some cases, the code needs to have access to the path for an inode even if
that inode is unlinked. In such situation, neither getPath nor getLogPath are
suitable, thus let's introduce a getUnsafePath, which is intended for these
handful of places.

The only known use case for such method is when adding conflicts during checkouts.

Reviewed By: genevievehelsel

Differential Revision: D29241902

fbshipit-source-id: 7756a95813d6fd5e471538cf82d29604dd5b8e5e
2021-07-26 14:14:57 -07:00
Mark Juggurnauth-Thomas
c8b33fd580 blame: enable batch derivation of blame_v2
Summary:
Implement batch derivation of blame V2.

Blame derivations are independent so long as the two commits do not change or
delete any of the same files.  We can re-use the existing batching code so long
as we change it to split the stacks on *any* change (not just a
change-vs-delete conflict).

Reviewed By: StanislavGlebik

Differential Revision: D29776514

fbshipit-source-id: b06289467c9ec502170c2f851b07569214b6ff0a
2021-07-26 07:09:35 -07:00
Stanislau Hlebik
116a51bd40 ConfigHandle: use fbthrift deserialization config reading
Summary:
I noticed that reading one of the mononoke configs was failing with

```
invalid type: string \"YnrbN4fJXYGlR1EzoxLRvVbibyUiRM/HZThRJnKBThA\", expected
a sequence at line 2587 column 61)\x18ninvalid type: string
\"YnrbN4fJXYGlR1EzoxLRvVbibyUiRM/HZThRJnKBThA\", expected a sequence at line
2587 column 61
```

The problem is coming from the fact that configerator configs use thrift simple
json encoding, which is different from normal json encoding. At the very least
the difference is in how binary fields are encoded - thrift simple json
encoding uses base64 to encode them. [1]

Because of this encoding difference reading the configs with binary fields in
them fails.

This diff fixes it by using simple_json deserialization for
get_config_handle()... but the existing callers used the old broken
`get_config_handle()` which is
incompatible with the new one. Old `get_config_handle()` relied on the fact
that serde::Deserializer can be used to deserialize the config, while thrift
simple json doesn't implement serde::Deserializer.

As a first step I migrated existing callers to use old deprecated method, and
we can migrate them to the new one as needed.

[1] It was a bit hard to figure out for sure what kind of encoding is used, but
discussion in
https://fb.workplace.com/groups/configerator.users/posts/3062233117342191
suggests that it's thrift simple json encoding after all

Reviewed By: farnz

Differential Revision: D29815932

fbshipit-source-id: 6a823d0e01abe641e0e924a1b2a4dc174687c0b4
2021-07-25 08:53:08 -07:00
Stanislau Hlebik
5afc48a292 mononoke: move bookmark in change_target_config conditionally
Summary:
Do a similar change to change_target_config as we've done for add_sync_target
in D29848378. Move bookmark only if it points to an expected commit. That would
prevent make it safer to deal with cases where the same change_target_config
was executing twice.

Reviewed By: mojsarn

Differential Revision: D29874803

fbshipit-source-id: d21a3029ee58e2a8acc41e37284d0dd03d2803a3
2021-07-24 03:55:08 -07:00
Stanislau Hlebik
4f632c4e8b mononoke: create bookmark in add_sync_target
Summary:
This is the first diff that tries to make megarepo asynchronous methods
idempotent - replaying the same reqeust twice shouldn't cause corruption on the
server. At the moment this is not the case - if we have a runaway
add_sync_target call, then in the end it moves a bookmark to a random place,
even if there was another same successful add_sync_target call and a few others on
top.

add_sync_target should create a new bookmark, and if a bookmark already exists
it's better to not move it to a random place.

This diff does it, however it creates another problem - if a request was successful on mononoke side, but we failed to deliver the successful result to the client (e.g. network issues), then retrying this request would fail because bookmark already exists. This problem will be addressed in the next diff.

Reviewed By: mojsarn

Differential Revision: D29848378

fbshipit-source-id: 8a58e35c26b989a7cbd4d4ac4cbae1691f6e9246
2021-07-24 03:55:08 -07:00
Michael Voznesensky
7ed41f2b36 Bump configerator, add support for config driven no parent commits
Summary: As discussed, extends Mononoke service to support commits w/o parents for the AI Infra usecase.

Reviewed By: markbt

Differential Revision: D29810303

fbshipit-source-id: f07fd7f1521ffe1cea85f1f54e71fe37fc39bb62
2021-07-23 13:40:18 -07:00
Shannon Zhu
3431d631c7 Remove target-based type checking in eden
Summary: Ensure checking is covered with the pyre config. unblocks deprecation of pyre targets based checking.

Reviewed By: pradeep90

Differential Revision: D29878832

fbshipit-source-id: 1bbeca3b61ae5b0362b768bbbe53057a1d72ee7f
2021-07-23 12:34:20 -07:00
Zhengchao Liu
321cb87688 cli support for ActivityRecorder
Summary:
This adds debug commands for ActivityRecorder:
```
eden debug start_recording --output-dir <DIR>
  * stdout: the id of the profile
eden debug stop_recording --unique <ID>
  * stdout: the output file path
```
Users can record multiple profiles concurrently. Each profile is identified by the timestamp when it started.

Reviewed By: genevievehelsel

Differential Revision: D29666359

fbshipit-source-id: 487ca67de77378a8141bc4ac46b9abd1375ffd23
2021-07-23 12:32:25 -07:00
Zhengchao Liu
6e18144baa log file access in ActivityRecorder
Reviewed By: genevievehelsel

Differential Revision: D29559677

fbshipit-source-id: 2ff8b9144f1d5d1a83f83e6a55d69a26735a5315
2021-07-23 12:32:25 -07:00
Zhengchao Liu
bf292e9e5b create ActivityRecorder boilerplate and thread it to EdenMount
Summary:
We want to introduce two debug commands to record perf profiles such as files read. This can later be integrated to CI so that we can have this data for troubleshooting perf issues.
* `eden debug start_recording` starts recording perf metrics such as files read/written and fetch counts/latency for a given mount.
* `eden debug end_recording` stops recording and dumps the recorded profile to a local file.

This diff adds the boilerplate `ActivityRecorder` (borrowed heavily from `HiveLogger`'s implementation). The start command would create an instance of the recorder; the end command would destroy the recorder. The recording and dumping are handled by the implementing class.

Reviewed By: genevievehelsel

Differential Revision: D29506895

fbshipit-source-id: a927a363942a041d5ae54186a265576325dfeed5
2021-07-23 12:32:25 -07:00
Genevieve Helsel
8263d8a606 set locale in hg env in integration tests
Summary: These are needed for mercurial in the test cases, we set this in the testharness C++ repo as well

Differential Revision: D29868460

fbshipit-source-id: e11cf41823ee073e3863fb5a38ecbf1146073ff5
2021-07-23 10:22:16 -07:00
Andrey Chursin
f3e4114186 fsprobe: implement sequential file reading test
Summary: This test reads files one by one and measures latency of reads

Reviewed By: kulshrax

Differential Revision: D29824745

fbshipit-source-id: abf73d4c279c184c2e76f2052304ea13c40e86b4
2021-07-23 10:09:25 -07:00
Liubov Dmitrieva
84aee08c10 Clean Up: remove old snapshots extension
Summary:
Clean Up: remove old snapshots extension.

This extension is unused and its name clashes with the new Snapshots project which offers a different implementation.

As discussed with markbt and yancouto, we should unfortunately delete this code.

Reviewed By: markbt

Differential Revision: D29875074

fbshipit-source-id: 2bcd835e58fc50c5aad94a184a4d2ecb6be79c9c
2021-07-23 09:57:35 -07:00
Liubov Dmitrieva
6d86a24632 add support for issue CAT commit cloud tokens on corp
Summary:
Add support for issue CAT commit cloud tokens on corp Macs.

This is needed to support enabling Scm Daemon for all mac users **automatically**.

The tool `corp_clicat` is probably not yet deployed everywhere but it will work once deployed.

The current manual way will remain working as well.

The current way is manual:

* obtaining OAuth token from https://our.intern.facebook.com/intern/oauth/184975892288525

* running `hg cloud auth -t <token>` (the command stores the token into Mac keychain, Scm Daemon fetches from it).

The problem with the manual way is that users are not aware about scm daemon and the features it provides. The manual way worked fine when the tokens were also used for hg commit cloud extension as well but now they are not used.

Reviewed By: markbt

Differential Revision: D29791737

fbshipit-source-id: 2391a196167e1f17d53a3231dbf58f7cb2bcd39a
2021-07-23 06:51:23 -07:00
Andrey Chursin
ea75c06d58 fsprobe: read probe plan
Reviewed By: kulshrax

Differential Revision: D29824746

fbshipit-source-id: 40528a4408d7f682a1611b05c6ff788eee89a7d5
2021-07-22 16:12:19 -07:00
Andrey Chursin
b7f8d625bf fsprobe: add fsprobe crate
Summary: This utility will be used to measure latency and throughput of EdenFS

Reviewed By: kulshrax

Differential Revision: D29824747

fbshipit-source-id: f5298125bdaa16ccd52cb00a6bc3cd544c0967b7
2021-07-22 16:12:19 -07:00
Chad Austin
1488d43cf1 redirections: handle ValueError from readlink on Windows
Summary: readlink on Windows raises ValueError instead of OSError. Handle that.

Reviewed By: kmancini

Differential Revision: D29854170

fbshipit-source-id: 0bcd0466e64768da34d186dceee5ce6a00b1be41
2021-07-22 15:39:17 -07:00
Yipu Miao
ca23978cdc Implement setPathRootId method
Reviewed By: chadaustin

Differential Revision: D29439945

fbshipit-source-id: 92c19ccffd14fdb8c99bcdf7be2f63960a4d5733
2021-07-22 15:04:31 -07:00
Stanislau Hlebik
d1e86ab457 mononoke: add more logging to add sync target call
Summary: It's nice to be able to keep track of what's going on

Reviewed By: mwdevine

Differential Revision: D29790543

fbshipit-source-id: b855d72efe8826a99b3a6a562722e299e9cbfece
2021-07-22 14:52:03 -07:00
Yan Soares Couto
3f8de3336a Add bubble id to upload files call
Summary:
Added an optional argument to `/upload/file`, that allows specifying a bubble id, which will be used to upload the file into the ephemeral blobstore instead of the main one.

This is necessary in order to create a snapshot, as all files must be in the ephemeral blobstore.

Reviewed By: liubov-dmitrieva

Differential Revision: D29734333

fbshipit-source-id: c1dcf8d5a78819925f8defbfbd7d06b0f6a9e973
2021-07-22 13:47:12 -07:00
Yan Soares Couto
681a5305e3 Use NonZeroU64 as BubbleId
Summary: Insert id's are always positive, so let's use `NonZeroU64` instead of `u64`. This is more restricted, which is good, but also has the added benefit that `Option<NonZeroU64>` doesn't use any additional space, because of compiler optimizations.

Reviewed By: StanislavGlebik

Differential Revision: D29733877

fbshipit-source-id: 8a0e1a1bd84bcedbba51840f1da8f8cac79bca42
2021-07-22 13:47:12 -07:00
Yan Soares Couto
16fbc46f2c Add ephemeral handle
Summary: Ephemeral handle is a blobstore that's built from a bubble and a "main blobstore", which first attempts to read from the ephemeral blobstore, but falls back to the main one. Will be used to read/write stuff in snapshots.

Reviewed By: liubov-dmitrieva

Differential Revision: D29733408

fbshipit-source-id: f15ae9d3009632cd71fafa88eac09986e0b958e7
2021-07-22 13:47:12 -07:00
Dustin Shahidehpour
e5a7ac4494 clean up python in prefetch cli
Summary:
- steal zertosh's helpers for avoiding CRLF on Windows.
- make private functions start with an underscore

Reviewed By: genevievehelsel

Differential Revision: D29804526

fbshipit-source-id: 5916f8cf634a6e8f15b57b0f588d93f84e6ecf81
2021-07-22 13:01:57 -07:00
Liubov Dmitrieva
bf41088ef2 Move EdenApi Uploads code from commit cloud extension to core
Summary:
Move EdenApi Uploads code from commit cloud extension to core

So this can be later used for pushes as well. The code is not commit cloud specific.

The function takes revs and returns uploaded, failed lists that are also revs.

Reviewed By: yancouto

Differential Revision: D29846299

fbshipit-source-id: e3a7fbc56f0b651c738dc06da7fdb7cde4feedf7
2021-07-22 11:52:57 -07:00
Mark Juggurnauth-Thomas
3dca04d257 tests: update test-backfill-derived-data.t
Summary: This test is overly reliant on exact logging output, and the output has changed.  Update the test for the new output, and make it a bit more lenient in the process.

Reviewed By: StanislavGlebik

Differential Revision: D29787827

fbshipit-source-id: 3e8aa77d2edcf3d0ca95c0d17d0b4e3845b78ae3
2021-07-22 09:34:14 -07:00
CodemodService Bot
0a402ce760 Daily common/rust/cargo_from_buck/bin/autocargo
Reviewed By: krallin

Differential Revision: D29841733

fbshipit-source-id: c9da8e0324f402f3b9726f2733b51de56abde8f6
2021-07-22 09:22:41 -07:00
Liubov Dmitrieva
33ab763498 Improve integration tests coverage for hg cloud upload and hg cloud sync
Summary:
Improve integration tests coverage for `hg cloud upload` and `hg cloud sync` with enabled upload.

This includes end2end tests for uploading mutation information, pulling commits from another repo,
generally how uploads behaves after a rebase, after file moves, after editing a commit message, how copy_from data has been preserved.

Reviewed By: markbt

Differential Revision: D29816436

fbshipit-source-id: 2aa421c8479683721984e13d537c34df8b1ca2d1
2021-07-22 08:31:19 -07:00
Liubov Dmitrieva
34fb6f721e update test certificates for another 10 years rather than the default 1 year
Summary: update test certificates for another 10 years rather than the default 1 year

Reviewed By: markbt

Differential Revision: D29846930

fbshipit-source-id: 98bc139c21e4d9e4cb5bab46485d849345bcc43d
2021-07-22 08:18:48 -07:00
Yan Soares Couto
838da13eb7 Use provided env var for CARGO_TARGET_DIR if present
Reviewed By: liubov-dmitrieva

Differential Revision: D29793661

fbshipit-source-id: 887dfce99439fc0db42e8ab6d57171b682d78fee
2021-07-22 06:10:56 -07:00
Liubov Dmitrieva
07b0dcf9cf move commitcloud to use auth settings provided already for the default path
Summary:
Move commitcloud to use TLS auth settings provided already for the default path.

I think it is a right approach to clean up separate configuration given that the certs for the default path has been supported for all platforms now and we have fully migrated to http/TLS.

Tested the token mode as well. Keep it fully supported for now.

This change will also allow on Demand to remove their custom commit cloud configuration.

Reviewed By: mzr

Differential Revision: D29764745

fbshipit-source-id: bc5681a919dfa6ec79ea3b832c9f4b98551278de
2021-07-22 03:46:53 -07:00
Jan Mazur
f19819341f overwrite headers with config and verbose mode
Summary:
It's useful to be able to overwrite or inject http headers without changing client's source code. I needed that when I was proxying client requests through ncat running locally on my machine - I had to set Host header.
Moreover, if it's part of the config, we'll be able to distribute it quickly with dynamicconfig to do some things.

Also, we have http.verbose that's being used by rust http client but it's not respected by mononokepeer in python. I'm adding that here as well. Not full blown verbose mode because it's not necessary - we're only upgrading to websocket.

Reviewed By: farnz

Differential Revision: D29792386

fbshipit-source-id: 51b7f3cf07a870636ac6aa126f0efb45e979ef30
2021-07-22 02:54:13 -07:00
Mark Juggurnauth-Thomas
1f81d30c93 source_control_service: add tree_exists and commit_path_exists
Summary:
Add methods to easily determine whether a tree exists, or whether anything
(either a file or a tree) exists at a particular path.

Reviewed By: StanislavGlebik

Differential Revision: D29815982

fbshipit-source-id: f3fb1919545bdcb46ed663a0a514338dc137abee
2021-07-22 00:09:27 -07:00
Zhengchao Liu
067abe2d55 collect memory and disk fetch counts
Summary: This adds counters for memory and disk counts in addition to import count so that we can understand cache hit rates during local investigation or output this in ActivityRecorder.

Reviewed By: genevievehelsel

Differential Revision: D29805637

fbshipit-source-id: 34261f91c33d6bd4bcb4b85b17d2e68360410896
2021-07-21 21:37:20 -07:00
Pyre Bot Jr
1b62f043b6 suppress errors in fbcode/eden - batch 1
Differential Revision: D29827031

fbshipit-source-id: f46b586a4e4710f6fd19828c09fd4241df562dd9
2021-07-21 17:40:14 -07:00
Sasitharan Jayagopal
0a235d684a Combine eden debug log and eden logs
Summary: Combine `eden debug log` and `eden logs`. The logic from `eden logs` is moved to `eden debug log upload`.

Reviewed By: genevievehelsel

Differential Revision: D29801785

fbshipit-source-id: 6283a33a3180fec6934ac52fc8d5eed4a0a483b0
2021-07-21 13:04:49 -07:00
Stanislau Hlebik
46827b3756 mononoke: remove unused method
Summary:
This is not used. Even though this method has the "right intention" (i.e. we
need to start marking long running requests as new), I'm not sure we can use it
as is. So let's just delete it for now.

Reviewed By: farnz

Differential Revision: D29817068

fbshipit-source-id: 84d392fea01dfb5fb7bc56f0072baf2cf70b39f4
2021-07-21 12:02:59 -07:00
Liubov Dmitrieva
25cd440bf8 support --date option in commit cloud history
Summary:
support --date option in commit cloud history

this could significantly simplify lookup for users if they know certain date range they are interested in

the date logic has been implemented to match the current `hg cloud sl --date` logic.

(the first timestamp >= date)

Reviewed By: markbt

Differential Revision: D29818966

fbshipit-source-id: eee5e8e7709d4ead1e9df35300177fc9abb63028
2021-07-21 11:51:13 -07:00
Liubov Dmitrieva
3b92e04d5e Clean Up: remove the old history ui.
Summary: The new UI is proven to be great, so there is no value to preserve the old one in our codebase I think.

Reviewed By: markbt

Differential Revision: D29817354

fbshipit-source-id: 152c7eaeb8c669fe71322c822f4e7f39c6f9062c
2021-07-21 09:35:26 -07:00
Dustin Shahidehpour
cb0b1b9db2 Log message to stderr if you didn't match any files.
Summary: https://fb.workplace.com/groups/eden.users/posts/4149086615141255/

Reviewed By: chadaustin

Differential Revision: D29804396

fbshipit-source-id: 8bfda9910c92431687005195cf956ba52b82a18e
2021-07-21 09:01:37 -07:00
Dustin Shahidehpour
52ee0ed655 beef-up docs for eden prefetch
Summary: https://fb.workplace.com/groups/eden.users/posts/4149086615141255/

Reviewed By: chadaustin

Differential Revision: D29803926

fbshipit-source-id: 41e8028b3dd9cf44fc93ec09c1446409148ac4a7
2021-07-21 09:01:37 -07:00
Jan Mazur
4d602331a2 print underlying errors in debug mode
Summary: Currently we only print what's in the `error` annotation.

Reviewed By: krallin

Differential Revision: D29794843

fbshipit-source-id: a2c411208d7be8fd856dd9b3f82fd96a4ed37aee
2021-07-21 07:19:32 -07:00
Liubov Dmitrieva
9c75e9b2b0 bugfix: fix uninitalized state variable
Summary:
bugfix: fix uninitalized state variable and add a test

in rare cases it is used further down the code

Reviewed By: StanislavGlebik

Differential Revision: D29815203

fbshipit-source-id: e117df5575f025787d94f0a8ed4a171408e361d0
2021-07-21 05:38:51 -07:00
Mark Juggurnauth-Thomas
796a0ef8af gitignore: add test showing gitignore directory pattern matching a file
Summary:
The gitignore matcher assumes everything is a directory.  This causes problems
if a directory pattern matches a file that we don't wnat to be ignored.

Add a test demonstrating the issue.

Reviewed By: quark-zju

Differential Revision: D29788782

fbshipit-source-id: 4cd41c7c0985a8729443d6c0507ba98fa212049e
2021-07-21 03:40:15 -07:00
Liubov Dmitrieva
e46de7652b commitcloud: remove dead code
Summary:
commitcloud: remove dead code:

this bit of code is unsed, was left from obsmarkers code

Reviewed By: quark-zju

Differential Revision: D29762009

fbshipit-source-id: 5f70ebe8a6b0b0261bba2d96c94eabac93f2fe4c
2021-07-21 01:59:23 -07:00
Stanislau Hlebik
eb0aebc24c mononoke: make sure we don't reload redaction config unnecessarily
Summary:
We seem to be reloading it every minute, even though we are supposed to reload
only when it's changed. That's probably not a huge deal, but we just get a
spammy stderr message. Let's remove it.

Reviewed By: yancouto

Differential Revision: D29789760

fbshipit-source-id: 65a39cca67636ae71befb963c78b6473b5b9f3fc
2021-07-21 01:32:43 -07:00
Stanislau Hlebik
5c7d31b3ae mononoke: fix integration tests
Summary:
mysql tests were failing because of invalid config with

```
+  E0719 14:48:27.582197 1846476 [main] eden/mononoke/cmdlib/src/helpers.rs:318] Execution error: unknown keys in config parsing: `{"blobstore.ephemeral_blobstore.?.metadata.?.filenodes", "blobstore.ephemeral_blobstore.?.metadata.?.mutation", "blobstore.ephemeral_blobstore.?.metadata.?.primary"}`
```

See example - https://www.internalfb.com/intern/testinfra/diagnostics/6473924511735259.562949979040542.1626706163/

This diff fixes it

Reviewed By: akushner

Differential Revision: D29812804

fbshipit-source-id: c71f7f38103194137523ca947e4b23819da37c35
2021-07-21 01:32:43 -07:00
Yipu Miao
7db45cf79f Let EdenMount::ensureDirectoryExists return TreeInodePtr instead of folly::Unit
Reviewed By: chadaustin

Differential Revision: D29592849

fbshipit-source-id: 8c34d1165f419359ddd2763fbf0d0f4758228b18
2021-07-20 18:50:03 -07:00
Yipu Miao
024b9d44b9 Let eden cli support RE-CAS store
Summary: This change let Eden cli can ```clone``` and ```info``` on a RE Digest backed store

Reviewed By: chadaustin

Differential Revision: D28855458

fbshipit-source-id: 5582992acc5b3b3acb05b0b53d59a6768cc02491
2021-07-20 18:50:03 -07:00
Jun Wu
b6a0d6afa1 hgcommands: set http.convert-cert to true on Windows
Summary:
For norepo use-cases the config remains unset because dynamicconfig (still)
requires a repo. This means lazy changelog clone won't work. To workaround
it, we set `http.convert-cert` to `true` directly on Windows.

Reviewed By: andll

Differential Revision: D29804599

fbshipit-source-id: c0fc819711ec8d4f9f77cbce7b9d08b193ee9e6d
2021-07-20 16:19:05 -07:00
Jan Mazur
59be6fda85 print out http body when server didn't upgrade to websocket
Summary:
Mononoke server returns info about error in the body:
https://www.internalfb.com/code/fbsource/[dd62020e835927ce72bcbf0355ddc3a3300cd860]/fbcode/eden/mononoke/server/repo_listener/src/http_service.rs?lines=74

Printing it out will make debugging client-side issues easier.

Reviewed By: liubov-dmitrieva

Differential Revision: D29790190

fbshipit-source-id: 7038385cd8f036b25dfab7cd99535a9317641e76
2021-07-20 11:48:15 -07:00
Jun Wu
1ab22eccf3 pysptui: bump streampager version
Summary: streampager has been upgraded to 0.10. 0.9 no longer exists.

Reviewed By: andll

Differential Revision: D29794320

fbshipit-source-id: 415d4bc8649236a49dd41bb922a636096ab67be7
2021-07-20 10:14:53 -07:00
Zhengchao Liu
7a05b10d26 add auto fsck path for snapshot tests
Summary: Currently the tests manually run fsck command (Python) on the snapshot. This makes the change so that the tests will not only test the manual fsck command but also test the auto fsck (C++) so that we cover both Eden CLI fsck (Python) and Eden mount auto fsck (C++).

Reviewed By: chadaustin

Differential Revision: D29690188

fbshipit-source-id: 593db1db587c3294aad1314ea8da1d8e778df8ee
2021-07-20 09:42:01 -07:00
CodemodService Bot
9da4c508e4 Daily common/rust/cargo_from_buck/bin/autocargo
Reviewed By: krallin

Differential Revision: D29786293

fbshipit-source-id: c1bad073d31889404278cb93a192214f06193018
2021-07-20 05:00:14 -07:00
Liubov Dmitrieva
26e149e737 rename cbor_stream => cbor_stream_filtered
Summary:
Rename to avoid confusion. The function filters errors from the underlying stream.

The first error and number of errors are logged to scuba but the errors are not passed to the client.

Reviewed By: kulshrax

Differential Revision: D29734930

fbshipit-source-id: 503adaa9e618d931a354011ef83c3ab22eb3b9bf
2021-07-20 03:50:09 -07:00
Zhengchao Liu
d8b2d58e84 categorize NFS handlers by AccessType
Summary: We already have AccessType for FUSE, this adds the same categorization for NFS. This allows us to easily filter events in trace stream and ActivityRecorder.

Reviewed By: chadaustin

Differential Revision: D29771074

fbshipit-source-id: a437f0693f9062fb2df3b6f618a9d8860a05df12
2021-07-19 19:10:48 -07:00
Yan Soares Couto
a47540a494 Add /ephemeral/prepare endpoint
Summary:
Using all the preparations added in the stack, this diff adds the `/:repo/ephemeral/prepare` endpoint to eden api.

It simply creates an ephemeral bubble and returns its id via the call.

Reviewed By: markbt

Differential Revision: D29698714

fbshipit-source-id: 5bc289cad97657db850b151849784e50a17a9da6
2021-07-19 09:53:04 -07:00
Yan Soares Couto
58448b16d5 Add ephemeral blobstore to inner repo
Summary: This allows ephemeral blobstore to be used in places that have a Repo context, like in the eden api, which will be used on the next diff to implement a new endpoint on eden api to create a bubble.

Reviewed By: markbt

Differential Revision: D29697657

fbshipit-source-id: b7e83c5c7c5e77243f0dba29c024d9f66ca4b2f9
2021-07-19 09:53:04 -07:00
Yan Soares Couto
e20022a088 Build ephemeral blobstore on repo factory
Summary:
Config for ephemeral blobstore and some code for creating ephemeral blobstores was already added, this diff ties them both together by making the ephemeral blobstore be build using the default config on RepoFactory, so it can be used as a Repo attribute easily in other places.

I was able to do this easily because I stopped using `BackingBlostore` and started simply using `dyn Blobstore` in the ephemeral blobstore. Using BackingBlobstore would require some significant changes, because:
1. Building of blobstores is not ergonomic, it is quite hard and requires a bunch of manual code to be able to build some subtrait of Blobstore.
2. A lot of the blobstores "wrappers" do not implement things like BlobstoreKeySource, which would need to be implemented individually (example: D29678881 (817948ca75) would be just the start).

Reviewed By: markbt

Differential Revision: D29677545

fbshipit-source-id: 0f5cffe6bdfece1aaa74339ef40376d1ff27e6c2
2021-07-19 09:53:04 -07:00
Liubov Dmitrieva
2c7e60f30a commit cloud: improve handling of failed commits for cloud upload
Summary: Improve handling of failed commits for `hg cloud upload` and `hg cloud sync` (upload mode)

Reviewed By: markbt

Differential Revision: D29734169

fbshipit-source-id: c995f700ea23ff2898f27780c39f2bd1c58c1a02
2021-07-19 06:51:23 -07:00
Yan Soares Couto
eccda5507b Use Reloader on segmented changelog periodic reloader
Summary:
Use the class added on previous diff on segmented changelog periodic reloader as well.

To do this, I needed to add some changes to reloader:
- Add auto implementation of `Loader` trait for functions
- Add a tokio notify, as that was used on tests in segmented changelog

Reviewed By: markbt

Differential Revision: D29524220

fbshipit-source-id: 957f21db91f410fcdabb0d1c16d5c4f615892ab6
2021-07-19 05:17:50 -07:00
Yan Soares Couto
817948ca75 Implement BlobstoreKeySource for Prefixer and Counting blobstores
Summary: If we ever want to start using things like BlobstoreKeySource more extensively, we'll need to implement it for a lot of blobstores. This starts that, though it's not used for now.

Reviewed By: ahornby

Differential Revision: D29678881

fbshipit-source-id: 918a169b8b934c6f5e1eefaba7d11dc220eb7c59
2021-07-19 05:04:34 -07:00
Aida Getoeva
0619e705ef mononoke/multiplex: put sync-queue lookup for get under the tunable
Summary: This is needed to disable sync-queue lookups and second blobstores lookups later on.

Reviewed By: StanislavGlebik

Differential Revision: D29663435

fbshipit-source-id: abb5109de6063158a7ff0a116a5c1d336bfdb43f
2021-07-17 17:00:16 -07:00
Aida Getoeva
008c99e5fa mononoke/multiplex: remove fail_if_unsure where possible
Summary: This just helps to understand where we definitely have to fail in case of "ProbablyNotPresent" and work on those in the future.

Reviewed By: StanislavGlebik

Differential Revision: D29663436

fbshipit-source-id: c8428115f3c9637114e3964c948123d473207d53
2021-07-17 17:00:16 -07:00
Durham Goode
195d166b0f memcache: don't use memcache for short commands in legacy store
Summary:
The memcache client has a 2+s setup time, so let's avoid it for short
commands.

Reviewed By: quark-zju

Differential Revision: D29627225

fbshipit-source-id: c755fbaadd35e423b6dafe772ffbed82fe41abce
2021-07-16 17:11:50 -07:00
Durham Goode
48939a54bf memcachestore: remove direct usage of MemcacheStore
Summary:
Previously we could add a MemcacheStore to the store hierarchy in two
ways: directly as MemcacheStore and through the MemcacheHgIdData/HistoryStore
wrappers.

In a future diff we'll want to track how long since the store was created and
not call the inner MemcacheStore in certain situations. To do this, we want all
accesses to go through the MemcacheHgId*Store abstraction.

Reviewed By: quark-zju

Differential Revision: D29627226

fbshipit-source-id: 9e979281fbb2eec123577d99a8879bcf80578136
2021-07-16 17:11:50 -07:00
Durham Goode
7e76b7dc29 memcache: don't use memcache for short commands in scmstore
Summary:
The memcache client takes 2 seconds to set up, so let's not use it for
short commands.

Reviewed By: quark-zju

Differential Revision: D29627229

fbshipit-source-id: bbefcd362e215a3b0f8a0f07c39b7ef00c71379e
2021-07-16 17:11:50 -07:00
Zhengchao Liu
17f9251909 allow separate batch sizes in HgImportRequestQueue
Summary: We want to support different batch sizes for blob or tree. This diff moves the batch size read logic into `HgImportRequestQueue`, adds a new config `import-batch-size-tree` (added in D29714772), and updates tests accordingly.

Reviewed By: kmancini

Differential Revision: D29703450

fbshipit-source-id: b85666838a0a8c1857b9d1de4f6c47128063633a
2021-07-16 15:01:58 -07:00
Durham Goode
5077128101 tests: actually fix test-import-t.py on Windows
Summary:
My previous attempt at fixing it chose the wrong hash. Let's just
delete these lines entirely.

Reviewed By: singhsrb

Differential Revision: D29742490

fbshipit-source-id: 72a174e0e2d59aec4de35d7eb3fcc43939be8ea1
2021-07-16 13:50:19 -07:00
Stanislau Hlebik
5ce118e1c2 mononoke: remove segmented changelog from BlobRepo
Summary:
Segmented changelog is initialized in every BlobRepo, and that's quite annoying
- there's a lot of spam goes to stderr in jobs like hg sync job which don't use
segmented changelog at all.

At the same time segmented changelog is only used in mononoke api, so we can
just initialize segmented changelog in InnerRepo, and remove from BlobRepo
completely.

Reviewed By: markbt

Differential Revision: D29735623

fbshipit-source-id: 9137c9266169b7ef16b1c6c0b80cae896214203b
2021-07-16 11:10:00 -07:00
Jun Wu
ff66f7deed undo: do not crash other commands if undo revlog is corrupted
Summary:
Undo revlog corruption should not affect other commands.
There were multiple user reports. This should not need a reclone.

Reviewed By: markbt

Differential Revision: D29723869

fbshipit-source-id: 8f48f45c1e25478ac9ff713fbcf69eaa08f464a8
2021-07-16 10:06:52 -07:00
Genevieve Helsel
ffc55511ea remove windows check for eden du --deep-clean
Summary: This can be used on windows since it uses `shutil.rmtree` instead of `fm -rf`

Differential Revision: D29723916

fbshipit-source-id: 7d12ce8d265661698c1f5ecd17271d1c2e950a55
2021-07-16 09:05:56 -07:00
Stanislau Hlebik
e5f8b1588e mononoke: read just written sync target config
Reviewed By: markbt

Differential Revision: D29728973

fbshipit-source-id: b1d9020222c9d4494b206dabeb7e92c9c45d35b7
2021-07-16 07:43:08 -07:00
Liubov Dmitrieva
ffbf880734 add option for using EdenApi Uploads for cloud sync command
Summary:
add option for using EdenApi Uploads for `cloud sync` command

This option could be used for early testing of the new protocol within the team.

The only different is that the upload function doesn't use the local backup state to filter initially.

TBD if we need it.

Reviewed By: quark-zju

Differential Revision: D29696175

fbshipit-source-id: 2261930f1f01bf2957b418cc24f31ef61d536e77
2021-07-16 02:23:34 -07:00
Liubov Dmitrieva
fe23153c23 Clean Up. Removed old tests
Summary:
These tests are broken and they are always skipped.
They are relared to old pullbackup/restorebackup.
Let's remove them.

Reviewed By: quark-zju

Differential Revision: D29695847

fbshipit-source-id: 9fc6babe70710ea1ba5f143a2203997945f1ccff
2021-07-16 02:23:34 -07:00
Liubov Dmitrieva
c7c618bc6f Clean Up: remove readheadsfromallpaths from commitcloud backup state
Summary:
remove readheadsfromallpaths from commitcloud backup state

This was used for migration and can be removed now

Reviewed By: quark-zju

Differential Revision: D29711512

fbshipit-source-id: 567071be255b12eba35f5a5d4b84a37ee4944ad8
2021-07-16 02:23:34 -07:00
Durham Goode
f92824d8d2 tests: fix test-import-t.py on Windows
Summary:
My recent treemanifest test hash update didn't update this Windows case
correctly, which broke hgbuild.

Reviewed By: akushner

Differential Revision: D29727165

fbshipit-source-id: 7310c49929411816b1929c52d4be3a74e8177c45
2021-07-15 23:19:06 -07:00
Durham Goode
ae737f0758 tracing: add edenapi metrics to non-scmstore fetches as well
Summary:
The previous diff only added these metrics to the scmstore path. Let's
add it to the legacy path as well, so we can start getting some insights while
scmstore rolls out.

Reviewed By: quark-zju

Differential Revision: D29601063

fbshipit-source-id: cb1935d02bc0b758c63abdf5d59f7a00d05ff4eb
2021-07-15 21:19:28 -07:00
Durham Goode
6a8953a66d edenapi: add metrics to perftrace
Summary: Let's record the scmstore edenapi stats to perftrace.

Reviewed By: kulshrax

Differential Revision: D29599900

fbshipit-source-id: 47c32df9c687504d4bb9a1d81d6752db6a8fa54c
2021-07-15 21:19:28 -07:00
Durham Goode
5d66631598 tracing: fix recording on spans via TracingCollector layer
Summary:
EspanId and tracing::span::Id had From/Into implementations that allowed them to be treated as
equivalent when they shouldn't be. This allowed for a subtle but where TracingData::record was
receiving an EspanId where the id was some huge u64 from a tracing::span::Id, when instead that
huge u64 should've been mapped to the real EspanId via the id_map.

Ideally we'd treat EspanId and the tracing Id separately, but the TracingCollector Subscriber
implementation relies on this. Since it controls span creation it can guarantee that all Id's are safely
convertible to EspanId.

Reviewed By: quark-zju

Differential Revision: D29599901

fbshipit-source-id: 79d24d41d86c6098888b1747cc0b9bc2838493fa
2021-07-15 21:19:27 -07:00
Xueqi He
25730908cd List env variables in eden rage
Summary: Add a new helper function 'print_env_variables' that reads the environment variables and prints them at the bottom of the rage report.

Reviewed By: genevievehelsel

Differential Revision: D29713709

fbshipit-source-id: 04e10597c93d11b58420f184048d9b55ad4e5166
2021-07-15 20:22:06 -07:00
Durham Goode
4f9ec52eac treemanifest: fix eden tree fetching
Summary:
A recent diff, D29167397 (ccc95d7f5a), refactored treemanifest fetching such that
1) all http fetching happened inside the store, instead of routing up through
the treemanifest extension, and 2) all tree fetches use ondemand fetching
instead of full tree fetching.

The eden python logic broke because it wasn't updated. With the two changes
mentioned above, the eden logic becomes simpler.

Reviewed By: singhsrb

Differential Revision: D29717646

fbshipit-source-id: 9c29ab38b27ada15424d54d8c251a730730b8352
2021-07-15 15:36:40 -07:00
Andrey Chursin
cee80facc3 revisionstore: add a way to force remote fetch for some files
Summary:
This currently works well with ContentStore with EdenApi backend, did not test in other combinations, probably some other tweaks will be needed

Injection is controlled by MISSING_FILES env variable, it is interpreted as list of comma separated repo path prefixes

Reviewed By: DurhamG

Differential Revision: D29640090

fbshipit-source-id: 4925eabd63dc3a28a1133d332a072c0e224ea74b
2021-07-15 14:59:20 -07:00
Durham Goode
056a9905d1 tests: fix test-amend-to.t
Summary:
This landed at the same time as my treemanifest flatcompat removal, so
it didn't receive the test update.

Reviewed By: singhsrb

Differential Revision: D29715926

fbshipit-source-id: bdc962da64da71e0cd3d8f834edb914b3266fdec
2021-07-15 11:52:09 -07:00
Yan Soares Couto
95621c4511 Add types for /ephemeral/prepare call
Summary: This adds some types that will be used by the `/ephemeral/prepare` call in eden api. The call will actually be added on D29698714.

Reviewed By: liubov-dmitrieva

Differential Revision: D29696921

fbshipit-source-id: 9516661c1f41fcf87d37181fbab3eda5b6131179
2021-07-15 09:22:38 -07:00
Liubov Dmitrieva
99ff270a78 Clean Up: remove everything about the infinitepush write path
Summary:
Remove everything about the infinitepush write path.

Infinitepush path has been splitted into 2 for migration purpose. It is now time to clean up.

Reviewed By: StanislavGlebik

Differential Revision: D29711414

fbshipit-source-id: c61799fe124e2def4254cdd45e550c82c501e514
2021-07-15 07:37:55 -07:00
Liubov Dmitrieva
04d32019fa edeapi: clean up usage of callback or progress in the new code.
Summary:
Clean up usage of callback or progress in the new code.

There is no need to use a callback or progress. They were used for legacy progress support. The new progress bar automatically applies to every HTTP request.

Reviewed By: yancouto

Differential Revision: D29710912

fbshipit-source-id: 33889d89680c90e63f4520626a166d0b39b67afb
2021-07-15 06:31:42 -07:00
Harvey Hunt
b3a504d191 mononoke: lfs: Remove throttle limits
Summary:
Now that the new `rate_limiting` crate is being used by LFS server we
can remove the throttle limits code and config.

Differential Revision: D29396505

fbshipit-source-id: 19638bd93ad9dea2638e8501837c6c13e4dd48ff
2021-07-15 04:09:51 -07:00
Zhengchao Liu
2e86cf8b6b fix fsck snapshot integration tests
Summary:
This test is broken due to Rust panic from hg (likely there was some change in hg and the original snapshot was from 2018). It's hard to know exactly what's causing this issue because 1) it's not from eden 2) this has been broken for a while so it's tricky to bisect.
To bring back the coverage and run on a modern repo, this diff:
 * generates a new snapshot (`buck run //eden/integration/snapshot:gen_snapshot -- basic`).
 * adds a step to translate hgrc because the path at snapshot generation time is in it.
 * migrates this test to the new snapshot

Reviewed By: kmancini

Differential Revision: D29670241

fbshipit-source-id: 1c5dccc673d516334de83582b32e2e3c9dc308f1
2021-07-14 16:20:04 -07:00
Mark Juggurnauth-Thomas
0914112d96 update test debug strings
Summary:
Integration tests rely on specific debug output.  This changed for `String`
in Rust 1.53, so update accordingly.

Reviewed By: yancouto

Differential Revision: D29696713

fbshipit-source-id: 751d72660f1d8772d754ab404192281857b32b2f
2021-07-14 10:18:30 -07:00
Jessica Vandebon
106a3fd437 fix broken privhelper tests
Summary: fixing tests broken as described in attached task

Reviewed By: genevievehelsel

Differential Revision: D29683637

fbshipit-source-id: 601fe16a27f90d216170429f9900b4d6867fc2f5
2021-07-14 08:54:52 -07:00
Jan Mazur
3ef3316aa7 add x-x2pagentd-ws-over-h1 header to requests going through x2pagentd
Summary: Add x-x2pagentd-ws-over-h1 header to improve performance of requests going through the x2pagentd

Reviewed By: johansglock

Differential Revision: D29695014

fbshipit-source-id: dd3f224bf653de1ca3e799f59f670b6b52f2dde2
2021-07-14 08:20:12 -07:00
Liubov Dmitrieva
64ef09155c clean up commit cloud! remove everything about infinitepush-other path
Summary: Code Clean Up. Remove everything about infinitepush-other path. This is a legacy to support migration.

Reviewed By: markbt

Differential Revision: D29677983

fbshipit-source-id: e9972117119d5e6005c3ec0b07809cf9d1fdc4a4
2021-07-14 06:52:57 -07:00
CodemodService Bot
b199c561e0 Daily arc lint --take BLACK
Reviewed By: zertosh

Differential Revision: D29693011

fbshipit-source-id: a298ba5c48cbaa6bcf07877bd87932ee89d2d1b0
2021-07-14 04:14:21 -07:00
Andrey Chursin
1e24cf2d00 vfs: fix linux detection
Summary: fanzeyi pointed that shortcut `cfg(linux)` does not actually exist

Reviewed By: fanzeyi

Differential Revision: D29670231

fbshipit-source-id: 5ebd2678ea540eeb0530b204814096ba0d9d7fed
2021-07-13 16:49:38 -07:00
Meyer Jacobs
e742e3befc edenapi: propagate missing content errors instead of panicking
Summary:
Remove the panicking APIs in D29647203 and instead propagate "missing content attribute" errors.

It was difficult to make these changes at the bottom of my diff stack, so I've added them here instead.

Reviewed By: DurhamG

Differential Revision: D29670495

fbshipit-source-id: 952ed4913a413c39ac3dff14a22f56e4766512ff
2021-07-13 15:17:31 -07:00
Meyer Jacobs
3be8fcb6f9 scmstore: report metrics for auxstore
Summary: Collect and report scmstore metrics for the `AuxStore` backends.

Reviewed By: DurhamG

Differential Revision: D29635551

fbshipit-source-id: 4e9ab6163ec901ddcee2e923147c1347229e6b70
2021-07-13 15:17:31 -07:00
Meyer Jacobs
28ef2ea851 scmstore: support preferring locally computing aux data
Summary: Add an option, `scmstore.prefercomputingauxdata`, which enables computing aux data from locally available content instead of requesting aux data from EdenApi when possible.

Reviewed By: DurhamG

Differential Revision: D29659777

fbshipit-source-id: e381c8beac359dc1735d76378c602fbf2bb0b668
2021-07-13 15:17:31 -07:00
Meyer Jacobs
72bd8c8c6e scmstore: implement edenapi file aux data fetching in FileStore
Summary: Update `FileStore` to fetch aux data from EdenApi. As written, `FileStore` will prefer remotely fetching aux data to computing it from locally available content.

Reviewed By: DurhamG

Differential Revision: D29659721

fbshipit-source-id: 13e33830ed84fbba31e19b00aaf748dcc4f67727
2021-07-13 15:17:31 -07:00
Meyer Jacobs
9a93bd5f47 edenapi: add attribute support to EdenApi trait
Summary:
Adds a new method, `files_attrs`, to the `EdenApi` trait, which allows the caller to specify per-key attributes.

This method is intended to be temporary, and should later be unified with `files`.

Implement `files_attrs` in `FakeEdenApi`, and implement a placeholder method in EagerRepo.

Reviewed By: DurhamG

Differential Revision: D29635233

fbshipit-source-id: d0773927939527d799918139e4abba5ea3b5efca
2021-07-13 15:17:31 -07:00
Meyer Jacobs
5b16613f44 scmstore: update FileStore to use new indexedlogauxstore
Summary: Update `FileStore` to use new `indexedlogauxstore` rather than JSON + `indexedlogdatastore`.

Reviewed By: DurhamG

Differential Revision: D29635152

fbshipit-source-id: 3f73b7f7ee1ebc4aa1a0e804973d98d342cbc6ba
2021-07-13 15:17:31 -07:00
Meyer Jacobs
98e7e342c6 revisionstore: add sha1 and blake2 ContentHash methods
Summary: Add utility methods to ContentHash for use in computing aux data

Reviewed By: DurhamG

Differential Revision: D29659855

fbshipit-source-id: fb5c9749899147ea03dbb9e0e19b492c62bde2dd
2021-07-13 15:17:30 -07:00
Meyer Jacobs
8757d2804f scmstore: specialized disk format for aux data
Summary: Add a new indexedlog wrapper, `indexedlogauxstore`, for storing file aux data for scmstore.

Reviewed By: DurhamG

Differential Revision: D29597641

fbshipit-source-id: 34a9d9095ee580b4d210c82760691496358e0c6d
2021-07-13 15:17:30 -07:00
Meyer Jacobs
f564998c4f edenapi: add new file aux data attribute
Summary: Adds a new file attribute, `FileAuxData` (based on Mononoke's `ContentMetadata`)

Reviewed By: DurhamG

Differential Revision: D29557288

fbshipit-source-id: 59251ebe8ddf2009d7bcf44a83eab68d49c817de
2021-07-13 15:17:30 -07:00
Meyer Jacobs
6c21aa14c9 edenapi: implement file content attribute
Summary:
Implement the `content` attribute.

Introduce a new `FileContent` type which stores the hg file blob and metadata, and modify `FileEntry` to allow constructing `FileEntry` with optional `FileContent` builder-style.

Reviewed By: DurhamG

Differential Revision: D29647203

fbshipit-source-id: b956c294d03dc81affc90d7274b2e430a3556e96
2021-07-13 15:17:30 -07:00
Meyer Jacobs
7c0b422b37 edenapi: introduce file attributes support
Summary:
Add support for optional file attributes to EdenApi, with `content` there as a placeholder.

Modifies the `FileRequest` type, adding a vec of `FileSpec`, which allows the client to specify desired attributes per-key. The existing `keys` field will be treated as a request for the content attribute and may be used in combination with the new per-key attributes.

Reviewed By: DurhamG

Differential Revision: D29634709

fbshipit-source-id: 6571837f87d1635e8529490e10dbe4ba054b7348
2021-07-13 15:17:30 -07:00
Meyer Jacobs
2bffe2927c edenapi_types: extract key parsing to separate function
Summary: `parse_key` will be re-used in my incoming EdenApi aux data change.

Reviewed By: kulshrax

Differential Revision: D29601071

fbshipit-source-id: 2039c8478e717ff58af2030588dd31ec0b418b19
2021-07-13 15:17:30 -07:00
Meyer Jacobs
64f3872a59 revisionstore: unify "store type" (local vs. shared/cache) enums
Summary:
We have a variety of enums in revisionstore that all serve the same purpose. With this change, I've consolidated them to a single type.

Not 100% sure if `StoreType` is the best name, in scmstore I named it `LocalStoreType` to be more clear - open to suggestions. I also decided to keep the variants named `Local` and `Shared` instead of adopting the `Local` and `Cache` terminology I used in scmstore - I'd rather not change that unless we decide to change the terminology everywhere to avoid confusion.

Reviewed By: kulshrax

Differential Revision: D29598025

fbshipit-source-id: 76d5a02230a8c1e5327cc5d90bbcae70049f251d
2021-07-13 15:17:30 -07:00
Meyer Jacobs
57a0164e8c scmstore: introduce per-backend filescmstore metrics
Summary:
Introduce a basic implementation of per-backend metrics collection for `FileStore`.

Currently, only indexedlog, lfs, and contentstore backends are instrumented, and only with basic metrics. Additional metrics (size, elapsed time, lfs pointer hits) and additional backends (aux, edenapi, lfs server) will be added in a later change.

Reviewed By: kulshrax

Differential Revision: D29552888

fbshipit-source-id: 54267f4de6f14db046cfae271b5c25a6bb494d7c
2021-07-13 15:17:30 -07:00
Meyer Jacobs
88af45aa20 metrics: add config for skipping certain metrics
Summary: Introduce a new config, `devel.skip-metrics`, intended to be used along with `devel.print-metrics` for filtering which metrics are printed in tests.

Reviewed By: DurhamG

Differential Revision: D29641812

fbshipit-source-id: 507099c5ad44a95e906d5ee4235a8a7eca64bd28
2021-07-13 15:17:30 -07:00
Durham Goode
93844abc0f treemanifest: remove flatcompat feature
Summary: The tests no longer require it, so let's remove all the logic for it.

Reviewed By: quark-zju

Differential Revision: D29643267

fbshipit-source-id: 86b44e3b7b4a4eb19d7f89b54b40957a7648573a
2021-07-13 15:04:57 -07:00
Durham Goode
1183f14f11 treemanifest: disable flatcompat by default
Summary:
This was a hack to allow the tests to produce the same hashes as
before. Let's disable this and fix the remaining test failures. A future diff
will remove the feature entirely.

Where possible I changed input hashes to desc() and output hashes to globs so
hopefully future hash changes are a little easier.

Differential Revision: D29567762

fbshipit-source-id: cf5150c112c56b08f583feba80e5a636cc07db0a
2021-07-13 15:04:57 -07:00
Durham Goode
4cd106a22c treemanifest: remove sendtrees and server configs
Summary: sendtrees is always on now, and server is always False.

Differential Revision: D29567763

fbshipit-source-id: f58aa7d84e97b7d69959e0796014a7ff09eb81e9
2021-07-13 15:04:57 -07:00
Liubov Dmitrieva
6b9587c207 remove deprecated commands
Summary: Clean Up. Remove deprecated commands.

Reviewed By: singhsrb

Differential Revision: D29677591

fbshipit-source-id: c4da701e9eedaa2f4dcd59b3e95c924aede74bf7
2021-07-13 13:48:06 -07:00
Durham Goode
5cb2db12f1 tests: remove accidental treemanifestserver.py
Summary:
This was accidentally committed in an earlier diff. It's unused, so
let's delete it.

Reviewed By: krallin

Differential Revision: D29668138

fbshipit-source-id: 105bf466665c447c37c73462e102d8771d0368ee
2021-07-13 13:32:16 -07:00
Muir Manders
a03c904c9f amend: rework "--to" to not use histedit
Summary:
The amend "--to" flag amends the specified commit rather than ".". Previously it made a temporary commit and used histedit to scoot it back. This is not optimal due to unnecessary disk operations and fragile conflict handling.

Instead, "--to" now does its work in memory, checking for conflicts as it goes. If it finds any conflicts it aborts the operation. It works by generating a patch based on the working context and applying it to the specified commit. Then it does a mini-rebase of the stack tail onto the amended comit.

I tweaked patch.py to unlink the "from" of a rename _after_ creating the "to", which seems like the natural order to me. Other than the repobackend which defers unlinking, I don't see how other patch backends would have worked when renaming a file.

Reviewed By: DurhamG

Differential Revision: D29471052

fbshipit-source-id: 83406ec16b724b27d9a23473b630cafbb75da4d2
2021-07-13 09:08:02 -07:00
Liubov Dmitrieva
990a246aa8 Support exchange of mutation information during changesets uploads
Summary:
Support exchange of mutation information during changesets uploads

Add new api for mutation information.

Add implementation for this new api.

Add client side support.

Reviewed By: markbt

Differential Revision: D29661255

fbshipit-source-id: 1d8cfa356599c215460aee49dd0c78b11af987b8
2021-07-13 01:56:06 -07:00
Liubov Dmitrieva
33fe62fda7 mutation: Rename function entriesforbundle => entriesfornodes
Summary:
Rename function entriesforbundle => entriesfornodes.

This function will be used for edenapi uploads and not related to bundles

Reviewed By: markbt

Differential Revision: D29661256

fbshipit-source-id: b101c31d53f0f535db0b90804472c70b2f3b2c9e
2021-07-13 01:56:06 -07:00
Jessica Vandebon
21dc355725 Make eden doctor report when the PrivHelper is inaccessible
Summary: Extended eden doctor to check if the PrivHelper is accessible and report when it is not.

Reviewed By: genevievehelsel

Differential Revision: D29593250

fbshipit-source-id: 2390e75b91c9d6f713db4b6084868af91a0b6623
2021-07-12 13:16:21 -07:00
Jun Wu
5b28b9bf1e changelog: avoid migrating to lazy backend without edenapi
Summary:
This hopefully prevents some issues running tests outside the hg run-tests
environment.

Differential Revision: D29644071

fbshipit-source-id: e5a4e3c5a56d8deef960a6bd92d5787d55d99e8f
2021-07-12 12:41:49 -07:00
Mark Juggurnauth-Thomas
ba8784f812 scs_server: support blame_v2
Summary:
Allow SCS server to use blame V2 to serve blame requests, if it is enabled.

This uses `CompatBlame` so that it can use either blame V1 or blame V2.

Reviewed By: liubov-dmitrieva

Differential Revision: D29645410

fbshipit-source-id: 8d02e295995439c3b64e0128bdb5e6f5f6153159
2021-07-12 02:45:23 -07:00
Mark Juggurnauth-Thomas
7567684c3a admin: support blame_v2 in the blame subcommands
Summary:
Allow access to blame V2 in `mononoke_admin` by using `fetch_blame_compat`.

This uses `CompatBlame` to provide blame support using either blame V1 or blame V2.

Reviewed By: liubov-dmitrieva

Differential Revision: D29492859

fbshipit-source-id: 38c73690d36b57be73cec98ae2a013f16b3e0f7a
2021-07-12 02:45:23 -07:00
Mark Juggurnauth-Thomas
af0dbd16fd blame_v2: implement fetch_blame_compat
Summary:
Implement `fetch_blame_compat`, which will fetch either blame V1 or blame V2,
depending on the repo config, and return a compatibility adapter that can be
used by code to use both kinds.

Reviewed By: StanislavGlebik

Differential Revision: D29492857

fbshipit-source-id: 88d68ef2988e316642a5ebd9aa38b541c02c5da4
2021-07-12 02:45:23 -07:00
Mark Juggurnauth-Thomas
a11563a2a6 blame_v2: implement derivation of blame_v2
Summary:
Add `blame_version` to `BlameDeriveOptions`, and if this is set to `V2`, derive
a V2 blame root for the changeset.

Blame V2 and its roots are in a separate blobstore key space, so this derivation
is entirely independent of blame V1.

The key prefix for blame V2 roots is `derived_root_blame_v2`, even though this
is slightly different to the prefix for blame V1.  This is so that it matches
other derived data roots (e.g. unode V2).  Similarly, `BlameRoot` becomes
`RootBlameV2` so that it matches the other root types.

Blame V2 uses a separate mapping for blame roots, which contain the root
unode manifest id as additional data.

Differential Revision: D29492858

fbshipit-source-id: de2799040129e1ab90cc6bd8f775a6d47c607db7
2021-07-12 02:45:23 -07:00
Mark Juggurnauth-Thomas
d3400bc439 blame: extract mapping and derivation for v1 from derived module
Summary:
Split the `derived` module into `derive_v1`, which handles derivation of blame
V1, and `mapping_v1`, which handles the derived data mapping.

This is in preparation for introducing derivation of blame V2.

Reviewed By: StanislavGlebik

Differential Revision: D29463127

fbshipit-source-id: ae3add600ca62141e7f25713367680b667507da3
2021-07-12 02:45:23 -07:00
Mark Juggurnauth-Thomas
bbd0dcfa5d blame: extract function for fetching content
Summary:
Extract `fetch_content_for_blame` to a separate module so we can re-use it in
blame V2.

The method previously returned nested `Result`s, which can be confusing as in
most contexts, the blame being rejected is not actually an error.  Switch to an
explicit enum to make it clearer what the inner result represents.

Reviewed By: yancouto

Differential Revision: D29462095

fbshipit-source-id: 52ffcb4173a3b36f4b6cdafe4f42a4cafd993f49
2021-07-12 02:45:23 -07:00
Liubov Dmitrieva
43187d53ad edenapi: Implement uploading changesets in hg cloud upload command
Summary:
Implement using of uploading changesets in `hg cloud upload` command.

This is the last part for `hg cloud upload` - uploading changesets via Edenapi
test
```

```
# machine #2
liubovd {emoji:1f352}  ~/fbsource
 [15] → hg pull -r 0b6075b4bda143d5212c1525323fb285d96a1afb
pulling from mononoke://mononoke.c2p.facebook.net/fbsource
connected to twshared27150.03.cln3.facebook.com session RaIPDgvF6l8rmXkA
abort: 0b6075b4bda143d5212c1525323fb285d96a1afb not found!
```

```
# machine #1
devvm1006.cln0 {emoji:1f440}   ~/fbsource/fbcode/eden/scm
 [6] →  EDENSCM_LOG="edenapi::client=info" ./hg cloud upload
Jul 11 13:26:26.322  INFO edenapi::client: Requesting lookup for 1 item(s)
commitcloud: head '0b6075b4bda1' hasn't been uploaded yet
Jul 11 13:26:26.472  INFO edenapi::client: Requesting lookup for 6 item(s)
commitcloud: queue 1 commit for upload
Jul 11 13:26:26.648  INFO edenapi::client: Requesting lookup for 1 item(s)
commitcloud: queue 0 files for upload
Jul 11 13:26:26.698  INFO edenapi::client: Requesting lookup for 4 item(s)
commitcloud: queue 4 trees for upload
Jul 11 13:26:27.393  INFO edenapi::client: Requesting trees upload for 4 item(s)
commitcloud: uploaded 4 trees
commitcloud: uploading commit '0b6075b4bda143d5212c1525323fb285d96a1afb'...
Jul 11 13:26:28.426  INFO edenapi::client: Requesting changesets upload for 1 item(s)
commitcloud: uploaded 1 commit
```

```
# machine #2
liubovd {emoji:1f352}  ~/fbsource
 [16] → hg pull -r 0b6075b4bda143d5212c1525323fb285d96a1afb
pulling from mononoke://mononoke.c2p.facebook.net/fbsource
connected to twshared16001.08.cln2.facebook.com session QCpy1x9yrflRF6xF
searching for changes
adding commits
adding manifests
adding file changes
added 895 commits with 0 changes to 0 files
(running background incremental repack)
prefetching trees for 4 commits

liubovd {emoji:1f352}  ~/fbsource
 [17] → hg up 0b6075b4bda143d5212c1525323fb285d96a1afb
warning: watchman has recently started (pid 93231) - operation will be slower than usual
connected to twshared32054.08.cln2.facebook.com session Hw91G8kRYzt4c5BV
1 files updated, 0 files merged, 0 files removed, 0 files unresolved

liubovd {emoji:1f352}  ~/fbsource
 [18] → hg diff -c .
connected to twshared0965.07.cln2.facebook.com session rrYSvRM6pnBYZ2Fn
 diff --git a/fbcode/eden/scm/test b/fbcode/eden/scm/test
new file mode 100644
 --- /dev/null
+++ b/fbcode/eden/scm/test
@@ -0,0 +1,1 @@
+test
```

Initial perf wins:

Having a large stack of 6 commits (total 24 files changed), tested *adding a single line to a file at the top commit*. We can see at least 2X win but it should be more because I have tested with a local instance of edenapi service that runs on my devserver.

```
╷
╷ @  5582fc8ee  6 minutes ago  liubovd
╷ │  test
╷ │
╷ o  d55f9bb65  86 minutes ago  liubovd  D29644738
╷ │  [hg] edenapi: Implement using of uploading changesets in `hg cloud upload` command
╷ │
╷ o  561149783  Friday at 15:10  liubovd  D29644797
╷ │  [hg] edenapi: Add request handler for uploading hg changesets
╷ │
╷ o  c3dda964a  Friday at 15:10  liubovd  D29644800
╷ │  [edenapi_service] Add new /:repo/upload/changesets endpoint
╷ │
╷ o  28ce2fa0c  Friday at 15:10  liubovd  D29644799
╷ │  [hg] edenapi/edenapi_service: Add new API for uploading Hg Changesets
╷ │
╷ o  13325b361  Yesterday at 15:23  liubovd  D29644798
╭─╯  [edenapi_service] Implement uploading of hg changesets
```

```
# adding new line to a file test in the test commit, and then run:
devvm1006.cln0 {emoji:1f440}   ~/fbsource/fbcode/eden/scm
 [8] → time hg cloud upload
commitcloud: head '4e4f947d73e6' hasn't been uploaded yet
commitcloud: queue 1 commit for upload
commitcloud: queue 0 files for upload
commitcloud: queue 4 trees for upload
commitcloud: uploaded 4 trees
commitcloud: uploading commit '4e4f947d73e676b63df7c90c4e707d38e6d0a93b'...
commitcloud: uploaded 1 commit

real	0m3.778s
user	0m0.017s
sys	0m0.027s
```

```
# adding another new line to a file test in the test commit, and then run:
devvm1006.cln0 {emoji:1f440}   ~/fbsource/fbcode/eden/scm
 [11] → time hg cloud backup
connected to twshared30574.02.cln2.facebook.com session uvOvhxtBfeM7pMgl
backing up stack rooted at 13325b3612d2
commitcloud: backed up 1 commit

real	0m7.507s
user	0m0.013s
sys	0m0.030s
```

Test force mode of the new command that reupload everything:
```
devvm1006.cln0 {emoji:1f440}   ~/fbsource/fbcode/eden/scm
 [13] → time hg cloud upload --force
commitcloud: head '5582fc8ee382' hasn't been uploaded yet
commitcloud: queue 6 commits for upload
commitcloud: queue 24 files for upload
commitcloud: uploaded 24 files
commitcloud: queue 61 trees for upload
commitcloud: uploaded 61 trees
commitcloud: uploading commit '13325b3612d20c176923d1aab8a28383cea2ba9a'...
commitcloud: uploading commit '28ce2fa0c6a02de57cdc732db742fd5c8f2611ad'...
commitcloud: uploading commit 'c3dda964a71b65f01fc4ccadc9429ee887ea982c'...
commitcloud: uploading commit '561149783e2fb5916378fe27757dcc2077049f8c'...
commitcloud: uploading commit 'd55f9bb65a0829b1731baa686cb8a6e0c5500cc2'...
commitcloud: uploading commit '5582fc8ee382c4c367a057db2a1781377bf55ba4'...
commitcloud: uploaded 6 commits

real	0m7.830s
user	0m0.011s
sys	0m0.032s
```

We can see the time is similar to the current `hg cloud backup` command.

Reviewed By: markbt

Differential Revision: D29644738

fbshipit-source-id: cbbfcb2e8018f83f323f447848b3b6045baf47c5
2021-07-12 02:13:31 -07:00
Liubov Dmitrieva
0e1c3e196e edenapi: Add request handler for uploading hg changesets
Summary: Add request handler for uploading hg changesets

Reviewed By: markbt

Differential Revision: D29644797

fbshipit-source-id: 8ebf3e416c99253d0df81283c99c3a2e4c571c62
2021-07-12 02:13:31 -07:00
Liubov Dmitrieva
f8784a6020 Add new /:repo/upload/changesets endpoint
Summary: add new /:repo/upload/changesets endpoint

Reviewed By: markbt

Differential Revision: D29644800

fbshipit-source-id: 7d17c9c7a52e0e528a1d2cb7ea323a9abf13cf93
2021-07-12 02:13:31 -07:00
Liubov Dmitrieva
68672593c0 edenapi/edenapi_service: Add new API for uploading Hg Changesets
Summary:
API for uploading HgChangeset

This is the last part for uploding commit cloud commits via edenapi.

The structures are generic, could be reused for pull, etc

Reviewed By: markbt

Differential Revision: D29644799

fbshipit-source-id: 53347992cf399d99eaee4b5d2ad5f6ea30417022
2021-07-12 02:13:31 -07:00
Liubov Dmitrieva
804fc98c3f Implement uploading of hg changesets
Summary:
implement uploading of hg changesets

For now, reuse the upload code path from unbundle but calling it with empty filenodes and manifests.

Those are used for parents validation but this is not needed for us because we load trees and filenodes and their parents to construct the bonsai cs.

We might want to rewrite it to a cleaner code later and separate from unbundle but for now reusing the fucntion is the easiest way because we know the implementation is correct and also has logging.

Reviewed By: markbt

Differential Revision: D29644798

fbshipit-source-id: 27217d3061ab8d9712417facdbfbbc7e3aebfc5b
2021-07-12 02:13:31 -07:00
Andrey Chursin
25b3c7a9ff daemon: pass rust specific env vars to daemon
Summary: This simplifies debugging of edenfs rust libraries

Reviewed By: fanzeyi

Differential Revision: D29641954

fbshipit-source-id: da11e1ae3ac7696ee24a45c28be7cfb1b4651a04
2021-07-09 22:31:30 -07:00
Andrey Chursin
b7ac0db3c6 backingstore: enable rust trace logging in edenfs
Summary: This allows to use EDENSCM_LOG env variable to control trace logging from linked rust libraries

Reviewed By: fanzeyi

Differential Revision: D29641903

fbshipit-source-id: cc7395a2a5740c557e3166b786343ec0fefd6039
2021-07-09 22:31:30 -07:00
Jun Wu
964dc6634a pull: skip pull fast path if master doesn't change
Summary:
If the old and new nodes are the same, there is no need to call the pull fast
path.

Reviewed By: andll

Differential Revision: D29646089

fbshipit-source-id: 752c9aec7479961ff0fb4cfa5b30cd611dcc170e
2021-07-09 22:31:30 -07:00
Jun Wu
5af32aa8b9 make are_heads_assigned work with duplicated heads
Summary: There is a code path that `heads` contain duplicated items. Be compatible with it.

Reviewed By: andll

Differential Revision: D29645743

fbshipit-source-id: ff73bc51e877c2d02fcfff28cd1001e70478f212
2021-07-09 18:24:25 -07:00
Katie Mancini
cca7ab3541 fix systemd tests locally
Reviewed By: fanzeyi

Differential Revision: D29640655

fbshipit-source-id: aa4e1377faf1a94789add86009a5b28ede2dd1d7
2021-07-09 17:24:11 -07:00
Zhengchao Liu
f5d13407cb fix rage getting process tree
Summary: `-s` requires session id, so get the `sid` from `pid`

Reviewed By: genevievehelsel

Differential Revision: D29627171

fbshipit-source-id: b2812a150fe56b6fd6cfa246298247164861fc9d
2021-07-09 09:24:14 -07:00
Stanislau Hlebik
d74cc69de4 mononoke: avoid creating deletion commit on megarepo mainline
Summary:
In previous diff we started creating deletion commits on megarepo mainline.
This is not great since it breaks bisects, and this diff avoids that.

The way it does it is the following:
1) First do the same thing we did before - create deletion commit, and then
create a merge commit with p1 as deletion commit and p2 as an addition commit.
Let's call it "fake merge", since this commit won't be used for our mainline
2) Generate manifest for our "fake merge", and then use this manifest to
generate bonsai diff. But this time make p1 an old target commit (i.e. remove
deleted commit as if it never exited).
3) Use generated bonsai diff to create a commit.

So in short we split the procedure in two - first generate and validate the
resulting manifest (this is what we use "fake merge" commit for), and then
generate bonsai changeset using this manifest. It's unfortunate that in order
to generate resulting manifest we actually need to create commit and save it to
blobstore. If we had in-memory manifests we could have avoided that, but alas
we don't have them yet.

This way of creating bonsai changesets is a bit unconventional, but I think it has the benefit of relying on tools that we have confidence that they work (i.e. bonsai_diff), and we don't need to reimplement all the bonsai logic again

Reviewed By: mitrandir77

Differential Revision: D29633340

fbshipit-source-id: eebdb0e4db5abbab9346c575b662b7bb467497c4
2021-07-09 05:23:43 -07:00
Stanislau Hlebik
58ffbc5cec mononoke: redo the way we create merge bonsai changesets in change_target_config
Summary:
Initially I just wanted to address comments from D29515737 (fa8796ae19) about unnecessary
manifest retraversals, but there were a few more problems:
1) We didn't detect file conflicts in the final merge commit correctly. For
example, if additions_merge commit added a file "dir/1.txt", but there's
already file "dir" in target changeset that we won't detect this problem.
2) What's worse is that we might produce invalid bonsai merge changeset
ourselves. Say, if we delete "source_1/dir/file.txt", and then add file
"source_1/dir" in additions merge commit then resulting bonsai changeset should
have "source_1/dir" entry in the bonsai changeset.

This diff does the following:
1) Adds more tests to cover different corner cases - some of them were failing
before this diff.
2) Improves logic to verify file conflicts
3) Instead of trying to generate correct merge bonsai changeset it simplifies
the task and creates a separate deletion commit.

Note that creating a deletion commit on the mainline is something we want to
avoid to not break bisects. This will be addressed in the next diff.

Reviewed By: mitrandir77

Differential Revision: D29633341

fbshipit-source-id: 8f755d852212fbce8f9331049bf836c1d0a4ef42
2021-07-09 05:23:43 -07:00
Stanislau Hlebik
a24c68cf27 mononoke: log bookmark name when bookmark is moved/created/deleted/pushrebased
Reviewed By: mitrandir77

Differential Revision: D29634346

fbshipit-source-id: 25e98921410e8a481f3468264d0a1f084b89b1ba
2021-07-09 05:23:43 -07:00
Mateusz Kwapich
3a41e7fbc3 megarepo_add_branching_sync_target method
Summary: This new method will allow the megarepo customers to create a sync target that's branching off the existing target. This feature is meant to be used for release branches.

Reviewed By: StanislavGlebik

Differential Revision: D29275281

fbshipit-source-id: 7b58d5cc49c99bbc5f7e01814178376aa3abfcdf
2021-07-09 05:23:43 -07:00
Liubov Dmitrieva
ebdae10209 edenapi: end to end integration test for hg cloud upload
Summary:
First integration test for the `hg cloud upload` command.

We will be able to cover more cases once last part (uploading of changesets) will be implemented.

Reviewed By: markbt

Differential Revision: D29612725

fbshipit-source-id: cb8fedfc4e8c2408bccaa4195dc1e5c0758d742a
2021-07-09 03:23:45 -07:00
Liubov Dmitrieva
7105c6e7c1 Back out "Revert D29586388: [hg] edenapi: upload trees client side API"
Summary:
Original commit changeset: 53d067bc2bb9

Same as https://www.internalfb.com/diff/D29586388 (0be0a68cca).

D29586388 (0be0a68cca) was disconnected from its parent and landed too early by mistake and reverted (because it wouldn't even compile without the parent commit).

This is just another version for the D29586388 (0be0a68cca) as it's not possible to reopen the original one.

Reviewed By: markbt

Differential Revision: D29598758

fbshipit-source-id: 96b6137366e196f9cd3c35c178eaa3d2fce1e071
2021-07-09 03:23:45 -07:00
Liubov Dmitrieva
9aaf619762 Implement upload trees API
Summary: Implement upload trees endpoint

Reviewed By: markbt

Differential Revision: D29556346

fbshipit-source-id: 415285f2fba0b3f18a75f616649e31f78afca2b9
2021-07-09 03:23:45 -07:00
Carolyn Busch
816c09e63a integration: disable changelog migration hook
Summary: The hybrid changelog relies on edenapi which isn't currently supported by tests. Disable the migration for integration tests, until test repos are able to use edenapi.

Reviewed By: singhsrb

Differential Revision: D29602284

fbshipit-source-id: 8a2b4395fc5717c3880d7b74c45a0aef571cdc17
2021-07-08 10:05:11 -07:00
Jan Mazur
b20471ef23 do not require certificates presence when using x2pagentd
Summary: when hg client is using x2pagentd it is not using TLS but plain HTTP. We shouldn't respect use-lfs-certs config option in this case.

Reviewed By: johansglock

Differential Revision: D29613166

fbshipit-source-id: 3a7c9c5add974dd927f4c76f1da2d5b8b67e864b
2021-07-08 08:45:59 -07:00
Meyer Jacobs
ada27d91d0 scmstore: log more detail on contentstore fallback
Summary: Log the key, metadata, and size of contentstore fallback hits in order to assist in debugging them.

Reviewed By: kulshrax

Differential Revision: D29552730

fbshipit-source-id: c10ed9dd50c48a28c2a256b9175e8555ea0862b2
2021-07-07 18:24:15 -07:00
Meyer Jacobs
404bd9e625 scmstore: fix double counting of scmstore metrics
Summary: Previously, filescmstore was flushed and logged twice, once via the contentstore shim and once via the filescmstore object directly. This change addresses that issue.

Reviewed By: kulshrax

Differential Revision: D29552720

fbshipit-source-id: d44003a016f735f528b560f259f64a5e76ce1865
2021-07-07 18:24:15 -07:00
Jessica Vandebon
86b65909f9 Teach eden du to clean .eden/clients/x/fsck directories
Summary: Added a --deep-clean option to eden du that removes .edeb/clients/x/fsck directories.

Reviewed By: genevievehelsel

Differential Revision: D29501641

fbshipit-source-id: 9c01dc76b54e151ada977c0ee0c28baafe761824
2021-07-07 17:30:37 -07:00
Andrey Chursin
36e9c5c1f6 backingstore: fix debug compilation warnings
Summary: There were bunch of warnings when compiling locally with debug_assertions

Differential Revision: D29594303

fbshipit-source-id: 7d257ff3d2450bfe8a089246b18511eb091ca361
2021-07-07 16:23:17 -07:00
Andrey Chursin
d9ba6093bb checkout: fix issue with symlink=>directory replacement
Summary:
We had an issue in native checkout when update needed to remove a symlink and then create a directory with same files instead of symlink.
This used to fail, because update has a plan to write to new files, but the files has already 'existed' as part of a symlink, so unknown files check were failing.

This code makes sure that when listing untracked files we do not go inside symlinks, and treat audit errors from VFS as if file did not exist

Reviewed By: DurhamG

Differential Revision: D29567562

fbshipit-source-id: 1b6751cc00c3c628e2cab8c081540dba200209fa
2021-07-07 14:23:40 -07:00
Liubov Dmitrieva
e652bd106a Revert D29586388: edenapi: upload trees client side API
Differential Revision:
D29586388 (0be0a68cca)

Original commit changeset: 73c549f1a0d4

fbshipit-source-id: 53d067bc2bb949945394aa75851e8e93176cd4e2
2021-07-07 14:23:40 -07:00
Liubov Dmitrieva
0be0a68cca edenapi: upload trees client side API
Summary:
Add new client side API for upload trees.

Before uploading them, check what is already present on the server, similar as we check for filenodes.

I also added --force flag for the `hg cloud upload` command. It should be useful in general and useful for testing.

Reviewed By: markbt

Differential Revision: D29586388

fbshipit-source-id: 73c549f1a0d4328a64a133ab508fb4d253a4c33d
2021-07-07 14:04:33 -07:00
Prabhash Rathore
889ceef7b9 Remove direct uses of gmock.h
Summary: Remove direct uses of gmock.h

Reviewed By: chadaustin

Differential Revision: D29532548

fbshipit-source-id: c4262eb2bba7461c4f4b6dc9114dae4bcb4c5f82
2021-07-07 13:32:31 -07:00
Liubov Dmitrieva
d327996144 edenapi: upload filenodes (client side)
Summary:
upload filenodes (client side)

On the client side I implemented file upload and filenodes upload in the same API repo.edenapi.uploadfiles

This is because we should use the tokens from the file upload part to feed then into filenodes upload request.

Reviewed By: markbt

Differential Revision: D29549091

fbshipit-source-id: 436de187c8dce9a603c0c0a182e88b582a2d8001
2021-07-07 11:31:05 -07:00
Mateusz Kwapich
1e00f00813 fix crash in pullcreatemarkers
Summary:
D29401200 (538bb71548) is crashing hg pull in some cases:

      File "/opt/fb/mercurial/edenscm/hgext/pullcreatemarkers.py", line 89, in _cleanuplanded
          draftnodes = draftnodes & difftolocal.get(diffid)
      TypeError: unsupported operand type(s) for &: 'set' and 'NoneType'

Reviewed By: krallin

Differential Revision: D29587344

fbshipit-source-id: 8cc3c0e1f65625950e323e76537934a28768634e
2021-07-07 09:56:12 -07:00
Xavier Deguillard
464eef804c cli: fix buckversion collection on Windows
Summary:
subprocess.run doesn't capture the output of a command by default, thus the
buckversion is populated with a CompletedProcess, which cannot fit in the
environment.

Differential Revision: D29576149

fbshipit-source-id: 9d0e13477ac2ffc479e093ea7231eb552c31a5ec
2021-07-07 09:04:00 -07:00
Alex Hornby
4db26bffd3 mononoke: update bundle to use byteorder::BigEndian
Summary: update bundle to use byteorder::BigEndian in preparation for Bytes upgrade.  New versions of Bytes no longer reexport it.

Differential Revision: D29561928

fbshipit-source-id: ce44d9c27f9786a4bcec8f7166763c95828847e8
2021-07-07 07:52:59 -07:00
Yan Soares Couto
b60cfff714 Use Reloader on redacted config
Summary: Use the class added on previous diff on redacted config as well

Reviewed By: mitrandir77

Differential Revision: D29521423

fbshipit-source-id: 70f5a1cbce80a0068a0f438b7d217bfffb6a1592
2021-07-07 06:21:38 -07:00
Yan Soares Couto
f6a6b6a337 Extract periodic reloader to common class and use it in skiplist
Summary:
I've seen periodic reloading of stuff in at least 3 places in mononoke (2 of which I added, skiplists and redaction config, and also on segmented changelog, there might be more).

This stack extracts that logic to a common place, so we don't need to reinvent that logic all the time, and it's easier to do it the next time.

Reviewed By: mitrandir77

Differential Revision: D29520651

fbshipit-source-id: 59820c03f168cb25e2c6345e36746121451f34e2
2021-07-07 06:21:38 -07:00
Stanislau Hlebik
42c8cc1247 mononoke: remove globalrev sql syncer
Summary: We don't need it anymore, and we recently had a sev that was caused by globalrev sql syncer. Let's remove it

Reviewed By: mitrandir77

Differential Revision: D29557246

fbshipit-source-id: c7d0232203b098dff3d750d34093877240d961c4
2021-07-07 04:25:49 -07:00
Mateusz Kwapich
051894b81d add fb303 flags to async request worker
Summary: needed to set up tw health check

Reviewed By: StanislavGlebik

Differential Revision: D29580808

fbshipit-source-id: 6a3833d652979915fd44dc6d89511192397d8b96
2021-07-07 03:47:07 -07:00
Jun Wu
c4fa0eaf61 io: do not allocate stderr stream if it's mixed to stdout
Summary: There is no point to keep an empty buffer around.

Reviewed By: DurhamG

Differential Revision: D29565105

fbshipit-source-id: 1b8ea5e0158d89e119b01b1bbedd25dc280b44f3
2021-07-06 19:06:20 -07:00
Carolyn Busch
c3d23d8b75 purge: Remove unused status work
Summary: The keepfiles arg for the purge method is unused. Delete it and save a repo recrawl.

Reviewed By: DurhamG

Differential Revision: D29567714

fbshipit-source-id: 47d6b1d13aab3b740685528bffda4e2f77c97b2a
2021-07-06 19:01:04 -07:00
Jun Wu
b3419f8dba pull: filter out existing heads to pull
Summary:
If heads exist in the repo, there is no need to pull them.

Practically we configured selectivepull to include master and stable.
While the master head is excluded by the pull fast path, the stable bookmark
previously triggers the heavyweight pull. This diff makes it that we can
skip the heavyweight pull and avoid other issues like devel-warn importing
empty changegroup.

Reviewed By: DurhamG

Differential Revision: D29525476

fbshipit-source-id: 9d1ff28d1194cac22ae66e669a5bd9dbe3f750c4
2021-07-06 14:01:55 -07:00
Durham Goode
9014a85e66 tests: fix test-fb-hgext-treemanifest-prefetch.t on Mac
Summary:
The recent treemanifest refactors broke this. The behavior seems
different on Mac vs others, so let's just make the output optional with (?).

Reviewed By: singhsrb

Differential Revision: D29565879

fbshipit-source-id: 35457a6d38b02b802cc0f98d31dcab38711ff1fe
2021-07-06 13:55:31 -07:00
Durham Goode
318343765a Enable fb dynamicconfig loading inside eden backingstore
Summary:
Reenables dynamicconfig loading with eden backingstore. Previously it
broke edenfs-windows-release, but we believe the
opensource/fbcode_builder/manifests/eden tweak has fixed it.

Reviewed By: xavierd

Differential Revision: D29561192

fbshipit-source-id: 775dd21d177f3baa09b0192e7d3f7231008c3766
2021-07-06 13:53:41 -07:00
Jun Wu
4a3664c40e localrepo: check before using repo weakref
Summary: The `repo` weakref might be invalid after `__del__`. Check before using it.

Reviewed By: DurhamG, singhsrb

Differential Revision: D29565718

fbshipit-source-id: 54c86414cd80db0d10a3966ed4e677b31ddcd906
2021-07-06 13:49:39 -07:00
Jun Wu
8bc4d6e3fb cpython-ext: rename pycell to PyCell
Summary:
cpython-ext is not part of hg business APIs. It does not need to be consistent
with lower-case class name (and hg codebase is okay with non-lowercase class names,
just that most classes there are lower-case).

This resolves a rustc warning about the struct name.

Reviewed By: kulshrax

Differential Revision: D29526579

fbshipit-source-id: a4bc8e788d55c65aae9eaa87e2c684c2fded7ae2
2021-07-06 13:16:10 -07:00
Ratnadeep Joshi
136b03fb92 Changing eden/Eden/edenfs/Edenfs in the help and other user visible texts to EdenFS
Summary: There are a lot of places in user visible text such as command line help  where EdenFS is mentioned as eden/Eden/edenfs/EdenFS. This will make it consistent to 'EdenFS' in most cases. In the places where it is referring to the process/daemon, 'edenfs' will be used.

Reviewed By: chadaustin

Differential Revision: D29419151

fbshipit-source-id: 7b8296f0a0c84fdcb566ff811f7fcedbe7079189
2021-07-06 12:17:20 -07:00
Mateusz Kwapich
fa8796ae19 change_target_config implementation
Summary: The implementation of change_sync_target_config_method.

Reviewed By: StanislavGlebik

Differential Revision: D29515737

fbshipit-source-id: 748278e73b1ed727550f3f05451b508a70be07db
2021-07-06 08:32:48 -07:00
Mateusz Kwapich
28d69d60c8 use the SourceName newtype where possible
Summary:
I got frustrated with the fact that half of the functions in
megarepo_api required the source name to be wrapped into newtype and
other half didn't. This refactor unifes it everywhere except the thrift
datastructure itself - not sure if we can afffect thrift codegen in this way.

Reviewed By: StanislavGlebik

Differential Revision: D29515474

fbshipit-source-id: 2d55a03cf396b174b0228c3fcc627b2296600400
2021-07-06 08:32:48 -07:00
Mateusz Kwapich
ae57ff3ccc make writing state optional in create_merge_commits
Summary:
The merge commit in case of change_target_sync_config won't be representing any
consistent state of the target so we don't want to write the remapping state
file there.

Reviewed By: StanislavGlebik

Differential Revision: D29515476

fbshipit-source-id: b0703be1127af6582785510fde51ff8501fb4f17
2021-07-06 08:32:48 -07:00
Mateusz Kwapich
15f3eadc49 make create_move_commits take just sources
Summary:
in case of change_target_sync_config we'll be creating move commits only for subset
of sources to let's change the function singature to so it's possible to
specify such subset.

Reviewed By: StanislavGlebik

Differential Revision: D29515475

fbshipit-source-id: 31002ec56dad872948bcbc79b0ed5fdb794e1f10
2021-07-06 08:32:48 -07:00
Mateusz Kwapich
85f31f3f85 move reusable functions to common
Summary:
The `change_target_config` methods responsibilities have a huge intersection
with `add_target_config`: the change method needs to know how to merge-in new
sources into the target and the whole "create move commits, then create merge
commits" flow can be reused.

Reviewed By: StanislavGlebik

Differential Revision: D29515301

fbshipit-source-id: c15f95875cbcbf5aad00e5047f6a8ffb55c4da31
2021-07-06 08:32:48 -07:00
Thomas Orozco
19769b7cb3 commitcloud: only check local nodes in _checkomissions
Summary:
With segmented changelog, this `if head not in repo` check goes and queries
the server to know if this exists. That's slow:

https://fb.workplace.com/groups/corehg/permalink/880425025886062/

This should hopefully fix it.

Reviewed By: quark-zju

Differential Revision: D29550877

fbshipit-source-id: f874fea3f42e1bde0acd4146bcfede4854b585f1
2021-07-05 14:38:33 -07:00
Aida Getoeva
498416a53c mononoke/blobstore: single lookup for is_present multiplex
Summary:
Currently `is_present` makes a blobstores lookup and in case it couldn't determine whether the key exists or not, it checks the sync-queue (in case the key was written recently) and then might check the multiplex stores again, then fails if still unsure. This brings unnecessary complications and makes the multiplex blobstore less reliable.
More details in: https://fb.quip.com/wOCeAhGx6Oa1

This diff allows us to get rid of the queue and second store lookups and move the decision-making to the callers. The new logic is under the tunable for the safer rollout.

*This diff is safe to land.*

Reviewed By: StanislavGlebik

Differential Revision: D29428268

fbshipit-source-id: 9fc286ed4290defe16d58b2b9983e3baaf1a3fe4
2021-07-05 11:13:18 -07:00
Harvey Hunt
fcaa5c72d6 mononoke: Implement loadshedding checks
Summary:
Now that Mononoke uses the `rate_limiting` library we can shed load if
a server is overloaded. Add load shedding checks to the entry points for
wireproto and EdenAPI HTTP traffic.

At the time of writing, there aren't any load shedding limits configure so this
change won't have any effect.

Differential Revision: D29396504

fbshipit-source-id: c90cc40fc2609bdae1a267be3a1aecfe7fd33b7b
2021-07-05 10:18:52 -07:00
Harvey Hunt
14ba455e60 mononoke: Use new rate limiting crate
Summary:
Update Mononoke server to use the new `rate_limiting` crate. This diff
also removes the old rate limiting library.

Differential Revision: D29396507

fbshipit-source-id: 05adb9322705b771a739c8bcaf2816c95218a42d
2021-07-05 10:18:51 -07:00
Harvey Hunt
a92eae78ae mononoke: lfs: Use new load shedding config
Summary:
Replace the LFS server's load shedding logic with that provided by the
`rate_limiting` crate.

Differential Revision: D29396503

fbshipit-source-id: a71812a55b9c9f111ee2861dc1b131ad20ca82d2
2021-07-05 10:18:51 -07:00
Harvey Hunt
7b40d3af0d mononoke: Add new rate limiting library
Summary:
Add a new rate limiting library that also supports load shedding when
an individual server is overloaded. This library provides a few benefits:

- The code can be shared between the LFS server and Mononoke server.
- The library supports more complex expressions of which clients to apply a
  rate limit to (e.g. 10% of sandcastle and mactest machines).
- The rate limiting `Target` can be expanded in the future as the client
  provides more information (e.g. client region).
- Mononoke server will be able to loadshed if an individual host is overloaded,
  as we can currently do with the LFS server.

I've added this library as a separate crate rather than rewriting
`load_limiter` to make it easier to review. The next diff will make use of the
new library and remove the old one.

Reviewed By: StanislavGlebik

Differential Revision: D29396509

fbshipit-source-id: 2fbc04e266b18392062e6f952075efd5e24e89ba
2021-07-05 10:18:51 -07:00