Commit Graph

382 Commits

Author SHA1 Message Date
Katie Mancini
864a6c1c1a make eden removal on windows a bit more graceful
Summary:
When eden is not running on windows `eden rm` will spit out some error
messages and exits with error code 1. But it does actually successfully
remove the repo.

On linux removing a repo while eden is not running behaves just like if
eden were running.

Let's make the removal more graceful on windows.

Reviewed By: xavierd

Differential Revision: D31519805

fbshipit-source-id: d393922a9474e64251142207ae38a602766f17bf
2021-10-12 10:22:05 -07:00
Zhaolong Zhu
cebe35eb7b Add eden prefetch-profile list output to eden rage
Summary: Add `eden prefetch-profile list` output to `eden rage`

Reviewed By: genevievehelsel

Differential Revision: D31488296

fbshipit-source-id: 216686dba842b8c5cec283627178d3e8c8b2a7e8
2021-10-11 11:21:51 -07:00
Katie Mancini
05806120f5 make eden top xterm-color friendly
Summary:
xterm-color terminals don't support hiding the cursor the way curses likes to.
this crashes eden top for users.

eden top mostly functions fine otherwise in xterm-color, so let's make
this a non fatal error.

Note: the highlighting behavior is a little wierd (the styling after the
highlighted column does not work, no bolding etc). This looks like a wierd
curses bug on these terminals, so not sure if we can really fix this. I figure
a little wierd styling is still better than a crash.

Reviewed By: fanzeyi

Differential Revision: D31480121

fbshipit-source-id: 581ef7c548fd1f7986c4f93d8b797d7f7588c351
2021-10-08 09:43:02 -07:00
Zeyi (Rice) Fan
3e551e4033 cmake: build edenfsctl Rust
Summary: This diff adds the Rust edenfsctl to our open source build.

Reviewed By: xavierd

Differential Revision: D30788685

fbshipit-source-id: 603caa933ecfc5af0ede7e22f6c7911462da3a65
2021-09-29 10:02:09 -07:00
Katie Mancini
6df8ab8faa include kernel protocol in rage
Summary:
Now that we might have multiple kernel protocols per mount (i.e. both fuse and
nfs on macOS) let's include them in eden rage.

Reviewed By: xavierd

Differential Revision: D31154042

fbshipit-source-id: 38e7630829d70fe9dd6dbeabacc3b538ee798e0d
2021-09-24 15:48:24 -07:00
Katie Mancini
5c6157bda0 fix python type error take 2
Summary:
we are passing some bytes into Popen and shlex.quote. shlex.quote expects a
string not bytes. fsencode gives us bytes fsdecode gives us string. Let's used
fsdecode instead.

Reviewed By: zhengchaol

Differential Revision: D31129335

fbshipit-source-id: 7792bdcd4dd833a4946daf8ec75576cfe4fc24af
2021-09-23 10:29:01 -07:00
Genevieve Helsel
4c9b9cd835 add telemetry for eden prefetch
Reviewed By: snufkinsnorka

Differential Revision: D31119378

fbshipit-source-id: 5ee13cbdf27a48eff0bf8e728f33b953c2794516
2021-09-23 09:37:03 -07:00
Xavier Deguillard
55d86a5557 cli: allow skipping chowning redirected directories
Summary:
During an `eden chown`, EdenFS will try to chown both the repository, and the
redirections. In some cases, chowning the redirection can both take a long time
and be unecessary. Consider the case where some automation temporarily chown a
repository to a service user that needs to access the repository, and then
chown it back to the owner of the repository. In that case, changing the
ownership of the redirection is superfluous and unecessary.

Reviewed By: mrkmndz

Differential Revision: D31010912

fbshipit-source-id: a882948005ac4fe29ff465088f196e0fc2bc10be
2021-09-17 09:23:42 -07:00
Katie Mancini
2671e5a4bb fix a python type error in redirect
Summary:
In D29940980 (2e2b9755cf) we used shlex for a redirect subprocess command line.
The list does not always contain strings tho, which is a requirement to use
shlex.quote my guess is that they are paths. We should still str things
before we shlex.quote them.

Differential Revision: D31001622

