Commit Graph

2427 Commits

Author SHA1 Message Date
Ken Yong Quan Oung
b80e719c81 Fix type annotation for ExpectedFileSet
Summary:
## Backstory
Pyre was throwing errors in my diff (D17747558) regarding an extraneous fixme. Turns out PyreBot has been adding and removing these fixmes during version updates (see D17135557 and D16183608), so I suspect it's something to do with the Pyre version. Anyways, I figured it'd be easier to do the annotation than to remove the fixme and risk Pyre throwing the same error in a later diff.

## What I did
I added the Key type (Path) and Value type(ExpectedFileBase). mypy then started throwing an error regarding __iter__ returning the wrong type because it wanted an iterator over keys rather than values. Fixed that and added .values() to the for loop.

Reviewed By: genevievehelsel

Differential Revision: D17806135

fbshipit-source-id: c07feee33db78a9bff19ba9856a7047657b8c63e
2019-10-08 11:18:51 -07:00
Wez Furlong
d50c413bc5 eden: collect full command line arguments for eden top on macos
Summary:
We make use of the KERN_PROCARGS2 MIB data that we can
retrieve via `sysctl`.

If we can't retrieve that data then we fall back to libproc as
we were doing previously.  From my testing so far it seems like
the main reason for failure is that the target process is a
protected system process.

Reviewed By: chadaustin

Differential Revision: D17724101

fbshipit-source-id: 8de1a978e6f89612bfe247e0fd540d9078f50746
2019-10-04 11:30:36 -07:00
Puneet Kaushik
97834a146d Add requesting process name in the trace
Summary: This will help us identify the calling process for the FS request. This was helpful while testing watchman crawl in Eden repo.

Reviewed By: chadaustin

Differential Revision: D17719028

fbshipit-source-id: 0d646d7949a6e26268b71287b26d63473a9a87f8
2019-10-04 11:08:44 -07:00
Zeyi (Rice) Fan
7f8aae31f9 getdeps: add libcurl and make Eden use libcurl instead of system curl
Summary:
We are seeing random segment fault originating from OpenSSL on macOS when
Mononoke fetching is enabled.

The cause is that on macOS we are actually linking against libcurl shipped with
the system instead of ours. That copy of libcurl is linked with macOS's
libcrypto instead of the one we compiles during Eden's build, and it seems that
version of libcrypto does not provide concurrency safety.

The solution is to build curl on macOS and make sure it is linked to our
OpenSSL that has the concurrency callbacks registered.

Reviewed By: wez

Differential Revision: D17657822

fbshipit-source-id: 85abdf3be10b3903a5efc6b3a91624c7258de790
2019-10-04 11:00:45 -07:00
Adam Simpkins
0b5a1295fc support running the hg status integration tests in CMake builds
Summary:
Update the CMakeLists.txt files to support building the hg integration tests.
At the moment this only includes one of the test files (`status_test.py`).
I have not verified if tests from the other modules pass yet or if they need
any additional tweaks to work in CMake-based builds.

Reviewed By: pkaush, fanzeyi

Differential Revision: D17678991

fbshipit-source-id: 4a5ee5a8d6039d9d2a635c7027897bbeed14f8c0
2019-10-04 08:56:38 -07:00
Adam Simpkins
8ce111ef53 support building the integration tests with CMake
Summary:
Add initial support for building and running some of the integration tests
with CMake.  For now this just runs the tests from basic_test.py, just to
confirm that most of the framework code works in CMake-based builds.

Many of the other tests should also work as well, but a few of them we may
want to disable for CMake-based builds.  e.g., a couple of the tests depend on
hypothesis, and we would need to include hypothesis as a dependency.  Some of
the tests that use systemd might also require a little more work to get
working.

Reviewed By: fanzeyi

Differential Revision: D17659026

fbshipit-source-id: 67420fda9e1021a0cddee2d385fd21e34fb2fd70
2019-10-04 08:56:38 -07:00
Wez Furlong
1fd6bfc2b3 eden: doctor: suppress FileNotFoundError when checking nuclide
Summary:
One of our diagnostics attempts to run `nuclide-connections`,
and prints a warning if that tool is not found.

In our macOS environment that tool is never present so it always emits
a warning that is not actionable.

This diff suppresses that particular warning.

