Commit Graph

2488 Commits

Author SHA1 Message Date
Wez Furlong
5bcff17a7f eden: implement mount parsing for macOS
Summary:
Parse the `mount` command output to understand the mount table on macOS.

This is helpful both for eden doctor and the upcoming redirection feature.

Reviewed By: strager

Differential Revision: D15701554

fbshipit-source-id: 6e17e1682dc609ae6f1e9f82bf7b9c729addea27
2019-06-11 16:41:01 -07:00
Wez Furlong
ac89061656 eden: add a helper function to the cli to tabulate output
Summary:
For the redirect subcommand I wanted to automatically tabulate
some data to display it, so here's a little helper function.

The intent is that we pass a list of dictionaries with the data and let
the tabulate function render it for human consumption.

That same set of dictionaries could also be passed to a json serializer
for machine readable output (out of scope from this diff).

The tabulated data is intentionally limited in this current form:

* We make a run through and compute the max width of each column
* A simple header_labels map can be used to provide more human
  readable versions of the dictionary keys as the column headers
* A missing header lable defaults to the uppercased version of
  the dictionary key for that column
* Cell contents are all left aligned in their respective cell

Reviewed By: strager

Differential Revision: D15700886

fbshipit-source-id: e47a1ebc56edb0fd386bfda83865f946f5e782ce
2019-06-11 16:41:00 -07:00
Adam Simpkins
e8a590e3f1 check the return values from chdir() in PathFuncsTest
Summary: This suppresses some build warnings on Ubuntu 18.04.

Reviewed By: strager

Differential Revision: D15768196

fbshipit-source-id: 436ab5ebe59df627b398fcc8cebd1c945e99771a
2019-06-11 16:30:51 -07:00
Adam Simpkins
b5381ebbbe fix some dependencies in the CMake files
Summary:
The eden/fs/store library depends on eden/fs/config.  The changes in
D15428932 exposed a build failure due to this missing dependency.

Reviewed By: strager

Differential Revision: D15768197

fbshipit-source-id: 4482e3a9027fd49163af39d6887da709be810b0a
2019-06-11 16:30:51 -07:00
svcscm
2d5a1f96fd Updating submodules
Reviewed By: yns88

fbshipit-source-id: d72c8fad950aef8bddc70610ed5728f61c5ee668
2019-06-11 16:30:50 -07:00
svcscm
79511c1754 Updating submodules
Reviewed By: yns88

fbshipit-source-id: fe7c2d1ea01474d0c2600d900940eb20143a2558
2019-06-11 13:35:19 -07:00
Adam Simpkins
e03b440e1c make ConfigSetting<bool>::getStringValue() return true/false
Summary:
The `FieldConverter<bool>` code previously relied on `folly::to<string>()` for
all arithmetic types, including `bool`.  Unfortunately `folly::to<string>()`
returns `"1"` and `"0"` for booleans, which isn't terribly human-friendly.

This updates the code to explicitly return `"true"` and `"false"` as the
output for converting boolean values to strings.

Reviewed By: strager

Differential Revision: D15550014

fbshipit-source-id: 69a3385e529e2940a8be20dbcbeda92e5836d969
2019-06-11 13:08:29 -07:00
Adam Simpkins
0c63605e75 add a config FieldConvertor for parsing nanoseconds
Summary:
Add a `FieldConvertor` implementation allowing a config field to be parsed
into a `std::chrono::nanoseconds` value.

Reviewed By: strager

Differential Revision: D15428932

fbshipit-source-id: d3ace45a2986717c798897534e7b3015eda35fa9
2019-06-11 13:08:29 -07:00
Adam Simpkins
60ef2759fe update FieldConverter API to support converting back to strings
Summary:
The `ConfigSetting` code previously used `folly::to<string>()` to convert
field values back to strings for debugging.  However, this only works for
values that actually are supported by `folly::to()`

This changes the code to use the `FieldConverter` to perform the conversion
back to string.  The `FieldConverter` class now contains the logic for doing
conversion both from strings and back to strings.

Reviewed By: strager

Differential Revision: D15428933

fbshipit-source-id: a37a978d151bf0ba79ca2a2b9107401c847b6591
2019-06-11 13:08:29 -07:00
Adam Simpkins
98f24c34cb add a durationToString() function
Summary:
Add a `durationToString()` function.  This converts a duration value to a
string that can be parsed back with `stringToDuration()`.

