Commit Graph

441 Commits

Author SHA1 Message Date
Adam Simpkins
4dc59b856b ensure that most thrift calls cannot access initializing mounts
Summary:
This updates the `EdenServer` class so that the existing `getMount()` and
`getMountPoints()` APIs only return mounts that have finished initializing.

These APIs are primarily used by the thrift interfaces.  In most cases the
callers did not intend to operate on mounts that were still initializing, and
doing so was unsafe.  The code could potentially dereference a null pointer if
it tried to access the mount's root inode before the root inode object had
been created.

New `getMountUnsafe()` and `getAllMountPoints()` APIs have been added for call
sites that explicitly want to be able to access mounts that may still be
initializing.  Currently the `listMounts()` thrift API is the only location
that needs this.

Reviewed By: strager

Differential Revision: D13981139

fbshipit-source-id: e6168d7a15694c79ca2bcc129dda46f82382e8e9
2019-03-06 20:33:42 -08:00
Adam Simpkins
b47184adc4 add a flag to report start-up success before finishing mounts
Summary:
Add a flag to tell edenfs to report successful start-up as soon as the thrift
server is running, without waiting for all mount points to finish being
remounted.

In the future I plan to have edenfs automatically perform an fsck scan of the
overlay for checkouts that were not shut down cleanly.  This may cause the
remount to take a significant amount of extra start-up time in some cases.
(This is already true today in some cases even with the simpler scan we do to
re-compute the max inode number.)

I think we will probably want to have systemd invoke edenfs with this option,
so that we do not time out during system start up if some mount points need to
be rescanned.

Reviewed By: strager

Differential Revision: D13522040

fbshipit-source-id: 6f183770c25efee34c4805c9bad42a9cce51039e
2019-03-06 20:33:41 -08:00
generatedunixname89002005289445
1678b9273e Update pyre version for eden
Summary: Automatic upgrade to remove `version` override and silence errors.

Reviewed By: shannonzhu

Differential Revision: D14305975

fbshipit-source-id: 7b54441dc846165fb12bfbe5339e4c917da463ec
2019-03-04 13:03:03 -08:00
Chad Austin
015c45872b split privhelper and privhelper_base
Summary:
We're not that far from building privhelper on mode/mac but it does
require figuring out how to depend on osxfuse from the Buck build, so
bypass that by breaking the inodes target's dependency on privhelper's
<fuse_ioctl.h> include.

Reviewed By: strager

Differential Revision: D14218709

fbshipit-source-id: edbb2a21df06d6f2a4f860ef13718ad05d445e98
2019-02-27 19:06:00 -08:00
Matt Glazar
4568ff90b7 Factor EdenMount::unmount function
Summary:
EdenMount calls fuseMount, but EdenServer calls fuseUnmount. I think only one of EdenMount or EdenServer should call fuseMount/fuseUnmount. Splitting the responsibility is confusing.

Move the call to fuseUnmount into EdenMount by creating a member function called unmount.

This diff should not change behavior.

Reviewed By: simpkins

Differential Revision: D14115385

fbshipit-source-id: 845c4a87cdba9f270c0eacaf01916ad91c3b7c0e
2019-02-26 22:54:12 -08:00
Mark Thomas
9218f35f45 rename and relocate eden and edenfs
Summary:
The Eden CLI tool is really a control program for `edenfs`.  Rename it to
`edenfsctl` to free up the `eden` name for future use.

The Eden daemon shouldn't really be on the user's path, and instead belongs in
`libexec`.

For transition compatibility, `eden` is symlinked to `edenfsctl`.

Reviewed By: simpkins

Differential Revision: D13888875

fbshipit-source-id: 435cc63e92b85b1f28b8691e4846fbcb05bc450e
2019-02-21 15:00:47 -08:00
Matt Glazar
b75e6d69a2 Fix typo in log message
Summary:
Before:

E0220 22:59:26.395141 837143 EdenServiceHandler.cpp:285] Error :attempt to construct an AbsolutePath from a non-absolute string: ""

After:

E0220 22:58:22.064988 1898825 EdenServiceHandler.cpp:286] Error: attempt to construct an AbsolutePath from a non-absolute string: ""

Reviewed By: chadaustin

Differential Revision: D14077849