Reviewed By: fanzeyi

Differential Revision: D17745753

fbshipit-source-id: 3394e88d443383880b632fca04a1ec074e46a9bd
2019-10-04 07:13:28 -07:00
Puneet Kaushik
eba935fa9a Move eden_win_util_tests from vcxproj to Cmake
Summary: Moved the code from vcproj testutils folder to test folder and enabled the Cmake build on it.

Reviewed By: wez

Differential Revision: D17738227

fbshipit-source-id: bcba41cb29b7e24782c36899c0977c5592888ff5
2019-10-04 06:40:48 -07:00
Chad Austin
5c3bdaf01d open unix domain sockets to the world, relying on our own ACL checking
Summary:
Make it possible for any user on the system to connect to Eden's unix
domain socket. Our own permission checking is implemented in D17459971.

Reviewed By: wez

Differential Revision: D17460113

fbshipit-source-id: 29eba62010a58837df0376c66e252f53314a25dd
2019-10-02 23:15:44 -07:00
Chad Austin
be2a3d5059 add permission checking to Eden's Thrift server
Summary:
To allow other user accounts to access fb303 counters, we plan to open
our unix domain socket to the world. But that requires implementing
our own permission checks, so do that first.

Reviewed By: wez

Differential Revision: D17459971

fbshipit-source-id: 3cc512da90f725d1c93f25f2a7a5ea7c72fb2b96
2019-10-02 18:52:25 -07:00
Genevieve Helsel
3137b65fb1 pyre-eden typing fix
Summary:
pyre-eden is mad at some diffs (D17531102, D17459971, D17252083, D17694987, D17633671, ...). I tried actually fixing this but couldn't come up with something immediately.

error here: https://our.intern.facebook.com/intern/sandcastle/log/?instance_id=36028797165385523&step_id=36028798422194913&step_index=14&name=Pyre+found+errors.

Reviewed By: wez

Differential Revision: D17703291

fbshipit-source-id: c53cde2226409ea3d7e381056a047da3da7084c6
2019-10-02 18:02:18 -07:00
Chad Austin
1f09aa2990 actually prefetch blob sizes in parallel
Summary:
Previously, readdir-triggered prefetches would merely look up and
cache the inodes for entries. Given a lookup also needs to return stat
information, including file sizes, prefetch blob sizes too.

Reviewed By: wez

Differential Revision: D17728752

fbshipit-source-id: 1c555c123fb7405f82885b427b32cd007fdb16ef
2019-10-02 17:54:18 -07:00
Puneet Kaushik
3af9ee1321 Converting const ptr to EdenMount to non-const reference
Summary:
Converting the const ptr in EdenDispatcher because we need to call non-const function (like update Journal). Also storing the reference in EdenDispatcher and WinStore instead of ptr.

This diff should not change the behavior of the Eden.

Reviewed By: chadaustin

Differential Revision: D17719606

fbshipit-source-id: 6c371c38045c760837130bb607163c2bc469b17a
2019-10-02 14:48:56 -07:00
Zeyi (Rice) Fan
56525d88b6 add hg:use-datapack config option to gate datapack related behaivor
Summary: This allows us to test the datapack code easier without rebuilding Eden.

Reviewed By: wez

Differential Revision: D17468473

fbshipit-source-id: a6807b4d6e747ae8557ae51fdf798de2a54fd4f1
2019-10-02 12:58:29 -07:00
Chad Austin
4363456fb8 set OOMScoreAdjust to -20 in systemd unit
Summary:
When Eden is competing with hundreds of build processes using about
the same amount of RAM, it's less painful for the OOM killer to kill
the compilers, not the edenfs daemon. Bias its OOM score a little.

Reviewed By: wez

Differential Revision: D17701071

fbshipit-source-id: 5ee1078e78e5aa6251692944ca12d9a892f86a6f
2019-10-02 12:53:28 -07:00
Chad Austin
560f7e3e6e allow trees to be deleted by gc
Summary: Now that Eden has dropped support for flatmanifest, allow GC'ing trees in the local storage.

Reviewed By: simpkins

Differential Revision: D17236345