fbshipit-source-id: 2a270781d7f2d84ad7a9a2f9975500b29306cfa8
2021-09-16 20:23:45 -07:00
Katie Mancini
1e10a6efd5 raise indulde dot files to a command arg
Summary:
We have an option on GlobFiles for listing hidden files, but we don't have a
cli option. We default to false in the cli. Let's pipe this option all the way through.
so that we can control this flag from the cli.

Reviewed By: xavierd

Differential Revision: D30915118

fbshipit-source-id: 28b91d4fd2dd4bdf9e342929f570f64db14e8ad0
2021-09-14 10:02:33 -07:00
Katie Mancini
11da6c1027 prefetch option to only list files
Summary:
`eden prefetch` and `eden glob` return lists that despite being called
"maching files" actually contains both files and directories.

In some cases, we only want the list of files and it introduces unnessecary
overhead on our clients for them to have to stat all the files in the list to
filter out the dirs. Let's add an option to just list files.

Reviewed By: chadaustin

Differential Revision: D30816193

fbshipit-source-id: 6e264142162ce03e560c969a0c0dbbc2f418d7b9
2021-09-14 10:02:33 -07:00
Genevieve Helsel
21c2410a6d pretty print rage sections and normalize underlining
Summary: the rage summary is getting hard to quickly parse, so this underlines each section header, as well as unifies underline looks (with `eden stats`). This adopts the underline code from `eden du` and makes it a util function for shareability.

Differential Revision: D30857773

fbshipit-source-id: 66b5b06f5b0125304d45d3465a8bc2248693b791
2021-09-10 23:54:48 -07:00
Genevieve Helsel
67fb93bf79 print eden config in rage report
Summary: it would be helpful to see a user's or sandcastle job's eden config, especially in the case of a gated feature rollout / staged feature rollout.

Differential Revision: D30857763

fbshipit-source-id: ee2a311ee643fc9db5acef1b02017564c51d2362
2021-09-10 16:27:17 -07:00
Genevieve Helsel
9207e03331 fix typo in cli comment
Summary:
just a typo fix

Created from CodeHub with https://fburl.com/edit-in-codehub

Reviewed By: fanzeyi

Differential Revision: D30849172

fbshipit-source-id: 9779832870c909d080548ec71ecf86aa53767dbc
2021-09-10 16:27:16 -07:00
Genevieve Helsel
62fe933e4e disallow infinite recursion in redirect unmount
Summary: If the bind unmount fails in in the privhelper, theres a possibility of infinite recursion in this method. This adds a flag to indicate if we've tried the bind unmount before.

Differential Revision: D30732857

fbshipit-source-id: 6ee887d211977ee94c8e66531287f076a7e61a2c
2021-09-02 15:00:10 -07:00
Genevieve Helsel
c101e56dec add json option to version
Reviewed By: chadaustin

Differential Revision: D30555962

fbshipit-source-id: 50cf7afa0f30242a5d28b112bae04793e9b55ceb
2021-08-30 22:12:15 -07:00
Zhengchao Liu
f2eb6aee68 fix thread safety issues in ActivityRecorder CLI
Summary:
This addressed 2 thread safety issues:
1. holding strong reference to `EdenMount`
2. converting unowned `stringPiece` to `std::string`

Reviewed By: chadaustin

Differential Revision: D30657955

fbshipit-source-id: 870e972d9e0fe3897e021aeca77bf2db8c5fbb20
2021-08-30 19:30:08 -07:00
Genevieve Helsel
19e9cd2f7a allow specifying log path in eden debug log
Summary: Adds an option to print the path to the eden log file. Similar to `eden pid`, this can be used for shell one-liners.

Reviewed By: chadaustin

Differential Revision: D30558294

fbshipit-source-id: ca70addaef2093e10f0321bae0cff3b1bfc7dc75
2021-08-30 14:16:35 -07:00
Genevieve Helsel
fdb1fe42c6 turn eden debug logs upload into a flag
Summary: `eden debug log --upload` fits in better with the format of the other cli tools (rather than `eden debug log upload`)

Differential Revision: D30557691