Reviewed By: wez, strager

Differential Revision: D15428935

fbshipit-source-id: 2840663385434bc35f04c16d2570fd86e234cb3f
2019-06-11 13:08:29 -07:00
Adam Simpkins
4d10340022 add a function to parse a duration string
Summary:
Add a `stringToDuration()` function to parse a string into a
`std::chrono::nanoseconds` value.

Strings are parsed as a sequence of `[number] [unit]` pairs.
For instance:

  `1m30s` --> 90 seconds
  `5s10ms` --> 5010 milliseconds
  `1d3h10m` --> 1 day, 3 hours, 10 minutes (1630 minutes total)

Reviewed By: strager

Differential Revision: D15428934

fbshipit-source-id: 63f6614595c1aaa08c0d03633c6d1b53ca5bf3d5
2019-06-11 13:08:28 -07:00
Adam Simpkins
7fbe72c368 add config FieldConverter implementations for all arithmetic types
Summary:
Update the `FieldConverter` code to support parsing any arithmetic type
(integers and floating point) using `folly::to<T>()`.  Also change the `bool`
conversion implementation to use the same code.

This does change the `bool` implementation to accept any string accepted by
`folly::to<bool>(string)`.  The old code only allowed `true` and `false`.  The
new code allows other strings: `yes`, `no`, `y`, `n`, `0`, `1`, `on`, `off`

This also makes the implementation more efficient by eliminating some
unnecessary string copies and avoiding throwing exceptions internally on
error.

Reviewed By: wez

Differential Revision: D15428700

fbshipit-source-id: feb73a1f53775fbf3d3acb8585fa689f79c0db81
2019-06-11 13:08:28 -07:00
Adam Simpkins
7309869981 add a thrift call for getting config values
Summary:
Add a thrift call to get the current config settings.

My primary use case for this method at the moment is to make it possible to
build integration tests that check the config behavior.  However in the future
this will probably also be useful for building CLI commands to report the
current config values to allow debugging if there are ever issues.  This API
can also be used to force EdenFS to immediately reload the config from disk.

Reviewed By: strager

Differential Revision: D15572124

fbshipit-source-id: da3bc982f9c419b3314a8b0560c9bd327760d429
2019-06-11 13:08:28 -07:00
Adam Simpkins
bf59ad279f add some new options for controlling if we reload the config
Summary:
Change the `ReloadableConfig::getEdenConfig()` method to accept an enum to
control whether it should reload the configuration, rather than the simpler
bool that it used previously.

The primary motivation for this is to allow us to force a reload to occur in
unit tests and integration tests, even if this operation would otherwise be
within the normal reload throttling time limit.

Reviewed By: strager

Differential Revision: D15572122

fbshipit-source-id: 9c638a415a451f26e7f5923f544724594ed4e0f1
2019-06-11 13:08:27 -07:00
Adam Simpkins
d6c25e0cab update the watchman manifest to include all Eden thrift files
Summary:
This is a hack for now to allow fbsource-based watchman getdeps builds to
succeed.  In the long run we need to update Watchman's CMakeLists.txt to
depend on a proper EdenFS build, rather than copying Eden's thrift files into
Watchman's source tree.

Reviewed By: wez

Differential Revision: D15753320

fbshipit-source-id: 2dea483c2053c4ea1cf64021c4bbc3239fce645d
2019-06-11 13:08:27 -07:00
svcscm
2091caca18 Updating submodules
Reviewed By: yns88

fbshipit-source-id: 606bc76f524b13c9c935e20004926037dfde79be
2019-06-11 13:08:27 -07:00
svcscm
d3882df357 Updating submodules
Reviewed By: yns88

fbshipit-source-id: 14781da000cf2e16e52647b7eb7631bc9e75f997
2019-06-11 11:07:19 -07:00
Matt Glazar
fa4e4cf78e Make 'edenfsctl start' fail if already running (systemd)
Summary:
With systemd integration enabled, if edenfs is running, or if edenfs' systemd service is active, `edenfsctl start` does nothing. This behavior differs from `edenfsctl start` with systemd integration disabled, and can cause `edenfsctl restart` to think that it successfully started edenfs.

