Commit Graph

3181 Commits

Author SHA1 Message Date
Xavier Deguillard
d8954839cf cli: sanitize the environ before starting edenfs
Summary:
A user may have some undesirable environment variables when calling `edenfsctl start`,
which we do not want to propagate to edenfs as this may affect EdenFS's
ability to run properly. Having PYTHONPATH set to inside a repository may for
instance lead to a deadlock when EdenFS is trying to setup redirections.

To avoid this, we need to sanitize the environment before calling edenfs. This
functionality already exist but was bypassed on Windows.

Reviewed By: chadaustin

Differential Revision: D29244358

fbshipit-source-id: bc96698732e71412296ed5e28842b59b2c758699
2021-06-18 21:43:16 -07:00
Xavier Deguillard
e0250f8c68 Back out "inodes: fix globbing bug with **"
Summary: The original commit broke globbing more than it fixed it. D29175333 will fully fix it, but in the meantime, let's revert the change to get a release out.

Reviewed By: singhsrb

Differential Revision: D29231954

fbshipit-source-id: 7a42e980c6fc4de09bee713a3a4141d52272b6d1
2021-06-18 17:27:27 -07:00
Xavier Deguillard
83663e1391 inodes: no more precise inode number for Windows
Summary:
Now that the InodeMap is pre-populated with the Overlay, we no longer need the
`folly::kIsWindows` test during checkout as inodes will enter this condition
when unloaded (IsInodeRemembered).

Reviewed By: fanzeyi

Differential Revision: D25106153

fbshipit-source-id: 511d795ae947651e1eaf3c54b8f1ab83c77f5cc4
2021-06-18 09:48:25 -07:00
Xavier Deguillard
37ccaa9231 diff: don't report case changes case insensitive mounts
Summary:
On a non-EdenFS mount, a case change of a file or directory isn't reported as
the file can still be accessed with the same path, and it has the same content
as before. EdenFS had a different behavior whereas renaming a file to a
different case would report a missing file and an untracked one, with different
casing.

This can be surprising to users as the behavior is different from Mercurial,
and it's also hard to actually fix as 2 renames would need to happen, a single
one would not work due to the case insensitivity nature of the filesystem.

While I do believe that reporting the case change might be more desirable to
allow users to actually commit changes the case of files, Mercurial might be
broken in subtle ways today if we allow this, thus it's best to make EdenFS
behave similarly to Mercurial.

Reviewed By: genevievehelsel

Differential Revision: D29150552

fbshipit-source-id: 6cceaa4c9fa61c03f35fcd91a9c01554da252222
2021-06-17 23:07:06 -07:00
Xavier Deguillard
703537b3c2 inodes: properly handle case changes in case insensitive mounts
Summary:
On case insensitive mounts, updating between commits that have a different
casing for a file/directory would lead to the update failing due to EdenFS
believing that an untracked file is present in the mount. That conflict is
however bogus and EdenFS simply gets confused in
TreeInode::processCheckoutEntry about the entry with the different casing.

To fix this, we should avoid comparing paths in a case sensitive manner and
instead compare then in a case insensitive fashion. This allows the rest of the
checkout code to update the directory/file in place.

On Windows, there is one more subtlety: we can't change the casing of a
file/directory that is already a placeholder and thus we need to force the
entire hierarchy to be removed, this will also make the checkout fail in case
of untracked files in the hierarchy, which is also the behavior on case
sensitive systems.

Reviewed By: genevievehelsel

Differential Revision: D29121741

fbshipit-source-id: 3d2cdacf296a3d061fc828cd6d04d249542cb63f
2021-06-17 23:07:06 -07:00
Zhengchao Liu
1a65835ca6 strace: add C++ implementation
Summary:
## This diff
* We are migrating `edenfsctl strace` to cpp due to segfaulting from Thrift-py3 (similar to {D25515377 (a152fa4585)}).
* This diff implements new subcmd `edenfsctl trace strace` for this cpp migration.

Reviewed By: xavierd

Differential Revision: D29164534

fbshipit-source-id: 4d8ed23393004f394159c36f71e0c78c077c7c73
2021-06-17 12:07:20 -07:00
Thomas Orozco
8f263485d9 eden: allow configuring path to privhelper when not running setuid
Summary:
When running tests, we need a way for Eden to find its privhelper. Normally, it
finds it by looking next to the EdenFS binary itself, but while that works in
Buck 1, it does not work in Buck 2, where the binaries are in separate
directories

Compared to the previous diffs, this requires some extra care because on a real
system, EdenFS is running as a setuid binary, and we don't want to let people
just run whatever binary they want the EdenFS privhelper!

To that end, we reject this argument entirely if the binary is setuid.

Reviewed By: xavierd

Differential Revision: D29061439

fbshipit-source-id: bf9427211d4209cf0bea805b9ea3a53270ec455b
2021-06-16 02:34:05 -07:00
Thomas Orozco
710c9c475a eden: set hgPath programmatically
Summary:
In Buck v1 the path we receive for hgPath is absolute so we can use it across
chdirs and the likes.

However, in Buck v2, it isn't. This means that using `--hgPath` doesn't work if
we go and chdir later, which we do because we run from the repo directory.

This updates the unit tests to set the path to an absolute value when they
otherwise look for their hg binary (which they do for operations in HgRepo). If
possible I would have preferred to thread this through to the HgImporter
constructor, but we have quite a few overloaded constructors already and this
turned out to be very messy.

Finally, this also updates the tests themselves to set `hgPath` to `false` so
that if we try to actually run it without configuring it, it won't work.

Reviewed By: xavierd

Differential Revision: D29060828

fbshipit-source-id: 17ad615d7ff98e9ce8278386f018167ec589c336
2021-06-15 02:47:41 -07:00
Thomas Orozco
e82c317c89 eden: move declare hgPath, hgPythonPath in HgImporter.h
Summary:
I'd like to be able to override this from unit tests. The underlying goal is
to let us make this path absolute in unit tests, so that we can make Eden unit
tests that rely on hgPath work on Buck v2, where paths are relative.

xavierd suggested overriding the glfag would be the easiest course of action
so that's what this does.

Reviewed By: xavierd

Differential Revision: D29060827

fbshipit-source-id: c4084072e3eef9cc5c9d404d10b3e19028f177ea
2021-06-15 02:47:40 -07:00
Xavier Deguillard
ea2e2f8bbd inodes: fix globbing bug with **
Summary:
When matching against the ** pattern, EdenFS would match against the full path
instead of against just the current entry. This means that what was matched by
the glob prior to ** will be rechecked against by the pattern that follows **,
which isn't what is expected.

As a bonus, the `candidateName` variable will be constructed less than before
leading to less memory allocations.

Reviewed By: chadaustin

Differential Revision: D29079762

fbshipit-source-id: af15ecf229ce7119100dd375df23269bb7cdb1c0
2021-06-14 17:03:27 -07:00
Xavier Deguillard
16bfb84b8b service: allow globbing from the root of the repository
Summary:
When using `eden glob` at the root of the repository, the `searchRoot` is
initialized with ".", which is an invalid PathComponent. Let's special case
this in edenfs itself as python's Path appear to always want to be "." and thus
it's easier to fix in EdenFS.

Reviewed By: chadaustin

Differential Revision: D29072478

fbshipit-source-id: 0108294e407784832cd35b3dd6aaceacf4bd7dd9
2021-06-14 17:03:27 -07:00
Chad Austin
ec486ccc20 delete some flaky tests
Summary:
These tests rely on the wall clock and fail somewhat regularly on CI
and on my local machine, so remove them.

Reviewed By: fanzeyi

Differential Revision: D29047847

fbshipit-source-id: 4008d079fac55f52827be534ab1b18b93c1d2f2f
2021-06-14 12:43:03 -07:00
Xavier Deguillard
e49eba745c pool eden thrift connections
Summary:
Whenever a file is modified in an EdenFS mount and a watchman subscription is
active, watchman will be nodified and will issue a getFilesChangedSince Thrift
call. In order to do that, Watchman ends up always re-creating a new connection
to EdenFS, causing the .eden/socket or .eden/config to be re-read in order to
find EdenFS's socket.

For workloads with heavy write traffic to EdenFS, this readlink/read can add
up. On Windows, writing ~2.5GB worth of data lead Watchman to read over 650MB
worth of data from the .eden/config!

Reviewed By: chadaustin

Differential Revision: D28912258

fbshipit-source-id: 549d57592672ef9cbdcccc213d0612d019677923
2021-06-14 12:37:41 -07:00
Zhengchao Liu
e9fe6f89f3 log Fuse opcode name
Summary:
## This diff
* Implement `getCauseDetail` for Fuse fetch context so that we log which Fuse call triggers the fetch.

Reviewed By: chadaustin, kmancini

Differential Revision: D29092690

fbshipit-source-id: 230ef193332a90a01ca9b89f5b8d8f20cdf4f321
2021-06-14 09:41:25 -07:00
Yedidya Feldblum
22a7fdfe34 migrate from LockedPtr::getUniqueLock
Summary: The new name is `LockedPtr::as_lock`.

Reviewed By: aary

Differential Revision: D28987868

fbshipit-source-id: 8abd6a69a1b9c884adf137f06c24fe0df9ddd089
2021-06-13 18:53:58 -07:00
Lauren Bentley
a2e7c666a4 remove .buckversion file from fbcode
Summary: Buck has not relied on the .buckversion file for a while now. Trying to clean up the number of configs at the root of the cell for buck. This diff attempts to remove .buckversion code referecnes. Instead of calling `cat .buckversion` to get the buckversion hash, you can call `buck --fast-version` which parses the `buck-java11` file without downloading buck. Alternatively, you can also do something like ` cat .buck-java11 | grep -o -E -e "[0-9a-f]{40}" | head -1`  to get the buckversion hash.