fbshipit-source-id: 32e47e1487703560f2adb5f0f79f1002d29eea93
2021-08-30 14:16:35 -07:00
Katie Mancini
6b315d5578 setup buck integration testing
Reviewed By: scottcao, xavierd

Differential Revision: D30003787

fbshipit-source-id: fcf387ba37a7443fdbf56520e387fc008be0bf37
2021-08-25 17:32:14 -07:00
Genevieve Helsel
07add0808e return 0 if skipping predictive fetch
Reviewed By: kmancini

Differential Revision: D30546084

fbshipit-source-id: 69b3ab3260e5d3ca56a1b8abd533f793f5d4b62f
2021-08-25 12:39:55 -07:00
Pyre Bot Jr
2b5216e31c suppress errors in fbcode/eden - batch 1
Differential Revision: D30514057

fbshipit-source-id: fba38e972f6dad2ad9e6f2d89a2eef06cf4e2872
2021-08-24 14:30:57 -07:00
Jessica Vandebon
2bad9e8b15 add global killswitch for predictive prefetch profiles
Summary: Added a kill switch to enable/disable predictive prefetch profiles similar to the existing one for regular prefetch profiles (D24803728 (7dccb8a49f)). This can be set manually in a user's config or via the cli `eden prefetch-profile disable-predictive/enable-predictive` commands.

Reviewed By: genevievehelsel

Differential Revision: D30404139

fbshipit-source-id: 01900f4030ef6991124f89a67ea404ff2f07ffeb
2021-08-23 17:55:09 -07:00
Jessica Vandebon
9116cc0eb4 add edenfsctl command to turn predictive prefetch profiles on/off
Summary:
Added eden prefetch-profile activate-predictive/deactivate-predictive subcommands to activate and deactivate predictive prefetch profiles. This will update the checkout config to indicate if predictive prefetch profiles are currently active or not, and stores the overridden num_dirs if specified on activate (--num-dirs N). If activate is called twice with different num_dirs, the value is updated (only one is stored). Unless --skip-prefetch is specified, a predictive prefetch with num_dirs globs (or the default inferred in the daemon) is run.

 Also added fetch-predictive [--num-dirs N], which will:
1. if num_dirs is specified: fetch num_dirs globs predictively
2. if num_dirs is not specified, and predictive fetch is active: get the active num_dirs from the checkout config and fetch globs predictively
3. if num_dirs is not specified, and predictive fetch is not active: fetch the default num_dirs (inferred in the daemon)

Added --if-active to fetch-predictive. If set, fetch will not run if predictive prefetch profiles have not been activated (predictive-prefetch-active in checkout-config). Used for post pull hook.

Reviewed By: genevievehelsel

Differential Revision: D30306235

fbshipit-source-id: ba02c2bc976128704c8ab0c3d567637265b7c95d
2021-08-23 17:55:08 -07:00
Zhengchao Liu
05e3a6e23c fix cleanup-apfs handling no stale apfs volume
Summary: This is an untended pop and would throw if there is no stale apfs volumes (and would remove one less volume if there are stale volumes).

Reviewed By: xavierd

Differential Revision: D30432642

fbshipit-source-id: 193d9c15f393a66bc8b43b5f31579c1fe972a7f1
2021-08-20 11:50:58 -07:00
Zhengchao Liu
2e2b9755cf add helper command for deleting stale APFS volumes
Summary:
This adds the `eden redirect cleanup-apfs` command for deleting stale APFS volumes.
* An APFS is considered as stale if it's not currently mounted and not considered as under any of the checkouts managed by the eden instance.
* The command prints the list of such volumes and uses the APFS util to delete them if the user confirms.

Note: as the command is local to an eden instance, it will list not-mounted APFS volumes of a checkout managed by another eden instance as stale. This should rarely happen as in production we expect there to be a single eden instance. The prompt would also let the user abort if something is wrong.

Reviewed By: chadaustin

Differential Revision: D29940980

fbshipit-source-id: e784cb54d20198bb1f74cd5f15cee0e7546b227c
2021-08-19 11:17:59 -07:00
Zeyi (Rice) Fan
0333c3d21c cli: fix long path handling in edenfsctl rm on Windows
Summary: `edenfsctl rm` often breaks down due to long path on Windows. This diff fixes that issue.