fbshipit-source-id: ea36151d8a87012cf6b3447883217e36a6de0992
2019-02-21 00:24:56 -08:00
Wez Furlong
8847a7a061 add dtype as an optional return value from glob
Summary:
This diff adds the dtype field to the glob results;
this will help to reduce the cost of some watchman queries by avoiding a
getFileInformation call that instantiates inodes.

As part of this, I added a bunch of unit test coverage.

Reviewed By: strager

Differential Revision: D8779149

fbshipit-source-id: 3064a3e42be55ec576fed9e0f7112edef426f32d
2019-02-19 11:26:26 -08:00
Adam Simpkins
5d4279567d add thrift APIs to the fault injection framework
Summary: Add some thrift APIs that allow injecting faults into Eden's FaultInjector.

Reviewed By: wez

Differential Revision: D14079490

fbshipit-source-id: a9ec16b560ddcc79d5d819dbbc120ad5da556b4e
2019-02-15 19:27:17 -08:00
Wez Furlong
cd5b4b6d92 watchman: pull in thrift in the oss build for eden support
Summary:
This diff enables building the eden watcher by linking in thrift and
its various dependencies.

To support building in-fbsource and in the github repo, a `maybe_shipit_dir`
function is used to setup a symlink to the `eden` and `fboss/common` dirs (this
mirrors the shipit configuration for this project: we cannot simply run shipit
because we have to build on mac and windows and shipit requires Hack, and that
does not support those platforms).

I tried to persuade cmake to let me build this without the use of a symlink but
found it too difficult to teach everything about the path mapping.  The
symlinks aren't terrible, but are the reason why this diff also updates some
`.gitinore` files that are seemingly unrelated to this diff.

This diff changes a couple of build/link options: without them the end product
fails to link either due to implicit/unilateral enablement of UBSAN in some of
the deps, or because warning->error promotion is turned on.

This diff includes a copy of the `ThriftCppLibrary.cmake` file from the fboss
repo.  This should get centralized and shipit'ed out into the places that
consume it.  That can be done when someone gets around to doing the same for
the `FindGlog.cmake` file and doesn't need to hold up this diff.

Reviewed By: simpkins

Differential Revision: D13486486

fbshipit-source-id: 3bb5b011771b2a87618147ca019b4e50a8e0aaf2
2019-02-04 21:37:47 -08:00
Lee Howes
4076449871 onerror to thenerror phase 2
Summary:
Replace Future::onError with Future::thenError:
 * to remove ambiguous typing
 * to ensure that the executor is not lost and the returned Future is still bound to an executor

See:
https://fb.workplace.com/groups/fbcode/permalink/2002251863144976/
for details.

Reviewed By: yfeldblum

Differential Revision: D13908257

fbshipit-source-id: 8b5315b019290f1c60087ca5716c31ebbf1f1be5
2019-02-01 13:16:50 -08:00
Shannon Zhu
37784ab043 Update pyre version for eden
Summary: using upgrade script to clear out all remaining version-set configs

Reviewed By: dark

Differential Revision: D13832474

fbshipit-source-id: 52c280cbd79b1410821ed829465b1c0907b50a86
2019-01-28 13:36:41 -08:00
Jon Maltiel Swenson
79b7db4d91 Make EventBase destruction callbacks safely cancellable
Summary: Currently, `runOnDestruction` aims to be thread-safe; new callbacks are added to the `onDestructionCallbacks_` list while the associated mutex is held. However, the caller may own the `LoopCallback` and wish to destroy/cancel it before the `EventBase` destructor runs, and this callback cancellation is not thread-safe, since unlinking does not happen under the lock protecting `onDestructionCallbacks_`. The primary motivation of this diff is to make on-destruction callback cancellation thread-safe; in particular, it is safe to cancel an on-destruction callback concurrently with `~EventBase()`.

Reviewed By: spalamarchuk

Differential Revision: D13440552

fbshipit-source-id: 65cee1e361d37647920baaad4490dd26b791315d
2019-01-24 15:57:39 -08:00
Adam Simpkins
d9955c5f7d return STARTING and STOPPING correctly in the fb303 getStatus() call
Summary:
Previously edenfs always returned `ALIVE` in response to the fb303
`getStatus()` call.  This fixes the code to return `STARTING` while Eden is
still starting and `STOPPING` while Eden is shutting down.

Reviewed By: strager

Differential Revision: D13515856