fbshipit-source-id: d40ec0c2e61c9971ba1d976572d002c48c7bfc20
2019-10-01 16:21:24 -07:00
Ken Yong Quan Oung
90f91b07e3 eden debug file_stat - add summary section
Summary:
The current debug file_stat tool returns a list of read and written files with their corresponding sizes. This is difficult to read and understand.

We add a summary section with:
- file count
- total bytes read/written
- total large files (> 10MB) read/written
- list of large files

The existing list of read/written files are moved into a `details` section.

Reviewed By: fanzeyi

Differential Revision: D17633963

fbshipit-source-id: a0b14d900e13590214b64fd9bbd7db2a0c69b300
2019-10-01 16:07:28 -07:00
Ken Yong Quan Oung
47e10150d4 eden debug file_stat - remove --sizes arg to tool
Summary:
D16836053 -> Diff where --sizes arg was added. Back then, sizes were computed locally and added significant overhead, so it made sense to put this feature behind a flag.

D17080186 -> Diff where function was updated to fetch sizes from thrift call instead of computing it locally

Eden CLI seems to be deployed on Sandcastle on a weekly cadence, so I'm holding off on removing the --sizes flag for now. We can wait till this change is deployed, then make the change to the callsite [here](https://our.intern.facebook.com/intern/diffusion/WWW/browse/master/flib/intern/sandcastle/util/SandcastleEdenUtil.php?commit=1001229135&lines=102) before coming back and removing the flag completely.

Reviewed By: fanzeyi

Differential Revision: D17633671

fbshipit-source-id: c640e5803d1c221f6912c3b4f995a2716c5e520b
2019-10-01 16:07:27 -07:00
Ken Yong Quan Oung
762c643e76 Refine type annotation for LoadedNode's file_size attribute
Summary: The file_size attribute for an inode is not always defined because it can refer to a directory. However, since `LoadedNode`s are always regular files, we can enforce file_size to be always an `int`.

Reviewed By: chadaustin

Differential Revision: D17683020

fbshipit-source-id: b79275c2146e5304bdef02c3228cc0bf35456095
2019-10-01 16:07:27 -07:00
Wez Furlong
e70c16d53e eden: restore getBindMounts method
Summary:
it turns out that buck was using this to avoid making a thrift
call to get the sha1 of files.

Let's restore the method but have it return an empty list until buck
has migrated away from that.

asp2insp is looking at fixing up that aspect of buck

Reviewed By: chadaustin

Differential Revision: D17694987

fbshipit-source-id: 9ab0771c00fc64ed3c3395948650189d50d99180
2019-10-01 14:21:47 -07:00
Zeyi (Rice) Fan
9a641011ff move hg datapack code to a separate class
Summary: Re-organizing code.

Reviewed By: wez

Differential Revision: D17467826

fbshipit-source-id: 83cf7d93b259bee6e22cbf91449b4a22d688eb92
2019-10-01 13:14:02 -07:00
Genevieve Helsel
3932ac9382 stop processing getScmStatus() calls if the thrift connection is closed
Summary: Keep track of `ResponseChannelRequest` in diff() in order to short circut function if client request is no longer active.

Reviewed By: wez, simpkins

Differential Revision: D17531102

fbshipit-source-id: 662333e5fbc2ed9b3b32b619b8d15db618ad06ec
2019-10-01 09:43:47 -07:00
Adam Simpkins
0351c6c772 update the CLI to exit with the correct status for CMake-based builds
Summary:
The Python 3 zipapp module always exits with return code 0 if the main
function returns.  Therefore we need to add our own wrapper function that
handles calling `sys.exit()` if we want to exit with a non-zero status.

Reviewed By: wez

Differential Revision: D17678021

fbshipit-source-id: 5944c75d8e765ab3e3fa038fa6f2eee95ab0e780
2019-10-01 08:21:56 -07:00
Wez Furlong
eb906614de eden: remove legacy bind mount support from doctor
Summary:
The doctor code can't see into the newer redirection
config, which makes it only partially valid.  In addition,
we run `eden redirect fixup` post-update; that supersedes
and replaces the doctor functionality.

I've also removed the associated tests: it's a shame that
they can't be re-purposed to work with the redirection code,
but their model is too awkward to use in that way--those tests
fake up aspects of the mount table and mount commands in layers
that are difficult to holistically fake up.

We have integration tests for the redirect functionality, so
we're not leaving things totally uncovered.

