Commit Graph

3155 Commits

Author SHA1 Message Date
Xavier Deguillard
3ac1b336cb inodes: remove unused UnloadedInodeData
Summary: This is unused, no need to keep it around.

Reviewed By: genevievehelsel

Differential Revision: D30046503

fbshipit-source-id: 1d20d9b4ce672d5d79410203807dbc93b4bce31a
2021-08-02 11:10:24 -07:00
Genevieve Helsel
6c6e7bdd8e Fix typo in inode documentation
Summary: Just fixing a typo as I'm reading.

Reviewed By: fanzeyi

Differential Revision: D30022289

fbshipit-source-id: 70df87d1e0ca77a53a8e156bbe956587f859f0c4
2021-07-30 15:27:59 -07:00
Genevieve Helsel
cac52b8412 keep ThriftLogHelper alive throughout lifetime of setPathRootId method
Summary: For `future_` endpoints, we wrap the final return statement with `wrapFuture(std::move(helper), ...` to ensure we keep the ThriftLogHelper alive through the whole call.

Differential Revision: D30018980

fbshipit-source-id: 2c63fe5d7b4504912cc46a32ca04f16e98b0805f
2021-07-30 14:55:51 -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
Xavier Deguillard
8051cb996b prjfs: fix a couple of path lifetime issues
Summary:
Copying PathPiece onto futures is a recipe for a use-after-free due to the
underlying string being likely freed when the future executes, let's instead
use plain Path and have the caller move/copy them onto the futures.

Differential Revision: D29989957

fbshipit-source-id: 2e6cebf8c9dfc8f55df8edbc410c2a7f681b8f22
2021-07-30 09:36:50 -07:00
Genevieve Helsel
935e3f1798 add allowlist for file access logging based on alias env variable
Reviewed By: kmancini

Differential Revision: D29944537

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

Reviewed By: xavierd

Differential Revision: D29974282

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

Differential Revision: D29978277

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

Reviewed By: kmancini

Differential Revision: D29952464

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

Reviewed By: DurhamG

Differential Revision: D29933214

fbshipit-source-id: d9631ea37b5ffa3f7051112d12cf3161c7c677ef
2021-07-29 10:01:02 -07:00
Mark Juggurnauth-Thomas
6c5c7055ce refresh datastore if root tree is not found locally
Summary:
If Mercurial asks EdenFS to update to a commit that it has just created, this
can cause a long delay while EdenFS tries to import the commit.

EdenFS needs to get the trees out of the Hg data store.  But these also
won't know about the new trees until the data store is refreshed or synced.

To fix this, call the refresh method on the store if we fail to find the tree,
and try again.  To make this work, we must first only look locally.  To keep
things simple, we only do this for the root tree.

However, currently indexedlogdatastore doesn't actually do anything when you
ask it to refresh.

To fix these, we call `flush()`,  which actually does a `sync` operation and
loads the latest data from disk, too.

Reviewed By: DurhamG

Differential Revision: D29915585

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

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

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

Reviewed By: chadaustin

Differential Revision: D29845604

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

Differential Revision: D29794557

fbshipit-source-id: e8e09c9aea994fad649af5119f3d8e42e12f5417
2021-07-29 09:56:24 -07:00
Xavier Deguillard
fbbc345561 inodes: remove unused statement
Summary:
There is no need to obtain the PrjfsChannel twice, especially if the first one
is unused.

Reviewed By: fanzeyi

Differential Revision: D29977555

fbshipit-source-id: 56428eae84a6abd8689b4f997173e0aa1501aede
2021-07-28 19:00:52 -07:00
Zhengchao Liu
cd044d60cf make NotFetched as the default RequestContext origin
Summary: Addresses feedback on {D29805637 (067abe2d55)}.

Reviewed By: chadaustin

Differential Revision: D29951945

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

Differential Revision: D29924043

fbshipit-source-id: be92630799bb5c78089dbe85f9c2f02f937300bc
2021-07-27 07:32:42 -07:00
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
fbe154d28e report fsck progress correctly
Summary: This affects all platforms but more noticeable on Mac that tons of 100% printed (e.g. P409794954), probably due to some weirdness with cursor.

Reviewed By: fanzeyi

Differential Revision: D29922276

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

Reviewed By: genevievehelsel

