Summary:
Summary
Change `ConfigTest` to derive directly from `EdenTestCase` rather than using
the `eden_repo_test` decorator. The configuration test code doesn't really
need a repository, and so we don't need to run it twice (for both Mercurial
and Git repositories).
Reviewed By: wez
Differential Revision: D15756359
fbshipit-source-id: 90d5011ae1ff7d2a251c9e7bb776045fbe2fdfe1
Summary:
Clean up the `EdenFS` class construction.
Previously it accepted the `eden_dir`, `etc_eden_dir`, and `home_dir`
arguments as separate parameters. If `etc_eden_dir` or `home_dir` were not
specified it would not pass these arguments to `edenfs`, allowing the default
values to be used. This is undesirable for most tests.
Now it accepts a `base_dir` argument. Explicit values for the `eden_dir`,
`etc_eden_dir`, and `home_dir` parameters can still be specified (this is used
for the snapshot tests), but if they aren't specified, default locations
inside the `base_dir` will be used instead.
This also cleans up some of the code to use `pathlib.Path` values instead of
plain `str` objects in more places.
Reviewed By: strager
Differential Revision: D15756358
fbshipit-source-id: 3e87ddc98d15fcb7f60c6c3116d4fcc8e49432ea
Summary:
Introduce a couple of globals that represent
the different stat results used in the test, and a helper
function to return the most common shape of the mount table.
Reviewed By: strager
Differential Revision: D15753258
fbshipit-source-id: 05d54d6098476464b0319615afb32da25431b2e6
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Summary: This diff allows zmq socket to run on folly::fibers
Reviewed By: saifhhasan
Differential Revision: D15113447
fbshipit-source-id: 8a0e1f91d719a9deda48837d4ff1065408280b72
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
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
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
Summary: JournalStats is currently O(# of deltas), updating it to be O(1)
Reviewed By: chadaustin
Differential Revision: D15718255
fbshipit-source-id: 1fb3f0b76d736bfa22195231c21d5f8b742fa1f7
Summary: Setting up structure to get the stats from Eden's Journal to ODS
Reviewed By: chadaustin
Differential Revision: D15684380
fbshipit-source-id: 90debc3f2a09d497201e5e73f85400a994b7afba