Reviewed By: simpkins

Differential Revision: D17252083

fbshipit-source-id: 8a576fb457bf0a4082bde1770085e809484ee73a
2019-10-01 08:20:06 -07:00
Wez Furlong
fed51ee453 eden: fixup fake_edenfs tests when compiled in @mode/opt
Summary:
Force a reference to the edenfsctlPath flag, otherwise the
linker will discard it and a large number of tests will fail.

Reviewed By: simpkins

Differential Revision: D17683222

fbshipit-source-id: b7cb29e74af85b544f45a228770ad2613c8e6efc
2019-10-01 08:17:29 -07:00
Wez Furlong
d58a3c96d8 eden: remove legacy bind mount code
Summary:
This diff removes the logic that consumes the legacy bind
mount list and mounts them on startup.  That functionality has been
replaced with the eden redirect command.

Instead of performing the bind mounts in the server, the server will
now run `eden redirect fixup` to apply that configuration.

This diff also changes the behavior of performBindMounts: previously, if the
bind mount setup failed, we would tear down the entire repo mount.  Since we're
now spawning an external process, it is much more likely that something might
fail and result in a bad experience, so we no longer bail out in that case:
we'll continue and leave the bind mounts as-is.  The user can then use `eden
doctor` or `eden redirect fixup` to sort things out.

Reviewed By: simpkins

Differential Revision: D17236366

fbshipit-source-id: 8b004551a076216f0e5448942f00b5195ee18803
2019-09-30 18:57:14 -07:00
Wez Furlong
357f2bfc1f edenfs: make eden redirect add nop if the config already exists
Summary:
mostafaeweda and otawfik observed that repeating the same `eden redirect
add` call with the same parameters was tearing down and re-mounting the bind
mount.  That shouldn't matter but it isn't as fast as not doing anything, and
sometimes hdiutil on mac can get into a weird state.

This commit compares the existing configuration against the new redirection
entry that we intend to add before applying the config; if they match then
it prints a note about not doing anything and then returns.

Reviewed By: mostafaeweda

Differential Revision: D17639592

fbshipit-source-id: 48d70d11e14a1a191ae655ad7a990c1c90c14953
2019-09-30 16:57:13 -07:00
Adam Simpkins
0ca94e3650 add missing dependency for eden_store library
Summary:
The RocksDbLocalStore.cpp code updates counters, so it depends on the fb303
library.

Reviewed By: fanzeyi

Differential Revision: D17669619

fbshipit-source-id: d05bee82b05743c2ba292808ce3d77812413d2eb
2019-09-30 16:06:05 -07:00
Zeyi (Rice) Fan
696a023188 eden: call folly's ssl init to initialize openssl callbacks
Summary: `folly::ssl::init` will initialize some of the random number generator and callbacks needed for concurrency.

Reviewed By: wez

Differential Revision: D17644835

fbshipit-source-id: 8b0b4ec98b119298053d7362339ebb8bfbd30586
2019-09-30 15:21:51 -07:00
Chad Austin
ca1ff1c877 write per-checkout config atomically
Summary: In the case of a hard reboot, ensure the per-checkout config.toml isn't corrupted.

Reviewed By: wez

Differential Revision: D17672198

fbshipit-source-id: 98141b411e70ed8b30052f989be8161c3ffcc354
2019-09-30 14:15:38 -07:00
Adam Simpkins
6cb69232a7 always log thrift call times, even if the call fails
Summary:
Update the `Future` based version of the `ThriftLogHelper` class to log how
long the call took, even if it failed.

The code already logged on error for non-Future thrift handler functions, but
for `future_*()` calls we only logged when producing a successful result.
This switches the code from `thenValue()` to `thenTry()` so that we log on
both successful and failed results.

Reviewed By: wez

Differential Revision: D17636471

fbshipit-source-id: 859a326e5bc54183c80f16bf463ba6d451f624e5
2019-09-27 17:32:03 -07:00
Adam Simpkins
b054d9e066 unbreak the build of ServiceAddressTest.cpp
Summary:
D17623550 deleted `ServiceCacheIf::invalidateSelection()` but did not remove
this override, which broke the build for EdenFS's tests.

Reviewed By: wez

Differential Revision: D17638351

fbshipit-source-id: 200ead0f79a2252dc7ac2318745cd98e520737a4
2019-09-27 16:19:49 -07:00
Adam Simpkins
beece856bd limit the number of thrift arguments that we log for some calls
Summary:
Update the logging for `getFileInformation()`, `glob()`, `globFiles()`, and
`getSHA1()` to log at most 5 paths, plus the number of remaining paths.
Watchman can sometimes call `getFileInformation()` with tens of thousands of
paths.  We don't enable these log messages by default, but if someone has
turned up the log levels to help debug, this can easily fill up the log files
with spam.

Reviewed By: wez

Differential Revision: D17623234

fbshipit-source-id: 3ea8ace294fb8f042f1c53382c76148ba4af95f6
2019-09-27 15:38:39 -07:00
Wez Furlong
0cd7ac7044 eden: suppress hdiutil output unless it errors out
Summary:
hdiutil is horribly verbose, which in turn causes `eden redirect fixup`
to be horribly verbose on macos, so let's supress its output when successful.

Reviewed By: simpkins

Differential Revision: D17254318

fbshipit-source-id: ed2508e554d70bdcde0f0546e24dd6155e05d258
2019-09-27 07:14:59 -07:00
Wez Furlong
bc76cfc8b3 eden: gc now compacts sparseimage files for macos redirections
Summary:
The sparse images that we mount in place of bind mounts on macos
can grow over time, and don't automatically shrink if their contents are
purged.

This commit teaches `eden gc` to run `hdiutil compact` on these images
to reclaim space.

The output from `hdiutil compact` is really verbose and noisy, so we
suppress it unless there is an error.

Reviewed By: simpkins

Differential Revision: D17254235

fbshipit-source-id: 944b3824717c8b46d8170ec729c04a93323ab7f0
2019-09-27 07:14:58 -07:00
Adam Simpkins
7ee2610c78 make support for Eden SCM optional
Summary:
Add a CMake option to control whether or not we should build support for
fb-mercurial (aka Eden SCM).  If this is disabled we avoid building anything
under eden/fs/store/hg and drop support for the "hg" backing store.

Reviewed By: wez

Differential Revision: D15980320

fbshipit-source-id: 23a49d3e5cf89199666ff4a0bf46626502c12171
2019-09-26 20:26:43 -07:00
Adam Simpkins
19f2d16c33 change the scm/hg:hg target to use a sh_binary() rule
Summary:
Change the `//scm/hg:hg` target to use an `sh_binary()` rule that invokes the
`:hg_rust` binary with the proper environment so it can find its dependencies,
rather than copying the binary and all of its dependencies into a new
subdirectory.