fbshipit-source-id: 91fe52e5f7f0a9e2c48ca1dd7663c99319afa8ad
2019-01-24 13:47:41 -08:00
Chad Austin
2eb4c976b7 update Eden's lock file with the new pid upon a graceful restart
Summary:
When graceful restart was first implemented we forgot to update the
lock file with the new pid, resulting in occasional unexpected output
from tools like eden doctor.

Reviewed By: simpkins

Differential Revision: D13744411

fbshipit-source-id: cdc758ed6ac1201fd2ff3e9d7805bb5ab6f83e8a
2019-01-22 10:47:07 -08:00
Wez Furlong
2ba72dc18e eden: have priv helper load the fuse kext if needed
Summary:
This is something that is not needed on linux because
the kernel module is typically already loaded (at least on the systems
on which we run).

On macos, since fuse is not part of the kernel, libfuse has some code
that loads it when needed.

This diff performs the equivalent actions for eden.

Reviewed By: simpkins

Differential Revision: D13721489

fbshipit-source-id: 627bc90681141d0e7da3d5b5e06756a36839958c
2019-01-17 18:52:53 -08:00
Adam Simpkins
798ccc750a track EdenMounts while they are initializing
Summary:
This updates the logic in EdenServer to add the EdenMount to the mountPoints_
map as soon as it is created, so that we track mount points as they are
initializing.

I don't expect this change to have any major impact in functionality yet.  In
a subsequent diff I also plan have EdenServer keep mount points in the
mountPoints_ map longer while they are shutting down.  I expect that change to
matter a bit more, as that will allow us to do a better job reporting and
debugging when mount points are taking a non-trivial amount of time to become
unreferenced and fully shut down.

Reviewed By: strager

Differential Revision: D13503050

fbshipit-source-id: 2e0e8dfde64c6a005efd6dcf503ad7577f314356
2019-01-16 19:35:09 -08:00
Victor Zverovich
cd0b50f0a5 Migrate to optional_field_ref Thrift API
Summary:
Migrate the code from accessing optional Thrift fields directly to a safer
`optional_field_ref` API. See https://fburl.com/safe for more details.

The output of this codemod has been reviewed in D13259011.

To preserve semantics, each unchecked access is replaced with an explicit call
to `value_unchecked()`. If you are sure that accessing a field is safe (the
field is marked as set), you can later replace `value_unchecked()` with
`value()` or dereferencing (`operator *`):

```
  ThriftStruct s = ...
- auto foo = s.foo_ref().value_unchecked();
+ auto foo = *s.foo_ref(); // will throw if s.foo is unset
```

Reviewed By: chadaustin

Differential Revision: D13684410

fbshipit-source-id: 919de4ddf89e7f0463f2614baba4bfbac1c8255c
2019-01-16 12:20:23 -08:00
Chad Austin
5dfe853be0 Minor refactoring
Summary: Small things I noticed while working on other stuff.

Reviewed By: strager

Differential Revision: D10055671

fbshipit-source-id: de8c3b04928567a821172e6fa7ee0e056958e1e7
2019-01-14 17:19:23 -08:00
Sinan Cepel
8d30ff0d6a upgrade fbcode/eden version
Reviewed By: simpkins, dark

Differential Revision: D13617216

fbshipit-source-id: 01066612dfc68cee9283b587fc08f25530857690
2019-01-10 16:13:47 -08:00
Adam Simpkins
05cb1dcd4f report the mount state in listMounts()
Summary:
Update the `listMounts()` thrift API to also report the current mount point
state.  This will allow us to do a better job of reporting mount points that
are in the process of initializing or shutting down.

This change splits the `MountInfo` thrift type into two distinct types for
the `listMounts()` vs `mount()` APIs.  However this change should be
completely backwards compatible at the wire protocol level for older client
and server code.

Reviewed By: strager

Differential Revision: D13503049

fbshipit-source-id: 68e7ca708b956991c8fd93bbf8973d90650aced9
2019-01-02 12:58:08 -08:00
Matt Glazar
24a80351c4 Make systemd service log to file
Summary:
When run inside the systemd service (fb-edenfs@.service), edenfs' logs are written to `/var/log/messages` (on Facebook dev servers). This is undesirable, since those logs have a bunch of noise.

Make systemd-managed edenfs log to `~/local/.eden/logs/edenfs.log` instead, matching the behavior of custom-managed edenfs.

 ---