Reviewed By: DrMarcII

Differential Revision: D28553844

fbshipit-source-id: ab90fa6a5e7467f6d5c11ffa9d0e10a03433975f
2021-06-11 16:16:47 -07:00
Xavier Deguillard
cc5951d322 service: key mount map with an AbsolutePath
Summary:
Using a PathMap to hold the list of mounts gives us case sensitivity for free
without needing to have #ifdef _WIN32, we can also avoid copying the paths just
to normalize them.

Reviewed By: fanzeyi

Differential Revision: D28969795

fbshipit-source-id: 859cdc3881e36db120913099ce3f451940fa48a4
2021-06-09 21:34:27 -07:00
Xavier Deguillard
30a146b38e config: enable NFS server by default on macOS
Summary:
We're planning on rolling out NFS to our users soon, let's make sure NFS is
enabled.

Reviewed By: singhsrb

Differential Revision: D29002395

fbshipit-source-id: 8351fa45c9bd5e68e162baa80e20bd34564b5ece
2021-06-09 16:19:41 -07:00
Chad Austin
49385c8a07 store: namespace facebook::eden
Summary: C++17

Reviewed By: fanzeyi

Differential Revision: D28966939

fbshipit-source-id: c8c9d49bc02557263a6acf9357c90b50e04fbdb9
2021-06-08 19:29:37 -07:00
Chad Austin
29c5aef912 model: namespace facebook::eden
Summary: C++17

Reviewed By: fanzeyi

Differential Revision: D28966916

fbshipit-source-id: baf8bec7b211ecf18d3fc3edf79a7c2de6b5aa68
2021-06-08 19:29:37 -07:00
Chad Austin
f8ee95ead1 fuse: namespace facebook::eden
Summary: C++17

Reviewed By: fanzeyi

Differential Revision: D28966903

fbshipit-source-id: 349b145aadd059b17c8e4b40feb28582e7a93650
2021-06-08 19:29:37 -07:00
Chad Austin
4ccb60e46d config: namespace facebook::eden
Summary: Start applying C++17 to our namespace definitions.

Reviewed By: fanzeyi

Differential Revision: D28964224

fbshipit-source-id: 72ad3f93c9304b34eef91d530e4e988420bd8fdc
2021-06-08 19:29:37 -07:00
Xavier Deguillard
d2fa55c4fe service: populate the inodemap counters on Windows
Summary:
The InodeMap is fully functional on Windows, there is no need to ifdef out its
counters.

Reviewed By: genevievehelsel

Differential Revision: D28970898

fbshipit-source-id: adeb2db19c70d5ff4a3a162fe34c32195fc2a1e0
2021-06-08 16:04:56 -07:00
Xavier Deguillard
d1ad84db19 inodes: prepopulate the InodeMap on mount
Summary:
On Windows, the working copy doesn't go away on unmount, instead placeholders
and full files[0] are still present on disk. For this reason, EdenFS needs to
either overly invalidate files and directories at update times, or need to
remember what is present on disk so the state can be recovered.

For now, this diff simply focus on reloading all the inodes that are present on
disk in the InodeMap.

[0]: https://docs.microsoft.com/en-us/windows/win32/projfs/cache-state

Reviewed By: chadaustin

Differential Revision: D28889082

fbshipit-source-id: 90170c1291da563bea455c8032dc8282a093c9b3
2021-06-08 16:04:56 -07:00
Yipu Miao
cc399f1c12 implement getTree API
Summary: This will implement getTree API of RE-CAS

Reviewed By: chadaustin

Differential Revision: D28157535

fbshipit-source-id: 6b09338f0635aa948497d934a8351a9ba362f1ab
2021-06-08 11:11:02 -07:00
Zeyi (Rice) Fan
d6a52d1789 overlay: allow creation of in-memory overlay
Summary: As we need to debugging a IO related performance issue. We want to see if writes in overlay has caused any issues. This diff adds an option to allow us to create in-memory overlays.

Reviewed By: chadaustin

Differential Revision: D28951905

fbshipit-source-id: 9ef1da183771ee69b855b49bbabc2ef02a7ec9ac
2021-06-08 10:14:09 -07:00
Thomas Orozco
0a633f9bf8 eden: pass path to overlay test data via Buck
Summary:
Like it says in the title. Right now this dependency is invisible to Buck so
we rely on reading it from the checkout. However, while this works on Buck 1
(I guess we run the tests from the repo root), it doesn't work Buck 2, and it
won't work if we try to run those tests remotely.

Let's make the dependency explicit!

Reviewed By: xavierd

Differential Revision: D28936482

fbshipit-source-id: 71c4a492c33f586abe6b721b90898f5424c06e94
2021-06-08 04:21:08 -07:00
Chad Austin
bb1cccac89 introduce a variable-width RootId type that identifies the root of an EdenFS checkout's contents
Summary:
Backing stores differentiate between individual tree objects and the
root of a checkout. For example, Git and Mercurial roots are commit
hashes. Allow EdenFS to track variable-width roots to better support
arbitrary backing stores.

Reviewed By: genevievehelsel

Differential Revision: D28619584

fbshipit-source-id: d94f1ecd21a0c416c1b4933341c70deabf386496
2021-06-07 17:25:31 -07:00
Xavier Deguillard
6fef47388c cli: default to using NFS on Apple Silicon
Summary:
Making it the default should make cloning using EdenFS easier and will remove
the need to manually pass the `--nfs` command line to `eden clone`.

Reviewed By: kmancini

Differential Revision: D28913818

fbshipit-source-id: 742c35c950cb5edf34fd9769fb78bf26095af0d5
2021-06-07 16:52:16 -07:00
Xavier Deguillard
e14dff2645 treeoverlay: enable WAL on the Sqlite database
Summary:
WAL is known to be significantly faster than the default DELETE journaling
mode, let's enable it.

Reviewed By: fanzeyi

Differential Revision: D28915718

fbshipit-source-id: 3ee10d10dbaf07a01a23101a6266874a41784cfc
2021-06-04 21:56:37 -07:00
Xavier Deguillard
413baab09d win32: remove some unecessary ifdef
Summary:
These appear to be unecessary, thus there is no need to keep them in place as
it makes the code harder to follow.

Reviewed By: chadaustin

Differential Revision: D28850241

fbshipit-source-id: 129b853e88f0291bb637c9d24de4872a222a5af4
2021-06-04 15:26:25 -07:00
Katie Mancini
405550c6fe thread ObjectFetchContext write, setattr, fallocate
Summary:
There are a few remaining holes where we are not passing a full fetch context.
We will need a full fetch context to do all data fetch logging needed for the
intern project. Additionally, we generally should not be using these singletons
in our production code.

A few final write calls need to be threaded as well.

Reviewed By: xavierd

Differential Revision: D28844011

fbshipit-source-id: 214853eea7fa65263fe6415e1ae8b76ca21512d6
2021-06-04 14:57:47 -07:00
Katie Mancini
2e6ea72e9a thread ObjectFetchContext thrift applyToInodes
Summary:
There are a few remaining holes where we are not passing a full fetch context.
We will need a full fetch context to do all data fetch logging needed for the
intern project. Additionally, we generally should not be using these singletons
in our production code.

Some thrift methods used by watchman to get metadata implicitly are not threaded.
These can cause fetches, so let's thread the fetch context here too.

Reviewed By: genevievehelsel

Differential Revision: D28842300

fbshipit-source-id: b1e4b3aea879d6ed7b92afa26184616dedad5935
2021-06-04 14:57:46 -07:00
Katie Mancini
96da8df402 thread ObjectFetchContext symlink
Summary:
There are a few remaining holes where we are not passing a full fetch context.
We will need a full fetch context to do all data fetch logging needed for the
intern project. Additionally, we generally should not be using these singletons
in our production code.

This change is for symlink

Reviewed By: genevievehelsel

Differential Revision: D28841453

fbshipit-source-id: 080eb62f0b562f8e0995c34e9a8302238fc59ed8
2021-06-04 14:57:46 -07:00
Katie Mancini
f2133297b6 thread ObjectFetchContext remaining parts of rm
Summary:
There are a few remaining holes where we are not passing a full fetch context.
We will need a full fetch context to do all data fetch logging needed for the
intern project. Additionally we generally should not be using these singletons
in our production code.

Most of rmdir is already threaded, not sure if this case can actuall cause
fetches in production, but might as well thread.

Reviewed By: genevievehelsel

Differential Revision: D28840211

fbshipit-source-id: 8dea08e775be470dd1730e2d32750a6912650ee0
2021-06-04 14:57:46 -07:00
Katie Mancini
526ced1f54 thread ObjectFetchContext rename
Summary:
There are a few remaining holes where we are not passing a full fetch context.
We will need a full fetch context to do all data fetch logging needed for the
intern project. Additionally, we generally should not be using these singletons
in our production code.

this change is for rename

Reviewed By: genevievehelsel

Differential Revision: D23467437

fbshipit-source-id: e9d79c65fb5c4d686f0597550e43a0e87c4792cb
2021-06-04 14:57:46 -07:00
Katie Mancini
82a43119ba update eden doctor for macFUSE
Summary:
we now want macFUSE to be installed instead of osxfuse. eden doctor will spew
errors if osxfuse is not installed or loaded, so it perpetually complains.
Update these checks for macFUSE now.

Reviewed By: xavierd

Differential Revision: D28751766