Make `edenfsctl start` fail if edenfs is running and healthy, or if edenfs' systemd service is active (yet edenfs is unhealthy).

Reviewed By: chadaustin

Differential Revision: D15703310

fbshipit-source-id: ce0a13780ee03de1f896a938d002901023e5bdd3
2019-06-11 11:02:13 -07:00
svcscm
a1dafab8a6 Updating submodules
Reviewed By: yns88

fbshipit-source-id: 8db49bfb19a3001f29cc556015672478ec8ba94d
2019-06-11 11:02:12 -07:00
svcscm
24b33a3b5d Updating submodules
Reviewed By: yns88

fbshipit-source-id: d8ae608afb2bb8b78505fdfbab67f49308ae0859
2019-06-11 00:32:18 -07:00
Matt Glazar
6ceb5973e2 Refactor 'edenfs is already running' check
Summary:
get_edenfs_start_cmd checks if edenfs is already running, and fails if it is. Most of the time, this check is redundant. This function is effectively called in five places:

* `edenfsctl start`
* `edenfsctl clone` if not running
* `edenfsctl restart` (`_graceful_restart`) with takeover=True
* `edenfsctl restart` (`_start`) if not running
* `edenfsctl restart` (`_finish_restart`) after stopping edenfs

The check is only necessary in one of these places (`edenfsctl start`). Move the check.

This refactor will allow us to run the check if systemd is enabled without duplicating code.

This diff should not change behavior (ignoring unimportant race conditions).

Reviewed By: simpkins

Differential Revision: D15703308

fbshipit-source-id: cbd4a70a3e0eb23da0d65d641d89a5ac022cd79f
2019-06-10 20:45:30 -07:00
svcscm
933d54bd3c Updating submodules
Reviewed By: cdelahousse

fbshipit-source-id: 7fa93ca2e0b0413cca369273e27b42e45b81e510
2019-06-10 20:45:29 -07:00
svcscm
9010f27a69 Updating submodules
Reviewed By: cdelahousse

fbshipit-source-id: 1e18cd79adad8c7c21f4a01714c8e5829bbb0b74
2019-06-10 18:59:09 -07:00
Shrikrishna Khare
8515d68784 fbcode_builder: getdeps: fboss: add FBOSS fetcher
Summary:
The previous diffs in the stack add fbcode_builder manifests for FBOSS
dependencies iproute2 and OpenNSL. The other FBOSS dependencies already have
fbcode_builder support. Thus, add FBOSS manifest.

Additionally, this patch also modifies fboss CMakeLists.txt to get FBOSS to
build using fbcode_builder.

Reviewed By: wez

Differential Revision: D15626298

fbshipit-source-id: 31802ef695ae69b08f526bbeb299c59f3b9d44be
2019-06-10 18:21:54 -07:00
Shrikrishna Khare
643ace4b5a fbcode_builder: getdeps: fboss: update libcurl manifest to disable lldp
Summary:
D15683387 introduced manifest for libcurl and used cmake instead of autoconf
(rationale: having cmake build curl would make it easy as we want curl to build
on windows and macos).

if libcurl finds ldap.h, then it builds with ldap enabled.
On my devserver, ldap library is not installed, and thus libcurl builds without
it, and links with FBOSS binaries fine.

In sandbox, ldap seems to be installed, thus libcurl builds with ldap. However,
linking fails for FBOSS binaries as those don't link against ldap - FBOSS does
not depend on ldap.

Thus, we need a way to configure libcurl with ldap disabled. [cmake.defines]
CURL_DISABLE_LDAP=OFF, does not quite do it. Thus, am going with autoconf, with
args --disable-ldap for now for Linux and cmake for non-Linux environments.

Reviewed By: wez

Differential Revision: D15730947

