Commit Graph

20294 Commits

Author SHA1 Message Date
Muir Manders
adb360a64e status: enable Rust status for test-treestate-trackignore.t
Summary: Update debug messages and remove the Rust specific parts of test since they are now covered naturally.

Reviewed By: quark-zju

Differential Revision: D46832706

fbshipit-source-id: fcdfd65ae5309523a22407b150c19b8112647b8e
2023-06-27 20:08:01 -07:00
Muir Manders
d63939f26e tests: update test-up-local-change.t to use Rust status
Summary: Had to tweak things to work w/ modern repo.

Reviewed By: quark-zju

Differential Revision: D46683381

fbshipit-source-id: a26623a4a89bea2643b1109690c12ff46231c29a
2023-06-27 20:08:01 -07:00
Muir Manders
140253df09 status: enable Rust status for test-update-unknown-files.t
Summary:
I had to fix a minor issue w/ in the non-watchman case where we were case normalizing an on-disk file name w/ a dirstate entry incorrectly. When the dirstate entry (e.g. "foo") is marked for removal, it shouldn't coallesce with a different case file (e.g. "FOO"). Otherwise, it is impossible to properly show the status:

```
$ hg st
R foo
? FOO
```

Reviewed By: quark-zju

Differential Revision: D46683382

fbshipit-source-id: 83f93209ab10098efeb65fba3ba7379107ded50d
2023-06-27 20:08:01 -07:00
Muir Manders
20b2d40fab tests: remove test-url-rev.t
Summary:
This is dealing w/ a legacy repo feature that allows specifying branch names as URL fragments.

I don't think it's worth trying to reconcile this w/ remotefilelog.

Reviewed By: quark-zju

Differential Revision: D46683380

fbshipit-source-id: 10249e734bba1624c5e9b9dd07c6c1c5d189654f
2023-06-27 20:08:01 -07:00
Muir Manders
9fa7d36491 repo: share scmstore stores between Python and Rust
Summary:
I made the Rust repo able to construct the scmstore objects for Python, sharing the underlying stores. This way we don't have to worry as much about invalidating the Rust repo's stores. We only construct the minimal contentstore (i.e. no edenapi, memcache, etc). We only need the contentstore fallback to support the legacy Python fetching (and write to local stores) - everything else is handled by scmstore.

In particular, test-visibility.t was failing w/ workingcopy.ruststatus=True because the Rust repo's stores got out of sync w/ Python during an "unshelve" triggered rebase. The Rust stores are invalidated on transaction completion, but in this case the "unshelve" transaction hadn't closed yet.

Note that I couldn't remove the scmstore construction logic from pyrevisionstore because the tree stuff is still used by the treemanifestserver extension, and the file stuff is still used by the "shared only" store used to force fetch commits to update linkrev data. This would be good to clean up, but I'm focusing on the status stuff.

Reviewed By: quark-zju

Differential Revision: D46646005

fbshipit-source-id: 99683521a1df2ef07f6d166b670c6e860e629f58
2023-06-27 20:08:01 -07:00
Jun Wu
c638710c9c test-blackbox: fix test
Summary:
With recent changes, the changelog backend info is logged via Rust tracing
directly. It no longer goes through blackbox.

Reviewed By: zzl0

Differential Revision: D47033778

fbshipit-source-id: a8a65002ece718d45e81c61687c473b0fa98b60c
2023-06-27 19:06:10 -07:00
Olivier Raginel
9b8214fe7c Show the number of changesets & tests remaining when running bisection
Summary:
This very simple change makes the `-c` behavior equivalent to a `-b / -g`

Otherwise, when running big bisection automatically (with `-c`),  having to manually assess how much work was left was annoying.

Before:
```
$ hg bisect --command 'sh script.sh and some params'
changeset e7fa0811edb0: good
changeset 03750880c6b5: good
changeset b53bea5e2fcb: bad
changeset 7874a09ea728: bad
changeset a3d5c6fdf0d3: good
The first good revision is:
commit:      a3d5c6fdf0d3
user:        test
```
After:
```
$ hg bisect --command 'sh script.sh and some params'
changeset e7fa0811edb0: good
Testing changeset 03750880c6b5 (15 changesets remaining, ~3 tests)
changeset 03750880c6b5: good
Testing changeset b53bea5e2fcb (7 changesets remaining, ~2 tests)
changeset b53bea5e2fcb: bad
Testing changeset 7874a09ea728 (4 changesets remaining, ~2 tests)
changeset 7874a09ea728: bad
Testing changeset a3d5c6fdf0d3 (2 changesets remaining, ~1 tests)
changeset a3d5c6fdf0d3: good
Testing changeset a3d5c6fdf0d3 (0 changesets remaining, ~0 tests)
The first good revision is:
commit:      a3d5c6fdf0d3
user:        test
```

Reviewed By: xunnanxu, eeggl, drdarshan

Differential Revision: D46991676

fbshipit-source-id: 40ddf0c86e56a5c3edc42d135c3cf40e51efd274
2023-06-27 18:46:23 -07:00
Saul Gutierrez
374bfeef8b symlinks: add gating for Windows symlinks on EdenFS
Summary: We needed a way of making EdenFS aware that some mount supports symlinks on Windows while at the same time make hg aware that that same mount / working copy supports symlinks.

Reviewed By: xavierd

Differential Revision: D45442009

fbshipit-source-id: 33640dbe1b6508092b622a977c357fb172c11d4c
2023-06-27 13:11:01 -07:00
Saul Gutierrez
8506f270e8 tests: make Windows tests use buck-built hg
Summary:
This makes the tests under `eden/integration` use the buck-built hg except under certain conditions, namely:
- Paths that are too long for batch files to be processed
- Interactive commands that for some reason are still failing

Also, for making some tests work, it changes the way hg commands are invoked from that test framework by escaping them to be more bat compatible

Reviewed By: muirdm

Differential Revision: D46123680

fbshipit-source-id: 690b61e3111b3b07deaa36a677edfa0d363ba987
2023-06-27 13:11:01 -07:00
Michael Devine
d1f13bbc34 Fix Logview Scribe schematization
Summary:
I've been at a loss for how to resolve the Logview Scribe schematization task we got, since all of our logging is performed for us via slog_logview called from Mononoke.

Luckily, it looks like oresk has already solved this problem for slog_logview in D44409191 and we just need to make use of that solution. Even better, it looks like a single update in MononokeMatches will fix the problem both for mega_grepo_sync, and also Mononoke itself.

Reviewed By: korest

Differential Revision: D46990440

fbshipit-source-id: 4c8f3953768072487bd87dd748af3307a9e3848f
2023-06-27 11:51:09 -07:00
Zhaolong Zhu
21ac2090f7 copies: check if the file is in source commit
Summary: Check if the file is in source commit. Currently, dagcopytrace assume the source file is in the source commit

Reviewed By: sggutier

Differential Revision: D47056956

fbshipit-source-id: db4de51be66d26b01d239c0d6023b154578cddf8
2023-06-27 11:43:45 -07:00
Zhaolong Zhu
9114f410ea dag: fix compiler warning
Summary:
as title

```
    --> /data/users/zhaolong/fbsource/fbcode/eden/scm/lib/tracing-collector/src/model.rs:1342:33
     |
1342 | ...                   let mut merged = &mut ctx.tree_spans[existing_child_id];
     |                           ----^^^^^^
     |                           |
     |                           help: remove this `mut`
     |
     = note: `#[warn(unused_mut)]` on by default