fbshipit-source-id: 4bc61349e33492aebe888a4e869ef7620c74768e
2021-06-04 14:04:50 -07:00
Katie Mancini
f1d0de859f thread ObjectFetchContext mkdir
Summary:
There are a few remaining holes where we are not passing a full fetch context.
We will need a full fetch context to do all data fetch logging needed for the
intern project. Additionally, we generally should not be using these singletons
in our production code.

This change is for mkdir

Reviewed By: genevievehelsel

Differential Revision: D23458622

fbshipit-source-id: f3914a4f692490434882143664a5d5f1701e93ba
2021-06-03 16:33:35 -07:00
Katie Mancini
88cb4ec5ba thread ObjectFetchContext create
Summary:
There are a few remaining holes where we are not passing a full fetch context.
We will need a full fetch context to do all data fetch logging needed for the
intern project. Additionally we generally should not be using these singletons
in our production code.

This change is for create

Reviewed By: genevievehelsel

Differential Revision: D23457862

fbshipit-source-id: d4c9cc658c26b3119b2b2a1da061e299eaf510c9
2021-06-03 16:33:35 -07:00
Katie Mancini
ee923324d2 thread ObjectFetchContext lookup
Summary:
There are a few remaining holes where we are not passing a full fetch context.
We will need a full fetch context to do all data fetch logging needed for the
intern project. Additionally we generally should not be using these singletons
in our production code.

Most of lookup is already threaded. This finishes the threading for lookup.

Reviewed By: xavierd

Differential Revision: D23456910

fbshipit-source-id: fab7397caeee19f921d8fba1fb6528baa5cf2960
2021-06-03 16:33:35 -07:00
Chad Austin
8a44512e1f remove FakeBackingStore::getTreeForManifest
Summary:
BackingStore and LocalStore are no longer tied at the hip, so decouple
FakeBackingStore from LocalStore.

Reviewed By: kmancini

Differential Revision: D28615431

fbshipit-source-id: ee6bc807da6de4ed8fba8ab6d52ff5aeff34e8ae
2021-06-03 11:07:14 -07:00
Chad Austin
894eaa9840 move root ID parsing and rendering into BackingStore
Summary:
The meaning of the root ID is defined by the BackingStore, so move
parsing and rendering into the BackingStore interface.

Reviewed By: xavierd

Differential Revision: D28560426

fbshipit-source-id: 7cfed4870d48016811b604348742754f6cdbd842
2021-06-03 11:07:14 -07:00
Chad Austin
ebbcef7605 start writing the v2 SNAPSHOT
Summary:
Start writing the v2 format (single, variable-width parent) into the
SNAPSHOT file.

Reviewed By: xavierd

Differential Revision: D28528419

fbshipit-source-id: 245bd4f749c45f4de2912b0406fc0d1b52278987
2021-06-03 11:07:14 -07:00
Katie Mancini
5a16819fb8 thread ObjectFetchContext mknod
Summary:
There are a few remaining holes where we are not passing a full fetch context.
We will need a full fetch context to do all data fetch logging needed for the
intern project. Additionally we generally should not be using these singletons
in our production code.

this change is for mknod

Reviewed By: chadaustin

Differential Revision: D23452153

fbshipit-source-id: 7b9bc6b624fbe81b91770bc65a0d27bc9d397032
2021-06-03 09:46:25 -07:00
Katie Mancini
4594776ada thread ObjectFetchContext getxattr
Summary:
There are a few remaining holes where we are not passing a full fetch context.
We will need a full fetch context to do all data fetch logging needed for the
intern project. Additionally we generally should not be using these singletons
in our production code.

this change is for getxattr

Reviewed By: chadaustin

Differential Revision: D23451954

fbshipit-source-id: bae73878754d59661cddf7c0b001e506bbc88d13
2021-06-03 09:46:25 -07:00
Katie Mancini
c98620da53 thread ObjectFetchContext readlink
Summary:
There are a few remaining holes where we are not passing a full fetch context.
We will need a full fetch context to do all data fetch logging needed for the
intern project. Additionally we generally should not be using these singletons
in our production code.

this change is for readlink

Reviewed By: chadaustin

Differential Revision: D23451821

fbshipit-source-id: 1f8ee369a992ab3489a9366f9a972f67461970de
2021-06-03 09:46:25 -07:00
Durham Goode
f1c8126ae9 Add tree metadata prefetching to batch tree fetching path.
Summary:
Tree metadata prefetching is a second step after a normal fetch. Let's
add it to the batch tree fetching path. Ideally we'd unify this with the
non-batch tree fetching path a bit. Or just get rid of the non-batch path
entirely.

Reviewed By: chadaustin

Differential Revision: D28427267

fbshipit-source-id: e23fc667f609925e8671a71876165ad2cea161b9
2021-06-01 22:41:07 -07:00
Durham Goode
c52c633d3c Refactor tree metadata fetching to a function
Summary:
Let's move the tree metadata fetching logic to a function so it can be
reused for tree batch fetching.

Reviewed By: chadaustin

Differential Revision: D28719443

fbshipit-source-id: 08197c63918334283e29c8327e244114d33ddb4c
2021-06-01 22:41:07 -07:00
Durham Goode
6ec7ebb4d2 Add tree batch fetching for EdenAPI
Summary:
Now that the backing store has a batch tree API, let's make Eden take
advantage of it.

This is largely just a copy of how blob batch fetching works. The next diff will
add tree metadata prefetching to this fetch path as well.

Reviewed By: chadaustin

Differential Revision: D28426788

fbshipit-source-id: 0dbd2d37950af88a470ef9d8996e9b912988d363
2021-06-01 22:41:07 -07:00
Xavier Deguillard
d7a967dce5 glob benchmark: make the watchman and eden more comparable
Summary:
In the eden benchmark, EdenFS didn't return the file list, while Watchman would
always do it, thus let's always return the file list.

I've also removed the calls to SetItemsProcessed as the output is completely
misleading. The "Time" column is what needs to be looked at and not the
"items_per_second" that SetItemsProcessed shows.

Reviewed By: kmancini

Differential Revision: D28664475

fbshipit-source-id: e920b311464667a720d9ab00286e094829e292f7
2021-06-01 11:53:42 -07:00
Katie Mancini
1c31dbb822 allow remount after force unmounting
Summary:
Previously if you `sudo umount -f fbsource-nfs` then try to
`eden mount fbsource-nfs`, the mount will fail because the EdenMount already
exists and is still running.

Let's properly unmount our selfs on a force unmount like we do for fuse.
There are two potential ways to detect a fource unmount: the UMNT call to the
mount deamon or the socket to the nfsd closing. The UMNT call is unreliable
(on Linux we do not get the UNMT call on `umount -l`), so this diff pursues the
socket closing option.

When the nfsd socket is closed we trigger the EdenMount unmounting process if
this has not already started.

Reviewed By: xavierd

Differential Revision: D28329482

fbshipit-source-id: 5df8f3eb818a92536095195f1b3a9e412394fbf6
2021-05-27 16:11:50 -07:00
Xavier Deguillard
bb5731198b inodes: move checks for recursiveChildren_ in caller
Summary:
The evaluateRecursiveComponentImpl function calls itself recursively, but would
always check for every invocation whether the recursiveChildren_ was empty. We
know that if evaluateRecursiveComponentImpl was called that recursiveChildren_
wasn't empty, so we can remove the check and move it to its caller.

Reviewed By: chadaustin

Differential Revision: D28724574

fbshipit-source-id: b1e07393d2f1cdb605550eca5f0b0b01591a785d
2021-05-27 14:45:07 -07:00
Xavier Deguillard
977e8b160b store: reduce globbing CPU usage by 10x
Summary:
Running the glob benchmark, creating the future causes EdenFS's CPU usage to
explode to 1000% for a single threaded glob query. Removing this significantly
reduce the CPU usage to 100% while not affecting performance, despite what the
comment claimed.

Reviewed By: kmancini

Differential Revision: D28617400

fbshipit-source-id: 42ff3401ff1da9d7a7f63bd1c91c8b5b30b182fd
2021-05-27 12:12:19 -07:00
Xavier Deguillard
f16000b764 inodes: make InodeBase::stat return an ImmediateFuture
Summary:
This is the last piece that allows both FUSE and NFS to not allocate futures
when replying to getattr calls.

Reviewed By: chadaustin

Differential Revision: D28396819

fbshipit-source-id: 9a4f8d5d03991dbacc4c56116bd56a38773dcd63
2021-05-27 10:57:52 -07:00
Xavier Deguillard
bbcd762b14 benchmark: add a glob benchmark that goes through Watchman
Summary:
Since Buck issues glob requests via Watchman, I was curious to understand the
overhead that Watchman adds to see if that is worth optimizing or bypassing.

From the results shown below, it looks like talking to EdenFS directly would
yield a ~4x globbing improvement.

Reviewed By: chadaustin

Differential Revision: D28644517

fbshipit-source-id: 1aa4c43d45248626adde31491fe40836ad6c436a
2021-05-27 10:54:59 -07:00
Xavier Deguillard
f7c66f9786 nfs: fix non-UTF8 name handling
Summary:
For non-UTF8 names, the PathComponent constructor would raise an exception, and
since that exception wasn't caught by the handler itself, it would bubble up to
the RPC server and a generic "server IO error" would be sent back to the
client. Since non-UTF8 names aren't a server error, but an invalid argument, we
should instead return a different error.

Unfortunately, EILSEQ isn't an error that an NFS server can return, instead
let's use EINVAL as the argument is clearly invalid.

Reviewed By: chadaustin

Differential Revision: D28482032