fbshipit-source-id: 2ce48976ee785401d550720cbdccb22f9d416675
2019-06-10 18:21:54 -07:00
Shrikrishna Khare
995082db3f fbcode_builder: getdeps: fboss: extend iproute2 builder to copy lib/*
Summary:
D15588809 introduced manifest and customer builder for iproute2. While the
Iproute2Builder copies include/* from build to install directory, it does not
copy lib/* which contains the libnetlink.a

As a result, the build system looks up libnetlink.a on local machine (which it
may not find).

Fix it by explicitly coping lib/* as well.

Reviewed By: wez

Differential Revision: D15708835

fbshipit-source-id: 3f5906eb48ce982b6e887cca0d3c11314425beab
2019-06-10 18:21:54 -07:00
svcscm
cdf908d3a5 Updating submodules
Reviewed By: cdelahousse

fbshipit-source-id: 5eff7ee65333f4f5498c43bd8718d67e2cace9b1
2019-06-10 18:21:53 -07:00
svcscm
e561974459 Updating submodules
Reviewed By: cdelahousse

fbshipit-source-id: f21a7bec3602adf6284c1517b5aa9b879c3d6102
2019-06-10 14:27:26 -07:00
Matt Glazar
c9b0e09c82 Use pystemd for 'eden start'; improve error messages
Summary:
systemctl has some problems for Eden. For example:

* With Restart=on-failure, 'systemctl start' reports that the job failed when the first failure occurs. 'systemctl start' does not wait for retries to finish. This means 'eden start' can fail despite edenfs starting successfully.
* If the service fails to start, 'systemctl start' prints a suggestion to use journalctl, even though journalctl is broken and is not even used by fb-edenfs@.service.
* If 'systemctl' can't connect to systemd, it prints a generic message such as "Failed to connect to bus: Connection refused" which the Eden CLI can't easily detect and customize.

For 'eden start', instead of using systemctl, talk to systemd using its D-Bus API (via pystemd [1]). This automatically solves the journalctl message problem, makes it trivial to customize certain errors, and will let us solve the Restart=on-failure problem in the future.

Aside from changing some error messages, this diff should not change behavior.

[1] https://github.com/facebookincubator/pystemd

Reviewed By: simpkins

Differential Revision: D13533184

fbshipit-source-id: 7fedc8ad4a094a2d04b14c2f6e82b51a0ed348a6
2019-06-10 14:05:55 -07:00
Kostia Balytskyi
5b4667e061 bring back the hg python entry point
Summary:
Back out "[hg] entrypoint: remove hg python script"

Original commit changeset: f3c8cfe4beb7

Reviewed By: mitrandir77

Differential Revision: D15739595

fbshipit-source-id: d13dd5a8cf7c645de622a2dd18960eba6561d131
2019-06-10 10:44:24 -07:00
svcscm
bbcb7247fc Updating submodules
Reviewed By: yns88

fbshipit-source-id: 59d03949c5ded5cc3e7aaace399c9975fb30b7fe
2019-06-10 10:44:24 -07:00
svcscm
81f570826b Updating submodules
Reviewed By: yns88

fbshipit-source-id: d76720ab0b6245059276a3fda81aebd2964095bf
2019-06-10 09:31:50 -07:00
Jingyi Yang
e0f7463bc6 add fiber support
Summary: This diff allows zmq socket to run on folly::fibers

Reviewed By: saifhhasan

Differential Revision: D15113447

fbshipit-source-id: 8a0e1f91d719a9deda48837d4ff1065408280b72
2019-06-10 08:46:14 -07:00
svcscm
ad33a215ce Updating submodules
Reviewed By: yns88

fbshipit-source-id: 46a21f63889e3737252b7211524e0e3373e3cfe7
2019-06-10 08:46:13 -07:00
svcscm
d101807e03 Updating submodules
Reviewed By: yns88

fbshipit-source-id: 4304ba5ad92194b0d537aefd2efd554edb5a8450
2019-06-09 18:24:35 -07:00
Luca Niccolini
4e1449545d Back out "[proxygen][oss] enable CMake build (with HTTP/3)"
Summary: Original commit changeset: 5e101fc38417

Reviewed By: snarkmaster

Differential Revision: D15726457

fbshipit-source-id: 001ee9ebaee81ebc60996e5fb95c1870121b2dec
2019-06-09 15:23:48 -07:00
svcscm
934a45b919 Updating submodules
Reviewed By: yns88

fbshipit-source-id: 32a7f133a293428617c5557e29af52c8af253111
2019-06-09 15:23:48 -07:00
svcscm
e52cdf452d Updating submodules
Reviewed By: yns88

fbshipit-source-id: 3d6e1007a6da4b6828ef911c82c1e97b9b6a520e
2019-06-07 19:07:57 -07:00
Jake Crouch
1f34bd8448 Templatize Path Memory Estimation
Summary: Previously functions were defined per string type but since SSO detection is now templatized so can path memory estimation.

Reviewed By: chadaustin

Differential Revision: D15723098

fbshipit-source-id: df8dcd359a0f4f704eba337ebf5e382d87ca3abe
2019-06-07 18:51:40 -07:00
Jake Crouch
29da6b4730 Generalize SSO Detection
Summary: Previously hard-coded values for how long a string has to be for SSO, now just check if data pointer is inside string stuct

Reviewed By: chadaustin

Differential Revision: D15720268

fbshipit-source-id: 988e45648e8b96332587f8d2f021642407d3dac3
2019-06-07 18:51:40 -07:00
Adam Simpkins
596243f44b fix a use-after-free bug during unmount()
Summary:
Update the EdenServer::unmountAll() code to make sure to keep a shared_ptr
reference to the EdenMount while the EdenMount::unmount() call is running.

Previously this could cause use-after-free errors due to the EdenMount
object being destroyed while the `unmount()` logic was still running.  In
particular, as soon as we call `privhelper->fuseUnmount()` the
fuseCompletionFuture could complete in a different thread.  The
fuseCompletionFuture's callback (normally the lambda inside
`EdenServer::mount()` which triggers the call to
`EdenServer::mountFinished()`) may have the last outstanding shared_ptr
refcount to the `EdenMount` object.  When it finishes in this other thread
it will then destroy the EdenMount, possibly before the
`EdenMount::unmount()` logic has completed.

Reviewed By: strager

Differential Revision: D15688674

fbshipit-source-id: 47b8b4fe022d2bca112558f9ef32bcdd169fefb0
2019-06-07 18:33:18 -07:00
svcscm
452965d234 Updating submodules
Reviewed By: yns88

fbshipit-source-id: ba23d44786c01fe5d875e5114e7de37a6d8c51fc
2019-06-07 18:33:18 -07:00
svcscm
d7c58e1643 Updating submodules
Reviewed By: yns88

fbshipit-source-id: a162d76a68722cceab284efc640fccb1491df1fb
2019-06-07 15:11:23 -07:00
Jake Crouch
9704627b62 Make Journal Stats O(1)
Summary: JournalStats is currently O(# of deltas), updating it to be O(1)

Reviewed By: chadaustin

Differential Revision: D15718255

fbshipit-source-id: 1fb3f0b76d736bfa22195231c21d5f8b742fa1f7
2019-06-07 13:37:02 -07:00
Jake Crouch
dd0b96dcfd Journal Stats to ODS
Summary: Setting up structure to get the stats from Eden's Journal to ODS

Reviewed By: chadaustin

Differential Revision: D15684380

fbshipit-source-id: 90debc3f2a09d497201e5e73f85400a994b7afba
2019-06-07 13:37:02 -07:00
Jake Crouch
0dc6812f33 Print out Journal Info with edenfsctl
Summary: Print out memory usage and entry counts with edenfsctl stats

Reviewed By: chadaustin

Differential Revision: D15607015

fbshipit-source-id: 866960ea1d3b5e9fdbe24df3b57fba419795ec76
2019-06-07 13:37:02 -07:00
svcscm
fa9846070c Updating submodules
Reviewed By: yns88

fbshipit-source-id: 082f32b56aaaef7225de2b20461e8b63221892ab
2019-06-07 13:05:34 -07:00
Sinan Cepel
c281b44695 upgrade Pyre version for eden
Reviewed By: shannonzhu

Differential Revision: D15718331

fbshipit-source-id: 3c3df62e8feb058766bc639482deb8dc3b6d4ec7
2019-06-07 12:27:23 -07:00
svcscm
3ffc92cfdc Updating submodules
Reviewed By: yns88

fbshipit-source-id: 264ddafad83cd942a87f10f0222f30f0dfa37957
2019-06-07 12:21:54 -07:00
Wez Furlong
00343575cd eden: avoid starting buck to kill buck
Summary:
Look for the .buckd/pid file before we try to `buck kill`
a project, and test whether that pid is still a real pid.  This
reduces latency of shutdown/restart a little, and de-clutters the
output in repos with several buck cells.

Reviewed By: chadaustin

Differential Revision: D15715133

fbshipit-source-id: 033549eae308ae8773bf270f55e215586b406ca9
2019-06-07 11:56:25 -07:00