Differential Revision: D29835813

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

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

Reviewed By: kmancini

Differential Revision: D29241901

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

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

Reviewed By: genevievehelsel

Differential Revision: D29241902

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

Reviewed By: genevievehelsel

Differential Revision: D29666359

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

Differential Revision: D29559677

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

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

Reviewed By: genevievehelsel

Differential Revision: D29506895

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

Reviewed By: kmancini

Differential Revision: D29854170

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

Differential Revision: D29439945

fbshipit-source-id: 92c19ccffd14fdb8c99bcdf7be2f63960a4d5733
2021-07-22 15:04:31 -07:00
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
7db45cf79f Let EdenMount::ensureDirectoryExists return TreeInodePtr instead of folly::Unit
Reviewed By: chadaustin

Differential Revision: D29592849

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

Reviewed By: chadaustin

Differential Revision: D28855458

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

Reviewed By: chadaustin

Differential Revision: D29771074

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

Reviewed By: kmancini

Differential Revision: D29703450

fbshipit-source-id: b85666838a0a8c1857b9d1de4f6c47128063633a
2021-07-16 15:01:58 -07:00
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
Jessica Vandebon
106a3fd437 fix broken privhelper tests
Summary: fixing tests broken as described in attached task

Reviewed By: genevievehelsel

Differential Revision: D29683637

fbshipit-source-id: 601fe16a27f90d216170429f9900b4d6867fc2f5
2021-07-14 08:54:52 -07:00
Jessica Vandebon
21dc355725 Make eden doctor report when the PrivHelper is inaccessible
Summary: Extended eden doctor to check if the PrivHelper is accessible and report when it is not.

Reviewed By: genevievehelsel

Differential Revision: D29593250

fbshipit-source-id: 2390e75b91c9d6f713db4b6084868af91a0b6623
2021-07-12 13:16:21 -07:00
Andrey Chursin
25b3c7a9ff daemon: pass rust specific env vars to daemon
Summary: This simplifies debugging of edenfs rust libraries

Reviewed By: fanzeyi

Differential Revision: D29641954

fbshipit-source-id: da11e1ae3ac7696ee24a45c28be7cfb1b4651a04
2021-07-09 22:31:30 -07:00
Zhengchao Liu
f5d13407cb fix rage getting process tree
Summary: `-s` requires session id, so get the `sid` from `pid`

Reviewed By: genevievehelsel

Differential Revision: D29627171

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

Reviewed By: genevievehelsel

Differential Revision: D29501641

fbshipit-source-id: 9c01dc76b54e151ada977c0ee0c28baafe761824
2021-07-07 17:30:37 -07:00
Prabhash Rathore
889ceef7b9 Remove direct uses of gmock.h
Summary: Remove direct uses of gmock.h

Reviewed By: chadaustin

Differential Revision: D29532548

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

Differential Revision: D29576149

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

Reviewed By: chadaustin

Differential Revision: D29419151

fbshipit-source-id: 7b8296f0a0c84fdcb566ff811f7fcedbe7079189
2021-07-06 12:17:20 -07:00
Chad Austin
99b3c9e053 rename Channel to FS in logging
Summary:
Channel is the general term, and FS is the distinguishing term. Rename
cause to FS, with the option for more specificity later: FUSE vs. NFS
vs. Projected FS.

Reviewed By: xavierd

Differential Revision: D29467592

fbshipit-source-id: 78fe4663f7a9896cf21f7d067bd33ab859ecdec9
2021-06-30 18:52:47 -07:00
Genevieve Helsel
c6f74709b9 store file access logging percentage as a denominator
Reviewed By: chadaustin

Differential Revision: D29475156

fbshipit-source-id: efe207f1a4a09d4a718b9392294dbb7e91a2b98f
2021-06-30 14:57:34 -07:00
Xavier Deguillard
428c11ee43 cli: read enable-tree-overlay from the repository table
Summary:
The enable-tree-overlay is not a top-level config, and thus this code would
never read a boolean value, thus when the config would be read, the
enable_tree_overlay would always be false.

Reviewed By: fanzeyi

Differential Revision: D29494144

fbshipit-source-id: 1537f3e12bf043e154b81e4c0672abf80d54e16c
2021-06-30 14:28:05 -07:00