Reviewed By: xavierd

Differential Revision: D30380003

fbshipit-source-id: e10faa357df932bdb49d7c62d04d9504c7885768
2021-08-18 16:35:33 -07:00
Zeyi (Rice) Fan
64ea813b8a doctor: warn about legacy overlay type
Summary: This diff teaches eden doctor to generate a warning when user has SQLite overlay repo on disk and asking them to migrate.

Reviewed By: chadaustin

Differential Revision: D30345721

fbshipit-source-id: 95796ca77979f034904b87e3a38f149baddd720a
2021-08-18 12:08:28 -07:00
Xavier Deguillard
e811336d4d rage: print some Thrift counters
Summary:
When a user reports a slow EdenFS and a high network traffic is suspected, the
lack of Thrift stats makes it hard to fully validate this. Thus, let's collect
some stats and put them in the rage.

The collected stats are the exact same ones that `eden top` uses.

Reviewed By: chadaustin

Differential Revision: D30355746

fbshipit-source-id: 519a8e2c8b0c458daecdcc0813a8d7416d5362d6
2021-08-16 18:58:39 -07:00
Xavier Deguillard
784afd8939 config: add a clone.default-mount-protocol config
Summary:
This newly added config controls the default behavior of `eden clone` and
whether a new clone will use NFS or FUSE. This is intended to facilitate the
transition to NFS from FUSE on macOS.

Differential Revision: D30110056

fbshipit-source-id: ea6b493aa803297952b46434f6d11d8edf58e40b
2021-08-04 19:31:05 -07:00
Zhengchao Liu
9154f6071a remove try-import FuseCall in cli
Summary: As title. This was added as `thrift-py3` doesn't support CMake well but we can workaround by importing from py.

Reviewed By: xavierd

Differential Revision: D30078300

fbshipit-source-id: 277866f8b226f164b5e30231aa10b59c0aba5807
2021-08-03 18:33:54 -07:00
Pyre Bot Jr
b17c436a2b suppress errors in fbcode/eden - batch 1
Differential Revision: D30070991

fbshipit-source-id: 7ccd964a6fbff552e8357faa77d3b52eeee4bb9c
2021-08-03 16:39:24 -07:00
Zhengchao Liu
3eea6fbe7e allow eden stats output subset of stats and in JSON
Summary:
This adds the options to `eden stats` for collecting only fast stats and printing in JSON.