```

Reviewed By: muirdm

Differential Revision: D47037610

fbshipit-source-id: ab417835116264e9ab83ed4e0d8746d821941874
2023-06-27 06:34:05 -07:00
Muir Manders
26c8a319b6 eager: share store between Rust and Python
Summary: This lets the Rust status operate with an up-to-date file/tree store when called from Python w/ pending changes.

Reviewed By: sggutier

Differential Revision: D47014121

fbshipit-source-id: cbef3d32fe85f7d3d0e086b6c723d6ce1ba3ee89
2023-06-27 00:01:50 -07:00
Mark Shroyer
06591fe3d7 Add timestamp to dashboard link in eden rage
Summary:
This way when we click on a dashboard link in a rage, it'll take us to the time
period where the user experienced their issues.

Reviewed By: xavierd

Differential Revision: D46917976

fbshipit-source-id: ef772a9dbcfea5d2944aaf6daf77127cff05c841
2023-06-26 13:23:55 -07:00
John Elliott
42b0e1a9f9 Implement chown support for NFS
Summary:
Provided implementation for EdenMount::chown on NFS (MacOS). Utilized exisiting code to get all referencered Inodes and then loaded and invaliated them.

Ran into some issues compiling Ranges - something to learn more about - where certain iterator traits needed to be defined. In subsquent diff should be able to address (if desired), but for this diff just used a vector instead.

Reviewed By: MichaelCuevas

Differential Revision: D46946414

fbshipit-source-id: b405f16712d6d6315d43d6973e7615aced7e5c7d
2023-06-26 11:53:22 -07:00
John Elliott
53aeec0c3e Added new chownV2 method to thrift service
Summary:
* On MacOS uid/gid are both defined as uint64_t, specifically `nobody` is 4294967294.
* The thrift contract uses int32_t for uid/gid parameters
* An overflow is likely occurring when passing values above INT_MAX to the service
* This change creates a new `chownV2` that uses int64_t values, "deprecates" the previous method

Reviewed By: MichaelCuevas

Differential Revision: D46946415

fbshipit-source-id: fcff8ab6c46018561b78f23c6460441333284832
2023-06-26 11:53:22 -07:00
Muir Manders
846aadf80a tests: disable Rust status in a couple tests
Summary: These seem to be failing/flaky on CI. I'm not sure Rust status is responsible for test-amend-metaedit.t, but it seems likely.

Reviewed By: zzl0

Differential Revision: D47020104

fbshipit-source-id: 556ce066de07fa5f92439493dea2ba2fbc5c7040
2023-06-26 08:48:29 -07:00
Zhaolong Zhu
f6a33aeec0 copies: enable dagcopytrace for duplicatecopies() to fix empty commit issue
Summary: The original copytrace was too slow, so it was disabled by default. This diff enables `dagcopytrace` (new fast copytrace) for duplicatecopies() to fix the empty commit issue.

Reviewed By: sggutier

Differential Revision: D46975341

fbshipit-source-id: 11219daee9e400a5ff1d8eda26fe17fbca5d5f12
2023-06-26 08:42:52 -07:00
Muir Manders
0cba5730b5 repo: expose scmstore stores
Summary: Retain and expose scmstore file and tree stores. I'm going to use this to share store instances between Python and Rust.

Reviewed By: sggutier

Differential Revision: D46683379

fbshipit-source-id: ad5204c47eb5d4147d27e9901611037384615bf8
2023-06-26 06:48:14 -07:00
Zoltán Nagy
72fadf3011 Upgrade clap, clap_completion
Summary:
This Clap update adds some new checks in `debug_asserts` that triggers new test failures in some existing CLIs (that I know of, we'll see if there's more red signals before landing). This diff fixes those along with the upgrade itself. Failure looks like this:

```
thread 'main' panicked at 'Command : Argument group 'multirepos' conflicts with non-existent 'repo' id', third-party/rust/vendor/clap_builder-4.2.7/src/builder/debug_asserts.rs:317:13
```

More context:
* https://github.com/clap-rs/clap/blob/master/clap_builder/src/builder/debug_asserts.rs#L317
* 185729a7dc

First added in Clap 4.2.5.

Reviewed By: zertosh

Differential Revision: D46934728

fbshipit-source-id: 2d17c2b02fb88af04ff65a0ea35a2be171acce31
2023-06-26 06:48:13 -07:00
Muir Manders
bd41a8387f changelog: turn on Rust changelog init in tests
Summary: I want to enable this in production to share changelog object between Rust and Python. Let's turn it on for tests, first.

Reviewed By: sggutier

Differential Revision: D46849672

fbshipit-source-id: 8a27c7310253edc767a333b3026a5f1b7dfd1f5f
2023-06-26 06:29:12 -07:00
Muir Manders
d062b1fba9 test-ancestor.py: fix test_gca
Summary:
There were three things wrong, in order of discovery:
1. It wasn't testing anything because the "cl" changelog in-hand was empty. Fix by getting cl after importing commits. Didn't investigate further.
2. ancestors.py was broken due to a previous change in D43839498. Reverted that in preceding commit D46961670.
2. Revision numbers were too big for ancestors.py. Set devel.segmented-changelog-rev-compat=true to get smaller numbers.

Reviewed By: zzl0

Differential Revision: D46898400

fbshipit-source-id: 9b2bb25b457d1757851ed05d9a79da185593910d
2023-06-26 06:29:12 -07:00
Muir Manders
ed72586c25 eagerepo: fix committing file copies
Summary:
Previously in D43839498 I tried to do add naive copy trace support for eager repos, but that wasn't correct as evidenced by the commit hash changes in some subequent test changes. It also broke the algorithm in ancestors.py, but that code wasn't being invoked at all due to some test issues.

Anyway, revert some parts of D43839498, instead adding a naive, separate commonancestorsheads implementation for eagerfilelog. Seems to be an improvement because the test output reverts to the previous commit hashes.

Reviewed By: quark-zju

Differential Revision: D46961670

fbshipit-source-id: e3e6e4821bbdda18d3c844d00ac742f84544ed46
2023-06-26 06:29:12 -07:00
Youssef Ibrahim
7d304fb8d3 sql_commit_graph_storage: allow querying from master in the lower level APIs and add a method for querying only changeset ids
Summary: Adds a parameter to the lower level APIs methods in SqlCommitGraphStorage to allow querying from master, and adds a method for querying only the changeset ids in a range without the associated changeset edges.

Differential Revision: D46862197

fbshipit-source-id: 57193eefdadd07474402108f452b9b6caf93b1f8
2023-06-26 05:12:38 -07:00
Youssef Ibrahim
efda6b6aae commit_graph: parallelize calculating disjoint segments
Summary: Each call to disjoint_segments is completely independent, so let's try to run them in parallel.

Reviewed By: markbt

Differential Revision: D46801400

fbshipit-source-id: 979ddaed4ac81d395debbea89b7a2cd84af25a0b
2023-06-26 05:12:38 -07:00
Youssef Ibrahim
7d9641bc72 cache_warmup: add cache warmup for commit graph segments
Summary: We need to make sure that the changesets the commit graph segments methods are querying are cache warm.

Reviewed By: markbt

Differential Revision: D46796191

fbshipit-source-id: 2d2d069222e909a6351ab7d596a41db590ceb87b
2023-06-26 05:12:38 -07:00
Youssef Ibrahim
e4d83c3bc9 expose commit/graph_segment endpoint to the client
Summary: Exposes commit/graph_segments EdenAPI endpoint to the client

Reviewed By: markbt

Differential Revision: D46796192

fbshipit-source-id: 982693e135757542dcf60aa62b77dccf8d32ad7e
2023-06-26 05:12:38 -07:00
Youssef Ibrahim
21cbf11f30 edenapi: add commit/graph_segments handler
Summary: Adds a new EdenAPI endpoint commit/graph_segments that returns a segmented representation of ancestors of one set of commits (heads) excluding ancestors of another set ot commits (common).

Reviewed By: markbt

Differential Revision: D46796194

fbshipit-source-id: 45513e97a1b42f3fbdbe14ed94961512011cb0d5
2023-06-26 05:12:38 -07:00
Youssef Ibrahim
629a1fd0c3 commit_graph: implement ancestors_difference_segments
Summary: Implements a method called ancestors_difference_segments that returns a segmented representation of ancestors of one set of changesets (heads) excluding ancestors of another set of changesets (common).

Reviewed By: markbt

Differential Revision: D46796195

fbshipit-source-id: c355cb3fe59829ae26d15b6064cfdf35510825c0
2023-06-26 05:12:38 -07:00
Muir Manders
aba56cfd2e scmstore: kill "enableshim" flag
Summary: Kill scmstore.enableshim flag, always using scmstore over content store.

Reviewed By: sggutier

Differential Revision: D45556672

fbshipit-source-id: 159eb2bfa14a9870ac0a3931f18f654c638bcc3f
2023-06-25 23:58:14 -07:00
Muir Manders
a73edbc8b6 scmstore: fix LFS compat w/ Python LFS extension
Summary: This fixes compatibility if both the Python LFS extension and remotefilelog.lfs are enabled. In particular, if we find an LFS pointer in the non-LFS indexedlog storage (i.e. inserted by Python LFS extension when remotefilelog.lfs was not enabled), we now upgrade it to the the scmstore pointer store.

Reviewed By: quark-zju

Differential Revision: D46714084

fbshipit-source-id: 4761f1c05017897544b33b0c322d4c3bce81274d
2023-06-25 23:58:14 -07:00
Muir Manders
37bd20598f scmstore: add lfs "passthrough" mode
Summary: Tweak things so scmstore is compatible with the python lfs extension. In particular, if remotefilelog lfs support isn't enabled, don't treat lfs pointers specially (i.e. just store them as regular file data). This is what contentstore does, and it is required for compatibility tests that use remotefilelog with the python extension. (This is not used in production.)

Reviewed By: zzl0

Differential Revision: D46674241

fbshipit-source-id: faa5b5b992a7e2cc61bf98ba2919753e9825bb0a
2023-06-25 23:58:14 -07:00
Muir Manders
d64ce8a516 undo: fix compat w/ debugruntest
Summary:
Use a different strategy to avoid "undo" on nested runcomand calls.

Previously it would remove the runcommand wrapper, but that effectively disables the undo extension for subsequent commands under debugruntest. Instead, we now have some global state that we unset when a command finishes so we can tell the difference between nested commands in the same process, and serial commands in the same process.

Reviewed By: zzl0

Differential Revision: D46646009

fbshipit-source-id: 47387c412da246e13b2b7c947ca04f3e419f5a87
2023-06-25 23:58:14 -07:00
Muir Manders
a0216a7ae7 status: propagate invalid path errors from Rust
Summary:
Now we propagate invalid path errors (e.g. invalid utf-8, invalid path components) to Python, and warn about them.

This is a change in behavior in that we don't bail out on invalid paths.

Reviewed By: quark-zju

Differential Revision: D46646008

fbshipit-source-id: af7fabdfcb559b987cd8254e28429256baaf34da
2023-06-25 23:58:14 -07:00
Genevieve (Genna) Helsel
4c884e60a9 rename SqliteConnection variable in SqliteDatabase
Summary: No functional change here, just giving the variable a more descriptive name

Reviewed By: chadaustin

Differential Revision: D46325246

fbshipit-source-id: daa40b625ccec66224c632309105c814a931b26f
2023-06-24 19:10:17 -07:00
Genevieve (Genna) Helsel
66cfc12580 tune some SQLite settings
Summary: Tuning particular numbers (like page size) did not show performance improvement when benchmarking, but enabling these two modes did show slight improvement.

Reviewed By: chadaustin

Differential Revision: D46325226

fbshipit-source-id: 6e0cc424f4d29c76be3237178a8a73f03066f67b
2023-06-24 18:47:59 -07:00
Genevieve (Genna) Helsel
38b1163680 serialize OverlayDir in BufferedSqliteInodeCatalog to save on memory usage
Summary:
Serializing and deserialzing the OverlayDir has similar runtime to copying the structure directly but is more memory efficient. For the benchmark I was running on Linux

```
I0509 16:33:45.357141 2489454 BufferedSqliteInodeCatalog.cpp:303] odirSize: 900, serializedSize: 254
```

Reviewed By: mshroyer

Differential Revision: D46325184

fbshipit-source-id: 8d5c063002e4601f81592941ee8791f239c85682
2023-06-24 16:26:16 -07:00
Barys Skarabahaty
1fde39a3ee Clarify blake3 key configuration
Summary: per title

Reviewed By: xavierd

Differential Revision: D46990909

fbshipit-source-id: 5d7211b15f3bcdddff6dac0667e7c52e0cb71795
2023-06-24 02:54:18 -07:00
Zhaolong Zhu
691efdacb7 tests: fix .t tests by disabling rust status
Summary:
D45510982 enabled rust status for debugruntest, but some tests are not
ready yet. This diff disable rust status explicitly for those tests.

Reviewed By: quark-zju

Differential Revision: D46985910

fbshipit-source-id: 92e1c825d420f7897f165dce93297991901ad6db
2023-06-23 19:51:27 -07:00
Xavier Deguillard
95f27884de cli: add missing blob metadata fetching in eden trace hg --help
Summary: The documentation didn't mention what the nametag emoji meant, fix this.

Reviewed By: chadaustin

Differential Revision: D46987216

fbshipit-source-id: 7c001cfc2b6268cfe9dd9e6514a68494bec54ed2
2023-06-23 15:46:21 -07:00
Skotch Vail
e362fb385e eden typo in redirect message
Summary: fixing typo

Reviewed By: chadaustin

Differential Revision: D46951682

fbshipit-source-id: b3560391bee6e9fec51a5fc577ee3045cb34559d
2023-06-23 15:27:50 -07:00
Barys Skarabahaty
0476b4c187 Add a possibility to configure the default blake3 key value
Summary: Adding a possibility to configure the default blake3 version that could be used if config is not set.

Reviewed By: xavierd

Differential Revision: D46934813

fbshipit-source-id: 6d6032eec1204800f06d5794c5150db7e139a6fa
2023-06-23 14:58:01 -07:00
Liubov Dmitrieva
ecbd5a685c avoid establishing wire proto connections for fully edenapi pulls
Summary:
avoid establishing wire proto connections for fully edenapi pulls (segmented changelog `hg pull`)

we can speed up the command by not sending clinettelemetry and hello for this
use case that will significantly reduce wireproto traffic: https://fburl.com/scuba/mononoke_test_perf/hlllh1id

we will aslo save time not establishing wire proto connection (this is always a
separate connection than edenapi protocol)

at the moment this only helps for master segmented changelog pulls but this is
our top used command

Reviewed By: quark-zju

Differential Revision: D46313581

fbshipit-source-id: 275de25ab751f8339afe28ea937d5e7c5eac8984
2023-06-23 05:30:55 -07:00
Muir Manders
0a2bb133f6 eden: share treestate between Python and Rust
Summary:
Make the eden dirstate map use a treestate object under the hood instead of a plain Python dictionary. This way Python and Rust can stay in-sync wrt the dirstate.

I'm working on making everything use the Rust status internally (e.g. "hg commit" uses the Rust status). For this to work, pending dirstate changes from Python need to be visible to the Rust status. Non-EdenFS handles this by sharing the same treestate object between Rust and Python. This doesn't work for EdenFS since EdenFS uses its own dirstate format completely separate from the Rust workingcopy.

However, the Rust workingcopy already converts the EdenFS dirstate into an in-memory treestate object for compatibility. In this commit, I pass this treestate object along from Rust to the eden_dirstate_map to act as the underling _map. This way, mutations from Python will be available to the Rust status code.

This isn't as nice as completely migrating to treestate, but it is much easier and is a step in the right direction.

Reviewed By: quark-zju

Differential Revision: D46840436

fbshipit-source-id: 99904622507645001cc5a9f2096da9d83cda98d4
2023-06-22 21:57:53 -07:00
Chad Austin
51081a4442 nodeipc: fix build on macOS
Summary:
On macOS, some of these types are u32. On glibc, usize. Add more
compatible casts.

This fixes the Watchman build on macOS.

Reviewed By: zzl0

Differential Revision: D46959090

fbshipit-source-id: a15635d10bb0ff687d2aab8fb608b6d841c157fd
2023-06-22 21:13:05 -07:00
Mark Shroyer
8fe8b6143d Remove Scuba and ODS URLs from eden rage
Reviewed By: xavierd

Differential Revision: D46917457

fbshipit-source-id: 581cff90237dd49558aef56f68659fa95d30dc7b
2023-06-22 13:56:24 -07:00
Mark Shroyer
befa2c913f Add edenhost link to rage output
Summary: Adds a link to a host dashboard to rage output.

Reviewed By: xavierd

Differential Revision: D46917455

fbshipit-source-id: 5acd4679b74ba87bb0e1e232d14cf04fe2a8313b
2023-06-22 13:56:24 -07:00
Mark Shroyer
34b6dbfce6 Use hostname normalizer in Python CLI
Summary: Apply hostname normalization to Python CLI

Reviewed By: xavierd

Differential Revision: D46539537

fbshipit-source-id: 9675eb9ad3769ba75764b5853712c4c27c90884f
2023-06-22 13:56:24 -07:00
Mark Shroyer
f388db1255 Move get_normalized_hostname to a new :hostname target
Summary:
This prevents a dependency cycle when using get_normalized_hostname in
telemetry code.

Reviewed By: xavierd

Differential Revision: D46910713

fbshipit-source-id: 35ebd7505512d418c6558f6f06b055b651a34ab1
2023-06-22 13:56:24 -07:00
Mateusz Kwapich
35d04fb79f add --no-merge flag
Summary:
This flag allows the repo import to progress through all the steps
but bail before actually merging in the repos.

Currently the repo_import tool is so slow that all the pre-merge steps
can take hours. This makes it really hard to control when the actual merge
commit will happen. This flag will allow us to prepare all those steps
ahead-of-time and then resume with just merge in mind.

I don't think it's a proper long-term fix but I found it useful when working
wath whatsapp/biz and would use it again util we properly optimize repo_import
tool.

Differential Revision: D46802952

fbshipit-source-id: 2e8185482c4ba9c04fed20013efcc80d75e80bad
2023-06-22 10:31:22 -07:00
Zhaolong Zhu
0d05f5fcdb tests: fix test-sparse-merges.t by disable rust status
Summary:
D45510982 enabled rust status for debugruntest, but this test is not
ready yet. This diff disable rust status explicitly in the test.

Reviewed By: quark-zju

Differential Revision: D46938285

fbshipit-source-id: b9cb514d8721328a65ac88229aeff8f85dbaf922
2023-06-22 09:43:50 -07:00
Egor Tkachenko
6daec5ad8d non-oss work 84/n
Differential Revision: D46901370

fbshipit-source-id: 45e8549191975ba143194e0de32f3c3948ebb36f
2023-06-22 07:46:20 -07:00
Egor Tkachenko
cd679ea8ec non-oss work 83/n
Differential Revision: D46860120

fbshipit-source-id: 21a71f785bc2261db654b0f72890668c12c3d30b
2023-06-22 07:46:20 -07:00
Haitao Mei
773bd915e7 new admin tool unlink keys after doing a sanitising check
Summary: This diff allows the new admin tool to double check if the key is really we wanted to delete, before doing the actual deletion.

Reviewed By: mitrandir77

Differential Revision: D46901306

fbshipit-source-id: 58904c5272d22b696dd22b3c83a9caf33fa3a0b2
2023-06-22 02:16:25 -07:00
Mateusz Kwapich
c79fc047d3 improve repo_create_commit docs
Summary:
Similarly named method in scmquery pushes commits onto some branch.
Let's make the description very clear.

Reviewed By: malmond77

Differential Revision: D46916234

fbshipit-source-id: 6137f42df97be80fff2775638f766f05c1113488
2023-06-21 18:33:21 -07:00
Jun Wu
43e78592f0 udsipc: add a simple connection pool
Summary:
Add "connection pool" logic that emulates a pool using a directory.
This can be useful on Windows where `fork()` is unavailable.

Reviewed By: zzl0

Differential Revision: D46885307

fbshipit-source-id: 26c85f6836fc7a9437ccaef0aaf4a7f0a6e8561f
2023-06-21 14:49:59 -07:00
Jun Wu
788c7c9f2a udsipc: integration with nodeipc
Summary:
Provide APIs to obtain the `NodeIpc` instance instead of raw sockets.
This makes it possible to use `NodeIpc` features like sending the
file descriptors, node channel, etc.

Reviewed By: muirdm

Differential Revision: D46812533

fbshipit-source-id: 7b3d51a6027c9dbacffcf74476f9b8a4a3440313
2023-06-21 14:49:59 -07:00
Jun Wu
00d183b934 udsipc: crate for unix-domain-socket communication
Summary:
Add a crate to make it easier to use UDS (unix-domain-socket) communication.

For now, it only contains the low-level bind, and connect functions.

Reviewed By: muirdm

Differential Revision: D46812534

fbshipit-source-id: efbf31dbb1286ae64051b570c20ca6f41c736afa
2023-06-21 14:49:59 -07:00
Jun Wu
d9334ee302 nodeipc: avoid closing underlying fd multiple times
Summary:
The `FileDescriptor` type will close the underlying fd on drop. In our
use-cases `r` and `w` refer to the same fd so we only need to close it
once. Note the reason we use separate `Mutex`es for r and w is that we
want `recv()` and `send()` running from different threads to not block
by each other.

Reviewed By: zzl0

Differential Revision: D46885308

fbshipit-source-id: b2a5644251ac4773581a995ae8c3d955b0b36861
2023-06-21 14:49:59 -07:00
Jun Wu
8a46d73b6e nodeipc: remove unused once_cell dep
Summary: The crate is no longer used.

Reviewed By: muirdm

Differential Revision: D46812535

fbshipit-source-id: 659b73a563bf14cc17cb1b09e9a57422d21a6377
2023-06-21 14:49:59 -07:00
Jun Wu
60ae5c218a nodeipc: test send/recv stdio
Summary:
Tested variations mentioned in the added README, especially the
nodejs -> parent -> child case:

Windows:

  $ node hello_parent.js
  [Parent] Got message from child: HELLO FROM CHILD
  [Child] Got message from parent: String("HELLO FROM PARENT 1")
  [Parent] Got message from child: [ 'Echo from child', 'HELLO FROM PARENT 1' ]
  [Child] Got message from parent: String("HELLO FROM PARENT 2")
  [Parent] Got message from child: [ 'Echo from child', 'HELLO FROM PARENT 2' ]
  [Child] Got message from parent: String("BYE")
  [Parent] Child process has exited

  $ cargo run --example spawn_sendfd
  Parent: spawning child
  Parent: sending hello
  Parent: sending a.txt file descriptor
  Parent: sending stdio
  Parent: waiting for child to exit
  Child: started with IPC handle 100
  Child: got message Some("hello")
  Child: got sendfd payload SendFdPayload { pid: 41528, raw_fds: [0x118] }
  Child: writing "something\n" to fd 0x118
  Child: got stdio
  Child: write to stderr
  Child: no IPC singleton

  $ node hello_parent.js spawn_sendfd
  Parent: spawning child
  Parent: sending hello
  Parent: sending a.txt file descriptor
  Parent: sending stdio
  Parent: waiting for child to exit
  Child: started with IPC handle 100
  Child: got message Some("hello")
  Child: got sendfd payload SendFdPayload { pid: 49952, raw_fds: [0x118] }
  Child: writing "something\n" to fd 0x118
  Child: got stdio
  Child: write to stderr
  Child: has IPC singleton
  [Parent] Got message from child: HELLO FROM CHILD
  Child: Got message: String("HELLO FROM PARENT 1")
  [Parent] Got message from child: [ 'Echo from child', 'HELLO FROM PARENT 1' ]
  Child: Got message: String("HELLO FROM PARENT 2")
  [Parent] Got message from child: [ 'Echo from child', 'HELLO FROM PARENT 2' ]
  Child: Got message: String("BYE")
  [Parent] Child process has exited

Linux:

  % node hello_parent.js
  [Parent] Got message from child: HELLO FROM CHILD
  [Child] Got message from parent: String("HELLO FROM PARENT 1")
  [Parent] Got message from child: [ 'Echo from child', 'HELLO FROM PARENT 1' ]
  [Child] Got message from parent: String("HELLO FROM PARENT 2")
  [Parent] Got message from child: [ 'Echo from child', 'HELLO FROM PARENT 2' ]
  [Child] Got message from parent: String("BYE")
  [Parent] Child process has exited

  % cargo run --example spawn_sendfd
  Parent: spawning child
  Parent: sending hello
  Parent: sending a.txt file descriptor
  Parent: sending stdio
  Parent: waiting for child to exit
  Child: started with IPC handle 4
  Child: got message Some("hello")
  Child: got sendfd payload SendFdPayload { raw_fds: [3] }
  Child: writing "something\n" to fd 3
  Child: got stdio
  Child: write to stderr
  Child: no IPC singleton

  % node hello_parent.js spawn_sendfd
  Parent: spawning child
  Parent: sending hello
  Parent: sending a.txt file descriptor
  Parent: sending stdio
  Parent: waiting for child to exit
  Child: started with IPC handle 5
  Child: got message Some("hello")
  Child: got sendfd payload SendFdPayload { raw_fds: [4] }
  Child: writing "something\n" to fd 4
  Child: got stdio
  Child: write to stderr
  Child: has IPC singleton
  [Parent] Got message from child: HELLO FROM CHILD
  Child: Got message: String("HELLO FROM PARENT 1")
  [Parent] Got message from child: [ 'Echo from child', 'HELLO FROM PARENT 1' ]
  Child: Got message: String("HELLO FROM PARENT 2")
  [Parent] Got message from child: [ 'Echo from child', 'HELLO FROM PARENT 2' ]
  Child: Got message: String("BYE")
  [Parent] Child process has exited

Reviewed By: muirdm

Differential Revision: D46811170

fbshipit-source-id: 96b2d4a7a3c5f8599058faea949ea3ee7be962be
2023-06-21 14:49:59 -07:00
Jun Wu
633dfd6ab6 nodeipc: move Windows AttachConsole from recv_fd_vec to recv_stdio
Summary: `recv_stdio` seems a better place for the logic.

Reviewed By: muirdm

Differential Revision: D46811171

fbshipit-source-id: ddd91489610fcf6a148897bbd4f35b1e404cbd0b
2023-06-21 14:49:59 -07:00
Jun Wu
08698d715f nodeipc: implement send/recv stdio
Summary:
This makes it easier to use. In addition, the "singleton" IPC initially decided
by NODE_CHANNEL_FD is handled internally so the callsite is less error-prone,
since it does not need to care about maintaining the NODE_CHANNEL_FD env var,
or the initialization order of the singleton.

Reviewed By: muirdm

Differential Revision: D46811166

fbshipit-source-id: a2a8a7a36986422a8d7c967d6fb5b820bedce0c9
2023-06-21 14:49:59 -07:00
Jun Wu
2eb8cc5a82 nodeipc: remove unnecessary non-blocking side effect
Summary:
Remove the side effect when constructing the NodeIpc. It does not seem
necessary. This allows us to construct NodeIpc without checking the underlying
fd until first send/recv.

Reviewed By: muirdm

Differential Revision: D46811162

fbshipit-source-id: 4fc7941a1e9d6b9a9c47daa699de4283bfcec5c3
2023-06-21 14:49:59 -07:00
Jun Wu
d02c4ecc35 nodeipc: make singleton mutable by crate
Summary:
This allows us to update it dynamically, without going through the
`NODE_CHANNEL_FD` environment variable.

Reviewed By: muirdm

Differential Revision: D46811169

fbshipit-source-id: bf52b5597fcf69291da81675d2917dc0dc010904
2023-06-21 14:49:59 -07:00
Jun Wu
71a5ee65ab nodeipc: move singleton to a method
Summary: This makes it more flexible so we can replace the singleton if we want.

Reviewed By: muirdm

Differential Revision: D46811160

fbshipit-source-id: 902b7ff05a4fb3f8a7d7218afd3d07e0f3a89a9f
2023-06-21 14:49:59 -07:00
Jun Wu
b4f645285c nodeipc: implement fd sending on POSIX
Summary:
Make it possible to send fds on POSIX. This is similar to what chg
(hgclient.c:attachio and osutil.c:recvfds) does. Note the `sendfd`
crate seems to have a solid implementation but its public API is
on the `std::os::unix::net::UnixStream` type, which is incompatible
with our struct that uses the `FileDescriptor`.

Example:

  % cargo run --example spawn_sendfd
  Parent: spawning child
  Parent: sending hello
  Parent: sending stdio and a.txt file descriptors
  Parent: waiting for child to exit
  Child: started with IPC handle 4
  Child: got message Some("hello")
  Child: got sendfd payload SendFdPayload { raw_fds: [3, 5, 6, 7] }
  Child: writing "something\n" to fd 3
  something
  Child: writing "something\n" to fd 5
  something
  Child: writing "something\n" to fd 6
  something
  Child: writing "something\n" to fd 7
  % cat a.txt
  something

Reviewed By: muirdm

Differential Revision: D46811163

fbshipit-source-id: 37686327f02a7fa0b0e8768d025094a7fcb0e2b5
2023-06-21 14:49:59 -07:00
Jun Wu
4b87bff93d nodeipc: use message header to prevent over-read
Summary:
This avoids over reading which might drop special messages from sendmsg(),
on POSIX systems.

The behavior disables itself if we need libuv compatibility on POSIX.

Reviewed By: muirdm

Differential Revision: D46811164

fbshipit-source-id: 3aed4bb4d63ad10ecc6a7bf76007cc7263c1c580
2023-06-21 14:49:59 -07:00
Jun Wu
3a4d26c5af nodeipc: use unbuffered read if we know the message size
Summary:
This avoids over reading which might drop special messages (like file descriptors)
from sendmsg(). Buffered reader might turn those special messages into regular
messages and will lose the file descriptors.

Reviewed By: muirdm

Differential Revision: D46811158

fbshipit-source-id: 2294c5c2b132c25c21950f26e9f0d44094743fe0
2023-06-21 14:49:59 -07:00
Jun Wu
c372790323 nodeipc: implement fd sending on Windows
Summary:
On Windows, we can send handles via DuplicateHandle and AttachConsole.

Example (running in mingw):

When stdio is not redirected:

  $ cargo run --example spawn_sendfd
  Parent: spawning child
  Parent: sending hello
  Parent: sending stdio and a.txt file descriptors
  Parent: waiting for child to exit
  Child: started with IPC handle 11c
  Child: got message Some("hello")
  Child: got sendfd payload SendFdPayload { message: "sendfd_message", pid: 1640, raw_fds: [0x0, 0x0, 0x0, 0x104] }
  Child: writing "something\n" to fd 0x104

When stdout is redirected:

  $ rm a.txt
  $ cargo run --example spawn_sendfd > b.txt
  $ cat b.txt
  Parent: spawning child
  Parent: sending hello
  Parent: sending stdio and a.txt file descriptors
  Parent: waiting for child to exit
  Child: started with IPC handle 100
  Child: got message Some("hello")
  Child: got sendfd payload SendFdPayload { message: "sendfd_message", pid: 34536, raw_fds: [0x0, 0x130, 0x0, 0x134] }
  Child: writing "something\n" to fd 0x130
  something
  Child: writing "something\n" to fd 0x134

  $ cat a.txt
  something

When stdio is fully redirected:

  $ cargo run --example spawn_sendfd >b.txt 2>c.txt <a.txt
  $ cat b.txt
  ...
  Child: got sendfd payload SendFdPayload { message: "sendfd_message", pid: 29728, raw_fds: [0x10c, 0x110, 0x114, 0x11c] }
  ...

Reviewed By: muirdm

Differential Revision: D46811159

fbshipit-source-id: 23e132ae460f61830d2240a3e6b2d5d57e80b30a
2023-06-21 14:49:59 -07:00
Jun Wu
5bd252bc31 nodeipc: add winapi
Summary:
We're going to use winapi to implement sending and receiving file descriptors
on Windows.

Reviewed By: muirdm

Differential Revision: D46811161

fbshipit-source-id: dca85722da9f96e15f1ec8bb4676058487c51872
2023-06-21 14:49:59 -07:00
Jun Wu
af56ab93cb nodeipc: make some items public
Summary: They will be used by upcoming changes.

Reviewed By: muirdm

Differential Revision: D46811168

fbshipit-source-id: fdd60a2aa96b979dd2dc5bb2d016189435bbf695
2023-06-21 14:49:59 -07:00
Jun Wu
13d31903ff nodeipc: add NodeIpc::from_socket
Summary: This makes it a bit easier to use in upcoming changes.

Reviewed By: zzl0

Differential Revision: D46811157

fbshipit-source-id: 333e17415d4a67fcb58bec61153b15e4cad03d23
2023-06-21 14:49:59 -07:00
Jun Wu
acf9c13edb nodeipc: add NodeIpc::from_raw_file_descriptor
Summary:
Exposes the ability to construct `NodeIpc` from a Windows HANDLE, not a
msvcrt/ucrt's fd.

Reviewed By: zzl0

Differential Revision: D46811167

fbshipit-source-id: 94f48dc0d059bca109c1792dceb0b733e4737adf
2023-06-21 14:49:59 -07:00
Jun Wu
d027cea337 nodeipc: rename raw_fd to libc_fd
Summary:
In the next change I'm adding "raw ..." concept. Let's rename `raw_fd` to
`libc_fd` to make it obvious that the raw something is different from the raw
"HANDLE" on Windows.

Reviewed By: zzl0

Differential Revision: D46811165

fbshipit-source-id: e0fe48633fd8d928ce7d7ae0652f041a90aec922
2023-06-21 14:49:59 -07:00
Jeremy Braun
e24f2bf601 format operations in the tracefs log that have two associated paths
Summary:
While most PrjFS operations only communicate about the filesystem object they're modifying via the [`PRJ_CALLBACK_DATA->FilePathName`](https://learn.microsoft.com/en-us/windows/win32/api/projectedfslib/ns-projectedfslib-prj_callback_data) member, notifications via the [`PRJ_NOTIFICATION_CB`](https://learn.microsoft.com/en-us/windows/win32/api/projectedfslib/nc-projectedfslib-prj_notification_cb) have a `destinationFileName` argument as well.

This is documented as:
> If notification is PRJ_NOTIFICATION_PRE_RENAME or PRJ_NOTIFICATION_PRE_SET_HARDLINK, this points to a null-terminated Unicode string specifying the path, relative to the virtualization root, of the target of the rename or set-hardlink operation.

While the individual STRACE `NotificationArgRenderer` functions handled the extra path, `PrjfsLiveRequest::formatTraceEventString` does not.

This forwards the string to that object, allowing it to be rendered if needed, so that it shows up in the `eden trace fs` output.

Reviewed By: xavierd

Differential Revision: D46809287

fbshipit-source-id: 781db1d911a975902d0b27d9ba4f553cc3b85299
2023-06-21 11:48:17 -07:00
Egor Tkachenko
0c0282221b non-oss work 82/n
Differential Revision: D46836985

fbshipit-source-id: da87e06165fe72044c2944f45fcac045c8a40286
2023-06-21 10:04:36 -07:00
Muir Manders
2ddb02440c RepoPath: validate \r as invalid byte
Summary: We were forbidding \n but not \r. A couple Python spots validate against "\r" and "\n" in filenames (scmutil.checkfilename and manifest._checkforbidden), so let's do it in Rust as well.

Reviewed By: zzl0

Differential Revision: D46646011

fbshipit-source-id: 41b5cbad057e2b966e3c00011d75cd6cd6e804fc
2023-06-21 08:29:03 -07:00
Muir Manders
3bf46e3cd8 tests: use Rust status in test-audit-path.t
Summary:
This test needed significant changes to use remotefilelog (unrelated to Rust status).

In particular:
- "hg cat" doesn't report "no such file" for non-existing files. Previously that came from py manifest, but Rust manifest walk doesn't support.
- Kill tampered bundle check. I tried for a while to get this working, but everything fails really early with the Rust manifest since bad paths are immediately rejected by the RepoPath type.
- Various update-over-symlink tests now work since the Rust vfs will remove symlinks in order to write the new file (thus avoiding the "xxx traverses symbolic link yyy" audit error).

Also this test revealed the need to process directories in the Rust status to catch a file being replaced by a directory. I changed the (Watchman) code path to no longer skip directories returned from watchman.

Reviewed By: zzl0

Differential Revision: D46646010

fbshipit-source-id: a2f8a92e85a97611212d917b2a6118f0dd1f5eed
2023-06-21 08:29:03 -07:00
Muir Manders
b4a36a0221 tests: remove test-advice-header.t
Summary:
The x2p auth advice header is handled/displayed by the network doctor in practice now.

I'm making tests support the Rust status, and opting to remove this one instead of update it.

Reviewed By: zzl0

Differential Revision: D46646012

fbshipit-source-id: 72bd074b0e8d76ecbc4206920f6c8867d6d794cd
2023-06-21 08:29:03 -07:00
Muir Manders
b4986423d1 status: use Rust status in test-casecollision.t
Summary: I had to tweak the case collision auditor to exclude untracked files. The Rust status (using Watchman) seem so to add untracked files to the dirstate earlier than Python, which was causing extra "possible case-folding" warnings.

Reviewed By: quark-zju

Differential Revision: D46832704

fbshipit-source-id: fa0e30df757804804ca437df94a4fb4b56dcbeda
2023-06-21 08:29:03 -07:00
Muir Manders
6a017d0f75 status: support match.bad() for Rust status
Summary:
Some Python commands depend on the "bad" matcher callback getting called by dirstate.status(). Tweak things so this happens when we use the Rust status as well. This also adds support for the "clean" option when using the Rust status since clean files and "bad" are somewhat coupled.

I moved invalid file type detection from filesystem.py into dirstate.py so it covers Rust status as well.

Reviewed By: quark-zju

Differential Revision: D46646006

fbshipit-source-id: 28278af15e02e0f794aefc7bde850ce58b319ac6
2023-06-21 08:29:03 -07:00
Muir Manders
0313941fa6 status: enable workingcopy.ruststatus for some tests
Summary: It aleady passes for these, so turn it on.

Reviewed By: quark-zju

Differential Revision: D45510980

fbshipit-source-id: f45a2dbe11186411adc259863b88c6ff5ee1914e
2023-06-21 08:29:03 -07:00
Muir Manders
aeb54654a3 tests: enable workingcopy.ruststatus for debugruntest
Summary: It's annoying to have to remember when this setting is and isn't enabled by default.

Reviewed By: quark-zju

Differential Revision: D45510982

fbshipit-source-id: 7d54c0c95d7edf61f358692b1a7c487e5889b5fa
2023-06-21 08:29:03 -07:00
Liubov Dmitrieva
0e7419f010 add option for consistent routing of single tree requests and single
Summary:
add option for consistent routing of single tree requests and single blob requests

Meta:

Background:

We are having a lot of traffic for single tree blob or single file blob:
https://fburl.com/scuba/mononoke_test_perf/0eainxd3
https://fburl.com/scuba/mononoke_test_perf/0ye4eduq
Let's route them consistently!

Reviewed By: quark-zju

Differential Revision: D46860178

fbshipit-source-id: 50298c583d82585b3345ec4c4ca6b7ab4ab57ab1
2023-06-21 04:14:20 -07:00
Genevieve (Genna) Helsel
68fac5cd33 explicity copy stats in lambda in LocalStore
Summary: Followup from D46706164

Reviewed By: xavierd

Differential Revision: D46877765

fbshipit-source-id: 4a5ea4676c55d13e6292472d26089e2b0f653788
2023-06-20 17:22:09 -07:00
Mateusz Kwapich
0ee50a92c3 pushrebase - allow exemptions from casefolding check
Summary:
The casefolding pushrebase check is blocking the sync of www commits causing
problems. Let's exempt www/ dir from it.

We'll also have to modify commit hooks - but that's a separate thing.

Reviewed By: markbt

Differential Revision: D46860559

fbshipit-source-id: 87db959e0d025c0c1fc5c6cfecbdcf96af9e0f81
2023-06-20 16:48:55 -07:00
Zhaolong Zhu
e662d3f7cd bisect: skip the sparseskip logic for Eden repo
Summary: skip the unnecessary sparseskip logic for Eden repo.

Reviewed By: quark-zju

Differential Revision: D46865714

fbshipit-source-id: 660ccc8e1ed740ad6db9aeff350fd5e87089816d
2023-06-20 15:26:46 -07:00
Haitao Mei
a66a40a339 new admin tool bulk unlinking refactoring
Summary:
This diff does the following refactoring:
* Remove redundent  key checking when parsing blobstore key, and repo_id from it
* Replace all the `writeln!` with `println!`
* Print errors using `eprintln!`
* Remove misuse of verbose

Differential Revision: D46857681

fbshipit-source-id: 1b065756eb91d8b4b67422ef49ded2783660992f
2023-06-20 10:39:12 -07:00
Haitao Mei
4d25e33775 new admin tool print how long does it take to delete all the keys from a file
Summary: This diffs allows the new admin tool to print out how long it takes to process each file during bulk blobstore key unlinking.

Differential Revision: D46838088

fbshipit-source-id: 92fa57edcce5b171a1d4f6be6d7a57571fdb618b
2023-06-20 09:07:49 -07:00
Haitao Mei
39d3400de2 new admin tool uses HashMap to cache the blobstores regarding a given repo_id
Summary:
This diff:
* Adds a new HashMap to store the blobstres, regarding a given repo_id, to avoid duplicated computation
* Removes some debugging output

Differential Revision: D46802649

fbshipit-source-id: 8ddf0243b192b5684af2d4a430cdb8873a78246d
2023-06-20 09:07:49 -07:00
Haitao Mei
29d634f146 new admin tool does the actual deletion for the bulk key unlinking
Summary:
This diff allows the new admin tool to actually delete the content from the blobstore.

When the key is not present, there is nothing happening.

Differential Revision: D46802651

fbshipit-source-id: ac1d9aabcb4fd17455263c29b1348f5d1619868b
2023-06-20 09:07:49 -07:00
Pierre Chevalier
6ed7f57fcc non-oss work 80/n
Summary:
[plan_deletion] Add subcommand to redact relevant blobs

To make it easy to use in the context of plan deletion, we take the provisional deletion plan issued from the `propose-deletion-plan` subcommand in and we output the redaction id to a file.

In the real world, one would use this redaction id to make a diff to the mononoke config in configerator and restart the mononoke servers to make sure that the redaction actually takes effect before moving on to the next step.

Reviewed By: markbt

Differential Revision: D46768075

fbshipit-source-id: 368dafd485a02d677f3a74c6ede59a80cbe931d4
2023-06-20 07:15:08 -07:00
Pierre Chevalier
f377936c00 Expose fetch-key-list through the API and the CLI
Summary:
The current interface relies on the assumption that redacted content only relates to file contents.
`list`, which is the way to read what was redacted discovers the blobs for filecontents by walking the fsnodes manifests.

For a feature I'm working on, I need to be able to redact arbitrary blobs, so I need a way to identify what was redacted
without relying on some derived data blobs being available.

Reviewed By: markbt

Differential Revision: D46806525

fbshipit-source-id: 78b5470d4dd741538e3e85353c0b1634f3b83b1c
2023-06-20 07:15:08 -07:00
Pierre Chevalier
14bbdd45bf Make the API to the redaction crate more minimal
Summary: Instead of taking in the full context of a `MononokeApp`, only take the two blobstores that we need.

Reviewed By: markbt

Differential Revision: D46768087

fbshipit-source-id: 773f0f31e12c58ee0cc8341e638fcbcedde8bab9
2023-06-20 07:15:08 -07:00
Pierre Chevalier
2fe77034e8 Extract redaction feature to its own crate
Summary:
The crux of the redaction process is this `create_key_list` function which appends each key to the redaction blobstores and provides instruction to generate the correct redaction config.

I will need to re-use this mechanism, so extract it to an accessible crate.

Reviewed By: markbt

Differential Revision: D46763714

fbshipit-source-id: 8f06a12c6348bc49d0ca4fe65155818a216c5b88
2023-06-20 07:15:08 -07:00
Muir Manders
e809d770f9 tests: fix test-status-mlog.t on Windows
Summary:
The blackbox was reporting a mode mismatch. The cause was the filesysytem walk yielding a mode with permission bits set (e.g. 0666), but os.lstat within dirstate.normal() yields a mode without permission bits set (e.g. 0000). Fix by only reporting a mode change when the executable bit changes (which seems like the intention of the code).

I don't think this is a recent change in behavior, so I'm not going to look further into it. Hopefully the Python filesystem code will go away soon with the Rust status.

Reviewed By: zzl0

Differential Revision: D46848722

fbshipit-source-id: cdd73137ae891bc8038d7d7ddcd09d8c95170051
2023-06-20 06:19:16 -07:00
Rajiv Sharma
6da90296c8 Clippy Fixes
Summary: As in title

Reviewed By: mitrandir77

Differential Revision: D46855503

fbshipit-source-id: 715548f1a138e950bc2ae00e9b83a47a13944109
2023-06-20 05:19:24 -07:00
Haitao Mei
c8968599aa new admin tool extract the blobstore key from the given key
Summary:
This diff allows the new admin tool to extract the blobstore key from a given key.

For example, `flat/repo2122.blame.fileunode.blake2.2e58d897760aa5927c7ca1b0755992c9109be6048a9dc1deab1c86a4619f5839` will give `repo2122.blame.fileunode.blake2.2e58d897760aa5927c7ca1b0755992c9109be6048a9dc1deab1c86a4619f5839`.

Differential Revision: D46802650

fbshipit-source-id: bec63353b1ca50eeeab73cd84b5e3d8fb967c694
2023-06-20 05:17:23 -07:00
Haitao Mei
0b7b932ef6 Implement getting blobstores for a given repo id
Summary:
This diff adds
* a new function to extract repo id from a given key
* a new function to construct all the blobstores given a repo id

Differential Revision: D46763054

fbshipit-source-id: 64bb1ab4fd8bcae8ab414dd03e78f0a7c2dd5639
2023-06-20 05:17:23 -07:00
Youssef Ibrahim
034dc93e70 commit_graph: use fetch_edges_required and fetch_many_edges_required everywhere except in exists, changeset_parents and changeset_generation
Summary: Some of the usages of the commit graph (e.g. in pushrebase) query very recent commits that might not have been fully replicated in xdb yet. This diff switches to using fetch_edges_required and fetch_many_edges_required everywhere except in exists, changeset_parents and changeset_generation, to avoid any errors caused by replication lag. This shouldn't cause any performance degredation as we always use the normal read connection first and only query master in the rare case that a commit is missing from replicas.

Reviewed By: mitrandir77

Differential Revision: D46842804

fbshipit-source-id: 3822d883b079447d0af90c9169cd3db7600f9b25
2023-06-19 14:20:27 -07:00
Youssef Ibrahim
0b9254b329 commit_graph: use fetch_edges_required in changeset_generation_required and changeset_parents_required
Summary: The SQL implementation of fetch_edges_required first tries fetching the changeset edges using the normal read connection, then tries to fetch any missing changesets using the master connection. This can sometimes be the desired behavior when working with very recent commits so let's expose it through changeset_generation_required and changeset_parents_required.

Reviewed By: markbt

Differential Revision: D46796193

fbshipit-source-id: 38b3d79dd88ca4b8b98f36705ca1a215379a87b3
2023-06-19 08:30:20 -07:00
Youssef Ibrahim
1afff25d5b newadmin: add the missing blobstore fetch decodings
Summary: Added the missing blobstore fetch encoding except RedactionKeyList as that require creating a separate config and already has its own newadmin command.

Differential Revision: D46491769

fbshipit-source-id: 82208ac9dcb1acb5370ff7904c285e843be4f18f
2023-06-19 07:08:40 -07:00
Mateusz Kwapich
fbea1eb670 change the megarepo tool to not use commiter date
Summary:
This makes commits created by megarepo tools roundtrippable through bonsais (so far they were not).
D27852341 shows that it's not a problem for actual backup job but.. it's a
problem for example for mirror_hg_commits binary so let's make thos commits
nice and tidy.

Reviewed By: mzr

Differential Revision: D46489608

fbshipit-source-id: d15ba6f6622f51189a1ba9e76efd68faf1bf2b71
2023-06-19 06:28:57 -07:00
Mateusz Kwapich
e058be184f new, faster verification
Summary:
Verification is used to verify if given megarepo mapping configuration can be cleanly applied to given pair of small repo and large repo commits. It's used when we want to change current config and we want to check if according to the new config the mapping is still sound.

The previous *fast path* verification worked by limiting the amount of visited entries to `O(small repo)`

The new fast path verification doesn't walk every file in the repository, instead it leverages FSNodes to compare hashes of entire directories. This was if the repository verifies OK the verification is very fast. The amount of entries visited is `O(differences to report + number of config entries)`. When the configuration is simple and the repository is intact (usual case) it's almost instant. In case of more complex configurations (like ovrsource one) it's still **much** faster than current one.

WARNING: The implementation is a bit hacky due to the path mover functions being orignally designed with moving file paths not, directory paths. The hack is mostly contained to wrap_mover_result functiton.

Differential Revision: D45864549

fbshipit-source-id: 2fad0ed29a5718e655fa4a69b28306ca3db31dda
2023-06-19 03:38:35 -07:00
Mateusz Kwapich
6dc96eaecf add committer date and time support
Summary:
I want to test for some bug in megarepotooling and I'd like to use that
feature.

Differential Revision: D46440647

fbshipit-source-id: 1f4bb0d937f6e681a02f9843a7241fde4ae9b774
2023-06-19 03:33:58 -07:00
Mateusz Kwapich
b15dc88eb6 add author_date
Summary: For completeness it would be great to have it.

Differential Revision: D46440646

fbshipit-source-id: 0c57ab1a5b865ba3a93cc46ac92c9345e2a39d86
2023-06-19 03:33:58 -07:00
Mateusz Kwapich
b203146f0f add committer and committer date to test commits
Summary:
Some of our commits have those fields set so let's allow setting them on test
commits.

Differential Revision: D46440648

fbshipit-source-id: 393d9fcb616ddee5481f239264ab87bf5c8315e9
2023-06-19 03:33:58 -07:00
generatedunixname89002005320047
34e5d05ffe Migrate "eden/testlib" from LLVM-12 to LLVM-15
Summary:
fbcode is migrating to LLVM-15 for safer and more up-to-date code and new compiler features. All contbuilds in your directory have passed our build test with LLVM-15, and your directory does not host any packages. This diff will migrate it to LLVM-15.

If you approve of this diff, please use the "Accept & Ship" button. If you have a reason for why it should not build with LLVM 15, please make a comment and send it back to author. Otherwise we will land this on Thursday 06/15/2023.

See the [FAQ post](https://fb.workplace.com/groups/llvm15platform010/posts/749154386769776/)! Please also direct any questions to [this group](https://fb.workplace.com/groups/llvm15platform010).

 - If you approve of this diff, please use the "Accept & Ship" button :-)

Build directives:

Reviewed By: meyering, zzl0

Differential Revision: D46662743

fbshipit-source-id: 1af43eea7bb103d29f3b409634f1b7a60ae84c88
2023-06-17 22:06:53 -07:00
Chad Austin
d110d684f2 hooks: allow other nocommit spellings
Reviewed By: mzr

Differential Revision: D46464575

fbshipit-source-id: d2cf8059062ea68f465a5db40185f0faec3b89e3
2023-06-16 14:53:10 -07:00
Shayne Fletcher
ca860fbcef Update autocargo component on FBS:master
Reviewed By: zertosh

Differential Revision: D46811187

fbshipit-source-id: 5d4e3993ccbc3871bf56495822d15de8d73f832c
2023-06-16 14:06:54 -07:00
Mateusz Kwapich
f7e8639689 option to rewrite dates in forward syncer
Summary:
We need that for current catchup to avoid confusing clients with backdated
commits.

Reviewed By: markbt

Differential Revision: D46743487

fbshipit-source-id: a71ee30eada63dab7c64cbe43a4495662fe04371
2023-06-16 04:08:02 -07:00
Mark Juggurnauth-Thomas
8eed042d80 cmdlib_caching: remove deprecated cachelib options
Summary: Remove the deprecated `--skip-caching`, `--blobstore-cachelib-only` and `--cachelib-only-blobstore` options.

Reviewed By: clara-9

Differential Revision: D45089767

fbshipit-source-id: 52707ce00865bfd9ed7e09f0df4f6ce190ac7481
2023-06-16 03:21:13 -07:00
Mark Juggurnauth-Thomas
32d13cc799 walker: specify cache-mode default
Summary: Walker previously specified a default for the deprecated `cachelib-only-blobstore` argument.  Switch to `cache-mode`, allowing us to specify local caching for all types, not just the blobstore.

Differential Revision: D45089769

fbshipit-source-id: 978ac545590935be5a825669db9df58f0281c41a
2023-06-16 03:21:13 -07:00
Jan Mazur
f34aeb993a show the path used when cert is not found
Summary: This is useful for debugging

Reviewed By: zzl0

Differential Revision: D46736892

fbshipit-source-id: cd8521b46c650888ec75ed0782f2792ae8ffdcff
2023-06-15 22:22:54 -07:00
Muir Manders
33e1d136d6 tests: enable rust status for test-commit.t
Reviewed By: sggutier

Differential Revision: D45510006

fbshipit-source-id: d7c8768762a0131be3cf1aebfddec6454d58f308
2023-06-15 19:48:34 -07:00
Muir Manders
2b6c27c219 workingcopy: ignore Git submodules in "status"
Summary: To avoid showing a bunch of "?" files, we need to ignore things within submodules. For watchman, we do similar to Python and add submodules to the ignored dirs list. For the manual walker, we similarly skip directories in the ignore list. Note that the walker already skipped the submodules due to the presence of the "dot dir" (e.g. ".sl") in the submodules, but I piped through the ignored dirs skipping to be consistent.

Reviewed By: quark-zju

Differential Revision: D46547238

fbshipit-source-id: b001dc02a3c73f69d74fe36615a812f9ac983944
2023-06-15 19:48:34 -07:00
Muir Manders
ae180addae status: fallback to Python for Git repos
Summary: Python status for Git has submodule aware logic we don't have in Rust, so we need to defer to Python. However, Python will still be able to use the internal Rust status API.

Reviewed By: zzl0

Differential Revision: D46547239

fbshipit-source-id: 2caf1436819219cea007307f602627fd1a38ef51
2023-06-15 19:48:34 -07:00
Muir Manders
9c2de6e351 workingcopy: kill SingleWalker fs walker
Summary: It wasn't used from Rust (only MultiWalker(threads=8) was used), and Rust walker is not enabled from Python. It's annoying to have to make changes twice, so let's kill the non-parallel walker.

Reviewed By: zzl0

Differential Revision: D46547240

fbshipit-source-id: 4a57222ec705059acbc6865f8e1a9701ae584ccc
2023-06-15 19:48:34 -07:00
Muir Manders
1648d2a0a6 filesystem: remove rust walker support
Summary: This wasn't enabled in production, and the parallel walker doesn't currently work from Python due to matcher GIL deadlock. Anyway, I'm working to make Python use the Rust status directly, so this intermediate optimization of using the Rust walker in the Python status won't buy us anything.

Reviewed By: zzl0

Differential Revision: D46646007

fbshipit-source-id: 645d88adb85700062c3edf2483fb5a5ffb76cca2
2023-06-15 19:48:34 -07:00
Muir Manders
c620498ea3 repo: add storage format type/methods
Summary: These make it more convenient to conditionalize logic based on storage format.

Reviewed By: zzl0

Differential Revision: D46547242

fbshipit-source-id: ef833c954090f5cb2b1c2c6e616d5d67a442886d
2023-06-15 19:48:34 -07:00
Muir Manders
d8a436f3f5 git: move ".gitmodules" parsing to Rust
Summary: I'm going to use this to skip submodules in the Rust status implemenation.

Reviewed By: zzl0

Differential Revision: D46547241

fbshipit-source-id: e5cf5dc5ee77aa3e8927ab3cf5922f3e29a25ae5
2023-06-15 19:48:34 -07:00
Eddie Shen
5db8c486ab Replace remaining atty usages with stdlib
Summary:
`std::io::IsTerminal` was stabilized in 1.70. It is intended to be a drop in replacement for `atty::is(Stdout)`.

This codemod removes all remaining instances of atty

`arc f` was ran twice, followed by two invocations of `arc lint -e extra --take RUSTFIXDEPS`. `arc autocargo` was also ran

This script was a little naive though, and as a result, I had to manually move the newly added imports to the correct line. I ran lints again afterwards.

Reviewed By: dbxfb

Differential Revision: D46736264

fbshipit-source-id: a686b96b1fa0aa4389f65487ed426f226c86e8e9
2023-06-15 18:42:33 -07:00
Mateusz Kwapich
e7b8e8b8b5 option to skip syncing empty commits
Summary: www has lots of empty commits that are being synced to all small repos. Until we fix that problem let's refrain from backsyncing any empty commits. I'm making it a tunable for easy on-off

Reviewed By: liubov-dmitrieva

Differential Revision: D46727657

fbshipit-source-id: 5f204cc8231fec3e6a4eaf25b6575c0d637d67a3
2023-06-15 08:46:20 -07:00
Pierre Chevalier
1017a247d0 non-oss work 79/n
Summary:
[plan_deletion] Implement `commit-deletion-plan-to-deletion-log-db` subcommand

This is the last necessary step before enacting the deletion.
As the outcome of this step, the deletion_log db is populated and we can start taking the necessary steps to safely proceed with the actual deletion of changesets and blobs.

We still need to document and potentially write tools to help with the whole process, including blobs redaction.

Differential Revision: D46724273

fbshipit-source-id: bc60209a28e2ee8a50ac0371f78c0b3be234781b
2023-06-15 07:57:35 -07:00
Haitao Mei
c27e9a8576 new admin tool creates a new struct to implement all features of bulk unlink
Summary: This diff moves all the bulb unlinking functions into a struct.

Reviewed By: mitrandir77

Differential Revision: D46759318

fbshipit-source-id: 143171706485ec6a56152bdfea6202221d88fe03
2023-06-15 07:51:33 -07:00
Haitao Mei
61bcdc04d4 new admin tool making the geting blobstores function for unlinking a key to be public
Summary: This diff makes the `get_blobstores` function to be public, so that we can use it to get blobstores. These blobstores are going to be used to unlink keys in a bulk.

Reviewed By: mitrandir77

Differential Revision: D46729000

fbshipit-source-id: 11d7ddc5f90527ebdb79141f61f1671997108ac5
2023-06-15 07:51:33 -07:00
Haitao Mei
f76eb1f9c6 new admin tool bulk unlink keys subcommand read keys from all files
Summary:
This diff allows the new admin tool to do the following for the new bulk unlking keys subcommand:
* Read the key list from the files
* Print all the keys extracted when running in dry-run mode
* Report the progress
* Fix the argument to take a boolean value

Reviewed By: mitrandir77

Differential Revision: D46725312

fbshipit-source-id: c039b89e00a9ffbbbee41e20617f45543ef147ce
2023-06-15 07:51:33 -07:00
Haitao Mei
b556d7cc08 Adding a new command to bulk unlink keys into new admin tool
Summary: This diff adds a new subcommand for our new admin tool, so that we can delete keys bulkly. The input is the directory that contains a list of files, each file contains a list of *Manifold* keys to remove.

Reviewed By: mitrandir77

Differential Revision: D46689957

fbshipit-source-id: 077b6a4c76872ef01bc7f0eab7096abeb87d7047
2023-06-15 04:17:16 -07:00
Eddie Shen
842b985bd4 Replace atty::is(Stdout) with stdlib
Summary:
`std::io::IsTerminal` was stabilized in 1.70. It is intended to be a drop in replacement for `atty::is(Stdout)`.

This codemod replaces all usages of `atty::is(Stdout)` with `stdout().is_terminal()`, importing the necessary paths.

It used this script (generated with assistance from Metamate):
```
#!/bin/bash