fbshipit-source-id: b59044f1a76f7eac79e2df07356a0aeafa22e3c5
2021-05-26 14:05:48 -07:00
Xavier Deguillard
d324a26672 nfs: fix permissions
Summary:
The modeToNfsMode simply didn't consider all the mode bits to be translated to
the proper NFS mode bits. It now does.

Reviewed By: chadaustin

Differential Revision: D28459428

fbshipit-source-id: d879fb1be2085e44110ba552bc47d2770637fc86
2021-05-26 14:05:48 -07:00
Xavier Deguillard
8391057f7d nfs: open files to do invalidation
Summary:
An NFS client caches the attributes of files to avoid having to request these
very frequently. What this means is that a file changed by another client (or
by the server itself) may take some time to be reflected on the client, that
time depends on the attribute caching configuration of the mount point.

For EdenFS, files can changed in 2 ways:
 - Either it is changed by the user via the mount point,
 - Or the user runs an `hg update`

For the first one, the client will simply update its attributes appropriately,
but for the second one, the cached attributes will only be updated when the
user does opens the file, any calls to stat prior will return the old
attributes. Since EdenFS runs on the same host, we can force the attributes
caches to be discarded by simply issuing an open call on the file that changed.

Reviewed By: chadaustin

Differential Revision: D28456482

fbshipit-source-id: 91022d35a33e436c47d94403d0c139992f880cf9
2021-05-26 14:05:48 -07:00
Yipu Miao
f2bb80c128 Not use gtest for UserInfo.h on Windows
Summary: There are some unused warning on Windows, should be an easy fix.

Reviewed By: fanzeyi

Differential Revision: D28663227

fbshipit-source-id: cee18ec28283c0aef18151465a3c13e9be604d7d
2021-05-25 23:55:08 -07:00
Yipu Miao
871f609401 Fix unused parameters on PrjfsChannel.cpp
Summary: There are some unused warning on Windows, should be an easy fix.

Reviewed By: xavierd

Differential Revision: D28610639

fbshipit-source-id: c85535669f84695217125af5de7cc4848fba6b2d
2021-05-25 19:45:22 -07:00
Yipu Miao
405c6996cd Fix warning on FileDescriptor.cpp
Summary: FileDescriptor.cp throws some warning on comparison of signed long and unsigned long.  So fix these warning and follow how ```folly/portability/SysUio.cpp:doVecOperation``` did

Reviewed By: fanzeyi

Differential Revision: D28608581

fbshipit-source-id: 3b6e35e9764548ce470634f16a1f6eec5118d7ed
2021-05-25 19:45:22 -07:00
Xavier Deguillard
9621d533f4 nfs: use makeImmediateFutureWith instead of a manual version of it
Summary:
Now that makeImmediateFutureWith exists, we can simply use it instead of
constructing a ImmediateFuture<folly::Unit> and calling thenValue on it.

Reviewed By: chadaustin

Differential Revision: D28518059

fbshipit-source-id: 0041cf863fb32efab274f11c77c76109ca9b454f
2021-05-25 15:16:59 -07:00
Yipu Miao
814c4c2bcf Fix unused parameters on EdenServiceHandler
Summary: There are some unused warning on Windows, should be an easy fix.

Reviewed By: xavierd

Differential Revision: D28665465

fbshipit-source-id: 9281de7fd62f38e09d91435bb53c819bb98fb4ec
2021-05-25 10:30:29 -07:00
Yipu Miao
eb8deb4f51 Fix unused parameters on inodes on Windows
Summary: There are some unused warning on Windows, should be an easy fix.

Reviewed By: xavierd

Differential Revision: D28595085

fbshipit-source-id: abc03d210b2e9c5aa19a8925be6d4c426311e826
2021-05-25 10:30:29 -07:00
Yipu Miao
8f05086834 Fix unused parameters on StartupLogger.cpp on Windows
Summary: There are some unused warning on Windows, should be an easy fix.

Reviewed By: xavierd

Differential Revision: D28594404

fbshipit-source-id: f3dec92403739d67df3ecd091f2d8283a11ea0db
2021-05-25 10:30:29 -07:00
Xavier Deguillard
5a84f7ac85 utils: add an makeImmediateFutureWith function
Summary: This will be used to replace calls to folly::makeFutureWith.

Reviewed By: chadaustin

Differential Revision: D28515786

fbshipit-source-id: 2c2c542392e8e57b8f865173d6878cb9d00ba376
2021-05-25 09:45:47 -07:00
Zeyi (Rice) Fan
a8e007bbf6 hg: promote batch size to a configuration option
Summary: This diff removes the gflag based batch size option and promote it into a EdenFS Configuration so we can experiment with different batch size easily.

Reviewed By: chadaustin

Differential Revision: D28555280

fbshipit-source-id: 6d3a7be3cd880f0aaa3f427c0328222efa2d37ea
2021-05-24 19:17:17 -07:00
Yipu Miao
c4fe54e1d5 Bump the waiting time for DaemonStartupLoggerTest.daemonClosesStandardFileDescriptors
Reviewed By: chadaustin

Differential Revision: D28499240

fbshipit-source-id: d04fc25ab3a823620c72c1355f897a274703efb5
2021-05-24 15:40:49 -07:00
Xavier Deguillard
95388f9d3a inodes: move InodePtr and shared_ptr instead of copying them
Summary:
Copying an InodePtr/shared_ptr adds 2 atomics: one for the copy, and one when
the copy is dropped. In the case where a move can be achieved, we can avoid
these atomics and make the code more efficient.

Reviewed By: fanzeyi

Differential Revision: D28614769

fbshipit-source-id: 9c4be6ce335cc17eb889a5681aa9c13595a7909e
2021-05-21 21:41:02 -07:00
Xavier Deguillard
c633705652 inodes: move some path instead of copying them
Summary:
Looking at the glob code, I noticed that some paths were copied into lambda and
vectors, while they could have been moved.

Reviewed By: fanzeyi

Differential Revision: D28614211

fbshipit-source-id: 5662586bcc3d9a9c5ca899c59d29b40a4e590adc
2021-05-21 21:41:02 -07:00
Xavier Deguillard
de7a364e78 utils: really skip path sanity checking when asked
Summary:
When the caller asks to not perform sanity checking, this should be honored as
the caller can for instance tell that a path is guaranteed to be valid and
shouldn't be checked.

When running the newly added glob benchmark, EdenFS was spending 7.5% of the
time validating a path that was constructed via the operator+.

Reviewed By: fanzeyi

Differential Revision: D28612665

fbshipit-source-id: 282155d0415ab6458bd9307c89a24e9e090bf09d
2021-05-21 19:26:46 -07:00
Xavier Deguillard
73cba2becc store: do not look in the LocalStore when blob caching is disabled
Summary:
Querying RocksDB for a blob that we know is not present is expensive, and will
always construct a StoreResult::missing which does allocate memory for that to
simply be dropped. We can revamp the StoreResult a bit, but for now let's
simply not query RocksDB.

In theory, if RocksDB is populated with blobs this can be a loss as more
request will need to go to the hgcache, in practice, RocksDB local caching has
been disabled for so long that we'll always get cache misses.

Reviewed By: fanzeyi

Differential Revision: D28592666

fbshipit-source-id: 49f48097e81eddb4f9c3eba7af774baf018b0821
2021-05-21 19:26:46 -07:00
Xavier Deguillard
b73674c009 inodes: speed up globbing by not copying vectors
Summary:
C++ is full of footguns, in this case, the lockContents method either returns a
const std::vector<TreeEntry>&, or an rlock RAII for a folly::Synchronized
object. When assigning the return value of that method to an `auto` variable, a
copy is made in both cases, which isn't exactly what is desired in the first
case. Instead using the reference as-is is what we want.

To achieve the right behavior, a `const auto&` needs to be used: it will either be
a const reference in the first case, or a copy in the second case.

During an `arc focus2` while the Buck parsing phase is ongoing, the copy shows
up at the top of the profiler as one of the most expensive operation. This
significantly reduce its cost.

Reviewed By: chadaustin

Differential Revision: D28591502

fbshipit-source-id: eac1e062ed94442c90ac549ec137d91b4cb42b9c
2021-05-21 19:26:46 -07:00
Xavier Deguillard
37a3d11e3c benchmarks: add a globbing benchmark
Summary:
While Buck compiling, when a glob query is running, EdenFS uses tons of CPU,
let's add a small benchmark to profile the code in isolation and keep track of
the progress.

Reviewed By: fanzeyi

Differential Revision: D28611157

fbshipit-source-id: 81df21c8a8aba44fdefec044f9cae387b4cdd15c
2021-05-21 19:26:46 -07:00
Chad Austin
4d9526f8c4 add a v2 SNAPSHOT format
Summary:
Add support to our C++ and Python SNAPSHOT parsers for version 2,
which is just an arbitrary binary string after the header.

Don't start writing the format yet. I'd like to roll one release with
read support before writing the new format.

Reviewed By: xavierd

Differential Revision: D28528235

fbshipit-source-id: 0b06596f06cafa26258ab392eaae4a8994f55f1f
2021-05-21 10:53:16 -07:00
Chad Austin
48dcaf8cb2 remove support for legacy SNAPSHOT files
Summary: The legacy format was last written in 2017, so we can remove it now.

Reviewed By: xavierd

Differential Revision: D28524663

fbshipit-source-id: 59ed437b0e5ef2e5ee3e3e9944d1049a13d64d9e
2021-05-21 10:53:16 -07:00
Chad Austin
df90f5626e stop tracking parent2
Summary:
EdenFS goes out of its way to track the second working copy parent,
but it never uses it. Stop writing it to the SNAPSHOT file.