I considered using systemd's StandardOutput= and StandardError= directives [1], but they have limitations:

* **StandardOutput=file:%f/logs/edenfs.log**: When the `logs` directory is missing, systemd does not create it. In this case, systemd fails when it opens the log file, so systemd refuses to start the service.
* **StandardOutput=journal** [2]: journald and journalctl are broken for user services. Logging to journald only works with persistent journal storage [3][4], but Facebook uses volatile journal storage.
* **StandardOutput=syslog** [5]: rsyslog seems designed for system administrators, not users. I didn't investigate much, but I suspect it's impossible to make rsyslog write to a user-controlled path such as `~/local/.eden/logs/edenfs.log`.
* **LogsDirectory=%f/logs and StandardOutput=file:%L/edenfs.log** [6][7]: LogsDirectory= does exactly what we need, except it only supports paths relative to `/var/log` or `~/.config/log/`. `LogsDirectory=%f/logs` does not work, and systemd will ignore such a directive.
* **StandardOutput=file:%f/logs/edenfs.log and a `mkdir` service**: If we create a service which just creates the `logs` directory, and make fb-edenfs@.service depend upon that service, systemd can successfully open the log file [8]. In theory, using StandardOutput= would cause errors like "could not set resource limits" to be logged to `edenfs.log`. In practice, systemd does not respect the service's logging configuration when reporting such errors [9]. Therefore, this solution is no better than the manual redirect.

[1] https://www.freedesktop.org/software/systemd/man/systemd.exec.html#StandardOutput=
[2] https://www.freedesktop.org/software/systemd/man/systemd-journald.service.html#
[3] https://www.freedesktop.org/software/systemd/man/journald.conf.html#SplitMode=
[4] https://lists.freedesktop.org/archives/systemd-devel/2016-October/037554.html
[5] https://www.rsyslog.com/
[6] https://www.freedesktop.org/software/systemd/man/systemd.exec.html#RuntimeDirectory=
[7] https://www.freedesktop.org/software/systemd/man/systemd.unit.html#Specifiers
[8]
```name=fb-edenfs-logs@.service
[Service]
Environment=EDENFS_CONFIG_DIR=%f
ExecStart=/bin/sh -c ' \
    set -e; \
    set -u; \
    \
    /bin/mkdir -p -- "$${EDENFS_CONFIG_DIR}/logs""; \
'
```
```name=fb-edenfs@.service
[Unit]
After=fb-edenfs-logs@%i.service
Requires=fb-edenfs-logs@%i.service
```

[9] fd0ec39d38/src/basic/log.c (L560-L639)

Reviewed By: simpkins

Differential Revision: D13422459

fbshipit-source-id: 57c575a6f377812caa2a79168778576c6ccff33e
2018-12-17 15:14:55 -08:00
Wez Furlong
3dbcd058d6 eden: add helper for accessing stat fields as timespecs
Summary:
ported forward from D4209167, add a couple of helpers
to access these fields on mac and linux, centralizing/minimizing ifdefs.

Simplify some of the logic in FileChangeMonitor.

Reviewed By: chadaustin

Differential Revision: D13475717

fbshipit-source-id: d7b39999808bc41a6dc17a87189501cb34e68b30
2018-12-16 18:31:46 -08:00
Wez Furlong
9fca886c54 eden: no pipe2 on macos, manually CLOEXEC
Summary: as above

Reviewed By: simpkins

Differential Revision: D13475713

fbshipit-source-id: 94968251516c6b96e5caa9433d5d24a0b40ea025
2018-12-15 19:11:05 -08:00
Wez Furlong
79b4ba6ac8 eden: add missing cmake for eden/fs/tracing
Summary: as above

Reviewed By: simpkins

Differential Revision: D13475709

fbshipit-source-id: d3958ad761375533a96b9c00679d80e88d63e7a4
2018-12-15 19:11:05 -08:00
Matt Glazar
7f97ecc7bd Make fake_edenfs use same log path as real edenfs
Summary:
I want to use fake_edenfs to test logging via EdenFS' systemd service. Make fake_edenfs and the real edenfs use similar logic to determine the log file path.

This diff should not change behavior for the real edenfs.

Reviewed By: simpkins

Differential Revision: D13424470

fbshipit-source-id: d0c2e035fdb5884dbd2d9704c7e0244d35e052f2
2018-12-13 19:47:47 -08:00
Chad Austin
008497c69a remove SerializedFileHandleMap
Summary: SerializedFileHandleMap is dead code now.

