Commit Graph

19921 Commits

Author SHA1 Message Date
Jan Mazur
f697307a97 tiered consistent routing code
Summary:
Seem summary on the previous diff.

This functionality should be a super set of the previous logic.

Reviewed By: mitrandir77

Differential Revision: D45395320

fbshipit-source-id: 2ebf08c6b8c3480ea30cd2bf4635fc116ecd65b6
2023-05-10 05:33:30 -07:00
Rajiv Sharma
4d20bdeebb Remove unused dependency in mononoke_api
Summary: As in title

Reviewed By: singhsrb

Differential Revision: D45726879

fbshipit-source-id: 51aa581536a57fa701a49f8bf83f9399b6f278ae
2023-05-10 03:48:45 -07:00
Rajiv Sharma
bcf031b194 Implement tag support in gitimport
Summary:
This diff includes the following key changes:
- Added `generate_changeset_for_tag` method in the `GitUploader` contract for creating changesets for annotated tags pointing to commits
- Handled `BookmarkCategory` of tags and branches when creating the Mononoke bookmark for git branches or tags
- Introduced the `TagMetadata` type that captures relevant data from a git tag
- Implemented `generate_changeset_for_tag` for `DirectUploader` in `gitimport`
- Modified integration test to validate annotated tag handling during `gitimport`

Differential Revision: D45534203

fbshipit-source-id: 15d00b16831fab601226a85f86bd2c2b65968ae3
2023-05-10 03:41:43 -07:00
Liubov Dmitrieva
1cd54e6f46 remove legacy code
Summary: remove legacy code

Reviewed By: mitrandir77

Differential Revision: D45395553

fbshipit-source-id: 92180e92241bd912421db0efb356060614f8eb9d
2023-05-10 02:24:40 -07:00
Mark Shroyer
ca97f27033 Make doctor's Windows ver check handle bad output
Summary:
Ensures that the doctor check for Windows version, done by running `cmd.exe /c ver`,
can handle non-utf-8 output and report it as a problem instead of terminating
with an unhandled exception.

Reviewed By: xavierd

Differential Revision: D45620254

fbshipit-source-id: c97642b3e48a76a2ff46ebc74d5257ad4c1fec18
2023-05-09 15:31:41 -07:00
Chad Austin
9e85f19db7 remove some unnecessary includes from VirtualInode.h
Summary: VirtualInode included several things it never used. Remove them.

Reviewed By: genevievehelsel

Differential Revision: D45629434

fbshipit-source-id: db937ddba1886c0fa2461ec9f1e5842462275be9
2023-05-09 15:29:04 -07:00
Chad Austin
1a77780c10 give up on trying to keep operator== out of ObjectId
Summary:
I need to use `std::optional<ObjectId>::operator==`, which uses
`ObjectId::operator==`.

I tried to make it hard to accidentally compare ObjectId, but that's
fighting a losing battle, so bring it back.

Reviewed By: genevievehelsel

Differential Revision: D45629405

fbshipit-source-id: 83c88afff0fb2954e40dd59204d0cfc76155fa70
2023-05-09 15:29:04 -07:00
Chad Austin
cef1a3e6e3 break Hash's dependency on folly/Conv
Summary: We use fmt now.

Reviewed By: genevievehelsel

Differential Revision: D45629293

fbshipit-source-id: 642087fc3fb0a1a8df4b2e26271fa52644e4f1d8
2023-05-09 15:29:04 -07:00
Chad Austin
f6210ace67 remove folly::to support from ObjectId
Summary: We use `fmt` now.

Reviewed By: genevievehelsel

Differential Revision: D45621339

fbshipit-source-id: ea61e2c645af822c12e5a9f53e85e40157746c69
2023-05-09 15:29:04 -07:00
Zhaolong Zhu
1d3d66463b copytrace: add max_rename_candidates config
Summary: Add `copytrace.max_rename_candidates` to limit the number of candidate files to check.

Reviewed By: quark-zju

Differential Revision: D45670741

fbshipit-source-id: 7512f91d31dfe6b58eab7b4fa777578791e3e422
2023-05-09 14:36:17 -07:00
Zhaolong Zhu
214ec48059 copytrace: add config RenameFinder
Summary: Added config object to RenameFinder, so we can use config to control the number of candidate files to check; and also use config to control content similarity threshold.

Reviewed By: quark-zju

Differential Revision: D45606906

fbshipit-source-id: 67d580fdac517a9a2713378c1c53f9c334ba63ae
2023-05-09 14:36:17 -07:00
Chad Austin
641d1544df fix getdeps build
Summary: This include is no longer necessary, so we can remove it.

Reviewed By: genevievehelsel

Differential Revision: D45620895

fbshipit-source-id: d8d9ae00cc38ad1331f8f6fb1f1c55b9d4276095
2023-05-09 10:27:42 -07:00
Muir Manders
0fc5d1363b auth: don't load certs if auth proxy enabled
Summary:
Skip certificate loading if the auth proxy is enabled. We don't use the certs in this case, so there is no point in loading them.

Also, when using an auth proxy (e.g. x2pagentd) the certs may not be present on disk, and we don't want to error out assuming they will be present.

Reviewed By: quark-zju

Differential Revision: D45486476

fbshipit-source-id: 3638299f72e7e5769eba48425be47aa90f96914e
2023-05-09 09:53:48 -07:00
Xavier Deguillard
3d94505d6e store: allow LocalStoreCachedBackingStore to be configured
Summary:
One of the main objective of the LocalStoreCachedBackingStore is the ability of
configuring its policy depending on the underlying backing store. For instance,
while some backing store want to cache everything in the LocalStore, others may
only want to cache BlobMetadata. Configuring the policy per-backingstore allows
the removal and special case inside the RocksDbLocalStore of blob caching: this
is now done entirely inside the LocalStoreCachedBackingStore.

Reviewed By: chadaustin

Differential Revision: D45550480

fbshipit-source-id: 386e384f0148e38fad8d4008b4e312f360edb676
2023-05-09 09:52:52 -07:00
Mateusz Kwapich
a998c6fcc1 cleanup the old logging code
Summary: The tunable is already flipped to true. We don't need the rollout gating anymore.

Reviewed By: Croohand

Differential Revision: D45405145

fbshipit-source-id: 4ae2314dc29eb650efc39fded5213c057fc0c562
2023-05-09 09:44:42 -07:00
Zhaolong Zhu
f944ae52ec pyconfigloader: add Send + Sync to config dyn trait object
Summary:
this will be needed for pycopytrace for converting Python object to
Rust dyn object

Reviewed By: quark-zju

Differential Revision: D45657741

fbshipit-source-id: 9ce9b720bc47a3513c561ced59bb7eb2f34f413d
2023-05-09 06:54:42 -07:00
Rajiv Sharma
2e8e2437e1 Clippy fixes
Summary: As in title

Reviewed By: YousefSalama

Differential Revision: D45690425

fbshipit-source-id: f09936ed5205e3f6e3cf67508c218908e76b63ec
2023-05-09 06:49:45 -07:00
Liubov Dmitrieva
ecc0cc8c3f reduce buffer size for cbor stream from 1 MB to 8 KB
Summary:
reduce buffer size for cbor stream from 1 MB to 8 KB by default

Currently, we don’t attempt to deserialise any data less than 1 MB on cbor
stream. The value is too high for most of our requests meaning the deserialization will be
performed at the end. Since the value was chosen arbitrarily in
https://www.internalfb.com/diff/D22370164, let's adjust it to 8K. This is more
reasonable default. For example, this is the frame size BufReader is using, and so
our zstd stream.

We will still move to 1MB buffers and large once we hit resize logic if we encounter an item that doesn't fit the smaller buffer. This may happen for files endpoint.

The current implememtation doesn't allow, for example, properly track number of incoming commits coming from commit graph stream since the entries
are very small and we are blocked for long on filling the buffer.

Reviewed By: quark-zju

Differential Revision: D45619933

fbshipit-source-id: b1e9d6e97aaa67aeaa718e3127baedcd615c82f7
2023-05-09 06:07:51 -07:00
Rajiv Sharma
9a912a1de1 Fix json rendering for commit-info for commits with git-extra-headers
Summary: The `git_extra_headers` field in a changeset contains the headers associated with the corresponding git commit which was translated into a Mononoke changeset. The `git_extra_headers` is a mapping of arbitrary bytes to bytes which might not necessarily be valid strings. When used in `scsc`, particularly for `scsc info`, we just want to display headers that make sense to a human (i.e. strings instead of bytes). This was already the case for the default output mode but when outputting in `json`, we use `serde` serialization which doesn't accept non-string keys when serializing `BTreeMaps`. A user [faced an error](https://fb.workplace.com/groups/2071217289839797/permalink/6054134597969443/) when trying to get the info for such a commit. This diff excludes non-string headers for the purpose of displaying output to the user.

Reviewed By: YousefSalama

Differential Revision: D45689738

fbshipit-source-id: 7be727650ad7637213ae59dc36e8a73464406f1a
2023-05-09 05:20:15 -07:00
Haitao Mei
09e26b82fb Delete derived_root_unode from code base
Summary: This diff deletes `derived_root_unode` from our code base, then we're going to remove the blobs as the next step.

Reviewed By: RajivTS

Differential Revision: D45606240

fbshipit-source-id: 028309c66c55a33ba0f73cee9082d414d3d69b4c
2023-05-09 01:58:01 -07:00
Pedro Rittner
53f1785ead Relax requirement that Scribe messages be valid UTF-8
Summary:
Outside of the HTTP endpoint specifically (which uses JSON), Scribe doesn't *actually* require the use of UTF-8 strings in its payloads.

To enable use cases that want to be able to offer non-UTF-8 messages into Scribe, the `ScribeClient` API has been changed to accept a more generic `&[u8]` instead of a strict `&str`.

Existing callsites that expected to only log UTF-8 strings now must enforce that at runtime or at their own API boundaries, which shouldn't be a problem in the scope of this codemod as that was (until now) enforced by the compiler.

Reviewed By: kuecks

Differential Revision: D45657053

fbshipit-source-id: bb08b02d3129e2cee895847c634fe9e809995f72
2023-05-08 17:03:41 -07:00
Muir Manders
fc6d3225fd megarepo: trigger autopull for xrepo commit lookup
Summary:
Re-implement the xrepo lookup as a namespace to map xrepo commits to local commits, and an autopull predicate to pull the translated commit.

There are a couple subtle concerns:
1. We don't want to trigger any xrepo work for normal cases such autopulling a normal commit. To achieve that, made it possible to defer the generation of an autopull attempt. This way, the xrepo autopull can cancel itself if the revision in question was successfully pulled by a higher priority autopull predicate.
2. We don't to trigger an xrepo query in `repo["deadbeef"]` (i.e. in commitctx.__init__). This could have surprising performance implications. To achieve this, we only do the xrepo translation during the autopull step. Later, the namespace lookup will only use the cached translation result.

I also moved the behavior into an extension to separate it better.

Reviewed By: quark-zju

Differential Revision: D45537964

fbshipit-source-id: 602db5218c618132672c708edabf366615646600
2023-05-08 15:28:10 -07:00
Saul Gutierrez
fb07625c7e tests: fix flaky test_ancestors test
Summary: This test was flaky since a long time ago we made some changes to `drawdag`, which this diff fixes

Reviewed By: zzl0

Differential Revision: D45442022

fbshipit-source-id: 5a36a70f985d81c42f822f9933e0dc43d87cb591
2023-05-08 13:48:52 -07:00
Zeyi (Rice) Fan
9f2cfe4af0 add shell completion for hg {hide,unhide,show}
Summary: I use these commands often but they don't have autocompletion.

Reviewed By: zzl0

Differential Revision: D45659357

fbshipit-source-id: 6f55324116cda45e159426f463974df175f9b25e
2023-05-08 12:55:33 -07:00
Revathy Kasipandian
bcf9089209 Make Prjfs Tracebus Tracebus size configurable by EdenConfig
Summary: Make Prjfs Tracebus Tracebus size configurable by EdenConfig

Reviewed By: kmancini

Differential Revision: D45384455

fbshipit-source-id: 716ad44474db6e5cc1046829f0e0639e1da9771e
2023-05-08 11:04:48 -07:00
Chad Austin
0b877177b2 enable rpc tests on Windows
Summary: There's nothing unix-specific about these tests, so enable them on Windows.

Reviewed By: genevievehelsel

Differential Revision: D45586168

fbshipit-source-id: 5acbcbe81c5c03b16e43fc561762dbafb47696b8
2023-05-08 11:03:07 -07:00
Mark Shroyer
fe7f58d5bf Error if user passes empty --config-dir to edenfsctl
Summary:
If a user relies on an environment variable in their invocation of edenfsctl,
e.g. `--config-dir=$EDEN_DEV_STATE`, then if the user accidentally leaves the
variable unset they may inadvertently specify an empty string as the path to
their config dir.

When running `edenfsctl stop`, the effect of an empty config dir path is to
shut down your main eden daemon instead of your dev daemon, so this has proven
a bit of a footgun.

Reviewed By: xavierd

Differential Revision: D45591968

fbshipit-source-id: 6df6eb8c05d94dafcaee1d6976a52310454a42d4
2023-05-08 10:36:51 -07:00
Revathy Kasipandian
707879fc5c Do not hard-fail when edenrc is corrupted
Summary: Do not hard-fail when edenrc is corrupted

Reviewed By: xavierd

Differential Revision: D45550209

fbshipit-source-id: 88b5e7249a7da2ef4c6df69a4c65f08b7832d8d2
2023-05-08 08:23:03 -07:00
Pierre Chevalier
888a60239a non-oss work 10/n
Differential Revision: D45600762

fbshipit-source-id: f802d2ae9a6296edc200b916374fbb1356395b44
2023-05-06 01:47:17 -07:00
Pierre Chevalier
6df12dbea7 non-oss work 9/n
Differential Revision: D45599777

fbshipit-source-id: c31fa8447c33b3a6f69f35986518708a22b064f1
2023-05-06 01:47:17 -07:00
Pierre Chevalier
ef92f5defe non-oss work 8/n
Differential Revision: D45599536

fbshipit-source-id: 7f0fb5262aeefbc56f6207037a66a2f4e3c68d03
2023-05-06 01:47:17 -07:00
Pierre Chevalier
9bba345d85 non-oss work 7/n
Differential Revision: D45599418

fbshipit-source-id: 4b81a03a9290884a2eb47760d4887dc53d5bc024
2023-05-06 01:47:17 -07:00
Pierre Chevalier
4b9c5ae2fe non-oss work 6/n
Differential Revision: D45575956

fbshipit-source-id: 590f31e707b4f0fab5dfdd267f7998b4719bdf04
2023-05-06 01:47:17 -07:00
Chad Austin
a3a8586a79 fix a crash in NFS graceful restart
Summary:
After a takeover, the new socket was initialized with a "remote
EventBase", causing stopAccepting to be asynchronous, tripping an
assertion.