files=$(fbgs -sl "atty::is(atty::Stream::Stdout)" | arc linttool debugfilterpaths --take RUSTFMT)

for file in $files; do
  sed -i 's/atty::is(atty::Stream::Stdout)/stdout().is_terminal()/g' $file
done

for file in $files; do
  sed -i '1i use std::io::{stdout, IsTerminal};' $file
done
```

`arc f` was ran twice, followed by two invocations of `arc lint -e extra --take RUSTFIXDEPS`.

This script was a little naive though, and as a result, I had to manually move the newly added imports to the correct line. I ran lints again afterwards.

Reviewed By: danielocfb

Differential Revision: D46601191

fbshipit-source-id: 3f2269c518e36241ab0e995b87976323d7da9cc6
2023-06-14 15:29:14 -07:00
Eddie Shen
39b6073961 Replace atty::is(Stderr) with stdlib
Summary:
`std::io::IsTerminal` was stabilized in 1.70. It is intended to be a drop in replacement for `atty::is(Stderr)`.

This codemod replaces all usages of `atty::is(Stderr)` with `stderr().is_terminal()`, importing the necessary paths.

It used this script (generated with assistance from Metamate):
```
#!/bin/bash

files=$(fbgs -sl "atty::is(atty::Stream::Stderr)" | arc linttool debugfilterpaths --take RUSTFMT)