In dev mode builds the `hg_rust` binary isn't guaranteed to work anywhere
other than its original location, due to the way that dev mode builds use
`$ORIGIN` in the binary's `RPATH` setting.  This happened to work up until now
as the hg_rust binary did not have any separate libraries, but I plan to add
one on the `chg` library.

Reviewed By: quark-zju

Differential Revision: D17109104

fbshipit-source-id: ae8bb1126969f012d1d2fb7d04e80867a310b9a8
2019-09-26 20:15:04 -07:00
Wez Furlong
28de3ee251 eden: fix eden chown to chown the mount point of a redirection
Summary:
We're seeing an issue where for an Eden instance started
as root a subsequent chown doesn't chown the root of the bind mount
and thus makes it impossible to write into the directory.

Reviewed By: simpkins

Differential Revision: D17620135

fbshipit-source-id: 4ee511234c551bbfc7330a60ee85fc5efd329d73
2019-09-26 18:43:29 -07:00
Chad Austin
3de9641856 add option to print debug thrift output as json
Summary:
It's convenient to manipulate Thrift output with jq sometimes, so add
an option to try to encode the resulting Thrift object as JSON.

Reviewed By: simpkins

Differential Revision: D17468559

fbshipit-source-id: b1f4639b6ea0d366400c8283cd7095bb4e0728de
2019-09-26 15:23:45 -07:00
Chad Austin
032e4ecfe6 bump timeouts in ProcessAccessLogTest to fix flake on macOS
Summary:
On a machine with one core, it's quite possible for the process to
freeze for a second, resulting in a flaky test.

Reviewed By: wez

Differential Revision: D17579535