There was a latent bug here: it might have been possible for a new
connection to be accepted by the old process after takeover begun.

Reviewed By: xavierd

Differential Revision: D45584154

fbshipit-source-id: cdd8118d82100bc1e19f6f19676cc2fa412b8775
2023-05-05 14:18:00 -07:00
Muir Manders
107eeb3fdb lock: kill Python makelock()
Summary: This is no longer used in favor of Rust locking.

Reviewed By: quark-zju

Differential Revision: D41998651

fbshipit-source-id: 8cadbe737ef064ac64b41bae1389b2123ef672b3
2023-05-05 11:41:29 -07:00
Muir Manders
c312030cbe lock: remove Python releaselock() impl
Summary: This is no longer used since we rely solely on Rust repo locks.

Reviewed By: quark-zju

Differential Revision: D41998654

fbshipit-source-id: 0f955821add1cf10f3220abf70238343fc5c9f8e
2023-05-05 11:41:29 -07:00
Muir Manders
03ec25635e debuglocks: deprecate ability to force lock release
Summary: The force release behavior is broken, and may no longer be necessary. It is broken because it unlocks by deleting the legacy compatibility lock file, which is not load bearing for locking anymore. It could be updated to delete the right lock files, but I don't think that is necessary since locks on all platforms are released automatically when the locking process exits.

Reviewed By: quark-zju

Differential Revision: D41998655

fbshipit-source-id: f3833e07668d108b7a2464dd272a03c76379f32b
2023-05-05 11:41:29 -07:00
Muir Manders
71b8f1e43c lock: kill python "releaselock" function
Summary: This was only used by the "debuglocks" command. Instead, make it get the lock information from the LockHeld exception. This is a better approach since it is "atomic" with regard to the corresponding lock contention (i.e. there is no race condition going to read the lock contents when they might have changed since the lock contention).

Reviewed By: quark-zju

Differential Revision: D41998653

fbshipit-source-id: 3c80b2321a97b052025ef1f316defce3177c60ef
2023-05-05 11:41:29 -07:00
Muir Manders
da8d540283 lock: remove now unused pythonlock class
Summary: Now that everything is using the rust_only locking mode, revert back to having a single "lock" class, but with the rustlock guts.

Reviewed By: quark-zju

Differential Revision: D41998650

fbshipit-source-id: f216df93e3758597c3df7e8c434bebcc8c64160d
2023-05-05 11:41:29 -07:00
Muir Manders
872fd55a71 repolock: share locks between Python and Rust
Summary:
Hook things up so the Python repo.lock() and repo.wlock() functions delegate to the Rust repo's RepoLocker object. This way, repo locks that Python acquires are re-entrant across calls into the Rust workingcopy.

In particular, this fixes a deadlock when calling into the Rust status code since the status code needs to acquire the wlock to update the treestate.

I tweaked the out-of-order lock detection to allow the wlock to be released before the store lock if the wlock had been acquired out-of-order via a no-wait/non-blocking acquisition. The Python status code does `repo.wlock(wait=False)` in a best effort attempt to update the dirstate. The store lock may already be held, so in this case they locks are acquired out of order, and released out of order (but there is no risk of deadlock, so it is okay).

In general I've taken a conservative approach to maintain all the existing Python logic, such as acquire/release callbacks, warnings, shared wlock acquisition, etc. I considered a more aggressive change where we push more into Rust, but we can do that later.

Reviewed By: sggutier

Differential Revision: D45510005

fbshipit-source-id: 178b2213db7e6ec57c3e59c66ca3e21d27674cbf
2023-05-05 11:41:29 -07:00
Muir Manders
fe576917a4 repolock: pull ref counted lock into a struct
Summary: I'm going to add another bit of data to this in the next commit.

Reviewed By: quark-zju

Differential Revision: D45579290

fbshipit-source-id: b882b06b110fd7b038166a592677acf8ac6410d7
2023-05-05 11:41:29 -07:00
Zhaolong Zhu
b5fe806aab pycopytrace: choose different RenameFinder based on storage format
Summary: This diff makes `dagcopytrace` choose different RenameFinders (Sapling or Git) based on storage format.

Reviewed By: quark-zju

Differential Revision: D45233571

fbshipit-source-id: 42da2bceff1e20f6679fe8960635a80486f766c4
2023-05-05 09:47:49 -07:00
Rajiv Sharma
10a8eeb963 Refactor of gitimport codebase
Summary:
This diff is preparatory work to allow creation and upload of changeset corresponding to git annotated tags. In particular, this diff:
- Makes fields in `BonsaiAnnotatedTag` public so that they can be set via the caller
- Makes the `gitimport` function use a reference to `GitUploader` instead of owning the uploader, so that it can be reused at multiple call sites
- Modifies the `create_annotated_tag` method in `mononoke_api` to allow for empty tag `author` and `author_date`
- Rename the `generate_changeset` method to `generate_changeset_for_commit` so we can have a `generate_changeset_for_tag` method later on. Renamed the `decode_commit_message` method for similar reasons

Reviewed By: mitrandir77

Differential Revision: D45529031

fbshipit-source-id: b4d12cbb705592cbd0114c4a5c241e90273f03f8
2023-05-05 02:01:07 -07:00
Pierre Chevalier
09da978f43 non-oss work 4/n
Differential Revision: D45571568

fbshipit-source-id: 418cebe5935528bcf1f10bdd8d34c22ce056f8f3
2023-05-05 01:56:52 -07:00
Scott Ramsby
b7a3373ecb Make fmt formatter methods const
Summary:
Staging an update to the latest fmt version triggered lots of build errors due to non-`const` methods on custom formatters. This fixes the `format()` methods to be `const` as they don't mutate any state anyway, as well as `parse()` methods that don't need to mutate internal state. This mitigates many future build errors.

Updates were identified and executed by using regular expression search/replacements such as:
`(constexpr auto parse\(ParseContext& [^)]*\)) \{` -> `$1 const {`
`(constexpr auto parse\(ParseContext& [^)]*\)) ->` -> `$1 const ->`
`(auto format\(.*, FormatContext& [^)]*\)) \{` -> `$1 const {`
`(auto format\(.*, FormatContext& [^)]*\)) ->` -> `$1 const ->`

Any changes to third-party code was then reverted. Some small changes detected from subsequent build errors were then applied.

Reviewed By: vitaut

Differential Revision: D45420948

fbshipit-source-id: 211bf7f3b59616eda3cd228caf4e93ff81d4fc2b
2023-05-04 17:42:27 -07:00
Scott Ramsby
229990b06b Use iterators when calling format_to() on memory buffers
Summary: Newer versions of fmt require that you pass an iterator rather than a direct memory buffer as an output to the `format_to()` family of functions. This does that to unblock an upgrade to a newer fmt version.

Differential Revision: D45555419

fbshipit-source-id: a4e2217299ada0ab5e56942dacc9107153e4260d
2023-05-04 15:09:43 -07:00
Muir Manders
0adfb47c8c tests: kill "remotefilelog.useruststore" config
Summary: Doesn't seem to be a live config setting anymore.

Reviewed By: quark-zju

Differential Revision: D45556674

fbshipit-source-id: 83b2a08410692757e68678b24b58f79343186665
2023-05-04 12:16:44 -07:00
Mark Shroyer
02cb019bd0 Doctor check for running as elevated process
Summary:
Adds an `eden doctor` check to report a problem if EdenFS is running in an
elevated process on Windows.

Reviewed By: xavierd

Differential Revision: D45169813

fbshipit-source-id: 41fd500adc1aed5641602d6dfe67cc6061d5b15d
2023-05-04 11:37:31 -07:00
Chad Austin
85b3feaf0c remove the dead Cython-based Thrift client
Summary:
We don't use the Cython-based Thrift client because it never worked in
the open source build. Removing it fixes the tests when run with
nix2rpm Python binaries.

Reviewed By: xavierd

Differential Revision: D45508963

fbshipit-source-id: d6f0e162177082a78504a3a6014a8a4d32670ccc
2023-05-04 10:53:12 -07:00
Pierre Chevalier
42a5cd4733 non-oss work 2/n
Differential Revision: D45533358

fbshipit-source-id: 12d1b3ae087bc7a68c32c74566925f699d2ab3ce
2023-05-04 09:13:32 -07:00
Muir Manders
48fe991547 repolock: add py bindings for RepoLocker
Summary:
Expose the RepoLocker via the pyrepo bindings. Python will make use of this to allow sharing of locks between Python and Rust (i.e. allow locks to be re-entrant across Python -> Rust boundary).

I added a new RepoLockHandle.count() method to enable some sanity checks in the bindings. In particular, we make sure that when the Python code acquires a lock, it isn't already acquired. Python has its own logic for storing the lock on the repo, so it should only try to acquire once. In general Python assumes it is the top level locker, so I want to catch any craziness where Rust acquires a lock and then calls into Python and the lock is re-acquired.