for file in $files; do
  sed -i 's/atty::is(atty::Stream::Stderr)/stderr().is_terminal()/g' $file
done

for file in $files; do
  sed -i '1i use std::io::{stderr, IsTerminal};' $file
done
```

`arc f` was ran twice, followed by two invocations of `arc lint -e extra --take RUSTFIXDEPS`.

This script was a little naive though, and as a result, I had to manually move the newly added imports to the correct line. I ran lints again afterwards.

Reviewed By: Imxset21

Differential Revision: D46601192

fbshipit-source-id: 18ef53a9fa25cbd733ca81f16b2c13ce8c5ddb98
2023-06-14 15:29:14 -07:00
Rajiv Sharma
c81071e34e Allow bypassing read-only status in gitimport
Summary: `gitimport` is typically used for mirror repos which by definition are locked. Creating or moving bookmarks on locked repos is disallowed by default. This behaviour can be overriden by passing the bypass flag. This diff adds argument support for bypassing the read-only check.

Differential Revision: D46722005

fbshipit-source-id: 9defcbc159a55d0e7ff197d8d732e3d5a208a998
2023-06-14 12:32:56 -07:00
Mark Shroyer
440f9da305 Use EDEN_TRY macro in FileUtils
Summary: Use the EDEN_TRY macro to reduce error-handling line noise.

Reviewed By: genevievehelsel

Differential Revision: D46668011

fbshipit-source-id: bb54ff710928b3a5c394b6e79474c25ef4775895
2023-06-14 12:16:45 -07:00
Mark Shroyer
46dde446e4 EDEN_TRY macro
Summary: Adds a macro to simplify bailing out of Try-returning functions, sort of like with Rust's question mark operator.

Reviewed By: chadaustin

Differential Revision: D46567326

fbshipit-source-id: f13eec678a101e423a99ba469a20d6de5513d73c
2023-06-14 12:16:45 -07:00
Zhaolong Zhu
ca12e2a75b bisect: optimize the check against skip revset
Summary: optimize the check against skip revset by reusing the unskipped result.

Reviewed By: muirdm

Differential Revision: D46687070

fbshipit-source-id: 01e5be4499daaa9e24437ddb16e2cc04f0436211
2023-06-14 12:08:24 -07:00
Zhaolong Zhu
a7e82b1613 bisect: support lazy evaluation for 'skip' option
Summary:
Currently, the 'skip' option is too slow when users want to use it to bisect on
a file or folder like below:

    sl bisect --skip "!( file('path:foo') & file('path:bar') )"

Since it tries to eval the skip revset upfront, which takes a long time for
current `file` implementation. This diff make it lazy evaluated.

Reviewed By: muirdm

Differential Revision: D46643574

fbshipit-source-id: c063fbea2bc0703772e07d5167adc8fbf989a68f
2023-06-14 11:07:02 -07:00
Zhaolong Zhu
38c190a35a bisect: add test for skipping revset
Summary: as title

Reviewed By: muirdm, sggutier

Differential Revision: D46643573

fbshipit-source-id: 1c1a46760667fc2b10623b709762eb1cbd9ba53e
2023-06-14 11:07:02 -07:00
Zhaolong Zhu
d0eff8a035 bisect: check bisect kind earlier
Summary:
move the bisect kind check earlier, so that it will not do unnecessary
node lookup

Reviewed By: sggutier

Differential Revision: D46643576

fbshipit-source-id: 624c6410aaf95f82a993093df4e24add6c5e48ea
2023-06-14 11:07:02 -07:00
Zhaolong Zhu
1c6609998e bisect: make state file format support 'revset' string
Summary: this will be needed for making 'skip' lazy evaluated

Reviewed By: muirdm

Differential Revision: D46643575

fbshipit-source-id: 53cfe2395d320d85582fbf707f62d69a5088bea2
2023-06-14 11:07:02 -07:00
Zhaolong Zhu
9772bf3c76 bisect: abstract a separate for updating state
Summary: we will update this function in the following diffs, abstract it to a separate function will avoid making the main function too complex

Reviewed By: muirdm

Differential Revision: D46643577

fbshipit-source-id: 227e0b60fe2efa1d6d00fa409ea95a30cc972747
2023-06-14 11:07:02 -07:00
Haitao Mei
354da6c438 newadmin tool now deletes keys from all the related blobstores II
Summary: We handle the error gracefully, when deleting a key from the underlying blobstores.

Reviewed By: RajivTS

Differential Revision: D46684795

fbshipit-source-id: 45349aab01e56b11fd1ab455aec2bb69d72c497b
2023-06-14 04:27:47 -07:00
Barys Skarabahaty
6e0743ebfc treat a failed blob metadata parse as missing cache
Summary:
If there's corruption in the cache, it should be considered a miss,
rather than failing.

Reviewed By: chadaustin

Differential Revision: D46577606

fbshipit-source-id: 4cc99e743e869422a149a073b726722896d971d4
2023-06-14 04:17:43 -07:00
Zhaolong Zhu
d3eaf5a42f copytrace: disable dagcopytrace for source missing files
Summary:
The dagcopytrace was enabled for source missing file in D46315431.

It's too slow if there are many files deleted in the source commit. I will debug the root cause tomorrow, let's disable it for hg repo first. We are not disabling it for git repo, because there is not alternative for git repos.

Reviewed By: muirdm

Differential Revision: D46711460

fbshipit-source-id: 4e20bbb34be126c13af081475953b83df61872df
2023-06-13 22:00:44 -07:00
Genevieve (Genna) Helsel
bcdb3c926f add Counters for failed local store lookups
Summary: Adding to track possible corruption issues we've been getting user reports about

Reviewed By: chadaustin

Differential Revision: D46706164

fbshipit-source-id: 6a868d9f9ffd3f72303123486bbb8312f2002072
2023-06-13 18:05:20 -07:00
Jan Mazur
5da5975071 import async-fcgi and http-body; add stream feature to hyper
Summary: Importing into third-party

Reviewed By: zertosh

Differential Revision: D46639634

fbshipit-source-id: c9eb7d056e75ae2c5d9a8bb9bcc781d419f65f4c
2023-06-13 17:56:22 -07:00
Haitao Mei
5f58f37936 newadmin tool now deletes keys from all the related blobstores
Summary: This diff allows the new admin tool to delete keys from all the related blobs (either the single blobstore specified by the id, or all the underlying blobstore given a repo)

Differential Revision: D46564415

fbshipit-source-id: d0299262a82acb4e1a9f4cedd5510418f270d527
2023-06-13 09:33:07 -07:00
Haitao Mei
8941996184 newadmin tool: adding a new func to construct all the underlying blobstores for multiplexed blobstre
Summary:
This diff adds a new function to construct multiple blobstores from a given repo.

The finaly step is to refactoring the existing `get_blobstore` function.

Reviewed By: RajivTS

Differential Revision: D46559402

fbshipit-source-id: 9b9901d00566556614264831f8643f7c6d4ee20f
2023-06-13 09:06:56 -07:00
Rajiv Sharma
eb70d07aeb Make statistics_collector job honor cancellation requests
Summary: Running a job in sharded setting requires it to support pre-emption in case ShardManager decides to move the repo around. This diff adds support for that pre-emption.

Differential Revision: D46514772

fbshipit-source-id: fb086e74a9c56e0ced5921877de49401bc426170
2023-06-13 04:01:12 -07:00
Rajiv Sharma
67a3a25555 Shard statistics_collector command
Summary: As in title. This tool is currently run as 5-6 different TW jobs that compute and publish data for specific repos. Instead of having multiple jobs, if we manage to shard this job across set of available tasks, it becomes much more easier to manage.

Differential Revision: D46483039

fbshipit-source-id: d7d879dee088c8f431c22915bd7ef9602b83aa00
2023-06-13 04:01:12 -07:00
Andres Suarez
af0f829543 Update strum and enable the derive feature
Reviewed By: diliop

Differential Revision: D46672815

fbshipit-source-id: e372ab53fd8f71b1011f8e1065c7d0ba38485c7a
2023-06-13 03:32:44 -07:00
Mark Shroyer
df148d223e Hostname normalization Python implementation
Reviewed By: xavierd

Differential Revision: D46503425

fbshipit-source-id: dae33a377a656d14c55f6095aea38b208d3e8c8d
2023-06-12 16:59:17 -07:00
Mark Shroyer
bd8b347dc7 Hostname normalization C++ implementation and test cases
Reviewed By: xavierd

Differential Revision: D46300186

fbshipit-source-id: f4784e03eb8d2f055db2015ee326ae24bc63de26
2023-06-12 16:59:17 -07:00
Mark Shroyer
056e016af7 Return correctly-sized string from win32 readFile
Summary:
In the win32 implementation of `readFile`, the ret string wasn't being resized
to the number of bytes actually read, which may be smaller than given in
`num_bytes`. This change makes it match the behavior of folly's readFile.

Reviewed By: xavierd

Differential Revision: D46532796

fbshipit-source-id: 1da3e4ff4190673796731610ae8a798b953d0c96
2023-06-12 11:11:55 -07:00
Haitao Mei
f98f3e94e6 newadmin tool: adding a new func of constructing a single blobstore from config and inner_id
Summary:
This diff adds a new function of constructing a single blobstore from config and inner_id.

Next step is to add a new function to construct multiple blobstores from a given repo.

The finaly step is to refactoring the existing `get_blobstore` function.

Reviewed By: RajivTS

Differential Revision: D46559565

fbshipit-source-id: b59e77e13fbe76ba013caa62bfeb9f56cbcf31d2
2023-06-12 07:50:08 -07:00
Haitao Mei
1a8a6bb35b newadmin tool: Construct blobstore inner ids from a multiplexed blobstore
Summary: This diff added a function to retrieve all the inner blobstore ids from a given multiplexed blobstore.

Reviewed By: RajivTS

Differential Revision: D46523044

fbshipit-source-id: e4c3b02e1672bc2eea3208bac4f23d879c004515
2023-06-12 07:50:08 -07:00
Youssef Ibrahim
49693566a4 remove mention of skiplist in comment
Summary: What are skiplists?

Reviewed By: mitrandir77

Differential Revision: D46640446

fbshipit-source-id: 485d3615a8344b3c217a3a378d37c231603c51a6
2023-06-12 05:13:04 -07:00
Rajiv Sharma
f65ed93617 Migrate statistics_collector to new Mononoke App
Summary: Now that the `blob_repo` dependency has been removed from `statistics_collector`, this diff migrates the tool from old Mononoke App to new Mononoke App getting rid of the old clap dependency.

Differential Revision: D46478775

fbshipit-source-id: dd713eef2175fa01934508445866d64ef01657f0
2023-06-12 03:41:37 -07:00
Barys Skarabahaty
429d9a6655 Add data integrity checks
Summary: In order to better understand what happens in cases described in https://fb.workplace.com/groups/edenfswindows/permalink/1315557692693439/ adding better logging and some data integrity checks.

Reviewed By: chadaustin

Differential Revision: D46605682

fbshipit-source-id: 485c5c83834cdde9ccfea9cfa94323cf03df7002
2023-06-09 14:29:55 -07:00
Katie Mancini
f4da0e5eb5 Add missing inodes in windows doctor
Summary:
eden doctor can discover when an inode is missing for a file, but can't
remediate the issue. restart usually remediates the issue, but it would be
better to have doctor remediate since restart can be very slow.

We could do something similar to our remediation for phantom inodes (performing
a filesystem operation). However, messing with the filesystem leaves us open to
races with concurrent modifications. The point of the filesystem io is to make
eden see a notification about a certain path and match it's state to the
filesystem. So we can directly do that instead.

We can more directly do this by introducing a thrift call to make eden match
it's internal state to the filesystem.

We could replace the other remediation with this thrift call. I'll leave that
for a follow up.

Reviewed By: xavierd

Differential Revision: D46243633

fbshipit-source-id: a1df5929428dc4f6c8fd71d826fe1e7371ebf283
2023-06-09 11:52:50 -07:00
Katie Mancini
5512c63552 gather all prjfs integration test basics
Summary:
We've got a couple sets of prjfs tests now and they have some utility functions.
Let's move this all into a base class so it can easily be reused.

Reviewed By: xavierd

Differential Revision: D46379827

fbshipit-source-id: c4b708a1effebe5f11c97a63519295be625c8018
2023-06-09 11:52:50 -07:00
Zhaolong Zhu
f570a5fe68 fbscmquery: optimize expensive repo scan
Summary:
`subset.filter(lambda r: False)` triggers an expensive repo scan. This
diff optimize that with an explicit empty smartset.

Reviewed By: quark-zju

Differential Revision: D46266771

fbshipit-source-id: bb6c8b4842369d3e165183bef0e22c3cb524111a
2023-06-09 09:05:58 -07:00
Liubov Dmitrieva
e753758d9f eliminate completely unnecessary traffic to commit graph endpoint
Summary:
eliminate completely unnecessary traffic to commit graph endpoint for
main bookmark (for segmented changelog supported repos, they use pull_fast_forward_master edenapi endpoint)

After the fast path pull being completed, the filtration of what is already
present wasn't working correctly. It could easily skip (not to be able to
filter out) what was just fetched via the fast path.

That resulted in completely unnecessary traffic to commit graph (which is
slower, especially for large bits of the master branch).

During the SEV that traffic was super expensive due to the www merge commit, but even without SEV this traffic leads to unnecessary load on our services especially if the repo is significantly behind master.

The solution is to invalidate caches.

Differential Revision: D46590498

fbshipit-source-id: c8d920f4ffd3411297ca7cd01368b731f3c2236e
2023-06-09 06:55:36 -07:00
Liubov Dmitrieva
ed5e7f19fe fix incorrect logging to scuba number of slow path heads
Summary:
fix incorrect logging to scuba number of slow path heads

it makes more sense to log after the filter I think because in this case it
would mean how many we need to pull via commit graph (slower) path

Reviewed By: zzl0

Differential Revision: D46559984

fbshipit-source-id: 4059c189afbb6ecc1dea69f0726af7b00e576f74
2023-06-09 02:52:25 -07:00
Zhaolong Zhu
3063e1e9c6 http-client: fix compiler warning
Summary:
```
warning: use of deprecated associated function `openssl::pkcs12::Pkcs12Builder::build`: Use Self::{name, pkey, cert, build2} instead.
   --> /data/users/zhaolong/fbsource/fbcode/eden/scm/lib/http-client/src/request.rs:885:36
    |