`eden stats` can be slow especially due to collecting fb303 counters and private bytes. An example use case of this new lightweight endpoint is that Buck can poll it to display Eden related info in its cli (see [post](https://fb.workplace.com/groups/132499338763090/permalink/210396380973385/) for context).

Reviewed By: xavierd

Differential Revision: D29687041

fbshipit-source-id: a663e71231527c5dfb822acbf238af0ac6ce4a00
2021-08-03 15:29:45 -07:00
Zhengchao Liu
f6374aa7a5 add command for listing active activity recorder sessions
Summary: Currently we have to manually save the id returned from `start_recording`. After this, we can simply ask for the list of all active recorder sessions.

Reviewed By: genevievehelsel

Differential Revision: D30056117

fbshipit-source-id: 7fd69b70e7b04fcd0b3724f4ee16c5e5e86badaf
2021-08-03 14:47:10 -07:00
Zhengchao Liu
f52d8185d2 replace readlink_retry_estale with os.readlink in cli
Summary:
Per comment in D30017261 (e9c039ab4a)

> [...] we can get rid of this ESTALE check. That dates back to when edenfs had a bug that returned ESTALE when reading the .eden directory sometimes.

Reviewed By: xavierd

Differential Revision: D30024979

fbshipit-source-id: 645097c8f689c916245845561fd3d824ff7df8b4
2021-08-02 15:00:17 -07:00
Zhengchao Liu
e9c039ab4a fix cli false positive mount success
Summary: `eden mount` currently swallows all but one type of exceptions, which resulted in cli reporting false positive mount success when the thrift endpoint throws. The try-catch was added in D21934538 (51df752a46) to provide clear error message for a particular windows error and we can just re-raise so that the other exceptions are propagated.

Reviewed By: chadaustin

Differential Revision: D30017261

fbshipit-source-id: 6a8a44330a90275b3c044301ff644dce0d6dee13
2021-07-30 12:18:32 -07:00
Katie Mancini
237561338b Support \ in eden prefetch paths on Windows
Summary:
Today the globing code is not able to parse `\` as a path separator
which causes an error like this:

```
facebook.eden.ttypes.EdenError: Invalid glob (attempt to construct a PathComponent from a string containing a directory separator: tools\arcanist): tools\arcanist
```

Many other tools like hg files still use these separators, so it would be
nice if we could support `\`.

This change will mean that Windows globs will not support special characters.
But they were already broken so we can not have any users successfully using
them today.
Ideally we will not have to support special charcters on Windows because it is
icky, But I left a note in the code about how we could do this, if its ever
needed in the future

Reviewed By: chadaustin

Differential Revision: D29971586

fbshipit-source-id: 32f54986e801b2aa3b3b1c90c650bd45531e8c0a
2021-07-30 11:48:22 -07:00
Mark Juggurnauth-Thomas
02c0bfc9e3 make hg inform edenfs of newly created root manifests
Summary:
If Mercurial asks EdenFS to update to a commit that it has just created, this
can cause a long delay while EdenFS tries to import the commit.

EdenFS needs to resolve the commit to a root manifest.  It does this via the
import helper, but the import helper won't know about the commit until it is
restarted, which takes a long time.

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

Reviewed By: chadaustin

Differential Revision: D29845604

fbshipit-source-id: 61736d84971cd2dd9a8fdaa29a1578386246e4bf
2021-07-29 10:01:02 -07:00
Genevieve Helsel
5a34dd506f perserve missing env var edenfs environment
Reviewed By: kmancini

Differential Revision: D29802351

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

Reviewed By: genevievehelsel

Differential Revision: D29666359

fbshipit-source-id: 487ca67de77378a8141bc4ac46b9abd1375ffd23
2021-07-23 12:32:25 -07:00
Chad Austin
1488d43cf1 redirections: handle ValueError from readlink on Windows
Summary: readlink on Windows raises ValueError instead of OSError. Handle that.

Reviewed By: kmancini

Differential Revision: D29854170

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

Reviewed By: genevievehelsel

Differential Revision: D29804526

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

Reviewed By: genevievehelsel

Differential Revision: D29805637

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

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

Reviewed By: genevievehelsel

Differential Revision: D29801785

fbshipit-source-id: 6283a33a3180fec6934ac52fc8d5eed4a0a483b0
2021-07-21 13:04:49 -07:00
Dustin Shahidehpour
cb0b1b9db2 Log message to stderr if you didn't match any files.
Summary: https://fb.workplace.com/groups/eden.users/posts/4149086615141255/

Reviewed By: chadaustin

Differential Revision: D29804396

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

Reviewed By: chadaustin

Differential Revision: D29803926

fbshipit-source-id: 41e8028b3dd9cf44fc93ec09c1446409148ac4a7
2021-07-21 09:01:37 -07:00
Yipu Miao
024b9d44b9 Let eden cli support RE-CAS store
Summary: This change let Eden cli can ```clone``` and ```info``` on a RE Digest backed store

Reviewed By: chadaustin

Differential Revision: D28855458

fbshipit-source-id: 5582992acc5b3b3acb05b0b53d59a6768cc02491
2021-07-20 18:50:03 -07:00
Genevieve Helsel
ffc55511ea remove windows check for eden du --deep-clean
Summary: This can be used on windows since it uses `shutil.rmtree` instead of `fm -rf`

Differential Revision: D29723916

fbshipit-source-id: 7d12ce8d265661698c1f5ecd17271d1c2e950a55
2021-07-16 09:05:56 -07:00
Xueqi He
25730908cd List env variables in eden rage
Summary: Add a new helper function 'print_env_variables' that reads the environment variables and prints them at the bottom of the rage report.

Reviewed By: genevievehelsel

Differential Revision: D29713709

fbshipit-source-id: 04e10597c93d11b58420f184048d9b55ad4e5166
2021-07-15 20:22:06 -07:00