Reviewed By: strager

Differential Revision: D13381629

fbshipit-source-id: ba872aaf8335d2be68d6af0465bd04e4ca59d578
2018-12-13 12:29:13 -08:00
Chad Austin
1e83ec3df0 remove FileHandleMap
Summary:
Eden no longer tracks any state in file handles, and has no plans to in the future.
Therefore, remove all related code.

Reviewed By: strager

Differential Revision: D13354307

fbshipit-source-id: 341d081f64c6c8fb2b4b1b5a5ff42f2cc7d38039
2018-12-13 12:29:13 -08:00
Matt Glazar
f86b6fc746 Forward systemd startup logs to 'eden start'
Summary:
When you run 'eden start' without systemd integration, edenfs writes startup logs to the terminal to let users know that stuff is happening:

```
$ eden start
Starting edenfs (dev build), pid 2792025
Opening local RocksDB store...
Opened RocksDB store in 0.95 seconds.
Remounting 1 mount points...
Successfully remounted /data/users/strager/fbsource-dev
Started edenfs (pid 2792025)
Logs available at /data/users/strager/.eden-dev/logs/edenfs.log
```

These startup logs are also used by various tests (especially 'eden restart's tests).

Make the same thing happen when running 'eden start' with systemd integration, improving the user experience and making some tests work:

```
$ EDEN_EXPERIMENTAL_SYSTEMD=1 \
  ./buck-out/gen/eden/cli/eden.par start \
  --daemon-binary "${PWD}/buck-out/gen/eden/fs/service/edenfs"
Starting edenfs (dev build), pid 2800760
Opening local RocksDB store...
Opened RocksDB store in 0.693 seconds.
Remounting 1 mount points...
Successfully remounted /data/users/strager/fbsource-dev
Started edenfs (pid 2800760)
```

Reviewed By: wez

Differential Revision: D13241979

fbshipit-source-id: de79b714e42b690fdab7c21d9add46bc2da35328
2018-12-07 17:07:08 -08:00
Matt Glazar
75d7a135b5 Pass extra daemon args from 'eden start' to systemd
Summary: Several tests for 'eden start', 'eden stop', and 'eden status' need to pass command-line arguments to fake_edenfs. With systemd support enabled, make 'eden start' forward daemon arguments to fake_edenfs, making these tests pass.

Reviewed By: wez

Differential Revision: D13249891

fbshipit-source-id: 9008a361fce7a5629535cc9d245b86073ee70826
2018-12-07 17:07:08 -08:00
Matt Glazar
f33c394da5 Fix crash for getSHA1(./hello)
Summary:
getSHA1 is only handling std::system_error. If another kind of exception is thrown, it's never caught and edenfs crashes.

Calling EdenMount::getInode with a path such as "./hello" will cause a std::domain_error to be thrown. Since std::domain_error is not derived from std::system_error, `getSHA1ForPathDefensively(["./hello"])` crashes edenfs.

Fix the crash by forwarding all exceptions over Thrift, not just std::system_error-s.

Reviewed By: simpkins

Differential Revision: D13386450

fbshipit-source-id: 06262dad30a5508ed482c9e8979b61aa9643280a
2018-12-07 16:34:42 -08:00
Chad Austin
3dbad3ac01 show blob cache sizes in eden stats
Summary:
Have `eden stats` print the size of the blob cache if the running
edenfs has information about it.

Reviewed By: strager

Differential Revision: D13349220

fbshipit-source-id: 9f59f4399f2d4283aa80bcb54ba73c51d555d502
2018-12-06 19:43:52 -08:00
Matt Glazar
50c0030d8f Give edenfs mount permissions in systemd
Summary:
edenfs's privhelper process needs the CAP_SYS_ADMIN capability [1] in order to manage mount points. Give it this capability by invoking edenfs as the `root` user using `sudo`.

Known issues:

* `sudo` must be passwordless in order for fb-edenfs@.service to start.
* systemd can't kill all of fb-edenfs@.service's processes, so `systemctl stop` is unreliable for example.

[1] https://manpage.me/index.cgi?q=capabilities&apropos=0&sektion=0&manpath=CentOS+7.1&arch=default&format=html

Reviewed By: chadaustin

Differential Revision: D13113450