Similarly, we check that when Python releases a lock, the lock is _actually_ released (i.e. there isn't some other Rust code still holding a reference to the lock handle).

Reviewed By: quark-zju

Differential Revision: D45510004

fbshipit-source-id: 8625da19b82b4cd92a052bca56e6e46affe1bc08
2023-05-04 09:05:16 -07:00
Muir Manders
9f78d6b183 repolock: add "try" interface to not block
Summary:
Add RepoLocker try_lock_working_copy() and try_lock_store() methods that only make a single, non-blocking attempt to acquire the lock.

This will be useful to integrate Rust repo lock w/ Python land.

Reviewed By: quark-zju

Differential Revision: D45510003

fbshipit-source-id: a9b2e44f6fe52e6d942ce910a1e145b63e80c045
2023-05-04 09:05:16 -07:00
Muir Manders
d446bc82a8 repolock: fix bad lock order detection
Summary:
In lock_working_copy(), only make sure store lock isn't held if we don't already hold the wlock. This is so we don't error out on locking orders like wlock() -> lock() -> wlock().

Similarly, when releasing locks, defer check of store lock until we actually drop the wlock. This avoids an error when unlocking an order like wlock() -> lock() -> wlock().

Reviewed By: quark-zju

Differential Revision: D45510002

fbshipit-source-id: f2c65d0bb10aac196f2bc152d8b4fff49f9c598f
2023-05-04 09:05:16 -07:00
Muir Manders
64d586a24d debuglocks: rearrange code a little bit
Summary: Move lock error handling code inline into except clauses.

Reviewed By: quark-zju

Differential Revision: D41998652

fbshipit-source-id: f95c278c6ab3f92c5744c4e852bab8b85578a78c
2023-05-04 09:05:16 -07:00
Mateusz Kwapich
f7d85a47bb switch more packmans to buck2
Summary:
mzr did migrate one of the rpms in D45309155 but we need to migrate all to
unbreak contbuild.

Reviewed By: YousefSalama

Differential Revision: D45502892

fbshipit-source-id: b9e659f9ae79ed2166927b649c127b71b32cde47
2023-05-04 08:36:12 -07:00
Egor Tkachenko
3307734404 support SKELETON_MANIFESTS type in prepare_derived_data
Summary: Mark's stack D45216982 added support to prepare derived data before creating stack of commits using scs, but it wasn't complete, since mononoke_api didn't allow any other types except Fsnodes. This diffs adds skeleton_manifests, so configerator rsync tailer can use it.

Reviewed By: mitrandir77

Differential Revision: D45568306

fbshipit-source-id: 23e1eef2485cc81d6dfb2ca426999a5d39c53aea
2023-05-04 08:04:55 -07:00
Haitao Mei
d5d7c2b8f1 Delete BlameV1 Part IV
Summary: This diff renames fetch_blame_compact to fetch_blame_v2, because we have already removed CompactBlame in our last diff

Differential Revision: D45566569

fbshipit-source-id: 466af2310c702699fb6463e0d41cbd1edef81fee
2023-05-04 07:59:08 -07:00
Haitao Mei
fc6c9eeb86 Delete BlameV1 Part III
Summary: This diff removes `CompatBlame`

Differential Revision: D45528421

fbshipit-source-id: 05077c6182f98b08868d102853337742658d3bf3
2023-05-04 07:59:08 -07:00
generatedunixname89002005287564
b740230dd4 Reviewed By: zertosh
Differential Revision: D45563268

fbshipit-source-id: 91c1fbe0b46ab0dcb26fb854745ccd534c9b3c91
2023-05-04 05:55:03 -07:00
Rajiv Sharma
bbacbea783 Remove everything about ContentMetadata
Summary: Now that `ContentMetadataV2` is rolled out completely, we can get rid of everything that references or depends on the old `ContentMetadata`. I will be relying on rust and integration tests to tell me if I broke something.`

Differential Revision: D43906528

fbshipit-source-id: 2169e48e70a4fc50592603ae8d47b14579677b24
2023-05-04 03:59:59 -07:00
Haitao Mei
9bb56a5b5f Delete BlameV1 Part II
Summary:
This diff :
* moves RejectedBlame from BlameV1 to BlameV2
* deletes Blame 1 related files

Reviewed By: RajivTS

Differential Revision: D45522867

fbshipit-source-id: ee492078b394fc11e2ae94c8639a60c9032801c4
2023-05-04 02:46:48 -07:00
Liubov Dmitrieva
db51a340b1 simplify code, keep the original ordering from ancestors_difference
Summary:
simplify code, keep the original ordering from ancestors_difference

we don't need any stable ordering anymore (see D45368943), so let's get rid of
any sorting here and also let's maintain the order returned from the
ancestors_difference (topo sorted from children to parents)

Reviewed By: mitrandir77

Differential Revision: D45394327

fbshipit-source-id: 586b1df057e6281aa75e2baaa9f959cddc082b2c
2023-05-04 02:44:29 -07:00
Andres Suarez
94911445f1 remove solana related crates
Reviewed By: dtolnay

Differential Revision: D45402694

fbshipit-source-id: 60aedf8c2cd8fabbcaa25edb1f0877d10a9ca4f4
2023-05-03 21:19:23 -07:00
Jun Wu
c86ddb7dcb config: bump stack export limits
Summary:
I had to bump them when testing stack editing features on my own stack.
It seems we're fine with 70-ish commits and more than 2MB files. So let's bump
the limits.

Reviewed By: muirdm

Differential Revision: D45540481

fbshipit-source-id: f9ae73271604afaadc2195cd26fa718b6313594b
2023-05-03 16:32:13 -07:00
Chad Austin
6d50eb6715 remove some redundant logging
Summary:
MountProtocol and FsChannel::getName() are the same information, so
just log the latter in this rare EDEN_BUG situation.

Reviewed By: genevievehelsel

Differential Revision: D45159212

fbshipit-source-id: 4bf4bce7889ffa704a25d7dbebcf7e13520abe1b
2023-05-03 16:22:11 -07:00
Chad Austin
76e8905821 remove some _WIN32 ifdefs
Reviewed By: genevievehelsel

Differential Revision: D45109938

fbshipit-source-id: 5e9f05f3e8bae04866a685239176bcf66e055f9c
2023-05-03 16:22:11 -07:00
Chad Austin
326c6bc189 break EdenMount's dependency on PrjfsChannel.h
Summary:
A primary advantage of existentials over sum types is that they allow
they breaking dependencies. Now that channel_ is an FsChannelPtr, we
no longer need to include PrjfsChannel.h in EdenMount.h.

Reviewed By: kmancini

Differential Revision: D45109931

fbshipit-source-id: 7774804fe4056ef5b897de294707496ff722db28
2023-05-03 16:22:11 -07:00
Chad Austin
9132786f04 unify EdenMount::channel_ on every platform
Summary:
On Windows, macOS, and Linux, EdenMount::channel_ is an
FsChannelPtr. Code that wants to branch on a specific implementation
can use getFuseChannel or getNfsChannel or getPrjfsChannel, though
those will be removed later.

Reviewed By: kmancini

Differential Revision: D45109907

fbshipit-source-id: d4b3b46bd78b9487909bf1cb7c1c754e48b6e9a9
2023-05-03 16:22:11 -07:00
Mark Shroyer
5690394add Add constants lib to Python CLI
Summary:
Our build signals for the Python CLI are currently fragile because other code
pulls main_lib into complex test cases, when it really only wants the CLI's
return code constants.  This decouples main_lib from these external tests.

Reviewed By: genevievehelsel

Differential Revision: D45404900

fbshipit-source-id: 4adb18030ac0ca934c6ceab7cbcd50ebd20c707d
2023-05-03 14:28:04 -07:00
Mark Shroyer
a6dcb211ff Use __EDENFSCTL_RUST to look up Rust binary path
Summary:
Fixes `buck2 run edenfsctl` by ensuring daemon.py knows how to use the
`__EDENFSCTL_RUST` environment variable, which we already plumb through our run
target, to lookup the path to the CLI.  This is needed so that `edenfsctl
start` can perform mounts at startup on macOS, for example.

Reviewed By: chadaustin

Differential Revision: D45533101

fbshipit-source-id: c9df700e506409f734ca98a4fb205f962fd8ed78
2023-05-03 14:19:43 -07:00
Chad Austin
da3b124374 replace force-unmount-tmp and force-unmount-all with a Python script
Summary:
The shell scripts and awk fu did not always work correctly, so use
Python to parse the Linux mount table.

Reviewed By: mshroyer

Differential Revision: D45238375

fbshipit-source-id: 6d8918b8ecbdfe37e8ceba2b0962e5f821794140
2023-05-03 11:53:45 -07:00
Jun Wu
b8f3b24d78 tweakdefaults: do not show commit changes for importstack operation
Summary: importstack is for automation so let's skip the messages for human.

Reviewed By: muirdm

Differential Revision: D45530213

fbshipit-source-id: b9fde9e24b5d53a77af29aa03c0c685db791d9d1
2023-05-03 10:05:04 -07:00
Jun Wu
43e2e40abf debugstack: fix accidental N^2 cleanupnodes
Summary: Wrong indentation. `cleanupnodes` should be called once for N commits.

Reviewed By: muirdm

Differential Revision: D45530212

fbshipit-source-id: 6cd21a6b0de3e91bc9c7a2c64333540f2b886cf3
2023-05-03 10:05:04 -07:00
Haitao Mei
1e857603a1 Delete BlameV1 Part I
Summary: This diff replace `BlameRoot` with  `RootBlameV2`

Reviewed By: RajivTS

Differential Revision: D45522868

fbshipit-source-id: 1dbe0b5c2f29550eb520b425b20219ccf4f4fadb
2023-05-03 07:50:44 -07:00
Rajiv Sharma
e3575d2f6b Implement chunking support in core sharding framework
Summary: With all the building blocks in place, this diff implements chunking support in the core sharding framework. Because the framework level contract is being modified, it affects all the services and jobs using sharding. In usual cases the changes are minimal but in x-repo and chunked jobs, there are some additional modifications. Note that these changes are not backward compatible so I will be stopping the existing chunked jobs (`AliasVerifyProd` and `AliasVerifyBackup`) before rolling out these changes. I plan to test these changes on the test sharding job.

Reviewed By: mitrandir77

Differential Revision: D45479019

fbshipit-source-id: 6e2290de356642a2dc33e35b56c9ab25c2571769
2023-05-03 04:22:01 -07:00
Mateusz Kwapich
dddf795040 fix broken test-server.t
Summary:
This test have been broken because it relied on deprecated openssl binary from
platform 009.

Differential Revision: D45505489

fbshipit-source-id: b3c52c5b22fb7f77fd0812ec4a2d4d6337b71b51
2023-05-03 02:53:30 -07:00
Mateusz Kwapich
c575124c93 fix flaky test-edenapi-commitcloud.t
Summary: Let's make sl output stable

Differential Revision: D45505490

fbshipit-source-id: d679f4bf2d65f68718714bb1e2fc214d475e4ba0
2023-05-03 02:53:30 -07:00
generatedunixname89002005307016
0df6d44d2c upgrade pyre version in fbcode/eden - batch 1
Differential Revision: D45492912

fbshipit-source-id: d237f65cb45ba6f71a1465bad7bb973c31ef0e6b
2023-05-02 23:29:54 -07:00
Jun Wu
dc57986397 debugstack: support hide operations
Summary: This supports dropping commits without successors use-cases.

Reviewed By: evangrayk

Differential Revision: D45337286

fbshipit-source-id: e2f4395e4b6e1f0c5adfe0f058defdce818e624d
2023-05-02 20:29:43 -07:00
Chad Austin
334837ad44 move acceptStopped into EventBaseState
Summary:
As a follow-up to a code review comment in a previous diff, move
acceptStopped into the EventBaseState to make it clear it's only
accessed on the EventBase thread.

Reviewed By: kmancini

Differential Revision: D45106980

fbshipit-source-id: 5bd201a0652fa2b539e18a7584fae48fd3abd54f
2023-05-02 16:12:46 -07:00
Chad Austin
3ccec5b5e4 add initialization to FsChannel
Summary:
FuseChannel already had an asynchronous initialize(). Lift that to
FsChannel and unify initialization of Prjfs and NFS.

Reviewed By: kmancini

Differential Revision: D45106889

fbshipit-source-id: 632ddfa275c732fc30efc1984bda43f61c37fd5e
2023-05-02 16:12:46 -07:00
Chad Austin
a9fe2e37a5 remove the special case for destroying Nfsd3 on its EventBase in EdenMount
Summary:
EdenMount shouldn't know about the vagaries of FsChannel teardown. In
fact, FuseChannel already has its own requirements, hidden behind a
unique_ptr deleter. Use the same mechanism for NFS, allowing us to
remove a .via() special-case.

Reviewed By: kmancini

Differential Revision: D44810223

fbshipit-source-id: db2f88bc3843b3842de60c5a993dfd9890dc3c15
2023-05-02 16:12:46 -07:00
Xavier Deguillard
a1fb3b1fb7 integration: rename some method in prjfs_stress.py
Summary:
mshroyer suggested renaming run_with_fault in D45135531 as the previous name
was confusing and he expected IO to fail, not to be blocked.

Reviewed By: fanzeyi

Differential Revision: D45459918

fbshipit-source-id: c39e5d414a6c0fda4eeff8314e6a266fa8eee185
2023-05-02 12:38:37 -07:00
Xavier Deguillard
f1e93884fc prjfs: keep mount alive during notification handling
Summary:
When unmount is called, the mount is kept alive until all the pending
ProjectedFS callbacks have completed (D45135531) to avoid use-after-free.
However, the notification callback is handled entirely in the background and
would thus not prevent the mount from being unmounted, and not being freed.

In order to fix this, we need to keep the PrjfsChannelInner alive for the
duration of the notifcation handling, which as a side effect will keep the
mount alive.

Reviewed By: mshroyer

Differential Revision: D45251808

fbshipit-source-id: e78afbc388cdf75f6d8d4e774bced8fdf841db5e
2023-05-02 12:38:37 -07:00
Jon Oh
8155d1c13f allow config to specify fbpython to run a script
Summary: Will look at seeing if the script exists in the repo to determine whether to use absolute path to run a script.

Reviewed By: muirdm

Differential Revision: D45106495

fbshipit-source-id: 88393b6563470e273218849cb71d41ab05a27df1
2023-05-02 10:50:11 -07:00
generatedunixname89002005287564
4dce3bbeb8 Daily common/rust/cargo_from_buck/bin/autocargo
Reviewed By: zertosh

Differential Revision: D45487289

fbshipit-source-id: d4a5f0f2ee4d10e8ee1c15ac34e7166945cd6aed
2023-05-02 09:19:48 -07:00
Pierre Chevalier
b2685295b4 Start implementing a non-oss subcommand for mononoke newadmin
Summary: As we need to add some functionality to `mononoke newadmin` that is not ready to be shared with `open-source`, extend the `subcommands` macro and adapt the `mononoke newadmin`'s `main` function to allow loading subcommands that are private to `facebook`.

Reviewed By: RajivTS

Differential Revision: D45398027

fbshipit-source-id: 493b24920c5310d67417274ab96e434a2bc0fbac
2023-05-02 08:44:13 -07:00
Mateusz Kwapich
ae58899743 add mononoke_new_commit logging for backsyncer
Summary:
I propose that instead of logging from pushredirection code we log from
backsyncer code. In that case it won't matter how the commits made it to
large repo, they'll be logged in small repo regardless.

Differential Revision: D45401754

fbshipit-source-id: 471cf6c3a4afd3da2f6a01729b7443f506e0d092
2023-05-02 08:30:52 -07:00
Mateusz Kwapich
87ee7a2ef7 remove sleeps from backsyncer test
Summary: "sleep 50" is a waste of time. We can do better

Differential Revision: D45479444

fbshipit-source-id: bbc25de7991e6a0b0e411a44db02d35c989b616a
2023-05-02 08:30:52 -07:00
Mateusz Kwapich
de574ddd63 move some commonly used code out of bookmarks_movement crate
Summary: This code will be useful for anybody doing the logging.

Differential Revision: D45401755

fbshipit-source-id: 0d1e4f933e241cce9d8078ded8963ee0f74080a3
2023-05-02 08:30:52 -07:00
Mateusz Kwapich
3d05662e97 fix scribe logging in backsyncer tests
Summary:
I lied in the previous diff. Without some extra scribe configuration the extra
logs wouldn't make it to fake scribe output in the test

Differential Revision: D45401756

fbshipit-source-id: f582dc6cb8692b0fd4ff2fec5da95f17b59366a4
2023-05-02 08:30:52 -07:00
Mateusz Kwapich
a53ad7e062 tests demonstrating problem with backsyncer logging
Summary:
Backsyncer doesn't log to mononoke_new_commit table which some customers
expect.

Differential Revision: D45401757

fbshipit-source-id: 300fe01d6c5693dcd547a88cfac5386488663bb6
2023-05-02 08:30:52 -07:00
Mateusz Kwapich
fb3d433a62 deblobrepoify megarepo_api crate
Summary:
I needed to use a bit different repo object than blobrepo and it's been frustating that I can't use it here.
This is not a complete deblobrepoification yet but it's definitely step in the right direction.

Reviewed By: YousefSalama

Differential Revision: D45356780

fbshipit-source-id: f8a9698e3afbcf4f08c6b3db485466ab19fc154d
2023-05-02 08:30:52 -07:00
Mateusz Kwapich
466685dfc6 debelobrepoify mapping crate
Summary:
I needed to use a bit different repo object than blobrepo and it's been
frustating that I can't use it here.

Reviewed By: YousefSalama

Differential Revision: D45356781

fbshipit-source-id: b7effca4d547975bf085e58d704247f48dae9593
2023-05-02 08:30:52 -07:00
Rajiv Sharma
c64b1c775b Log file content type for Metadata Diffs in SCS
Summary: Phabricator uses the `commit_file_diffs` method to get metadata diff which it then uses to render information on the diff view page. With `ContentMetadataV2`, there are opportunities to avoid loading the  files in the commit in memory cause we already have the necessary metadata in hand. However, this optimization will only come in play when the file is non-textual (i.e. binary or non-UTF8). This diff adds logging changes to identify such requests from clients.

Reviewed By: YousefSalama

Differential Revision: D45395092

fbshipit-source-id: 19d2e7370adafff6e626387e1480249349da9be1
2023-05-02 05:12:44 -07:00
Rajiv Sharma
56939ded8f Support for ContentMetadataV2 and ContentAliasMapping healing in walker
Summary: We know there are some `ContentMetdataV2` blobs that haven't been generated with the correct format and when `ContentMetadataV2` gets generated directly on user request path, it doesn't generate the necessary aliases. This diff adds the necessary support for that use-case.

Reviewed By: Croohand

Differential Revision: D44197817

fbshipit-source-id: d8dd654228618232ed1e24d6755c673322fc18db
2023-05-02 04:56:05 -07:00
Rajiv Sharma
e8dfa0c7f0 Remove old ContentMetadata from Walker
Summary: Now that `ContentMetadataV2` is exposed via `FileStore` and all the relevant metadata methods, we no longer need to validate or scrub `ContentMetadata` blobs. Once we remove support from walker, we can then go ahead and delete the unused `ContentMetadata` blobs.

Reviewed By: mitrandir77, yancouto

Differential Revision: D43905796

fbshipit-source-id: 20c98a65192244546b7212b82eb24612abc92c4a
2023-05-02 04:56:05 -07:00
Muir Manders
35da254f24 blame: fix line number output for EdenAPI blame
Summary: We were displaying a line's current line number instead of the original line number when that line was first introduced.

Reviewed By: quark-zju

Differential Revision: D45458176

fbshipit-source-id: 75c6a43f0d015bdea6585058ebec74526104dbf6
2023-05-01 21:04:03 -07:00
Muir Manders
683347e697 blame: use edenapi with "-r wdir()" for clean files
Summary:
Now if the user requests a blame including working copy changes, we still use EdenAPI as long as the file is clean.

For a real fix we can use the server data as a base and then augment it as required. That is non-trivial, so let's do that later.

Note that I noticed we are displaying the wrong line number in blame output. Will fix in following diff.

Reviewed By: quark-zju

Differential Revision: D45415546

fbshipit-source-id: 47f412c835d20107ad945dc030cb8b3eb541bf6e
2023-05-01 21:04:03 -07:00
Xavier Deguillard
7193a19e8d store: allow paths to be filtered out at import time
Reviewed By: mshroyer

Differential Revision: D45162165

fbshipit-source-id: 78ae03807ae72533f8c4ec9850c38536757561b5
2023-05-01 19:37:30 -07:00
Muir Manders
c5876f1c62 treestate: add fastpath to normalized_get()
Summary: Before we do a slower search for all matching paths, do an optimistic "get()" for the exact path. If it exists and is EXIST_NEXT, we can confidently return it early. I think this is the normal case in practice because case insensitive filesystems are case preserving, so things normally match up between dirstate and filesystem.

Reviewed By: quark-zju

Differential Revision: D45378856

fbshipit-source-id: 7fb5fdadd417d95a39bb559d703dc792e336bca0
2023-05-01 14:03:59 -07:00
Muir Manders
a3ed9e5a82 workingcopy: filter directories from watchman results
Summary: I don't think we need directory results from watchman, and in particular they were triggering use of the GitIgnorematcher because we were stupidly considering them as untracked files.

Reviewed By: quark-zju

Differential Revision: D45378855

fbshipit-source-id: c3dce4212801749ac25cc4f7ccd5c86cf8d8ee76
2023-05-01 14:03:59 -07:00
Muir Manders
b778766fe6 workingcopy: optimize fresh instance dirstate scan
Summary:
We were using an ExactMatcher to walk the treestate and discover tracked files that werent returned by watchman after fresh instance (and hence must have been deleted). This was slow, so replace with a simple HashSet check.

With this change, however, we lose some case-insensitive correctness (although I have discovered things didn't work that well before anyway). Improve things by ignoring file deletions if they case insentitively match other files we got from watchman. This handles two cases:
1. File "foo" is renamed to "FOO" and watchman sends us both "foo deleted" and "FOO updated" (now we ignore the "foo" deletion). This issue was pre-existing.
2. Watchman restarts and "foo" has been changed to "FOO". Watchman only reports "FOO", and we need to ignore the "foo" deletion we infer when walking the treestate. This issue was introduced by this commit's perf optimization.

Reviewed By: quark-zju

Differential Revision: D45378862

fbshipit-source-id: 3dd56ef2ff3baf6115333326d4c8386c91715ab5
2023-05-01 14:03:59 -07:00
Muir Manders
3a9f67ee37 workingcopy: add more trace points
Summary: Break down the "status" work into more spans so I can tell what is going on in traceprof output for slow commands.

Reviewed By: quark-zju

Differential Revision: D45378863

fbshipit-source-id: a9604d888b3c9ca37e284a023c33105404df8707
2023-05-01 14:03:59 -07:00
Muir Manders
da66c92e6e workingcopy: combine file change detector impls
Summary:
I noticed the parallel file detector was slower when there aren't many dirty files that need content checks. Now that we use the watchman file metadata, we don't have to "stat" clean files at all, so the parallel overhead outweighs the the light bookkeeping work.

Address by combining the non-parallel detector and parallel detectors. The metadata comparison is done without parallelism since we always have the metadata in-hand. Any content comparisons are still done in parallel since that work is IO heavy.

Reviewed By: quark-zju

Differential Revision: D45378865

fbshipit-source-id: 31d0890e88183b09b7703d66f69be86f86a9b0e8
2023-05-01 14:03:59 -07:00
Xavier Deguillard
b1c645763c prjfs: avoid use-after-free in Prj functions
Summary:
Per Microsoft (Christian Allred), calling any Prj functions after
`PrjStopVirtualizing` will lead to use-after-free due to the internal
virtualization context being freed on `PrjStopVirtualizing`.

In EdenFS, there is a subtle cases where this may happen, in particular, if a
callback is ongoing and detached to a background thread, while
`PrjStopVirtualizing` is called as a result of `PrjfsChannel::stop`. In that case,
the callback will attempt to use a freed virtualization context and crash
EdenFS!

To prevent this, we need to make sure that `PrjStopVirtualizing` is only called
when no in-flight callbacks exits. This can be achieved by simply moving the
`PrjStopVirtualizing` into the `PrjfsChannelInner` destructor: a `shared_ptr` of
`PrjfsChannelInner` is held alive for the duration of callbacks.

After `PrjfsChannel::stop` is called, no new callbacks will be accepted due to
the `PrjfsChannelInner` field being `nullptr` thus failing IO early ensuring
that the lifetime of the mount won't be extended indefinitively.

Reviewed By: mshroyer

Differential Revision: D45135531

fbshipit-source-id: 15b25efc121ab1577c4355e07357148d122cc39f
2023-05-01 13:57:41 -07:00
Zhaolong Zhu
20343fdb3f revset: parse x^:: as (x^)::
Summary:
The issue is that revset parser raised an error for `.^::`, the user's
expectation was something like `(.^)::`, but the current parser thinks `^` is
an infix in `.^::` [2], and then it tried to parse `::` as a prefix, and
eventually got the "not a prefix: end" error. I would agree with the user and
think `.^::` should be parsed as `(.^)::`.

I asked Yuya this question, the current parser can't recover from
the error while parsing. He suggested to backport a workaround from
https://www.mercurial-scm.org/repo/hg/rev/beb667c9880f.

This diff is to introduce that change to Sapling. Another potential fix might be
resolving this ambiguity in an ealier stage by checking token type after ^, so
we don't need the `_fixops` function to rewrite the tree, but that would need
more code.

Related issue: https://github.com/facebook/sapling/issues/612

Reviewed By: muirdm

Differential Revision: D45443282

fbshipit-source-id: 8eba6fbba76bdde5051342abc1d1c739eced2661
2023-05-01 13:14:59 -07:00
Zhaolong Zhu
af7b750c7e revset: reproduce parse error of x^::
Summary:
```
$ sl log -r '.^::'
sl: parse error at 4: not a prefix: end
(.^::
     ^ here)

```

Related issue: https://github.com/facebook/sapling/issues/612

Reviewed By: muirdm

Differential Revision: D45443281

fbshipit-source-id: c59e9bb5ebff08c9269e75c05f297675321c8557
2023-05-01 13:14:59 -07:00
Jason Fried
3cb0fdeba9 asyncio loop vars for 3.10
Summary:
Loop vars have been out of favor since 3.7.   in 3.10 they are not acceptable in most places.

#buildmore

Reviewed By: itamaro

Differential Revision: D45072252

fbshipit-source-id: 667af4b1d44e709cec84e9f5e4ef173063b0cb9e
2023-05-01 10:56:58 -07:00
Revathy Kasipandian
185c6a8345 Make Fuse Tracebus size configurable by EdenConfig
Summary: Make Fuse Tracebus size configurable by EdenConfig

Reviewed By: kmancini

Differential Revision: D45409139

fbshipit-source-id: 7ae0a5e48325ce9e29aaca218ad87a5f73cc3dff
2023-04-30 22:37:07 -07:00
Muir Manders
ed58522243 blame: avoid fetching trees for edenapi blame
Summary:
Previously we prefetched the trees for all relevant commits so that fetching the fctx via ctx[path] was fast. Fetching the trees was still slow, though, since it takes O(path depth) round trips. However, I've realized we don't actually need the file context since all the info used to display the blame output comes from the change context.

Tweak things so that annotate can provide either the change context and path, or the file context.

This gets rid of the slowest remaining part of edenapi assisted blame. This reduces "hg blame" latency of edenscm/merge.py from 8s to 1.5s.

Reviewed By: quark-zju

Differential Revision: D45405272

fbshipit-source-id: b65813f958645009baf41240cae15f0f60e2bed5
2023-04-28 16:48:50 -07:00
Michael Cuevas
2d0766cfeb E-Menu: avoid crashing due to WndProc failures
Summary: We're seeing even more users that are crashing due to win32 errors. It seems like these sorts of E-Menu issues shouldn't crash Eden entirely. A non-functional E-Menu is better than crashing Eden entirely. Therefore, let's log these as errors for now.

Reviewed By: xavierd

Differential Revision: D45365471

fbshipit-source-id: f4092a9d44c1c5e6749e52d7e656c5de339551d3
2023-04-28 15:19:07 -07:00
Liubov Dmitrieva
f57f303a6a join expensive remote bookmarks into a single fetch
Summary:
join expensive remote bookmarks fetching into a single fetch in cloud sync

This can be done because streaming has been implemented for public pulls!

And if we join it will be faster overall to pull.

Although, this is very rare, I've seen a workspace with oculus-10, oculus-12, and portal-pie branches together.

Reviewed By: mitrandir77

Differential Revision: D45394191

fbshipit-source-id: 901370f4be8b846b1124894554f17cf8b0067d1e
2023-04-28 13:26:57 -07:00
Youssef Ibrahim
b0d7e9efd6 commit_graph: replace RangeNodeStream usages with new commit graph range_stream (conditional on a tunable for critical ones)
Summary: Directs RangeNodeStream usages to use commit_graph().range_stream instead (conditional on a tunable (enable_new_commit_graph_range_stream) for critical ones).

Differential Revision: D45356044

fbshipit-source-id: 379f214e8a6da1dc69d8744950e0e313abe8d813
2023-04-28 10:24:20 -07:00
Youssef Ibrahim
f9ba776ed7 derived_data_manager: add CommitGraph to DerivedDataManager
Summary: Will eventually replace Changesets

Differential Revision: D45319164

fbshipit-source-id: 98f08f40bd4fa095a201668177e254b1df51dfe0
2023-04-28 10:24:20 -07:00
Youssef Ibrahim
163620fa1e admin: delete rebase.rs and pushrebase.rs
Summary: They were migrated to newadmin.

Differential Revision: D45319166

fbshipit-source-id: 241c817efd736c0f7796c40e0e57d1ba5ab4baf3
2023-04-28 10:24:20 -07:00
Youssef Ibrahim
163ab65a21 commit_graph: add CommitGraph facet to BlobRepo
Summary: Migrating from using the Changesets facet to the CommitGraph facet would otherwise require deblobrepoifying too much stuff.

Differential Revision: D45319163

fbshipit-source-id: f93c091befc5b3419a7d1364107cc717c9d19303
2023-04-28 10:24:20 -07:00
Youssef Ibrahim
7f95c77064 pushrebase: deblobrepoify unittests
Summary: I hate blobrepo

Differential Revision: D45319165

fbshipit-source-id: 42e49f2b4255081c802682e32c40e85d97cc95a6
2023-04-28 09:46:21 -07:00
Rajiv Sharma
fbc633694f Unit tests for shard parsing
Summary:
The previous diff introduced `RepoShard` as the struct containing the parsed information from the passed in string shard-id. This diff adds relevant test cases to ensure that the logic for parsing the string based ID is accurate.

This diff also modifies the original parsing logic in response to the errors discovered during unit testing.

Reviewed By: mitrandir77

Differential Revision: D45355079

fbshipit-source-id: 78f28fa80bf4a3186ab66b08b29f20d39230094d
2023-04-28 09:05:23 -07:00
Revathy Kasipandian
8860d083e7 make Thrift Tracebus size configurable with EdenConfig
Summary: make Thrift Tracebus size configurable with EdenConfig

Reviewed By: kmancini

Differential Revision: D45362951

fbshipit-source-id: 9590b94a95fbd389889d91cf5ed2cf4570684001
2023-04-28 08:40:40 -07:00
Liubov Dmitrieva
df251e1802 make mutation tracing message similar to other requests
Summary: make mutation tracing message similar to other requests

Reviewed By: mitrandir77

Differential Revision: D45392969

fbshipit-source-id: 9ba180962fbde4607b777273837d41aeefe30263
2023-04-28 07:00:36 -07:00
Liubov Dmitrieva
795bbaa89c clean up left over legacy code
Summary: clean up left over legacy code

Reviewed By: quark-zju

Differential Revision: D45368971

fbshipit-source-id: 2cbba53b571f1cfc004ec59e44871ea3e8343b2c
2023-04-28 03:30:37 -07:00
Revathy Kasipandian
acf24d55a9 make Inode Tracebus size configurable with EdenConfig
Summary: To make Inode Tracebus size configurable with EdenConfig

Reviewed By: kmancini

Differential Revision: D45334494

fbshipit-source-id: cba942272b17172ad4dd88361af4bb87ad9d4c3f
2023-04-27 21:36:16 -07:00
Xavier Deguillard
d269a86c28 prjfs: add fault in read-only dispatcher methods
Summary:
This will allow tests to easily block some methods to perform concurrent
operations to them. For instance, this will allow that unmount concurrently to
read will not crash EdenFS.

Reviewed By: mshroyer

Differential Revision: D45186931

fbshipit-source-id: 3bd1fa9191d6e18cec985159914c0ee03a22a107
2023-04-27 14:37:18 -07:00
Katie Mancini
c1d4f54d9b don't collect tace pastes in dry run
Summary:
Background runs of eden rage are making tracing pastes. We should not make these
pastes in dry-run automation runs.

I should have caught this in code review, my bad.

This uses the same fix as D28541898. Perhaps the paste method should not work in automation.

Reviewed By: xavierd

Differential Revision: D45362138

fbshipit-source-id: c28a18bc739921b3dc6e5b906c2491427f501644
2023-04-27 14:27:54 -07:00
Xavier Deguillard
e29f654146 BUILD_MODE.bzl: set NOMINMAX
Summary:
EdenFS doesn't care about the min/max definition from Windows.h, thus define
NOMINMAX. This allows removal of a lone `#define NOMINMAX` in FaultInjector.h.

Reviewed By: janondrusek

Differential Revision: D45359806

fbshipit-source-id: 7f24bda46e9720fdac471c24ff05a32c504d3eff
2023-04-27 14:18:55 -07:00
Zhaolong Zhu
b527c898aa copytrace: add GitRenameFinder
Summary: Add GitRenameFinder, this diff only consider the files that are exactly the same as source file as a rename. Will add content similarity check later, I am considering using [similar](https://github.com/mitsuhiko/similar) crate for this, since it has a nice API: https://docs.rs/similar/latest/similar/fn.get_diff_ratio.html

Reviewed By: quark-zju

Differential Revision: D45232985

fbshipit-source-id: d462063aff74103f8332c838b137df9dabc01501
2023-04-27 14:07:42 -07:00
Zhaolong Zhu
25477c380d chg: fix compiler warning about type mismatch in a comparison expr
Summary:
Fix the following compiler warning:

```
contrib/chg/hgclient.c:474:9: warning: comparison of integer expressions of different signedness: 'int32_t' {aka 'int'} and 'size_t' {aka 'long unsigned int'} [-Wsign-compare]
   if (n != fds_len)
         ^~
```

Reviewed By: quark-zju

Differential Revision: D45357414

fbshipit-source-id: 783d572b06bb775cabd0f34ea13849103681ada9
2023-04-27 11:25:53 -07:00
Zhaolong Zhu
b53dddede6 copytrace: add metrics for missingfiles and found copies
Summary: as title

Reviewed By: sggutier

Differential Revision: D45357016

fbshipit-source-id: 61d65e1842a6a9d88786b037e6dbe47907b29f24
2023-04-27 11:25:12 -07:00
Liubov Dmitrieva
2376ee80ee streamimg support for public pulls
Summary:
streamimg support for public pulls

If all heads in the request are public, use the streaming API, so that we are not
limited to any keep alive timeouts on HTTP side, since we can return things more gradually.

This is to be used for hg pulls in not segmented changelog repos, pulling of
expensive branches, etc

Commit Cloud would still use the API where we calculate the whole graph before returning it but this is fine because:

* we need to derive filenodes and calculate phases in parallel
* that function is a little bit more optimised since better batching of hg <=> bonsai conversions, for example.

Reviewed By: mitrandir77

Differential Revision: D45352368

fbshipit-source-id: 7549396d249a50adc163b5de1586d8789776b0df
2023-04-27 10:38:13 -07:00
Liubov Dmitrieva
8a90f63486 eliminate lifetimes from ancestors_difference_stream method
Summary:
eliminate lifetimes from ancestors_difference_stream method since they
create unnecessary complexity and some consumers require a static stream.

self (arc under the hood)  and ctx is cheap to clone there

Reviewed By: markbt

Differential Revision: D45352367

fbshipit-source-id: 6eca62838d1e31ff046ce987c52afced84227a6c
2023-04-27 08:24:00 -07:00
Rajiv Sharma
d8ae6f2027 Implement native chunking support in sharding library
Summary: This diff introduces the `RepoShard` type which will serve as the holder of shard-level state information. Currently, we keep the information encoded in the shard_id (e.g. `fbsource_TO_ovrsource_CHUNK_1-11_SIZE_1000`) and expose it directly to the clients who then have to parse it themselves to get the relevant pieces of information. To avoid this duplication and to centralize the parsing and error handling logic, we will use the `RepoShard` struct. I have added it in `sharding_ext` crate so the type itself can be used independently of the sharding framework (for lightweight dependencies).

Reviewed By: markbt

Differential Revision: D45277195

fbshipit-source-id: 6ae9717fdcf312f0546e7b75d530e8dec8f69d32
2023-04-27 08:18:19 -07:00
Rajiv Sharma
3d8acc265a Move sharding_lib_ext under cmdlib
Summary:
The `sharding_lib_ext` crate was created to contain the add-on logic that is used by `ShardedProcessManager` but also by other components (e.g. encoding, decoding repo-name for shard-aware routing). I plan to use this crate further for adding chunking support. Before I do that, I decided to clean things up a bit. Particularly,
- Move `sharding_lib_ext` crate under `cmdlib` instead of keeping it under `mononoke` since its a library
- Renamed the crate to `sharding_ext` removing the `lib` since all crates under `cmdlib` are libraries anyway

Reviewed By: markbt

Differential Revision: D45272976

fbshipit-source-id: 90be4f1f4659a03a591a8acbb04fdcbf06234a74
2023-04-27 08:18:19 -07:00
Mateusz Kwapich
705e1c9e8b fix new clippy problems
Summary: clippy_spell_check

Reviewed By: markbt

Differential Revision: D45326580

fbshipit-source-id: e7f57df3c50a7eff8c3080421dccc2f9cf9ff48b
2023-04-27 03:27:30 -07:00
Rajiv Sharma
8c72e77a47 Upload raw git tags during repo import
Summary: Similar to direct `gitimport`, this diff adds support in `remote-gitimport` to upload raw git annotated tags when pushed to the remote git server. Note that this only uploads annotated tags since basic tags get directly converted into branches while annotated tags need a corresponding changeset to be represented in the Mononoke data model. This diff doesn't delete existing tags when deletions are pushed to the server and modifications of the raw git tag are prevented by the no-update model in Mononoke blobstores.

Reviewed By: markbt

Differential Revision: D45271703

fbshipit-source-id: f7cdbed7fb665c9d32b08e26d7e9f404175b6eb9
2023-04-27 02:19:25 -07:00
Jun Wu
066b737187 deps: drop criterion from types crate
Summary:
The `criterion` crate is a heavyweight crate that shouldn't be part of `types`
dependency tree.

Reviewed By: muirdm

Differential Revision: D45314783

fbshipit-source-id: 6476539c8d95927a6e6fa821e312632c6fffcced
2023-04-26 18:02:41 -07:00
Jun Wu
5e578c1a84 xdiff: skip cleanup logic for edit_cost
Summary:
xdiff has logic to "cleanup" (force "unmatch" lines that are unique on one
side) with the intention to speed things up. However, in the `edit_cost`
case this might actually slow things down. So let's skip the cleanup logic
accordingly.

Using the test case of `test_edit_cost_large_diff()`, the `edit_cost(100)`
now completes in ~0.6s, down from ~1.5s.

  In [7]: %time bindings.xdiff.edit_cost(a,b,100)
  CPU times: user 253 ms, sys: 347 ms, total: 599 ms
  Wall time: 597 ms
  Out[7]: 100

  In [6]: %time bindings.xdiff.edit_cost(a,b,1000)
  CPU times: user 282 ms, sys: 351 ms, total: 633 ms
  Wall time: 632 ms
  Out[6]: 1000

Reviewed By: muirdm

Differential Revision: D45305089

fbshipit-source-id: 20f49bce742f7ef02f17fc5a0d0a2008cb1eecbd
2023-04-26 18:02:41 -07:00
Jun Wu
05a9b65302 pyxdiff: expose edit_cost
Summary: This makes it possible to use `edit_cost` in Python.

Reviewed By: muirdm

Differential Revision: D45303297

fbshipit-source-id: f948f317f907f9e808aec66f5e388abe632c768a
2023-04-26 18:02:41 -07:00
Jun Wu
4cd5f61895 xdiff: implement edit_cost with a limit on time complexity
Summary:
`edit_cost` returns the edit cost with a maximum cap, without producing actual
diffs.

This can be useful for similarity check without calculating the full diff.
See `test_edit_cost_large_diff` for performance comparsion.

Reviewed By: muirdm

Differential Revision: D45303299

fbshipit-source-id: c33bb6c186c2a5281910530988397ec00e37769d
2023-04-26 18:02:41 -07:00
Jun Wu
dd8a33b04f xdiff-sys: regenerate bindgen
Summary:
Update the bindgen logic so it skips C stdlib items and impls Default.
This makes the next change smaller.

Reviewed By: muirdm

Differential Revision: D45305448

fbshipit-source-id: dc3462c3ff037bafc3ebc867350c28aeda81c3a3
2023-04-26 18:02:41 -07:00
Jun Wu
dce300a724 xdiff: resolve a pointer UB with empty input
Summary:
In this code:

  ps1 = msmall.ptr + msmall.size - 1

In case an empty slice is passed from Rust,
- `msmall.ptr` is 0x1, since Rust uses pointer 0x1 for empty slices.
- `msmall.size - 1` is `-1` (overflow).
- ps1 will be 1 - 1 = NULL, which makes UBSAN unhappy.

Resolve it by skipping the code block for `size == 0` cases.

This issue wasn't found before, because previously `xdiff` tests do not use empty slices.

Reviewed By: muirdm

Differential Revision: D45305368

fbshipit-source-id: 2b9ca3dd8dd48e9a3c23e41c556f63af0a59fc6c
2023-04-26 18:02:41 -07:00
Jun Wu
a5dc541d11 xdiff: track "optimized out" lines internally
Summary:
xdiff has internal logic to optimized out lines unique on one side, since they
never match the other side. We want to track how many lines are optimized out
for bounded similarity check.

The value will be used by the next change.

Reviewed By: muirdm

Differential Revision: D45303298

fbshipit-source-id: a9c58197664800013473f59dead76852a10c0e4a
2023-04-26 18:02:41 -07:00
Jun Wu
9628fd73e8 mdiff: switch to Rust xdiff binding
Summary: Replace the C xdiff extension with the Rust one.

Reviewed By: muirdm

Differential Revision: D45303295

fbshipit-source-id: a278a0c7a26d6d7f73cc1aaf70c1ccfcf5e10f3b
2023-04-26 18:02:41 -07:00
Jun Wu
bc088cffcd pyxdiff: bindings to xdiff
Summary: This will replace the C Python `xdiff` extension.

Reviewed By: muirdm

Differential Revision: D45303296

fbshipit-source-id: 29a16b8c75f2109fa3b5bb5f4406a34ff880c160
2023-04-26 18:02:41 -07:00
Jun Wu
ddfb14c928 xdiff: provide blocks API used by mdiff.py
Summary:
Implement the `blocks` API in xdiff Rust wrapper so it can serve mdiff.py
use-cases.

Reviewed By: muirdm

Differential Revision: D45303294

fbshipit-source-id: 8eae63a52fa2e7ec825d55b140f598a06e068c0a
2023-04-26 18:02:41 -07:00
Jun Wu
a0fffb6013 checkcode: remove some Python 2 compat checks
Summary: These no longer apply. This change should have been part of D44715340.

Reviewed By: sggutier

Differential Revision: D45339827

fbshipit-source-id: f112625dfae011c70dfb17c3f9c13501b96428e7
2023-04-26 18:00:16 -07:00
Michael Cuevas
4aa3c38e5e E-Menu: avoid crashing due to WndProc failures
Summary:
We've seen at least 1 user that crashed due to:

```
E0417 09:41:18.412118 20840 WindowsNotifier.cpp:68] TrackPopupMenuEx failed: Error (0x5a6) Popup menu already active.
F0417 09:41:18.434692 20840 WindowsNotifier.cpp:454] Exception occurred in E-Menu WndProc: TrackPopupMenuEx failed: Error (0x5a6) Popup menu already active.
```

Failures like this really shouldn't cause the entirety of Eden to crash, so let's ignore it for now.

Reviewed By: chadaustin

Differential Revision: D45130458

fbshipit-source-id: f906a17ac359f2a3c48a852d0668f70014ccd63d
2023-04-26 17:01:58 -07:00
Muir Manders
c516db84d0 megarepo: support transparent hash translation
Summary:
Add a new commit resolution step that checks if unknown hashes are from another repo, and if so translates to corresponding hash of current repo.

This behavior is enabled by configuring the other repo name under the megarepo.transparent-lookup config.

Reviewed By: sggutier

Differential Revision: D45092192

fbshipit-source-id: 9434a21d258cdfda153eb81e2d1eb0149f8a063e
2023-04-26 16:51:14 -07:00
Muir Manders
364c426a9f debugshell: disable progress bar display
Summary: Disable progress bars in ipython. They are really annoying.

Reviewed By: zzl0

Differential Revision: D45092191

fbshipit-source-id: 138e6f5783a5bf89cabb5ec8279cbc5eca2b4609
2023-04-26 16:51:14 -07:00
Muir Manders
cfb9e2af65 edenapi: allow specifying different repo name
Summary: Allow specifying repo name for the http edenapi client. This makes it easier to do edenapi queries for other repos.

Reviewed By: quark-zju

Differential Revision: D45092190

fbshipit-source-id: 77d09eba0cb4f1cbf169d24bdf424cf1e1519844
2023-04-26 16:51:14 -07:00
Muir Manders
f8190d9be0 translate_id: add support for xrepo lookups
Summary:
Respect the optional "from" and/or "to" repo names to convert the commit ids from and/or to different repos. Only applies for repos that are megarepo'd together.

I added a get_repo method to the EdenApiContext object to facilitate the xrepo behavior.

I thought about disallowing requests where both "from" and "to" are different from the "subject" repo in the path, but it seems harmless.

Reviewed By: quark-zju

Differential Revision: D45019173

fbshipit-source-id: 8a25f5506521765296142553963b19f47570e865
2023-04-26 16:51:14 -07:00
Muir Manders
6624a28997 allow handlers to propagate specific HttpErrors
Summary: Previously any outer error returned by an EdenApiHandler got turned into a 500. With this change, we no longer allow the generic `Into<anyhow::Error>` propagation. This allows for specialized HttpError propagation that retains response code.

Reviewed By: quark-zju

Differential Revision: D45296090

fbshipit-source-id: bb21518e5f8c77f578eec6d42a2582c474b5d1e9
2023-04-26 16:51:14 -07:00
Muir Manders
1c498ee665 translate_id: simplify handler a bit
Summary:
Use the CommitId directly as HashMap key to get rid of some per-type bookkeeping.

This minor change allows my next diff for xrepo translation to be significantly simpler.

Reviewed By: markbt

Differential Revision: D45019175

fbshipit-source-id: eb369b9e2d51345482590bbbbd9a1758b140b309
2023-04-26 16:51:14 -07:00
Muir Manders
d1f0dab4de introduce EdenApiContext object
Summary:
I want to enable EdenApiHandlers to fetch other repo objects, but that requires various other objects not currently available. I don't want to complicate the handler signature with multiple additional args, so introduce a context object that can contain the dependent objects (i.e. RequestContext and ServerContext).

I tucked the path and query extractors into the context since they are barely used by any handlers (in fact, the path extractor is not used at all).

Reviewed By: markbt

Differential Revision: D45019176

fbshipit-source-id: ec4427d2f134277e89a8c48018f29c5f56cdc60d
2023-04-26 16:51:14 -07:00
Muir Manders
4556b1d1f9 edenapi: add xrepo params to commit_translate_id
Summary: Update schema to support optionally specifying "from" and/or "to" repo to translate commit identifiers across repos, when possible.

Reviewed By: zzl0

Differential Revision: D45019174

fbshipit-source-id: 6c6c834525845f1ced4dbbc42895bb82f4c2a90e
2023-04-26 16:51:14 -07:00
Revathy Kasipandian
7ea1f2454b make hg tracebus size configurable with EdenConfig
Summary: make hg tracebus size configurable with EdenConfig

Reviewed By: kmancini

Differential Revision: D45256093

fbshipit-source-id: 20761aed368eb4cdecf4e116a3d3406cb83608c1
2023-04-26 14:52:32 -07:00
Youssef Ibrahim
3c4b3f792a commit_graph: implement range_stream
Summary: Implements a stream that yields all changesets that are simulatenously a descendant of one changeset and a descendant of another, in topological order.

Reviewed By: markbt

Differential Revision: D45156176

fbshipit-source-id: 6c70d40252b5e2402ec1718e6cbe4c35ec8e9c1e
2023-04-26 14:15:50 -07:00
Mark Juggurnauth-Thomas
c592cabeec scsc: improve help text for info --path
Summary: Make this help text more helpful.  Also record that `--bookmark-info` and `--path` are mutually exclusive.

Reviewed By: MichaelCuevas

Differential Revision: D45315761

fbshipit-source-id: 150c80e1e1369c3f0c76d6708e9453fb64e3e7e0
2023-04-26 14:03:40 -07:00
Ján Ondrušek
dc3850023f Windows NOMINMAX
Summary: `boost/regex.hpp` probably includes `windows.h` at some point, this causes a `min()` / `max()` macro conflict

Reviewed By: ispeters

Differential Revision: D45318842

fbshipit-source-id: 19fc29b03ca7dbf75fb6bfaef1787d8e73c329c2
2023-04-26 12:26:56 -07:00
Rajiv Sharma
8efc2af1d6 Fix edenfs build issues
Summary:
Context: https://fb.workplace.com/groups/learningrust/permalink/3405570553032635/

The previous diff makes use of `//third-party/rust:blake3` (or `//third-party/blake3:blake3-rust`) in `revisionstore` for computing the `seeded_blake3` hash of raw file content in `LazyFile`. `revisionstore` is a dependency for `edenfs` which also depends on the C++ library `eden/fs/digest:blake3_hash`.

When building `edenfs`, the linker comes across multiple definitions of the same symbol coming from the C++ and the Rust Blake3 library. Minimum repro in D45176271. Since there is no known solution for this, this diff uses the `blake3_c_ffi` crate which is a FFI wrapper (instead of native rust implementation) over the same C blake3 code as used by `eden/fs/digest:blake3_hash`. This solves the build problem while giving the same behavior in code. Note that the OSS version of the code continues to use the open-source Blake3 crate since the `duplicate symbols` error is not observed in OSS builds.

Reviewed By: mitrandir77

Differential Revision: D45310838

fbshipit-source-id: 9273bcc64871d5a86d07e23cc0200e305be7f4fd
2023-04-26 12:04:21 -07:00
Rajiv Sharma
b63beffc2d EdenAPI: Changes for ContentMetadataV2 and Blake3
Summary:
The `ContentMetadataV2` provides the seeded blake3 hash for each created file. This information needs to be passed to `buck` which interacts with `EdenAPI` through `EdenFS`. The relevant endpoints in `EdenAPI` are `trees` and `files` which were modified in the previous diff to support the new hash and are used here.

NOTE: This diff was already landed (D44010967) but then had to be reverted (D45156142) since it was causing build issues for EdenFS on ARM64 MacOS. More context [here](https://fb.workplace.com/groups/learningrust/permalink/3405570553032635/)

Reviewed By: quark-zju

Differential Revision: D45226440

fbshipit-source-id: 051dee9898d2441d6a03c10809988c6b99f36ab4
2023-04-26 12:04:21 -07:00
Jun Wu
cd95212d50 hghave: backout D44715340 changes
Summary:
We want `py2` to be a feature that returns False instead of crashing the tests
complaining about unknown feature.

Reviewed By: sggutier

Differential Revision: D45321821

fbshipit-source-id: 80a2a0077a50b29284a8db06f16def5e16081f14
2023-04-26 11:17:37 -07:00
Jun Wu
7290f65905 watchmanclient: fix undefined compat.PYTHON3
Summary:
Fix issue:

  AttributeError: module 'edenscm.ext.extlib.pywatchman.compat' has no attribute 'PYTHON3'

in various tests caused by D44715340.

Reviewed By: sggutier

Differential Revision: D45321822

fbshipit-source-id: 49025b54b04b819804be58ee0265d2530b67de66
2023-04-26 11:17:37 -07:00
Liubov Dmitrieva
1b7455d14b prefetch expensive bookmarks separately
Summary:
prefetch expensive bookmarks separately

this is to avoid timeouts until we have streaming support and ublock rollout
for AOSP repo

also, this provides better ux since we notify users that slow fetch is being executed

I also noticed that the commitcloud.remotebookmarkssync config option wasn't mentioned in the help. So, add it to avoid confusion.

Reviewed By: quark-zju, zzl0

Differential Revision: D44998087

fbshipit-source-id: f24bd959f02380ff0d7ff4f30dbe7e1647403329
2023-04-26 10:18:31 -07:00
Muir Manders
8c9caf8425 blame: optimize prefetching for EdenAPI blame
Summary:
The goal is to avoid any serial fetching per commit/path in the blame history.

To get there, we now prefetch:
- Relevant commits and their parents. Parent hashes are used to verify commit hashes in repo.changelog.revision().
- Trees for all relevant paths for all relevant commits. This makes use of the newly improved manifest BFS iter. Note this is still the slowest part since it has a round trip for each directory as it walks the tree. I want to make the trees endpoint to support deep fetches to avoid these round trips.

Reviewed By: quark-zju

Differential Revision: D45273889

fbshipit-source-id: 7935874da178d9f39d9aab3cc9e026503db919ab
2023-04-26 09:36:37 -07:00
Muir Manders
1217c97d1d fastannotate: remove extension
Summary:
This extension is not used and depends on server side features Mononoke doesn't implement.

Server assisted blame is instead achieved via an EdenAPI blame endpoint that fetches precomputed blame data.

Reviewed By: sggutier

Differential Revision: D45273888

fbshipit-source-id: 4efd269ad16f52b3df98e558b1fded7135c87419
2023-04-26 09:36:37 -07:00
Muir Manders
00b13dc427 manifest: support prefetching multiple nodes
Summary: Tweak the manifest BFS iter to take a list of initial nodes. I'm going to use this to allow prefetching trees for multiple commits at once.

Reviewed By: quark-zju

Differential Revision: D45273890

fbshipit-source-id: d3487a1a2ee71f602e535b8b7f673aa5d6a91aea
2023-04-26 09:36:37 -07:00
Muir Manders
20ac09f41b manifest: re-implement prefetch to use bfs iter
Summary:
First, kill the "depth" and "path" args since neither were set by any callers.

Then, use the bfs_iter to walk the tree instead of the naive level-by-level walk. This should be much faster, but more importantly is a step towards making prefetch support fetching multiple root trees/paths at once.

Reviewed By: quark-zju

Differential Revision: D45273891

fbshipit-source-id: 8b93ac1f5a327555d80c22410c7c95ab56af9984
2023-04-26 09:36:37 -07:00
David Tolnay
c2328ee5e5 Update to Rust 1.69.0
Summary: Release notes: https://blog.rust-lang.org/2023/04/20/Rust-1.69.0.html

Reviewed By: zertosh

Differential Revision: D45267362

fbshipit-source-id: 57439306c2b6efc584947f9931b32ca87493b80e
2023-04-26 08:49:16 -07:00
Jan Mazur
8c1b00b5b4 build RPM with buck2
Summary: See attached task

Reviewed By: mitrandir77, RajivTS

Differential Revision: D45309155

fbshipit-source-id: 4d7f1fde4b41609a1e71a8e261ca9f6d38ad8e7b
2023-04-26 03:42:55 -07:00
David Tolnay
4114b89e5e Update tracing-subscriber from 0.3.16 to 0.3.17
Reviewed By: zertosh

Differential Revision: D45286804

fbshipit-source-id: bb49b1b850f150a865577411de6bb5a0d91b7a20
2023-04-25 15:59:50 -07:00
Shyam Sunkari
b8c767f9ab delete Python 2 specific checks
Summary: removed python 2 specific references  along with sys.version.info and dependencies.

Reviewed By: sggutier

Differential Revision: D44715340

fbshipit-source-id: 0dae8cf1bd9cb21a8ca336d22efecf796930bccc
2023-04-25 14:54:44 -07:00
Zhaolong Zhu
81db3ecafb copytrace: move SearchDirection to lib.rs for reuse
Summary: I will reuse this `SearchDirection` in GitRenameFinder in the following diff.

Reviewed By: sggutier

Differential Revision: D45233573

fbshipit-source-id: 4885fc5df8beda729d23843471d63aa8e870c8f4
2023-04-25 14:53:16 -07:00
Michael Vivirito
04fdb682b5 prjfs: disallow crashplan
Summary:
Code42 was known to crawl the repository without taking
into account that files are virtual. It seems that this has been corrected in the new CrashPlan 11.0.1 agent, but we will land this diff as a safety precaution to not allow them to read the repository

Reviewed By: xavierd

Differential Revision: D45282206

fbshipit-source-id: 32f77aa96745bccb36e43d4df8ff47755a7670bc
2023-04-25 14:37:19 -07:00
Mark Juggurnauth-Thomas
f3c3011443 scs_server: add commit and range counts to blame data
Summary:
This data may be useful for analysing the blame history of the file.

* `approx_commit_count` is the total number of commits in the blame history of the file.  It is approximate as some merged in commits may be omitted.

* `distinct_range_count` is the number of distinct ranges in the blame, which may indicate the file's complexity.

Reviewed By: RajivTS

Differential Revision: D45218574

fbshipit-source-id: c0c399f525f8c047a0415cf9d6f6e3483c033700
2023-04-25 14:26:32 -07:00
Ilia Medianikov
78a5d29413 mononoke: reject pushes and bookmark moves if they come outside of VPN
Reviewed By: johansglock, mitrandir77

Differential Revision: D44470707

fbshipit-source-id: 76a86d5c9996a0d5eccca731e85a32cef3078980
2023-04-25 13:47:11 -07:00
Emerson Ford
5a461e2154 fix unit tests broken by changes to Thrift client error formatting
Summary: bunch of unit tests that relied on the specific error formatting weren't caught by CI and are failing. this fixes them by changing their error formatting to use `{:#}`.

Reviewed By: markbt

Differential Revision: D45245281

fbshipit-source-id: 6b0c9c5f3a3ecb594292d2a658ecce457f007e7e
2023-04-25 13:26:21 -07:00
Zhaolong Zhu
b57eb5232d chg: fix fds size mismatch
Summary:
this diff is to fix below chg abort error:

```
chg: abort: sendmsg failed (errno = 9, Bad file descriptor)
```

Reviewed By: quark-zju

Differential Revision: D45279121

fbshipit-source-id: 7bcd107c7e0857ed43dfdedc917fc4939a76699d
2023-04-25 12:57:22 -07:00
Youssef Ibrahim
27ef609539 commit_graph: replace DifferenceOfUnionsOfAncestorsNodeStream callsites with ancestors_difference_stream conditional on a tunable
Summary: Directs DifferenceOfUnionsOfAncestorsNodeStream callsites to use commit_graph().ancestors_difference_stream instead conditional on a tunable (enable_new_commit_graph_ancestors_difference_stream) being set to true.

Reviewed By: markbt

Differential Revision: D45042733

fbshipit-source-id: ca508d9b1a2e9efd7b45d1ee834f7587a7d886c3
2023-04-25 12:45:33 -07:00
Youssef Ibrahim
4b84687d67 commit_graph: implement ancestors_difference_stream
Summary: Implements a streamable variant of ancestors_difference to be used as a replacement for DifferenceOfUnionsOfAncestorsStream

Reviewed By: Croohand

Differential Revision: D45042732

fbshipit-source-id: aa7377512866038172899545ee9c43a2d6db39f7
2023-04-25 12:45:33 -07:00
Youssef Ibrahim
47d9d4764d test_repo_factory: enable double writing to the new commit graph in test repos
Summary: Use ChangesetsCommitGraphCompat when constructing Changesets in TestRepoFactory to enable double writing to the new commit graph

Reviewed By: mitrandir77, singhsrb

Differential Revision: D45227317

fbshipit-source-id: 6ce1809a2e30d930f8edef1efda0f9bef53b2a7c
2023-04-25 12:45:33 -07:00
Youssef Ibrahim
c9f4ba76a0 mononoke_api: remove Repo::new_test and Mononoke::new_test
Summary: Replaced by using TestRepoFactory directly and adding the extra config to the default config.

Reviewed By: RajivTS

Differential Revision: D45227320

fbshipit-source-id: bd93d1a2fd3a10398ca1cfd4b647a32627b83179
2023-04-25 12:45:33 -07:00
Youssef Ibrahim
fadb030b3f mononoke_api: remove Repo::new_test_lfs
Summary: Replaced by using TestRepoFactory directly with overrided config.

Reviewed By: RajivTS

Differential Revision: D45227316

fbshipit-source-id: 9be089f7645ec0a9070b538e37d64f33d4a5c222
2023-04-25 12:45:33 -07:00
Youssef Ibrahim
b219f34a26 test_repo_factory: add method for building warm bookmarks cache
Summary: Has the same behaviour as the contruction of warm bookmarks cache in Repo::new_test_common. To keep the same behaviour this required making TestRepoFactory into an async builder and modifying all of its callsites.

Reviewed By: RajivTS

Differential Revision: D45227318

fbshipit-source-id: 51303d48bebc0c4b915a359a7d0942bf485e8db5
2023-04-25 12:45:33 -07:00
Youssef Ibrahim
ab75fb2901 warm_bookmarks_cache: add a sync method
Summary: Adds a sync method that awaits the completion of all ongoing updates. Mostly useful for tests to avoid adding artificial sleeps.

Reviewed By: RajivTS

Differential Revision: D45227319

fbshipit-source-id: 9f3a9c7d063ad065b913db521a27624041b2400a
2023-04-25 12:45:33 -07:00
Liubov Dmitrieva
2d9d228b8d fix 'repo changed while backing up'
Summary:
fix 'repo changed while backing up'

the current logic is still incorrect for non besteffort (regular) mode

we introduced a high level transaction in D44664729, so now it is safe to drop
the check for non besteffort (regular) mode entirely

Why is it incorrect?

This is because the check is inside the retry loop (have lost the race),
inside the loop we apply commit cloud changes from the currect sync,
so basically if we haven't synced yet at this stage we will always fail the check.

We are loosing our retry logic that we should keep for the regular mode.

After a high level transaction has been added, we can drop the check and
resuscitate our retry logic.

The only possibility for another transaction to change the repo is that the transaction belongs to the previous iteration of the loop in the current cloud sync.

Reviewed By: quark-zju

Differential Revision: D45271716

fbshipit-source-id: 78de00c512f6ac737b107053563bd74b43080d32
2023-04-25 12:44:53 -07:00
David Tolnay
99c31b35ff Update clap from 4.1.11 to 4.2.4
Reviewed By: zertosh

Differential Revision: D45278284

fbshipit-source-id: d3aa28a3158b6b3c228c1f364b7c643d93766133
2023-04-25 12:13:11 -07:00
Max 👨🏽‍💻 Coplan
0ce7010b7f (clone): set publicheads to remote HEAD when cloning (#607)
Summary:
(clone): set publicheads to remote HEAD when cloning
c8b66c6899 added support for cloning the remote git repo's HEAD (in this
case `develop`), instead of main/master by default.

However, this doesn't mark `remote/develop` and its ancestors as public
commits.

This commit will also set remote git repo's HEAD as a public commit

Closes https://github.com/facebook/sapling/issues/600

Pull Request resolved: https://github.com/facebook/sapling/issues/607

Pull Request resolved: https://github.com/facebook/sapling/pull/607

Test Plan: - Added test `test-git-clone-sets-publicheads.t`

Reviewed By: sggutier

Differential Revision: D45249747

Pulled By: zzl0

fbshipit-source-id: 8c3a36bd21a25a856d13cc3b2c78f9cbdd9a94c5
2023-04-25 12:10:49 -07:00
David Tolnay
b5d3aab8ce Update ref-cast from 1.0.12 to 1.0.16
Reviewed By: zertosh

Differential Revision: D45278283

fbshipit-source-id: 85f83923f4a18e87b60a8ab68ab731fe74fd2a8c
2023-04-25 12:08:03 -07:00
Andres Suarez
b1c2f7d12b Apply RUSTFIX
Reviewed By: dtolnay

Differential Revision: D45273915

fbshipit-source-id: 633fcecbc38b373f6f16352f2ecfeaf41d6f12dd
2023-04-25 11:06:59 -07:00
Mark Juggurnauth-Thomas
62d92b31f0 scs_server: support preparation of derived data in create stack
Summary:
When creating a stack, make it possible to request that a derived data type is prepared as part of creating the stack.  Since the data for the stack is in local cache, this should be faster than it would otherwise be.

This is a simple initial implementation.  It requires that the data is already derived for the parents of the stack, and does not support parallel derivation of the different types, nor types that include interdependencies.  In fact, we only support fsnodes and skeleton manifests right now.

Differential Revision: D45216982

fbshipit-source-id: c6ca7b265b1e6219a1193c51d0a984794aa34965
2023-04-25 10:55:54 -07:00
Mark Juggurnauth-Thomas
dd66bf21dd scs_server: add support for preparing skeleton manifests
Summary:
Add support for skeleton manifests as a type of derived data that can be prepared.

The current enum for derived data types does not follow best practices and uses zero.  Fix this now by adding a new variant for `FSNODE`.  Once server support is available, we will remove `FSNODE_NEW` and switch to that value for `FSNODE`.

Differential Revision: D45216983

fbshipit-source-id: b0714ef6f9121139cc8d4602a5a8d1beaac00a3f
2023-04-25 10:55:54 -07:00
Mark Juggurnauth-Thomas
9113ec3663 mononoke_api: extract preparation of derived data to an api method
Summary: Move the preparation of derived data into a `mononoke_api` method in preparation for re-use.

Differential Revision: D45216984

fbshipit-source-id: ee99379685a202018b4c32b4b56e2930755d723a
2023-04-25 10:55:54 -07:00
Chad Austin
6639b2cfaf remove the now-unnecessary memory safety hack from Nfsd3
Summary:
After my previous refactoring, the memory safety bug in Nfsd3 no
longer manifests, and we can remove the unnecessary defer call.

Reviewed By: kmancini

Differential Revision: D44988749

fbshipit-source-id: 2ebd5fbf96d05ce6850fc248a642409f827ffeec
2023-04-25 10:50:52 -07:00
Chad Austin
6d3482922c remove an unnecessary ifdef now that Windows supports NFS
Reviewed By: mshroyer

Differential Revision: D44988728

fbshipit-source-id: c7d450d735756b735f056b4903e19deb84e4b356
2023-04-25 10:50:52 -07:00
Chad Austin
6be30ced2f comment clarity and remove RUNNING from RpcStopReason
Summary:
All of the comments in RpcServer are helpful. I found a couple
opportunities to improve their clarity.

It also helps to decouple RpcStopReason from the connection status.

Reviewed By: kmancini

Differential Revision: D44988608

fbshipit-source-id: 967f35ba09533a9c8c953ef33cd595b51e7c3111
2023-04-25 10:50:52 -07:00
Chad Austin
28bda31ef1 minor takeover refactoring
Summary:
I'm carefully reading the takeover code and noticed a few things to
improve.

Reviewed By: kmancini

Differential Revision: D44946740

fbshipit-source-id: 558441a47425b15c19ca2a6816ae2e8bf3d68019
2023-04-25 10:50:52 -07:00
Mark Juggurnauth-Thomas
8e5c2efd05 tests: increase wait time for bookmark updates
Summary: When tests are run in parallel, it can take more than a couple of seconds for the server update to become visible.  Increase the wait to up to to 10 seconds.

Reviewed By: RajivTS

Differential Revision: D45229687

fbshipit-source-id: 24bc9607c285a4098c35a4105b8deac7916a7591
2023-04-25 08:47:39 -07:00
Clara Rull
b6f6bd9254 Make client follow master
Reviewed By: YousefSalama

Differential Revision: D45052574

fbshipit-source-id: 9f76ea1e005c92208a3a11987d0c49f1e5cb553c
2023-04-25 07:46:32 -07:00
Liubov Dmitrieva
96e6e0ed72 add new command to provide state of commit cloud workspace in
Summary:
add `debugcloudstatus` command

this command is to be used by automation, for example, on demand to get a name
of commit cloud workspace

currently they have to parse the name from the text output of the `hg cloud status` but providing json output is less error prune.

Reviewed By: quark-zju

Differential Revision: D45227570

fbshipit-source-id: 9e1a67edcefa7a2f7f11c7a80e99d061e5ca4bad
2023-04-25 02:19:02 -07:00
Chad Austin
18e8b4fe77 capabilites -> capabilities
Summary:
Fix a typo. The word capabilities hurts my eyes when I look at it too
long, but it's the correct spelling, so sed it into place.

Reviewed By: kmancini

Differential Revision: D44945525

fbshipit-source-id: 05e82c058c3015b0590b07d6458840b4c56730b6
2023-04-24 19:11:42 -07:00
Chad Austin
1c3e009c34 use EventBaseState in TakeoverServer
Summary:
Out of curiosity, I'd removed a .via(getEventBase()) from
TakeoverServer, and it manifested as hard-to-understand segmentation
faults in the integration tests. The issue is that FutureUnixSocket
has EventBase affinity and must only be accessed from it.

To make this safer and more obvious, put FutureUnixSocket and the
other takeover connection state in EventBaseState.

Reviewed By: kmancini

Differential Revision: D44945469

fbshipit-source-id: add3af84a35d451385a73afb622f9b63c7cdb217
2023-04-24 19:11:42 -07:00
Chad Austin
03245b04ff move EventBaseState into fs/utils
Summary:
I want to use EventBaseState in TakeoverServer, so move it from
RpcServer to eden/fs/utils.

Reviewed By: kmancini

Differential Revision: D44945418

fbshipit-source-id: b9738162c84ca20da800d3662be6271f4b492acc
2023-04-24 19:11:42 -07:00
Chad Austin
fe121a6a84 simplify futures in TakeoverServer
Summary:
Some dead code, a judicious use of makeFutureWith, and replacement of
thenTryInline+makeAsyncTask with via+thenTry makes the implementation
of TakeoverServer easier to follow.

Reviewed By: kmancini

Differential Revision: D44945165

fbshipit-source-id: 67c7b68b892c5112620bdc1ab2a0feb7df4d1864
2023-04-24 19:11:42 -07:00
Chad Austin
a1cdb1efc2 pass folly::File by value instead of r-value reference
Summary:
For small handle types, passing by value is the correct choice,
because it indicates unconditional ownership transfer. (It also
generates slightly smaller code and is less typing.)

Reviewed By: xavierd

Differential Revision: D44927835

fbshipit-source-id: 5fefee7889e8216e46548f4801e83f51cde8b8c4
2023-04-24 19:11:42 -07:00
Chad Austin
53a027b10b kill the unnecessary getRawHiveLogger
Summary:
Simplify ServerState a bit by returning a const reference to the
member shared_ptr.

Reviewed By: xavierd

Differential Revision: D44924418

fbshipit-source-id: cd5f3a17d92b677ec7be43d9a07ed38dca1a3c24
2023-04-24 19:11:42 -07:00
Chad Austin
b98026e0be RpcConnectionHandler is the ReadCallback
Summary:
No need to have an intermediate object to forward callbacks from
ReadCallback to RpcConnectionHandler. This simplifies both memory
management and data flow.

Reviewed By: kmancini

Differential Revision: D44860344

fbshipit-source-id: af02f7d7f331d6ff3a8c4f49abb5ba1b95db5f85
2023-04-24 19:11:42 -07:00
Chad Austin
c9b5036c4c put portmap state into the EventBase
Summary: Replace another Synchronized with EventBaseState.

Reviewed By: xavierd

Differential Revision: D44860277

fbshipit-source-id: b4a2c070c29f1c484314beca483d4d7618cb8bc5
2023-04-24 16:41:38 -07:00
Revathy Kasipandian
63ca9e021d eden trace --retroactive in eden rage
Summary:
Adding the below cli outputs to eden rage

`eden trace inode --retroactive` (this one is empty though because we don't publish events right now)
`eden trace thrift --retroactive`
`eden trace hg --retroactive`

Reviewed By: kmancini

Differential Revision: D45165616

fbshipit-source-id: f4a89377fdc489e10bd78dc4175bdf89e2992cbf
2023-04-24 12:40:03 -07:00
Jun Wu
0515fb7d2e nodeipc: fix compatibility with chg
Summary:
For chg, it needs to pass the node channel fd explicitly.
The chg server should not use the node channel fd, and should close it.

Test script:

  # p.js
  const {spawn} = require('child_process');
  let executable = '/bin/hg';
  const args = ['dbsh', '-c', String.raw`b.nodeipc.IPC.send('foo'); ui.write("[Child] Got message: %r\n" % b.nodeipc.IPC.recv());`];
  const child = spawn(executable, args, {stdio: ['inherit', 'inherit', 'inherit', 'ipc']} );
  const responses = ['HELLO FROM PARENT 1', 'HELLO FROM PARENT 2', 'BYE'];
  child.on('message', message => {
    console.log('[Parent] Got message from child:', message);
    const response = responses.shift();
    if (response) { child.send(response); }
  });
  child.on('exit', () => { console.log('[Parent] Child process has exited'); });

Before:

  $ CHGSOCKNAME=$PWD/foo CHGDEBUG=1 node p.js
  using chg: true, because /etc/mercurial/usechg
  chg: debug: 0.000028 try connect to /home/quark/hg/lib/util/nodeipc/examples/foo-hg
  chg: debug: 0.000141 connected to foo-hg
  ...
  chg: debug: 0.007911 request runcommand, block size 96
  Traceback (most recent call last):
    File "/opt/fb/mercurial/edenscm/ext/debugshell.py", line 99, in debugshell
      exec(command, env, env)
      # command = 'b.nodeipc.IPC.send(\'foo\'); ui.write("[Child] Got message: %r\\n" % b.nodeipc.IPC.recv());'
    File "<string>", line 1, in <module>
  BrokenPipeError: [Errno 32] Broken pipe (os error 32)
  chg: debug: 0.162147 response read from channel r, size 4
  chg: debug: 0.162160 got exitcode 255
  chg: debug: 0.162181 free context buffer
  [Parent] Child process has exited

After:

  $ CHGSOCKNAME=$PWD/foo CHGDEBUG=1 HG_REAL_BIN=~/hg/hg node p.js
  using chg: true, because unix
  chg: debug: 0.000026 try connect to /home/quark/hg/lib/util/nodeipc/examples/foo-hg
  ...
  chg: debug: 0.008299 request attachio
  chg: debug: 0.008572 passing NODE_CHANNEL_FD 3
  chg: debug: 0.008870 response read from channel r, size 4
  ...
  chg: debug: 0.009038 request runcommand, block size 96
  [Parent] Got message from child: foo
  [Child] Got message: 'HELLO FROM PARENT 1'
  chg: debug: 0.163058 response read from channel r, size 4
  chg: debug: 0.163072 got exitcode 0
  chg: debug: 0.163084 free context buffer
  [Parent] Child process has exited

Reviewed By: zzl0

Differential Revision: D45011055

fbshipit-source-id: 20d59358a5203f0966b13120ee8a5e1e8585adc3
2023-04-24 08:14:57 -07:00
Giuseppe Ottaviano
748d105053 Add missing re2/re2.h includes
Reviewed By: marksantaniello

Differential Revision: D45210587

fbshipit-source-id: 00af57e84d6f053082171367fe8190e7c4edb402
2023-04-23 16:16:15 -07:00
Rajiv Sharma
32a53eff54 Back out "Back out "[eden] Generalize Hash and add Hash32""
Summary: Backing out the revert of D44173515 to unblock RE with their development. I will revert my own diff instead.

Reviewed By: genevievehelsel

Differential Revision: D45190063

fbshipit-source-id: 2b14fdc2fa118719aed0f3215393d172a162639f
2023-04-22 07:14:52 -07:00
Zhaolong Zhu
5fe814029b copytracing: sort the potential renamed-to files by path similarity
Summary:
Based on statiscal data, most renames have either same basename or
same directory, so we will use this information when checking potential
renamed-to files.

Reviewed By: quark-zju

Differential Revision: D45184854

fbshipit-source-id: 7b4ed45d27781725c372beb33d24a0960d442816
2023-04-21 20:28:27 -07:00
Zhaolong Zhu
2160be996c copytrace: add file_path_similarity function
Summary:
add file_path_similarity function, we will use this to reduce the
number of files to compare for Git use case; and also use it for sorting
the potential files for Sapling use case.

Reviewed By: quark-zju

Differential Revision: D45157537

fbshipit-source-id: 476c9fa07f2409a2cf0d1a6a72c57069a42ad347
2023-04-21 20:28:27 -07:00
Katie Mancini
b25fc2af3a only register valid ports with portmapper
Summary:
UDS don't have port numbers, so trying to register their port with the
portmapper is going to fail. This can cause eden to fail to start when we
enable uds. The current portmapper version we use can't support
this, so let's just skip attempting to register uds servers with the
portmapper.

Reviewed By: xavierd

Differential Revision: D45196379

fbshipit-source-id: 584e6e04129d1ddbcc756ed66c55a03c3955705a
2023-04-21 17:43:55 -07:00
Zhaolong Zhu
25e8cf5efc absorb: skip obsolete commits in the stack
Summary:
The case that I met was like the following DAG, and I'd like to skip those `Landed` commits when running `hg ab` since they already landed.

```
╷ o  zzz  Apr 21 at 18:18  zhaolong
╷ │  commit zzz
╷ │
╷ o  yyy  Apr 21 at 17:18  zhaolong
╷ │  commit yyy
╷ │
╷ x  ccc [Landed as ddd]  Apr 21 at 9:00  zhaolong
╷ ╷  commit bbb
╷ ╷
╷ x  aaa [Landed as bbb]  Apr 12 at 08:00  zhaolong
╭─╯  commit aaa
```

Reviewed By: sggutier

Differential Revision: D45184140

fbshipit-source-id: a539468843032d41ab4d61e5c461b9a1de53cb40
2023-04-21 14:52:40 -07:00
Rajiv Sharma
08dd7b8ff6 Upload raw git tags during repo import
Summary: Like in the previous diffs, this diff uploads the raw git tags during repo import through `gitimport`.

Differential Revision: D45118571

fbshipit-source-id: f5a6bb9b5805235e9f66f97ab3a58bd165ef475c
2023-04-21 11:59:38 -07:00
Rajiv Sharma
5a76b73fe1 Upload raw git trees associated with commit during git import
Summary: The previous diff uploaded raw git commit data while the commit gets imported in Mononoke through gitimport or remote-gitimport. This diff ensures that the git `tree` associated with the commit also gets  uploaded in Mononoke.

Differential Revision: D45085959

fbshipit-source-id: cf4f4a5ebd0d077972f75fe9c6a8d1dfc5067180
2023-04-21 11:59:38 -07:00
Rajiv Sharma
53d0bcb32a Upload raw git commits during git import
Summary:
With the `upload_object` method in place, this diff utilizes the new uploader method to upload the raw git commit in Mononoke store before creating its corresponding Changeset at Mononoke end.

This diff has the following changes:
- Modified the `get_object` method in `GitReader` to return the raw git content (i.e. header + body bytes of git object) along with the parsed `GitObject`
- Added the `read_raw_commit` method in the `gitimport_objects` library to read the raw commit bytes
- Modified the `ExtractedCommit` type to contain the raw bytes of the commit as well
- Modified all modes of `gitimport` execution to upload the raw git commit before creating the corresponding changeset at Mononoke end
- Made changes in integration test to validate the commit upload behavior

Differential Revision: D45082135

fbshipit-source-id: f339b2851646996be7f43f02458ea5afabb9ca48
2023-04-21 10:13:50 -07:00
Rajiv Sharma
fa889aad25 Implement upload_objects for Direct and Remote Git Uploader
Summary:
This diff includes the following changes:
- Introduces the `upload_object` method in the `GitUploader` trait for uploading raw git-objects (e.g. commit, tree, tag) in the mercurial mirror of the repo
- Implements the `upload_object` method in `Direct` and `Remote` implementations of the `GitUploader` trait allowing the objects to uploaded from both `gitimport` and `remote-gitimport`

This diff just introduces this method, follow-up diffs will use it for uploading different commit objects.

Differential Revision: D45046811

fbshipit-source-id: 9b4e6a295ec22e06294e410735e67877e6d0ef10
2023-04-21 10:13:50 -07:00
Rajiv Sharma
98426e3b65 Restructure mononoke_api git methods to exist as free functions
Summary:
The existing `mononoke_api` git methods were defined under `RepoContext` which relies on a specific type of `Repo` facet container as defined in `mononoke_api` crate. These methods can easily be used through SCS which serves as an external entry point into the `mononoke_api` crate. `remote-gitimport` uses SCS and thus can leverage the necessary endpoints.

However, `gitimport` (or `direct-gitimport`) directly references the logic behind these methods. To ensure that we don't repeat ourselves, there are two alternatives.
- Make `gitimport` use the same `Repo` facet container as the one in `mononoke_api` crate
- Decouple the git methods from `RepoContext` and define them with explicit `facet` dependencies

I chose the later since using the same facet container would have made `gitimport` use a much bulkier `Repo` definition than is necessary. I also made some changes in the `create_annotated_tag` method which are as follows:
- Removed the `start_write()` statement which was essentially an authorization check to validate if writing to the repo is allowed. This check makes sense when validating an external caller (e.g. SCS) but direct references of the library should be allowed
- Removed `CreateChangeset` permission check since we are not actually creating a changeset that corresponds to a commit. Additionally, any auth checks need to be performed at the call-site (e.g. SCS) and not in the API
- Removed the `allowed_no_parents` check since any changeset created for representing a `Tag` object will not have a parent. Infact the concept of parent is invalid for a tag.
- Replaced the returned `MononokeError` into `GitError` to maintain consistency with other methods
- Replaced the instance `save_changeset` method with the struct-level `save_changeset` method. The new method doesn't log to the scribe category thus preventing users tailing it from receiving an invalid commit creation notification. Additionally, the new method doesn't consider any bubble changes but they are anyway irrelevant in the context of these git methods.

Differential Revision: D45046639

fbshipit-source-id: 7ff02cde3fd356eb7a18f5ca12e6c478e23ee315
2023-04-21 10:13:50 -07:00
generatedunixname89002005287564
bd72e48b09 Reviewed By: zertosh
Differential Revision: D45176968

fbshipit-source-id: ded28098710321c5f96aabcc555c481dc26ec457
2023-04-21 08:46:00 -07:00
Xavier Deguillard
3659954679 inodes: on NFS filter AppleDouble from the Overlay
Summary:
Previously, the nfs.allow-apple-double was tentatively rolled out but had to be
rolled back as XCode disliked when an AppleDouble file was present on disk but
a new one couldn't be created. To avoid this issue, let's prevent AppleDouble
from being loaded from the Overlay and re-write the Overlay for directories
that contains one at the same time.

As a slight behavior change, the nfs.allow-apple-double is no longer read on
the fly but only read at startup time to avoid cases where a TreeInode is
already loaded with an AppleDouble and the config is flipped which would cause
XCode to fail to save files.

Reviewed By: chadaustin

Differential Revision: D44854105

fbshipit-source-id: 2c263411719d19eb1d457e26661620e8d6c905ce
2023-04-21 08:33:34 -07:00
Xavier Deguillard
f23137cda1 config: allow unordered_set in config
Summary: A future diff will create a ConfigSetting<std::unordered_set<T>>.

Reviewed By: kmancini

Differential Revision: D45162159

fbshipit-source-id: a67b3b94d708ae694041753d7dffaa6f0ff974de
2023-04-21 08:27:20 -07:00
Rajiv Sharma
2c8e74370b Back out "Generalize Hash and add Hash32"
Reviewed By: markbt

Differential Revision: D45180105

fbshipit-source-id: 94d73b5f95c6495b2953da335ce927f3b5ad9ff0
2023-04-21 07:12:24 -07:00
Mark Juggurnauth-Thomas
e6ef902125 blame: make blame v2 the default version
Summary: In preparation for deleting blame v1, make blame v2 the default.

Differential Revision: D45044338

fbshipit-source-id: c9c71a148b42f4a3301d6c4fd0de5ad7ed321a3e
2023-04-21 05:58:38 -07:00
Mark Juggurnauth-Thomas
0e00d50d56 walker: switch to blame v2
Summary:
Allow the walker to walk the blame v2 graph.

Since the walker is the main user of blame in the integration tests, we can make v2 the default for the integration tests, too.

Differential Revision: D45044294

fbshipit-source-id: 52c991dd81be78053ffc0a6953caf8a068ef59e3
2023-04-21 05:58:38 -07:00
Mark Juggurnauth-Thomas
96b376b90c benchmark_bulkops: convert to clap4
Differential Revision: D45114047

fbshipit-source-id: f99ebe71b61827079db259a9644f21ba11508950
2023-04-21 04:52:41 -07:00
Mark Juggurnauth-Thomas
f9211aa47f bulkops: move benchmark to the benchmarks directory
Summary: This is a benchmark, so put it with the other benchmarks.

Differential Revision: D45114045

fbshipit-source-id: c524c76671d4183f6baa71ca9cd4c3cdfc402dac
2023-04-21 04:52:41 -07:00
Chad Austin
892e5c83ff enforce the connection handler set is only updated from the EventBase
Summary:
We don't need folly::Synchronized for the RpcServer state
machine. It's only touched from the EventBase, so make it
EventBaseState.

Reviewed By: xavierd

Differential Revision: D44860240

fbshipit-source-id: bcbc3d02e7cc5f2dc377718065c7f95eed30202d
2023-04-20 18:49:40 -07:00
Chad Austin
e384876d86 rename RpcTcpHandler to RpcConnectionHandler
Summary:
There's nothing TCP-specific about RpcTcpHandler, so give it a more
accurate name.

Reviewed By: xavierd

Differential Revision: D44860198

fbshipit-source-id: 55b9dc95b2caa9d87179a17435313b91bacfee49
2023-04-20 18:49:40 -07:00
Chad Austin
b6ea3bc0ed RpcServer is the AcceptCallback
Summary:
RpcServer can handle the accept callbacks directly. There's no need
for an intermediate object.

Reviewed By: xavierd

Differential Revision: D44860163

fbshipit-source-id: fd2d96735810a52cd287c357534c8f5bae9eee90
2023-04-20 18:49:40 -07:00
Chad Austin
2164cd333a lift StateWrapper into a top-level EventBaseState so we can use it elsewhere
Summary:
I plan to use StateWrapper elsewhere so rename it to EventBaseState
and move it to the top level.

Reviewed By: xavierd

Differential Revision: D44860040

fbshipit-source-id: fb03b3b726df50099bcce144e343be0caeeaf1be
2023-04-20 18:49:40 -07:00
Chad Austin
1d73dd9d2b RpcTcpHandler is the WriteCallback
Summary:
There is no need for an intermediate object: RpcTcpHandler can handle
the write callback methods directly.

Reviewed By: xavierd

Differential Revision: D44860027

fbshipit-source-id: fe1f44b83a371291a21a3b1b26422bef5cbbf2a0
2023-04-20 18:49:40 -07:00
Chad Austin
ba132a7e4e assert that acceptStopped was synchronous
Summary:
To simplify RpcServer further, assert that removal of the accept
callback is a synchronous operation. Previously, it wasn't, because
specifying any EventBase in addAcceptCallback created a RemoteAcceptor
which scheduled operations on the other EventBase.

Reviewed By: xavierd

Differential Revision: D44853408

fbshipit-source-id: 9369cdcb0bd8450d42e195c15738362d4a53d2e7
2023-04-20 18:49:40 -07:00
Chad Austin
d8400c6faa small RpcServer simplifications
Summary:
I'm trying to track down a subtle lifetime rule violation in
EdenMount. While reading RpcServer, I noticed a few possible
simplifications.

Reviewed By: xavierd

Differential Revision: D44849773

fbshipit-source-id: 4c27c47a7e2c211dcd040acce955e9b2f617b55b
2023-04-20 18:49:40 -07:00
Chad Austin
455e7c6efa unify prjfs takeover "handling"
Summary:
This removes an ifdef _WIN32 in mount shutdown by standardizing the
takeover logic on all three platforms.

Projected FS doesn't support takeover, but removing ifdefs allows
simplifying the control flow and unblocking NFS or other FsChannel
implementations on Windows.

Reviewed By: kmancini

Differential Revision: D44737273

fbshipit-source-id: fc6b718e01698ef3700b5c198750c0e3b1f62063
2023-04-20 18:49:40 -07:00
Chad Austin
2c30d06196 unify FUSE and NFS takeover handling
Summary:
By moving NFS's StopData behind FsStopData, the std::variant and
runtime checks during takeover can be unified into one path. The next
diff will do the same for Windows.

Reviewed By: kmancini

Differential Revision: D44737160

fbshipit-source-id: 19ca623f90b367d25385f177cafa44d7bf7ebb62
2023-04-20 18:49:40 -07:00
Chad Austin
fc265ff4ed cli_rs: log a message when we fall back to Python
Reviewed By: xavierd

Differential Revision: D41896672

fbshipit-source-id: 967aaa758699bf4b312e274f3dad9a2bbe762aca
2023-04-20 18:48:09 -07:00
Mark Shroyer
1d7bbe6d6d Add eden/fs/cli:repl target
Summary:
Adds a buck target to drop us into a Python repl, to ease interactive
development of Python commands in the CLI.

Reviewed By: genevievehelsel

Differential Revision: D45159857

fbshipit-source-id: 31ff61ea29ab080cc1131905c6cf363368f3c617
2023-04-20 16:03:57 -07:00
Genevieve (Genna) Helsel
ecc11aef2b Back out "EdenAPI: Changes for ContentMetadataV2 and Blake3"
Summary:
Original commit changeset: a755f0750ed3

Original Phabricator Diff: D44010967

need to revert to fix our release

https://www.internalfb.com/intern/sandcastle/job/36028797946731051/insights

Reviewed By: xavierd

Differential Revision: D45156142

fbshipit-source-id: 6e5362cf609f69cdbfeb7da30981227f93d42b65
2023-04-20 14:43:37 -07:00
Zhaolong Zhu
f8ef1a5431 copytrace: make find_renames return early when found the target rename
Summary: The original `find_renames` finds all the renames of the commit and checks if it contains the path that we are interested in. This diff optimizes that logic to make it return early when found the target rename. In order to do that we split `find_renames` into two functions `find_rename_forward` and `find_rename_backward`, since they will have different optimization logics.

Reviewed By: quark-zju

Differential Revision: D45149506

fbshipit-source-id: b77b3b9ef4700581e6d044644d40bf405d66d263
2023-04-20 14:39:22 -07:00
Zhaolong Zhu
b42d43047b storemodel: update doc of read_file_contents function
Summary: fix a typo in the doc of read_file_contents function

Reviewed By: quark-zju

Differential Revision: D45126147

fbshipit-source-id: 6f541acb41c5de71f56c5573a5f56b536b669959
2023-04-20 14:39:22 -07:00
Zhaolong Zhu
1c5eec1d0d copytrace: separate find_renames from copytrace trait
Summary:
Practically the graph log and the find_renames can use different impls
independently and form different combinations. This will be used for suppoting
Git use case in following diffs.

Reviewed By: quark-zju

Differential Revision: D45125851

fbshipit-source-id: 785800a0e4b1c74c48b97cf47132b45b268dc0bb
2023-04-20 14:39:22 -07:00
Mark Juggurnauth-Thomas
8a13aec1c0 remove upload_globalrevs
Summary: This tool was used for the original import of globalrevs.  We are now the source of truth for globalrevs, so it is no longer needed.

Differential Revision: D45112829

fbshipit-source-id: 8ff106c66de74a79e6cd963ca48bd1875d6ee44c
2023-04-20 07:38:19 -07:00
Mark Juggurnauth-Thomas
242b35e606 remove rechunker
Summary: This tool was used to rechunk the filestore.  The filestore is always chunked now, so this tool is no longer needed.

Differential Revision: D45112830

fbshipit-source-id: cd03dd06f7dc55a6b47b8fc338accf9d300977d2
2023-04-20 07:38:19 -07:00
Mark Juggurnauth-Thomas
d91fbd8a26 remove manual_scrub
Summary: This tool was used for the initial population of the XDB blobstore.  It has been superseded by the walker, and can now be deleted.

Differential Revision: D45112828

fbshipit-source-id: 134e2c2b761fd27a9b096df4d64404bc14c89c43
2023-04-20 07:38:19 -07:00
Mark Juggurnauth-Thomas
80f85f9f0b remove configlint
Summary: This tool lints toml-format configs which we don't use in production any more, and as such the tool is unused.

Differential Revision: D45112827

fbshipit-source-id: a4f7783144ab782adba5f0a0fb346e8cb542ad97
2023-04-20 07:38:19 -07:00
Mark Juggurnauth-Thomas
e39509da38 remove compute_commit_stats
Summary: This tool was used early on to compute commit stats, but is no longer needed as it has been superseded by other data.

Differential Revision: D45112824

fbshipit-source-id: e88282647e8e3ed85a95ff2a9b15d9212851b8ff
2023-04-20 07:38:19 -07:00
Mark Juggurnauth-Thomas
f40e7dd509 remove regenerate_hg_filenodes
Summary: This tool was introduced to fix up the problem with linknodes pointing at commit cloud commits, however that has long since been resolved, so the tool is no longer needed.

Differential Revision: D45112822

fbshipit-source-id: 350b770e9a3499a8bad8aca29badc3e20a02f168
2023-04-20 07:38:19 -07:00