Reviewed By: genevievehelsel

Differential Revision: D28453213

fbshipit-source-id: d7d36a1c67553f92234bec911051f4f1d4ef1d4a
2021-05-21 10:53:16 -07:00
David Tolnay
d4f337c889 Resolve bare_trait_objects warnings in path components
Reviewed By: quark-zju

Differential Revision: D28558352

fbshipit-source-id: d4b85716096c43eed8e6172ade3dfe40e277e670
2021-05-19 22:03:56 -07:00
Xavier Deguillard
eb83e15862 cli: enable pyre-strict for logfile.py
Summary: This will force future modification to this file to be fully type checked.

Reviewed By: fanzeyi

Differential Revision: D28544422

fbshipit-source-id: 5ecc08a21e49535a3ed4ae9c33f219080365e609
2021-05-19 19:27:07 -07:00
Xavier Deguillard
4a159e808a cli: enable pyre-strict for fsck.py
Summary: This will force future changes to this file to be fully type checked.

Reviewed By: fanzeyi

Differential Revision: D28544427

fbshipit-source-id: 0ccfe675818a96ee8fc702317ace85d0b26ccc26
2021-05-19 19:27:07 -07:00
Xavier Deguillard
c51b1ed1da cli: enable pyre-strict for filesystem.py
Summary: This will force future changes to this file to be fully type checked.

Reviewed By: fanzeyi

Differential Revision: D28544421

fbshipit-source-id: 67d15e4d6ed13c139adffa7cedf7795856d87c7e
2021-05-19 19:27:06 -07:00
Xavier Deguillard
74328d8dd3 cli: enable pyre-strict for debug_posix.py
Summary: This will enforce future changes to this file to be fully type checked.

Reviewed By: fanzeyi

Differential Revision: D28544426

fbshipit-source-id: d502de1e0e4c3f7910e0796b2c82ebbb9992be22
2021-05-19 19:27:06 -07:00
Xavier Deguillard
47e48bfceb cli: enable pyre-strict for configinterpolator.py
Summary:
This adds the few missing types. This will ensure that future modifications of
this file are all type checked.

Reviewed By: fanzeyi

Differential Revision: D28544424

fbshipit-source-id: 4053ede8a2901928e90c484158777aab31937600
2021-05-19 19:27:06 -07:00
Xavier Deguillard
ed3034a15f cli: enable pyre-strict for cmd_util.py
Summary: That file was already had good types.

Reviewed By: fanzeyi

Differential Revision: D28544420

fbshipit-source-id: b1b02b7d116ca382001c318fd0626c8d50480013
2021-05-19 19:27:06 -07:00
Xavier Deguillard
29e8001ae8 cli: enable pyre-strict for buck.py
Summary:
This will enable future modifications of this file to always be properly type
checked.

Reviewed By: fanzeyi

Differential Revision: D28544423

fbshipit-source-id: 73e2fe9ba386c7a0b6165424c383db7d647abcc0
2021-05-19 19:27:06 -07:00
Xavier Deguillard
59077e2e6b cli: enable pyre-strict for config.py
Summary:
This fixes the handful of errors and warnings that Pyre threw when I tried
making this file strict. Enabling pyre strict will force future addition and
modifications to this file to have type checking, increasing the reliability of
the code.

Reviewed By: fanzeyi

Differential Revision: D28543212

fbshipit-source-id: 06b976a37e6f4c3a0bab2eb3ecc4c217497bbbd5
2021-05-19 19:27:06 -07:00
Zeyi (Rice) Fan
61865663ed config: rearrange settings so they are in group
Summary: Move configuration options closer to the group.

Reviewed By: chadaustin

Differential Revision: D28554557

fbshipit-source-id: 879b14ac5a51cd69d8fd423564a46b7e17c4c8f4
2021-05-19 18:47:49 -07:00
Xavier Deguillard
82e35a1a76 inodes: split inodes test target
Summary:
On Windows, Buck will spawn one process per test target and all the tests will
run sequentially. What this means is that the inodes tests are running for a
long time due to running single threaded. To remediate this, let's start by
splitting the tests into multiple targets.

Reviewed By: chadaustin

Differential Revision: D28521827

fbshipit-source-id: dc4cd20cb9d1cdc52e84b373bb82f6bae44aa9d4
2021-05-19 18:35:25 -07:00
Zeyi (Rice) Fan
ccce71364f cli: add dry-run flag to eden rage
Reviewed By: chadaustin

Differential Revision: D28541898

fbshipit-source-id: 4f069f445ec3cefb8a091f73c812fbcd161a4296
2021-05-19 13:46:34 -07:00
Xavier Deguillard
36d6e80dfb inodes: remove test main
Summary: Tests appear to pass without it, remove it.

Reviewed By: chadaustin

Differential Revision: D28521826