fbshipit-source-id: 01b89521cab371b5017fab6fbd38d55eea599c46
2018-12-06 19:43:52 -08:00
Matt Glazar
b8911889f0 Refactor systemd ExecStart: enable sh logic
Summary:
I want to add some non-trivial systemd-specific logic to fb-edenfs@.service's ExecStart command. Refactor the existing command to use sh, giving us access to `if` and other useful utilities.

Also, the shell language is likely more familiar (e.g. `${foo}` and `$foo` behave the same in sh, but behave differently in systemd), so using sh should lead to fewer headaches.

This diff should not change behavior.

Reviewed By: chadaustin

Differential Revision: D13165377

fbshipit-source-id: 2e500abf75c6f79a8b174a848f7eeb1cfaebb96c
2018-12-06 17:51:25 -08:00
Matt Glazar
c20d275a6b Make 'eden start' run a bare minimum systemd service (opt-in)
Summary:
Add the plumbing necessary to make 'eden start' start a systemd user service. This is only enabled if you opt in using EDEN_EXPERIMENTAL_SYSTEMD.

Currently, only fake_edenfs works. The real edenfs doesn't work yet because it needs root access to configure mount points.

'eden restart', 'eden stop', etc. are not affected by this diff (and are probably broken with EDEN_EXPERIMENTAL_SYSTEMD enabled).

Reviewed By: simpkins

Differential Revision: D10849390

fbshipit-source-id: c087a6498951ff100e5c80bd07ad869b2709e1b3
2018-12-06 16:01:43 -08:00
Chad Austin
ef141a6585 remove DirHandle
Summary: DirHandle no longer does anything. Remove it.

Reviewed By: strager

Differential Revision: D13288298

fbshipit-source-id: 3edebbcdf60982608ddb87c1ff82ebff1c3d2067
2018-12-05 01:34:53 -08:00
Puneet Kaushik
96d32b9f05 Create Eden Mount on Windows
Summary: This diff also includes build script changes to EdenDispatcher, FsChannel and EdenMount.

Reviewed By: strager

Differential Revision: D13091786

fbshipit-source-id: cecc8d849fcb9ebc8fa718e1011ef8931bebc279
2018-12-04 18:14:48 -08:00
Chad Austin
03a1a7a06b instantiate a BlobCache in EdenServer
Summary: Instantiate a blob cache in the EdenServer with configurable settings.

Reviewed By: strager

Differential Revision: D12813880

fbshipit-source-id: 8ccc89826f04aca78964230374dea48abf05e05e
2018-11-26 11:10:14 -08:00
Adam Simpkins
7854d6250d add type information to the eden.thrift helper module
Summary: Add type annotations to all functions in eden/fs/service/client.py

Reviewed By: strager

Differential Revision: D13051091

fbshipit-source-id: 23b93008352664336ad155a7f5cc281bd5529702
2018-11-14 13:03:09 -08:00
Adam Simpkins
b93c29f772 update the CLI to make pyre happy
Summary: Update the CLI code to make the pyre type checker happy.

Reviewed By: wez

Differential Revision: D13035413

fbshipit-source-id: d201f2e65667e0ce1bf4a73fbb05878e8711ad16
2018-11-12 20:25:29 -08:00
Wez Furlong
0d3f197803 pass ReloadableConfig through to LocalStore
Summary:
This makes it possible to change configuration options
for the LocalStore while the server is running.

As you'll see in the next diff, our current layering makes using
the config a bit more awkward, but at least this diff doesn't
look gross :-p

This diff doesn't introduce any new functionality or configuration.

Reviewed By: strager

Differential Revision: D12949577

fbshipit-source-id: cf897ba676b9359f92865170faa42ff17329b85f
2018-11-09 11:22:03 -08:00
Adam Simpkins
75a65ff073 error out if users run "edenfs" directly instead of "eden"
Summary:
Sometimes users accidentally run `edenfs start` or `edenfs restart` instead of
`eden start` or `eden restart`.  This adds a new `--edenfs` flag to the
`edenfs` binary, and asks users if they meant to run `eden` instead if they do
not pass in this flag.

This used to be less of a problem since `edenfs` required users to also
explicitly specify several other configuration flags (like `--edenDir`).
However `edenfs` can not automatically figure out these settings, so these
flags are no longer required.  Therefore `edenfs` would still try to start
normally when invoked with `edenfs restart`, since it did not require these
flags and it did not complain about unhandled command line arguments.