885 |     let pkcs12 = Pkcs12::builder().build("", "", &key, &cert)?;
    |                                    ^^^^^
    |
    = note: `#[warn(deprecated)]` on by default
```

Reviewed By: sggutier

Differential Revision: D46570706

fbshipit-source-id: 8999ed3119f9dd6fc8721110758c4f18ddf04fd7
2023-06-08 18:15:14 -07:00
Zhaolong Zhu
9e1948bc40 copytrace: add test for git to prevent regression
Summary: add test for testing missing files in destination

Reviewed By: quark-zju

Differential Revision: D46570174

fbshipit-source-id: b0284b2df34301e90a0c1761f9de6866f69e8a54
2023-06-08 18:11:52 -07:00
Zhaolong Zhu
84aff19dd7 debugcopytrace: use repo._dagcopytrace instead of creating one explicitly
Summary:
we have added repo._dagcopytrace property in a previous diff, let's
use it in the debugcopytrace command

Reviewed By: quark-zju

Differential Revision: D46570173

fbshipit-source-id: 729c12160e8f0ce89ae07a5c94ca98852bbaf68f
2023-06-08 18:11:52 -07:00
Jun Wu
e6c079025d hgcommands: do not collect process tree information on Windows
Summary: Profiling shows the overhead is too much.

Reviewed By: zzl0

Differential Revision: D46569345

fbshipit-source-id: 1676dde7418fff720837a381a7bbffa46734a839
2023-06-08 14:36:13 -07:00
Liubov Dmitrieva
19b1645eae update master bookmark on pull
Summary:
update master bookmark on pull

update of the master bookmark normally uses fast path for most of the repos

pulling of bookmarks is the first thing the repo.pull implementation does, if
after that the commit is present in the repo, slow path pull won't be called

otherwise, we are calling slow path pull for fetching a chunk of main branch

if the clone is old, it is a long chunk, if there are merges, it gets even
more complicated for the slow path pull

the current version seems to have the issue with phases as well, then you restore snapshot from old clone, you got enormous smartlog.

Differential Revision: D46556754

fbshipit-source-id: a771a856813d513cd34b207ea76f1a410dc0b1c0
2023-06-08 07:39:08 -07:00
Muir Manders
4fb979aefa fix test-checkoutidentifier-commitinfo.t
Summary: Failing after D46432233.

Reviewed By: sggutier

Differential Revision: D46546195

fbshipit-source-id: 933b4121e5c2a417248ea07e33d671a9ac23e0ec
2023-06-07 19:53:17 -07:00
Muir Manders
26bb24a141 pager: fix pager shutdown on ctrl-c
Summary:
After previous commit D46473305, ctrl-c is no longer handled by streampager in "direct" mode since streampager isn't polling for user input. This leaves the terminal in a funny state since streampager doesn't clean up.

Fix by waiting up to 10ms for streampager to shut down after we send it the "quit" action. I had to make the "direct" mode in streampager actually handle the "quit" action.

Reviewed By: quark-zju

Differential Revision: D46474536

fbshipit-source-id: 11df5849ea13ac530e169bdba33d5061a77647e0
2023-06-07 18:58:45 -07:00
Muir Manders
8c6d17f047 streampager: use recv_timeout instead of try_recv+sleep
Summary: Tweak the "direct" mode run loop to use recv_timeout on the event channel instead of a try_recv+sleep. This allows it to respond faster to events (in particular, I'm going to make it support "quit" in following commit).

Reviewed By: zzl0

Differential Revision: D46508080

fbshipit-source-id: efb1261324b2720baaa1960fae60a3b09f4d82ce
2023-06-07 18:58:45 -07:00
Muir Manders
7930ea96a8 streampager: don't consume input in direct mode
Summary:
Command line users commonly type their next command before the current command has finished (or, they paste in a series of commands all at once). Previously if one of the commands invoked the streampager, all remaining pending input to the terminal would get lost. This was because streampager would always put the terminal into raw mode, which loses pending input AFAICT. Raw mode also disables terminal echo, which is also undesirable for streampager "direct" mode.

Fix by deferring enablement of raw mode until it is needed. I also disabled the startup_poll_input option since that requires raw mode in order to poll for user input. This means a user can't type "q" or "h" anymore in direct mode, but I think that is a worthwhile tradeoff since users probably don't even know they are in a pager. This makes streampager behave more like "less -F".

Reviewed By: zzl0

Differential Revision: D46473305

fbshipit-source-id: 4523050bc6c8b96d0f37e2b6078555aa23ae2b28
2023-06-07 18:58:45 -07:00
Youssef Ibrahim
ca5bec76d0 commit graph: gate disabling memcache when prefetching behind a tunable
Summary: Makes it easier to disable

Differential Revision: D46525777

fbshipit-source-id: 5ba4df213de8aba7b427ccb1db7bdbc99ae58532
2023-06-07 12:34:07 -07:00
Muir Manders
103e652069 commit_info: log repo name as well
Summary: Log repo name as well as commit hash and other commit info.

Differential Revision: D46432233

fbshipit-source-id: dff22dd00297d3d5694f09a2b64ef7d6c4b7c87e
2023-06-06 20:35:16 -07:00
Ilia Medianikov
b5a891a003 mononoke/vpn_less: add new AuthorizationContext type to replace ad-hoc checks scattered across push code
Summary: This is a refactor aimed to retain the same behavior while consolidating the code and improving it's resilience to future changes.

Reviewed By: mitrandir77

Differential Revision: D46190582

fbshipit-source-id: a956f5df1044c52346a712e271c75baf298b481d
2023-06-06 13:20:30 -07:00
Xavier Deguillard
1b2abb2006 prjfs: move PrjfsChannel::start onto PrjfsChannel::initialize
Summary:
In the case where PrjfsChannel::start failed to initialized, EdenFS would crash
due to the stopPromise_ not being fulfilled. That promise is being set in the
PrjfsChannel::stop method, but unfortunately, when start throws, the caller
wouldn't catch the exception.

To fix this, we can simply move all the code in the initialize method, which if
it throws, the caller already properly tears down the mount thus solving the
crash mentioned above.

Reviewed By: genevievehelsel

Differential Revision: D46210460

fbshipit-source-id: 1524e8e0fc74ce3119b1b6dcd35b5419efcebdf3
2023-06-06 12:36:24 -07:00
Jun Wu
b1893b6b35 smartset: optimize 'generatorset & set' by applying a cutoff
Summary: See the previous commit for context.

Reviewed By: muirdm

Differential Revision: D45959185

fbshipit-source-id: ff60352111d175fa9dfd9609e0a1bb2a15dd776e
2023-06-06 11:13:25 -07:00
Jun Wu
f94acf4425 smartset: add a test case about slow 'generatorset & set' behavior
Summary: See the added test for context.

Reviewed By: muirdm

Differential Revision: D45959186

fbshipit-source-id: e437d8dc51b3730504528ee836632ed0b5ebe088
2023-06-06 11:13:25 -07:00
Jun Wu
b397acb61d smartset: add comment about generatorset iteration order
Summary: It's not obvious until reading the code.

Reviewed By: muirdm

Differential Revision: D45959182

fbshipit-source-id: ce34e070611a01b59c6bbcc8d2c4b9548b30f0f2
2023-06-06 11:13:25 -07:00
Jun Wu
8491b19eda smartset: implement fastmin, fastmax for nameset
Summary:
The Rust `NameSet` tracks O(1) `min`, `max` in its `Hints` structure.
Use it to implement `fastmin`, `fastmax`. This is used by the next change.

Reviewed By: muirdm

Differential Revision: D45959181

fbshipit-source-id: a0a506243610914c879978715c59e1277863508d
2023-06-06 11:13:25 -07:00
Jun Wu
0accc73395 smartset: add fastmin, fastmax methods
Summary:
Similar to `fastlen`, these methods return `None` if the information cannot be
computed quickly.

Reviewed By: muirdm

Differential Revision: D45959183

fbshipit-source-id: 4c693eab2122c12bad40d8c9e9ab228f6d1f5057
2023-06-06 11:13:25 -07:00
Jun Wu
e5a2d8d634 fastlog: optimize set intersection
Summary:
Optimize fastlog follow() revset to avoid iterating on the slow `subset` for
both ASC and DESC order.

Reviewed By: muirdm

Differential Revision: D45936985

fbshipit-source-id: 951af6d82376d0256c25b03af531a49d45a01559
2023-06-06 11:13:25 -07:00
Jun Wu
cd6d9856ab log: attempt to use follow() even without -f
Summary:
For commands like:

    hg log -r SOMETHING PATH

Use `follow(PATH,heads(SOMETHING))` instead of `_matchfiles(...)` as an optimization.

Reviewed By: muirdm

Differential Revision: D45936986

fbshipit-source-id: 0922fff697b38278f4c33a11f8c9ec66246ae0d9
2023-06-06 11:13:25 -07:00
Jun Wu
16be4f07ad remotefilelog: do not set --removed flag to the log command
Summary:
The behavior was added by D2634918. It sets `--removed` with the intention of
forcing the "slow path", in other words, "do not use filelog() path". It does
not really care about the `--removed` behavior.

Note: tweakdefaults might add the `--follow` flag, depending on whether
tweakdefaults or remotefilelog runs first, the `--removed` flag might be added
undesirably if tweakdefaults is going to add `--follow` next.

Anyway, with D45936982, the `filelog()` code path knows to disable itself
for remotefilelog repos. So there is no need for remotefilelog to use
`--removed` to disable the `filelog()` code path. Let's remove it so we can
get the true `--removed` flag decided by the user.

Reviewed By: muirdm

Differential Revision: D45936984

fbshipit-source-id: e800c09d0489e84e01a7d0b499a6d31963c73bf6
2023-06-06 11:13:25 -07:00
Jun Wu
8b4d7bf1f4 log: further rewrite _makelogrevset to be less cryptic
Summary:
The `_makelogrevset` feels cryptic due to the intertwined deeply nested
conditions about what strategy it uses to generate the revset.

This diff makes the strategies more explicit by using dedicated functions to
make the code (and future changes) easier to reason about.

Reviewed By: muirdm

Differential Revision: D45936982

fbshipit-source-id: 531464a1dc16e2e0b4aa61eda49a6c87488ae23b
2023-06-06 11:13:25 -07:00
Jun Wu
e0afcd18bd log: partically rewrite _makelogrevset to be less cryptic
Summary:
The `_makelogrevset` feels cryptic, partially because its use of `opt2revset`
and related logic for adhoc revset expression calculation.

This diff removes `opt2revset` and related logic, so:
- `opts` is no longer both input and output. It's only input. The output is a
  different variable.
- Use `revsetlang` APIs to format revset strings directly, without going
  through an indirection via `opts`. Avoid `repr` or `a % b` formatting.
  Note: `%d` is formatted as `_intlist(v)` instead of `rev(v)`.

The new code generates slightly simpler revset expressions with less `()`s
(or "group" in revsetlang AST).

Reviewed By: zzl0

Differential Revision: D45936983

fbshipit-source-id: 3155016a85fa9ea61f9334a2d1fc82eac5450fec
2023-06-06 11:13:25 -07:00
Jun Wu
b49ad5cac6 revset: kill _firstdescendants
Summary:
It's already the same as `descendants` in our current implementation.
It's non-trivial to implement efficiently and is rarely used. So let's just
remove it for now.

Note the order of children of a commit is undefined, unlike parents. If we want
to provide a "meaningful" order and implement this in the future we might want
to use commit date etc to sort children.

Reviewed By: zzl0

Differential Revision: D45936979

fbshipit-source-id: bff72a130a5ffb7c573f06374da8f9c02791049f
2023-06-06 11:13:25 -07:00
Jun Wu
1064ae23d4 revsetlang: add %v format for variadic args
Summary: Used by the next change.

Reviewed By: zzl0

Differential Revision: D45936988

fbshipit-source-id: f2edee33bfefe3e5dd90a3cd7bc157d3b537cc0f
2023-06-06 11:13:25 -07:00
Jun Wu
aa8409d980 revsetlang: add "formatlist"
Summary: Useful to chain a list of revset together.

Reviewed By: zzl0

Differential Revision: D45936980

fbshipit-source-id: 1775cd472e239f56971d0b441aae3e416852ea3f
2023-06-06 11:13:25 -07:00
Jun Wu
6ec291990b log: mark "--branch" as deprecated
Summary: Named branches are removed in our implementation. Clean them up in the log command.

Reviewed By: zzl0

Differential Revision: D45936987

fbshipit-source-id: 98d3df01b1f3db53861f886289cb720dccf0535a
2023-06-06 11:13:25 -07:00
Jun Wu
5020be072f log: drop "cannot follow nonexistent file" message
Summary: It's not used anywhere. This removes a dependency on the legacy filelog.

Reviewed By: zzl0

Differential Revision: D45936981

fbshipit-source-id: 1c3af8dc792454d1bf893e922c1c37c80fa0a79b
2023-06-06 11:13:25 -07:00
Jun Wu
e8d0a21746 repo: add storage_format API
Summary: This can simplify logic that checks a bunch of repo requirements.

Reviewed By: zzl0

Differential Revision: D45936978

fbshipit-source-id: eec8ca0035642bf2324782b7fb7e97cb740cc02d
2023-06-06 11:13:25 -07:00
Mateusz Kwapich
28c9cdda53 add make unlink command support more blobstores
Summary: We need that for optimizing our storage.

Reviewed By: RajivTS

Differential Revision: D46362446

fbshipit-source-id: d81973cd05cffdc78ad84da867fa4791efea877c
2023-06-06 08:32:15 -07:00
Rajiv Sharma
17c0fe0da2 Mirgrate away from BlobRepo in StatisticsCollector tool
Summary: As in title. Once `BlobRepo` has been removed from this tool, I will also migrate it to the new `Mononoke Admin`

Reviewed By: mitrandir77

Differential Revision: D46444744

fbshipit-source-id: 059623d32d608f852254f16f811bcaf4e6bf3b4a
2023-06-06 02:48:35 -07:00
Jeremy Fitzhardinge
86c075fca5 third-party/rust: update to text_placeholder 0.5
Summary: This includes PR 7 so drops the patch.

Reviewed By: zertosh

Differential Revision: D46451758

fbshipit-source-id: 5df8ccbfa610eab470744e28b5bffe411a983996
2023-06-06 00:44:17 -07:00
Barys Skarabahaty
0a29c16672 Remove default ctor from BlobMetadata
Summary: Removing the previous default ctor to ensure that we always compute and pass blake3.

Reviewed By: chadaustin

Differential Revision: D46268716

fbshipit-source-id: d9bfbc7bfd07b61dbb2e915c3fe72d7526d919e1
2023-06-05 23:41:35 -07:00
Barys Skarabahaty
8099af29e0 Add getBlake3 method to eden service
Summary: Adding a method to retrieve blake3 hash for a list of files.

Reviewed By: chadaustin

Differential Revision: D46268718

fbshipit-source-id: 59cb3d25a1d059a7e9b6a4da784a820945ffbd32
2023-06-05 23:41:35 -07:00
Barys Skarabahaty
7dba15317f Expose blake3 via file attributes
Summary: Expose blake3 via file attributes and changing some integration tests accordingly. Added blake3_sum so that it could be used to verify blake3 hashes and updated the tests to work with blake3.

Reviewed By: chadaustin

Differential Revision: D46307686

fbshipit-source-id: 6f2a4e8e25757862ef17d56f92b90a95c7f5a474
2023-06-05 23:41:35 -07:00
Barys Skarabahaty
25b673f8d0 Integrate with virtualInode
Summary: Integrating blake3 with virtual inode.

Reviewed By: chadaustin

Differential Revision: D46268717

fbshipit-source-id: c513a71e81691c43b0eada26aa5f1325a79db07b
2023-06-05 23:41:35 -07:00
Barys Skarabahaty
fd3ab81bd3 Add blake3_sum
Summary: This utility binary could be used from the integration tests to compute blake3 hashes as it is easier to have it than adding the python pypi package with native dependencies.

Reviewed By: chadaustin

Differential Revision: D46307685

fbshipit-source-id: 1c48c689312cd9a04a19a62ad02ae3e9185041e5
2023-06-05 23:41:35 -07:00