fbshipit-source-id: a3e158b5895c06bdf560ebecd849a74e4efa591e
2019-09-25 18:27:53 -07:00
Misha Shneerson
9a0585ba15 make selection.hosts a shared_ptr
Differential Revision: D17412196

fbshipit-source-id: 872e7e6332284fa00b52e03ce237adeea32fd852
2019-09-25 14:02:59 -07:00
Wez Furlong
e3ebd87a82 eden: tell systemd to raise ulimits
Summary: Increase the limit to a larger amount

Reviewed By: chadaustin

Differential Revision: D17533394

fbshipit-source-id: 7e15d28b049216e238bac48fe062d16bc91ebadc
2019-09-25 09:38:34 -07:00
Chad Austin
4587650f13 atomically write config.json
Summary:
Use fdatasync (or fsync on macOS and Windows) and os.replace to write
Eden's config.json.

Reviewed By: wez

Differential Revision: D17465682

fbshipit-source-id: 0e92a58653befc84d45eb815bc0a02b8c2df3d39
2019-09-23 16:36:18 -07:00
Genevieve Helsel
6a036808cc use callbacks in source control tree comparisons
Summary: Use callback to save ScmStatus instead of storing status inside a `TreeDiffer` object. Involes a bit of restructuring of some code to avoid circular dependencies and library creation. Mostly renames and file moves, some funtion moves as well.

Reviewed By: simpkins

Differential Revision: D17400466

fbshipit-source-id: fcd194a4c20204dffd3d11cd4a083564dc0ea938
2019-09-23 15:22:30 -07:00
Adam Simpkins
21becc5cba increase log level of FUSE request timeouts
Summary:
Increase the log level if a FUSE request timeout occurs, so we can tell if
this has occurred in the logs when debugging user problems.  Rate limit the
messages to at most once per second to avoid lots of log spam when a problem
occurs that causes lots of FUSE requests to time out.

Reviewed By: chadaustin

Differential Revision: D17506837

fbshipit-source-id: b84bd094034f1b31ef74038a9fd3828d4db9acf2
2019-09-23 10:45:16 -07:00
Genevieve Helsel
9130d4f3c4 return error information as part of thrift callback result
Summary: Use callback to save ScmStatus instead of storing status inside a `TreeDiffer` object.

Reviewed By: simpkins

Differential Revision: D17379318

fbshipit-source-id: b5f56c937509f0861f5dc06c742ebc3e1f85c695
2019-09-23 09:08:28 -07:00
Genevieve Helsel
47bb2910bf clean up InodeDiffCallback and replace DiffTest callback
Summary: Uses ThriftStatusCallback in tests and removes unused parameters from InodeDiffCallback

Reviewed By: simpkins

Differential Revision: D17378954

fbshipit-source-id: 47f08e6828a6d5e46197658ca57c1889dc9dd0ba
2019-09-23 09:08:27 -07:00
Adam Simpkins
69e28322d3 make support for Git optional
Summary:
Add a CMake option to control whether or not we should build support for
Git.  If this is disabled we avoid building anything under eden/fs/store/git
and drop support for the "git" backing store.

Reviewed By: wez

Differential Revision: D15980321

fbshipit-source-id: 434364d81b44935ce86fdf4d66697ee21ff2992f
2019-09-20 18:22:04 -07:00
Puneet Kaushik
eb9db5745d Use Win32 implementation of writeFileAtomic on Windows
Summary:
The folly's version of fileutil's throw's "permission denied" error on Windows while creating the config file. Updating the code to call the Win32 version from eden/fs/win/utils.

We do eventually plan to fix Folly by moving the Eden Windows's FileUtils code to it. Until then we will call it from Eden's utils.

Reviewed By: fanzeyi

Differential Revision: D17490623

fbshipit-source-id: 948c488f1dfddd7b12eb8623e056a7680fd5aa73
2019-09-20 14:29:58 -07:00
Adam Simpkins
40ab42dc42 the edenfsctl program depends on python-toml
Summary:
Update the getdeps manifest and Eden's CMake files to indicate that the
edenfsctl program depends on python-toml.

Reviewed By: chadaustin

Differential Revision: D17401215

fbshipit-source-id: f512678d8bca9c7b2b4d25bf9c3ecd7eed825de9
2019-09-20 11:36:13 -07:00