Reviewed By: wez

Differential Revision: D12927803

fbshipit-source-id: dbf7ce2449c391ca218652439eb68ff43c2ebd46
2018-11-08 12:09:42 -08:00
Puneet Kaushik
134f5dfc2b Removing unused folly/Subprocess.h to fix the Windows build.
Summary: folly/Subprocess is not compatible with Windows and has broken the Windows build. It's not used so removing it.

Reviewed By: wez

Differential Revision: D12967451

fbshipit-source-id: 54d33bf6fe2ec3ede9d68eccd99e53c5eb6ed53d
2018-11-07 18:27:05 -08:00
Dan Schatzberg
8fe62ce81b Add command to chown a mount
Summary:
Sandcastle has several cases where we chown the entire
repository which performs terribly on Eden. As a workaround we have a
command to do this in eden without loading all the files.

Reviewed By: chadaustin

Differential Revision: D12857956

fbshipit-source-id: 36cebcc710fbcf4e1eb265df901513cf50a227b9
2018-11-07 08:58:31 -08:00
Dan Schatzberg
b2a4204b4d Add thrift interface to dump tracepoints
Summary:
With this the eden cli can dump tracepoints and translate
them to various formats or perform any processing

Reviewed By: chadaustin

Differential Revision: D10384072

fbshipit-source-id: 8b38e7f6b551a2bd98b3e748ba1cceafeceeec8c
2018-11-01 08:09:19 -07:00
Dan Schatzberg
7bccb95618 Instrument getSHA1 with tracepoints
Summary:
This uses the tracing infrastructure to create blocks around
the getSHA1 invocation as well as the getOrLoadChild (called for each
element of the path-walk) method.

Reviewed By: chadaustin

Differential Revision: D10384074

fbshipit-source-id: a06fbe38e8d3f35fcb248e6bd724e5572724d27d
2018-11-01 08:09:19 -07:00
Wez Furlong
d06599457f use ReloadableConfig for configuration in HgBackingStore
Summary:
Remove the handful of (but growing) parameters that
are threaded down to the HgBackingStore in favor of the ReloadableConfig
object and use that to configure mononoke support.

This doesn't notice changes to the config on the fly today, but
does simplify the amount of stuff we need to pass around.

Reviewed By: chadaustin

Differential Revision: D12813053

fbshipit-source-id: b8309328fab4980889624257cfd387c8c1335001
2018-10-31 11:50:39 -07:00
Wez Furlong
d623be956d pass ReloadableConfig down to HgBackingStore ctor
Summary:
This allows detecting changes to the edenrc configuration
and adjusting how we read data accordingly.

To avoid a huge gnarly diff with a lot of dependencies, this diff
introduces a little interface class that defines the method to obtain
a possibly reloaded EdenConfig instance.

This diff shouldn't change any functionality.

Reviewed By: chadaustin

Differential Revision: D12813051

fbshipit-source-id: 35390dc28671ba46a03d098c4f280e2f567dbdc9
2018-10-31 11:50:38 -07:00
Matt Glazar
032900a9ec Ensure error is written if log file can't be opened
Summary: If an error happens when opening the log file, edenfs should stop immediately and report the error. Write a test to verify that this happens with DaemonStartupLogger.

Reviewed By: chadaustin

Differential Revision: D10436926

fbshipit-source-id: 3f33ed276a668b7ecda8176a55b114b5878304e3
2018-10-25 14:11:30 -07:00
Matt Glazar
13d7be97ea Fix stdin fd leak in daemon mode
Summary:
When running edenfs in daemonize mode (i.e. when --foreground is not specified), the daemon process inherits stdin from the parent and never closes it. This has two consequences:

* The daemon process holds a reference to stdin even after the parent exits. This causes tests to hang if they wait for EPIPE on stdin after waiting for the parent process to exit. (I discovered this issue when adding tests for 'eden start' in D10434379.)
* edenfs could potentially read from the terminal after 'eden start' has returned. I think this behavior is surprising and could potentially cause problems.

Promptly close stdin after forking the daemon process, since nothing inside the daemon needs stdin.

Reviewed By: simpkins

Differential Revision: D10442346

fbshipit-source-id: f3d287e8b48e121807f845b73a1a550e63efae25
2018-10-25 12:54:42 -07:00