fbshipit-source-id: a44650552380485719f7ad1418a01fb717872f74
2021-05-18 18:27:07 -07:00
Xavier Deguillard
cdb6b9ca6d inodes: remove debug logs
Summary: For whatever reason some of my debug logs got landed :(

Reviewed By: fanzeyi

Differential Revision: D28510825

fbshipit-source-id: 65bd9165020bfe3afff54109a9f550a460266737
2021-05-18 09:08:21 -07:00
Zeyi (Rice) Fan
1ad184455b inodes: implement FSCK for Windows Tree Overlay
Summary:
This diff implements FSCK for EdenFS Windows.

On Windows, users can still modify EdenFS mounts even when EdenFS is not
running, which may cause mismatch between EdenFS state and on-disk view. This
subsequently may cause issues when EdenFS is running again (such as permission
error, not seeing added entries in `hg status`, etc..).

This diff adds FSCK to EdenFS Windows. It is not exactly same as what fsck
traditionally do on *NIX systems. We are still dubbing it as FSCK since it
works at the same place as eden fsck.

At startup, FSCK will crawl the EdenFS mount to compare the overlay state with
disk state. It then synchronizes the overlay view with what the user has on
disk. Note Windows does not always permit user to modify the mount, it only
allows changes in certain situation. In particular, when the directory is in
Full state, this diff takes advantage of that so we can finish the scanning by
only scans such directories.

One limitation of Windows FSCK is that, it cannot reliably tell if the user
deleted a directory or file from dirty placeholder directories. This is because
ProjectedFS will hide untouched entries under dirty placeholder directory when
EdenFS is not running, and there is no way we can tell if the entry is gone
because of user deletion or hid by ProjectedFS.

This is not perfect but acceptable to some extent. One possible failure scenario is:

1. User creates a directory named `foo`.
2. User writes a file to that directory (`foo/bar`).
3. EdenFS then stops running.
4. User then deletes the entire `foo` directory on disk.
5. EdenFS starts again, `foo` will be recrated with an empty `bar` file. This
   will still correctly show in `hg status`, and the user is able to delete
   them again.

Reviewed By: xavierd

Differential Revision: D27872753

fbshipit-source-id: c553db568379062ff4504204c1a1785664f87c00
2021-05-17 23:38:02 -07:00
Manish Rajpal
604ec1da74 relax version mismatch check
Summary:
We want eden doctor to report a problem about mismatched running and installed version only if the running version is more than 2 weeks older than installed.

Please see task for more context

Reviewed By: fanzeyi

Differential Revision: D28464491

fbshipit-source-id: 34b9b4cf533482f3006100bbf675c89ea7ee6fff
2021-05-17 19:36:05 -07:00
Xavier Deguillard
02a10e17ad fs: shave 136 bytes off FileInode
Summary:
While looking at the previous diff, I noticed that a significant amount of
memory was used by the loading promise. Since this loading promise is only used
when an inode is being loaded, its usage is the uncommon case: there should be
significantly more inodes being loaded or unloaded than loading at any given
time in EdenFS's lifetime.

Reviewed By: chadaustin

Differential Revision: D28477391

fbshipit-source-id: e80269506b980d7f217f6bdf59034ef003c4b3fc
2021-05-17 14:10:40 -07:00
Xavier Deguillard
9c73da76f9 fuse: use ImmediateFuture in the Fuse dispatcher
Summary:
Similarly to the NFS change, this moves all the folly::Future handling in the
FuseChannel itself instead of inside the dispatcher. This should allow the
inode code to be converted to using ImmediateFuture instead of folly::Future.

Reviewed By: genevievehelsel

Differential Revision: D28372252

fbshipit-source-id: 7aae29d4a32500513c0062dfa42b2c7a3be038db
2021-05-17 14:07:29 -07:00
Xavier Deguillard
de6ca0c970 utils: handle void lambda in ImmediateFuture
Summary:
Lambda returning no values would cause the compiler to try to instantiate an
ImmediateFuture<void>, which doesn't compile. We could try special casing the
void type, but it's easier if we simply consider these lambda to return unit.

Reviewed By: genevievehelsel

Differential Revision: D28372253

fbshipit-source-id: 1368ae5dc5e2d4d6a5c3e31bc87ed7d230027c3a
2021-05-17 14:07:29 -07:00
Xavier Deguillard
3eb9e86b61 inodes: convert InodeMap to ImmediateFuture
Summary:
The InodeMap can be extremely hot when issuing tons of requests to EdenFS.
Unfortunately, it still needs to do memory allocation due to its use of
folly::Future. By switching to ImmediateFuture we can avoid the memory
allocation, speeding it up slightly.

For the NFS dispatcher, this moves the call to `semi()` inward, allowing us to
target specific inode methods to convert next. For the Fuse dispatcher, I've
simply converted the ImmediateFuture into a Future directly, keeping the rest
of the code unchanged, a subsequent change will convert the dispatcher code to
ImmediateFuture.

Reviewed By: chadaustin

Differential Revision: D28302480

fbshipit-source-id: 4e097a721443f0d52f34a337a96f8a63a9a7cd7c
2021-05-17 14:07:29 -07:00
Xavier Deguillard
3863a8972a utils: add a timeout to ImmediateFuture::{get,getTry}
Summary:
This is to mimic the folly::Future API which allows the `get` and `getTry` to
throw if the Future isn't ready. One difference is that the ImmediateFuture API
has a default argument of a max duration instead of having a separate method.
Since chrono durations are expressed as intmax_t (64-bits on systems supported
by EdenFS) a max duration is virtually infinite.

Reviewed By: chadaustin

Differential Revision: D28424053

fbshipit-source-id: 319493174f31367184dbe0aa811a97145b0310cf
2021-05-17 14:07:28 -07:00
Chad Austin
c5b895d7f2 allow 1000 background FUSE requests
Summary:
DurhamG discovered that setting max_background in fuse_init_out allows
a larger number of concurrent FUSE requests. The documentation
indicates it's intended to affect background requests like readahead,
but empirically you can observe increased live FUSE requests with `rg
-j200` and `eden top`. Default to 1000 because EdenFS can handle a
large amount of concurrency and we want to avoid blob and tree fetches
to block FUSE IO when not necessary.

Reviewed By: xavierd

Differential Revision: D27526032

fbshipit-source-id: 0d3fa383772f719524a9be84b73fa2eb599580d7
2021-05-17 12:48:03 -07:00
Chad Austin
48b35a0a5e differentiate EdenConfig and CheckoutConfig in EdenMount
Summary:
`getConfig` was ambiguous, so differentiate EdenConfig and
CheckoutConfig across the implementation.

Reviewed By: genevievehelsel

Differential Revision: D28398762

fbshipit-source-id: 9490e4b31c5d1b0570ee5615e5a3197400397993
2021-05-17 12:48:03 -07:00
Chad Austin
9a41e85d45 add validation to config key names and standardize on hyphens instead of underscores
Summary: To avoid inconsistency on an unimportant degree of freedom, disallow configs with underscores.

Reviewed By: genevievehelsel

Differential Revision: D28398510

fbshipit-source-id: 7720bd79129102d668d229979733a90547e275da
2021-05-17 12:48:03 -07:00
Chad Austin
c46b27d505 remove the dead mononoke configs
Summary:
EdenFS doesn't have a mononoke backend anymore, so the configs are no
longer necessary.

Reviewed By: genevievehelsel

Differential Revision: D28398369

fbshipit-source-id: 63f352bd82bc14b745535c227cb213e01f15afe8
2021-05-17 12:48:03 -07:00
Chad Austin
c35829ff15 organize EdenConfig layout
Summary:
As EdenConfig grows more knobs, some structure is warranted. I'd
prefer something like anonymous structs or maybe even an
EdenSettingGroup type, but for now add some comments and at least put
them near each other.

Reviewed By: genevievehelsel

Differential Revision: D28398306

fbshipit-source-id: 169c4d2e0eeeb36d1812cdb73c9ac61d11652e09
2021-05-17 12:48:03 -07:00
Xavier Deguillard
13f9edb209 inodes: shave 8 byte off of the size of InodeBase
Summary:
The structure had 2 padding of 4 bytes each due to the alignment requirement of
the EdenMount pointer and of the location_ field. Moving the EdenMount pointer
allows the padding to go away.

Reviewed By: fanzeyi

Differential Revision: D28476945

fbshipit-source-id: b521b4184d3924480ef54f840389156faab3988d
2021-05-17 11:54:52 -07:00
Xavier Deguillard
288a56327b utils: EDEN_BUG_FUTURE returns a Try<T>
Summary:
This allows the macro to be used for both folly::Future, but also with
ImmediateFuture, reducing the cost of migrating to the latter.

Reviewed By: chadaustin

Differential Revision: D28302478

fbshipit-source-id: d8470428ecaa6aaccf2aa884437ca97d4b45806f
2021-05-13 16:51:34 -07:00
Xavier Deguillard
b525114769 nfs: switch RpcServerProcessor::dispatchRpc to ImmediateFuture
Summary:
Now that both implementation are using ImmediateFuture, we can move the
ImmediateFuture one layer up.

Reviewed By: kmancini

Differential Revision: D28302479

fbshipit-source-id: 3c2c164a90ffb42a0e7da8528f976af34fc87315
2021-05-13 16:51:34 -07:00
Xavier Deguillard
65d00fff9f nfs: convert Nfsd3 to ImmediateFuture
Summary:
With the Mountd code being converted to ImmediateFuture, we can now convert
Nfsd3 to use ImmediateFuture too. For now, this isn't expected to perform
better due to the InodeMap still using on folly::Future, which forces the
ImmediateFuture code to store a SemiFuture. A future change will look at
switching the InodeMap to ImmediateFuture to solve this.

Reviewed By: kmancini

Differential Revision: D28297422

fbshipit-source-id: 8b85103657e877b0f102130f2117bbe60598ed52
2021-05-13 16:51:34 -07:00
Xavier Deguillard
189934f9ac utils: allow mutable lambda to be passed to ImmediateFuture::thenValue
Summary:
Since lambda are default capturing by const, Func was also captured that way,
which made it impossible to call if Func was actually a mutable lambda.

Reviewed By: chadaustin

Differential Revision: D28297423

fbshipit-source-id: b9c6bdcf024c2e219ec0f8f5be2379e51df24db0
2021-05-13 16:51:34 -07:00
Xavier Deguillard
472e67081c nfs: convert Mountd to use ImmediateFuture
Summary:
As a first towards converting the code to use ImmediateFuture more broadly,
let's start with a small self contained part of the code.

This is mostly a sed except for the dispatchRpc method that needs to call
.semi().via().

Reviewed By: kmancini

Differential Revision: D28297421

fbshipit-source-id: e706e91fc8f132d4ef742ae98af9bb8304e0bf36
2021-05-13 16:51:34 -07:00
Xavier Deguillard
5ee950f5e0 utils: also call func when an ImmediateFuture holds an exception
Summary:
This code initially was for thenValue, but when I converted it for thenTry I
forgot to also remove the hasException case. We were never calling the callback
on a Try that had an exception.

Reviewed By: chadaustin

Differential Revision: D28302477

fbshipit-source-id: 755fb2c8928627fbe1883f3863cafc360e34a038
2021-05-13 16:51:34 -07:00
Xavier Deguillard
7d48df9938 utils: coerce a SemiFuture<ImmediateFuture<T>> to a SemiFuture<T>
Summary:
When the passed in callback returns an ImmediateFuture, the code had a small
typing bug where we would try to return an ImmediateFuture<ImmediateFuture<T>>
while the function signature expected an ImmediateFuture<T>. This is due to the
SemiFuture code not coalescing a SemiFuture<ImmediatureFuture<T>> into a
SemiFuture<T>.

Reviewed By: chadaustin

Differential Revision: D28293942

fbshipit-source-id: 1bc8f58d387766f29e573499fb37402ff9b49c83
2021-05-13 16:51:34 -07:00
Katie Mancini
85942cfaad use portable version of gtest
Summary:
gtest includes some windows headers that will have conflicts with the
folly portability versions. This caused some issues in my in-memory tree
cache diffs (D27050310 (8a1a529fcc)).

We should probably generally be using the folly portable gtests so we can
avoid such issues in the future.

see here for more details: bd600cd4e8/folly/portability/GTest.h (L19)

I ran this with codemod yes to all

- convert all the includes with quotes:
`codemod -d eden/fs --extensions cpp,h '\#include\ "gtest/gtest\.h"' '#include <folly/portability/GTest.h>'`

- convert all the includes with brackets
`codemod -d eden/fs --extensions cpp,h '\#include\ <gtest/gtest\.h>' '#include <folly/portability/GTest.h>'`

- convert the test template
`codemod -d eden/facebook --extensions template '\#include\ <gtest/gtest\.h>' '#include <folly/portability/GTest.h>'`

then used `arc lint` to clean up all the targets files

Reviewed By: genevievehelsel, xavierd

Differential Revision: D28035146

fbshipit-source-id: c3b88df5d4e7cdf4d1e51d9689987ce039f47fde
2021-05-12 15:58:27 -07:00
Xavier Deguillard
76111d58c2 privhelper: override the fstype to EdenFS for our NFS mount
Summary:
In order to get Watchman to recognize EdenFS mounted as NFS, we previously set
the f_mntfromname to be "edenfs". Unfortunately, Apple decided that when the
NFS server is accessed via a unix socket it would overwrite that and instead
use the path to the socket.

Digging in the source code, I did find that the f_fstypename can be overwritten
by calling fsctl with the right set of arguments. Thus, let's do just that.

Reviewed By: kmancini

Differential Revision: D28270605

fbshipit-source-id: f6be4e394d814806aa03ec3e82b8bc2faf364ea7
2021-05-12 13:06:57 -07:00
Xavier Deguillard
f2e7099799 nfs: allow mountd and nfsd to bind to a unix socket on macOS
Summary:
Due to NFS being designed as a network filesystem, it default to binding on a
TCP socket. For EdenFS, since we're not expecting to mount an actual remote
filesystem, we bind these sockets to localhost. Unfortunately, TCP sockets have
some inherent overhead due to being designed to be reliable over a non-reliable
medium.

On macOS, Apple provides a way to mount an NFS server that is listening on a
unix domain socket. Thanks for unix socket being reliable, the TCP overhead
goes away leading to some higher throughput and lower latency for the NFS
server. For EdenFS, timing `rg foobar` over a directory containing 27k files gives:

NFS over TCP:
rg foobar > /dev/null  0.80s user 5.44s system 567% cpu 1.100 total

NFS over UDS:
rg foobar > /dev/null  0.77s user 5.27s system 679% cpu 0.888 total

osxfuse:
rg foobar > /dev/null  0.87s user 5.59s system 662% cpu 0.975 total

The main drawback of going through a unix socket is that D27717945 (bcf6aa465c) appears to
no longer be effective due to
8f02f2a044/bsd/nfs/nfs_vfsops.c (L3739)

Reviewed By: kmancini

Differential Revision: D28261422

fbshipit-source-id: 25dc1dc78cdb50d6c6550a86ef01ea2c894c110f
2021-05-12 13:06:57 -07:00
Xavier Deguillard
fdbedc4818 nfs: allow mountd and nfsd sockets to be non-inet on macOS
Summary:
macOS supports NFS servers that can be reached via a unix socket as a way to
improve performance by reducing the TCP cost. To support this, let's first
allow the socket to bind to to be passed to the RpcServer, and then pass it
through to the privhelper code.

Reviewed By: kmancini

Differential Revision: D28261423

fbshipit-source-id: 78c60aac26353d1da76a67897429b964332df8b3
2021-05-12 13:06:57 -07:00
Xavier Deguillard
6de9b24cb0 Back out "checkout: keep InodeNumber constant during checkout"
Summary: Looks like this is causing files to not be immediately updated after an update.

Reviewed By: kmancini

Differential Revision: D28384151

fbshipit-source-id: 61159db64a9f3c9c1f9e54ee0462ca870ff2aecc
2021-05-12 12:26:53 -07:00
Xavier Deguillard
935791590a utils: add a semi() method to ImmediateFuture
Summary:
While ImmediateFuture are expected to be used on values that are mostly
immediate, there are cases where it won't be. In these cases we need a way to
wait for the computation/IO to complete. In order to achieve this, we need to
transform an ImmediateFuture onto a SemiFuture.

Reviewed By: fanzeyi

Differential Revision: D28293941

fbshipit-source-id: 227c0acf1e22e4f23a948ca03f2c92ccc160c862
2021-05-11 08:05:11 -07:00
Xavier Deguillard
be1aeaf5be utils: add default constructor to ImmediateFuture
Summary:
When a T can be default constructed, make an ImmediateFuture default
constructible.

Reviewed By: fanzeyi

Differential Revision: D28292874

fbshipit-source-id: 4c239cc9c3f448652b2bcdc103ea1a81ace46402
2021-05-11 08:05:11 -07:00
Xavier Deguillard
f331a0c3f9 utils: add noexcept qualifier to ImmediateFuture
Summary: This should help the compiler generate even better code.

Reviewed By: chadaustin

Differential Revision: D28153979

fbshipit-source-id: b1d84c92af4fa760c92624c53d7f57330d7706fa
2021-05-11 08:05:11 -07:00
Xavier Deguillard
1aa6e143e6 fuse: allow applexattr with macFUSE
Summary: This is the same change as D27137328 (a9a1b73418) but for macFUSE.

Reviewed By: kmancini

Differential Revision: D28328029

fbshipit-source-id: c58e146dba2e7e3bdb320f2b5e80946e4a7b3afe
2021-05-10 13:37:43 -07:00
Genevieve Helsel
728e643a48 use eden daemon background prefetch logic instead of python subprocesses
Summary: With the addition of the ability to "background" the prefetches in the daemon itself, we can remove the subprocess backgrounding in the python layer and just depend on the internal backgrounding.

Reviewed By: chadaustin

Differential Revision: D27825274

fbshipit-source-id: aa01dc24c870704272186476be34d668dfff6de5
2021-05-10 12:42:50 -07:00
Xavier Deguillard
29d003865f fuse: workaround macFUSE ABI change
Reviewed By: chadaustin

Differential Revision: D25505235

fbshipit-source-id: 31a2b3993801de4c8f084213e73f623dba820ef6
2021-05-10 12:39:33 -07:00
Chad Austin
d45b2711a2 remove the dead getTreeForManifest
Summary: getTreeForManifest is no longer called, so remove it.

Reviewed By: genevievehelsel

Differential Revision: D28306796

fbshipit-source-id: e51a32fa7d75c54b2e3525e88c162247b4496560
2021-05-10 11:53:30 -07:00
Tianxiang Chen
59e5ae5c66 make Kerberos renewal command suggestions consistent
Summary: Change remediations to use `kdestroy && kinit`

Reviewed By: stepanhruda

Differential Revision: D28295440

fbshipit-source-id: 0e3348b2ad99870d275a84c482be02464b718102
2021-05-07 16:03:23 -07:00
Xavier Deguillard
c79ff7602a checkout: keep InodeNumber constant during checkout
Summary:
In an NFS mount, the InodeNumber are sent to the client as the unique
identifier for a file. For caching purposes, the client will issue a GETATTR
call on that InodeNumber prior to opening it, to see if the file changed and
thus whether its cache needs to be invalidated.

In EdenFS, the checkout process does unfortunately replace file inodes
entirely, causing new InodeNumber to be created, and thus after an update, an
NFS client would not realize that the content changed, and would thus return
the old content to the application. To solve this, we could approach it in 2
different ways:
 - Build a different kind of handle to hand over to the NFS client
 - Keep InodeNumber constant during checkout.

After trying the first option, it became clear that this would effectively need
to duplicate a lot of functionality from the InodeMap, but with added memory
consumption. This diff attempts to do the second one.

Reviewed By: chadaustin

Differential Revision: D28132721

fbshipit-source-id: 94d470e33174bb9ffd7db00e1b37924096aac8e9
2021-05-06 13:28:44 -07:00
Xavier Deguillard
b7ab05edc5 utils: add an ImmediateFuture type
Summary:
In very hot code path, EdenFS is spending a very large amount of time creating
and destroying folly::Future objects. This is due to the required memory
allocation, as well as the handful of atomics that are happening at creation
time, and these are showing up in EdenFS profiles.

In the steady state, EdenFS actually doesn't need futures, as it often times is
able to service requests from its in-memory caches, in which case we should
ideally just return the value itself and not wrap it in a folly::Future. The
added ImmediateFuture is a step in this direction, as it can hold either an
immediate value, or a folly::SemiFuture, and allow the same API to be used
transparently between these 2.

Reviewed By: genevievehelsel

Differential Revision: D28006802

fbshipit-source-id: 89eaa32e7fa82c44844c4b23c4cb30dbeea46ca8
2021-05-06 10:54:03 -07:00
Zeyi (Rice) Fan
dfc5480620 cli: disable edenfsctl top for Windows
Summary:
Currently running `edenfsctl top` will crash on Windows:

```
Traceback (most recent call last):
  File "C:\Python38\Lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Python38\Lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\tools\eden\bin\edenfsctl.exe\__main__.py", line 3, in <module>
  File "C:\tools\eden\bin\edenfsctl.exe\eden\fs\cli\main.py", line 2253, in zipapp_main
  File "C:\tools\eden\bin\edenfsctl.exe\eden\fs\cli\main.py", line 2236, in main
  File "C:\Python38\Lib\asyncio\runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "C:\Python38\Lib\asyncio\base_events.py", line 616, in run_until_complete
    return future.result()
  File "C:\tools\eden\bin\edenfsctl.exe\eden\fs\cli\main.py", line 2212, in async_main
  File "C:\tools\eden\bin\edenfsctl.exe\eden\fs\cli\main.py", line 1059, in run
  File "C:\tools\eden\bin\edenfsctl.exe\eden\fs\cli\top.py", line 395, in __init__
  File "C:\Python38\Lib\curses\__init__.py", line 13, in <module>
    from _curses import *
ModuleNotFoundError: No module named '_curses'
```

This diff will let it prints an error message.

Reviewed By: xavierd

Differential Revision: D28207330

fbshipit-source-id: a465fe5941b469f4a1ef964f1d4dc8a593639e7c
2021-05-05 18:24:12 -07:00
Zeyi (Rice) Fan
bd08aac957 cli: parse command line args outside asyncio
Summary:
It looks like argparse's exit was not able to handle asyncio event loop well,
causing edenfsctl to generate a long ugly stack trace when the command line
flag does not parse.

Let's just move the arguments parsing outside the asyncio runloop to avoid this
problem as a whole. In theory it should improve our `--help` time a little bit.

Reviewed By: chadaustin

Differential Revision: D28206622

fbshipit-source-id: 881eefaea73b244eadff0165965085e64dad935f
2021-05-05 18:24:12 -07:00
Zeyi (Rice) Fan
70f7b5151b cli: do not call os.getuid on Windows
Summary:
Some user reported to see `edenfsctl restart` crashes due to this call to
os.getuid() since it does not available on Windows. P410914264

https://docs.python.org/3.9/library/os.html#os.getuid

Reviewed By: chadaustin

Differential Revision: D28204262

fbshipit-source-id: 077bf207d8b1b6c014fface63ea93e66057629cd
2021-05-05 18:24:12 -07:00
John Reese
9fd86a4fae apply upgraded black 21.4b2 formatting to fbsource
Summary:
This applies the formatting changes from black v21.4b2 to all covered
projects in fbsource. Most changes are to single line docstrings, as black
will now remove leading and trailing whitespace to match PEP8. Any other
formatting changes are likely due to files that landed without formatting,
or files that previously triggered errors in black.

Any changes to code should be AST identical. Any test failures are likely
due to bad tests, or testing against the output of pyfmt.

Reviewed By: thatch

Differential Revision: D28204910

fbshipit-source-id: 804725bcd14f763e90c5ddff1d0418117c15809a
2021-05-04 22:16:51 -07:00
Zeyi (Rice) Fan
9bee308885 cli: disable edenfsctl fsck on Windows
Summary:
Context: https://fb.workplace.com/groups/edenfswindows/permalink/828914994691047/

Even with D27872753 it doesn't really make sense to have `eden fsck` running on Windows since it requires EdenFS repository to **be unmounted**.

This diff changes it to generate a warning to redirect users to run `eden doctor` instead (which is likely what they need).

Reviewed By: kmancini

Differential Revision: D28203778

fbshipit-source-id: ae105678876903bcf6514252bf07189775f9b187
2021-05-04 21:25:00 -07:00
Pyre Bot Jr
99f17e57ed suppress errors in fbcode/eden - batch 1
Differential Revision: D28190108

fbshipit-source-id: 6d67de1cb21f6ec4400adae2f42811f1f3e5d155
2021-05-04 15:25:14 -07:00
Diego Elio Pettenò
d0a4406f1c Make the eden restart --force command explicit.
Summary: This just makes it more obvious _where_ `--force` should be passed.

Reviewed By: genevievehelsel

Differential Revision: D28119590

fbshipit-source-id: 1fbdb4428e9b89e7b66c959f874067485a91d534
2021-05-04 09:51:40 -07:00
Xavier Deguillard
fc382774d6 service: remove dependency on curl
Summary:
From what I can see, this was added when EdenFS had a Mononoke store, which is
now long gone, thus we should be able to remove the Curl dependency altogether.

Reviewed By: fanzeyi

Differential Revision: D28037816

fbshipit-source-id: 834f7db64bab5dda1748ad2f033c27a2854b0ba4
2021-04-29 19:41:04 -07:00
Xavier Deguillard
ddf6c2dc5c fuse: remove @manual from FuseTypes.h
Summary: Looks like these aren't needed since these files are owned by a TARGETS file.

Reviewed By: genevievehelsel

Differential Revision: D28101197

fbshipit-source-id: d790530227641bf25e48bd96c8a95dd31f08a954
2021-04-29 17:30:16 -07:00
Xavier Deguillard
5a6172a8e6 autodeps: remove @manual for cpptoml
Summary:
Now that autodeps knows where to find cpptoml.h, we no longer need these
manual annotation.

Reviewed By: kmancini

Differential Revision: D28100956

fbshipit-source-id: 463b73834c500c1d16a4a769af3655938124d49d
2021-04-29 16:19:09 -07:00
Zeyi (Rice) Fan
e94d69dcd5 utils: define symlink type for Windows
Summary:
This diff defines symlink type in `DirType`.

Even though it is not directly used in the FSCK diff. This will allow us to support symlink in EdenFS Windows in the future.

Reviewed By: genevievehelsel

Differential Revision: D28016305

fbshipit-source-id: 67c1aa22e39198f9c91845129695f27b8303a5f1
2021-04-29 13:17:54 -07:00
Xavier Deguillard
3868dd01fc inodes: File::fallocate should return a Future
Summary:
We were ignoring the return value of runWhileMaterialized, and thus we were
returning to FUSE before fallocate returned.

Reviewed By: fanzeyi

Differential Revision: D28081991

fbshipit-source-id: f398942ddb2432e48e80c148abc8edb7e5ada71d
2021-04-29 09:51:48 -07:00
Xavier Deguillard
42b17dfa1c nfs: add to Executor directly without creating a future
Summary:
folly::via is a Future API, and thus it creates one, which requires allocating
it and then attaching it to the Executore. Since the code to dispatch a request
isn't Future based, we don't need to use folly::via, and we can simply add the
lambda to the Executor directly. This removes expensive memory allocations from
the EventBase.

Reviewed By: kmancini

Differential Revision: D27976674

fbshipit-source-id: 8fa9724a94ba69b071ab894cdbbad0d33733c098
2021-04-28 17:06:23 -07:00
Xavier Deguillard
72b4096a06 nfs: remove multi-fragment O(N^2) complexity
Summary:
Neither macOS, nor Linux are sending multi-fragment requests to the NFS server.
Since supporting these means calling into memmove, which can be expensive for
large requests, let's just remove support for them for now. If somehow macOS
and/or Linux start sending these, the XCHECK(isLast) will catch this and we can
fix the code by then.

Reviewed By: kmancini

Differential Revision: D27976671

fbshipit-source-id: 77c758b2bb36517d22d5b637e6f0ebf84cc19e5b
2021-04-28 17:06:23 -07:00
Xavier Deguillard
32ee50d702 nfs: move some code out of the event base
Summary:
The EventBase is single threaded, and for heavily concurrent client workflows,
it could see a lot activity, thus every cycle saved can be used to drive more
client requests. The construction of the IOBuf doesn't need to be done while in
the EventBase, thus let's build it outside.

Reviewed By: kmancini

Differential Revision: D27976670

fbshipit-source-id: c6c015ef26df1dcb3fc0c5f179e474bafbd71fac
2021-04-28 17:06:23 -07:00
Xavier Deguillard
04ba04fe88 nfs: bump buffer preallocation size
Summary:
Passing 64 to preallocate means that the AsyncSocket code will issue reads of
64 bytes, even though the IOBufQueue has significantly more space available. We
can thus pass a bigger size to preallocate to reduce both the cost of
allocation, and the syscall cost. For heavily concurrent client code, this will
allow us to read more than one request per syscall.

The careful reader may have noticed that for very small requests the code may
reallocate more often that it should as it will always reallocate when falling
under 4KB. This is likely to not be an issue in practice.

Reviewed By: kmancini

Differential Revision: D27976672

fbshipit-source-id: 4c7e3aecc4763ab20854f3c466ce0872332f9b77
2021-04-28 17:06:23 -07:00
Xavier Deguillard
4daf57cab6 nfs: various cleanup of Server.cpp
Summary:
These are various cleanups that should make the code easier to read, there is
no behavior changes.

Reviewed By: kmancini

Differential Revision: D27976673

fbshipit-source-id: 470eb628ca75bf1712a93c6e9aa3a27c3f314d01
2021-04-28 17:06:23 -07:00
Xavier Deguillard
3185c2f83e inodes: cache size for non-materialized inodes
Summary:
Running `rg foobar` in a loop and profiling EdenFS shows that we're spending a
significant amount of time collecting the size of non-materialized files. Since
this will never change, we can easily cache it for much faster access.

Reviewed By: chadaustin

Differential Revision: D27924804

fbshipit-source-id: 8b8af63dcb82664db2ecd81b3fcdc006a3a52d72
2021-04-28 17:06:23 -07:00
Yipu Miao
85b9f8ed3d creating RE CAS Digest proxy
Summary: Create a proxy that stored RECAS-> Eden Hash, similar to SCS and HG proxy.

Reviewed By: chadaustin

Differential Revision: D27873498

fbshipit-source-id: 0b3e50e3a74b8f0914547178789cb6684b780866
2021-04-28 14:59:39 -07:00
Yipu Miao
10dd235a48 creating RE CAS backing store with everything unimplemented.
Summary: Create a RE-CAS backing store with all APIs unimplemented, and Linux only.

Reviewed By: chadaustin

Differential Revision: D27771047

fbshipit-source-id: de00c6e290f924872eae7290b1945e6b3f40d610
2021-04-28 14:59:39 -07:00
CodemodService FBSourceClangFormatLinterBot
63c0e35bd7 Daily arc lint --take CLANGFORMAT
Reviewed By: zertosh

Differential Revision: D28053932

fbshipit-source-id: d2f903158c49a41a0a19df5cf1af540ba9f90a98
2021-04-28 04:38:27 -07:00
Katie Mancini
7e37116aae report TreeCache stats
Summary:
Chad first noted that deserializing trees from the local store can be expensive.
From the thrift side EdenFS does not have a copy of trees in memory. This
means for glob files each of the trees that have not been materialized will be
read from the local store. Since reading an deserializing trees from the local
store can be expensive lets add an in memory cache so that some of these
reads can be satisfied from here instead.

We collect some cache statistics already, lets expose them through thrift with
the rest of the stats.

Reviewed By: chadaustin

Differential Revision: D27052265

fbshipit-source-id: d7fdf70260599b8df43824e2442471e332c1b0cf
2021-04-27 17:38:40 -07:00
Katie Mancini
8a1a529fcc use custom in memory tree cache
Summary:
Chad first noted that deserializing trees from the local store can be expensive.
From the thrift side EdenFS does not have a copy of trees in memory. This
means for glob files each of the trees that have not been materialized will be
read from the local store. Since reading an deserializing trees from the local
store can be expensive lets add an in memory cache so that some of these
reads can be satisfied from here instead.

Here we actually start to use the cache!

Reviewed By: chadaustin

Differential Revision: D27050310

fbshipit-source-id: e35db193fea0af7f387b6f44c49b5bcc2a902858
2021-04-27 17:38:40 -07:00
Katie Mancini
90072e0f4e add unit tests for TreeCache
Summary:
This introduces some basic unit tests to ensure correctness of the cache.
We are adding tests to cover the simple methods of the object cache since we
are using that code path here. And adding a few sanity check tests to make sure
the cache works with trees.

Reviewed By: chadaustin

Differential Revision: D27050296

fbshipit-source-id: b5f0577c1662483f732bb962c5b40bca8e1dcb40
2021-04-27 17:38:40 -07:00