Commit Graph

262 Commits

Author SHA1 Message Date
Chad Austin
4f532889d1 reenable ProcessNameCache
Summary:
Now that the deadlock in ProcessNameCache has been fixed, bring it
back.

Reviewed By: strager

Differential Revision: D13742965

fbshipit-source-id: f407105e06b9954766bdb48ef1303e2003c07284
2019-01-24 15:45:29 -08:00
Chad Austin
c9fde87f05 switch ProcessNameCache from std::condition_variable to LifoSem
Summary: SharedMutex + LifoSem is faster than std::mutex + std::condition_variable.

Reviewed By: strager

Differential Revision: D13792363

fbshipit-source-id: 591634276379d15df236ca7504b52681119601e7
2019-01-24 15:45:29 -08:00
Chad Austin
a4d18475f9 move ProcessNameCache processing onto a background thread
Summary:
This fixes a deadlock where the kernel held the memory manager lock while satisfying a page fault resulting in a call into Eden, which tried to read /proc/pid/cmdline, acquiring the memory manager lock again.

The fix is to never read /proc/pid/cmdline while handling a request. That work is now done on a background thread.

Reviewed By: strager

Differential Revision: D13685318

fbshipit-source-id: c4e17de3358b668638db0c2dcfba8536d05e5b7c
2019-01-24 15:45:29 -08:00
Matt Glazar
e9f5639b1f Make ProcessNameCache optional for ProcessAccessLog
Summary:
To mitigate a deadlock, I want to make ProcessAccessLog not access /proc/. Allow this by making ProcessNameCache optional.

This diff should not change behavior.

Reviewed By: simpkins

Differential Revision: D13540948

fbshipit-source-id: 4c5d68c972c04122de1d2414084debfec078dd4c
2018-12-21 15:43:51 -08:00
Wez Furlong
78622ebf2b eden: sendmsg portability for macos
Summary: transplanted from D4209167

Reviewed By: strager

Differential Revision: D13475718

fbshipit-source-id: 8e922f09938f3250eda50cce9e9c0d51962d3c4a
2018-12-17 20:16:18 -08:00
Wez Furlong
608ed79890 eden: macos has no mremap, adjust MappedDiskVector
Summary: Also no MAP_POPULATE

Reviewed By: chadaustin

Differential Revision: D13475716

fbshipit-source-id: 333531a35537d72246ea7d4a446245b49e5151c3
2018-12-17 15:53:15 -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
2297c7833e eden: fixup std::min for differently sized args
Summary:
on macOS the LHS is `unsigned long` and the RHS is `unsigned long long`.
Introduce a cast for consistency.

Reviewed By: chadaustin

Differential Revision: D13470036

fbshipit-source-id: f726507013e4ed9f123ced474299bb2d6818732f
2018-12-15 13:43:31 -08:00
Wez Furlong
09227586be eden: macos has no std::set::node_type
Summary: Even in C++17 mode, this isn't available, so work without it

Reviewed By: chadaustin

Differential Revision: D13470034

fbshipit-source-id: c917cc011aaabc2cfcf79e801bb6870482302fd8
2018-12-15 13:43:31 -08:00
Wez Furlong
47dbe19121 eden: add missing include for optional
Summary: this is required for the build on macos

Reviewed By: chadaustin

Differential Revision: D13470035

fbshipit-source-id: 066cb5b2ea86ffddb9c8cf6f7ae50da90b62a5bc
2018-12-15 13:43:31 -08:00
Chad Austin
86f0a3bd44 use CoverageSet to drop blobs when they're fully read by FUSE
Summary:
Drop interest in cached blobs at various points in the FileInode
lifecycle.

Reviewed By: strager

Differential Revision: D12991762

fbshipit-source-id: 19fd94938c96485160d547ecbd259ffeb39b2341
2018-12-06 12:04:17 -08:00
Wez Furlong
c5bef2d26d eden: eden top shows cmdline rather than exe
Summary:
Frequently, non-eden-owner-owned processes show up as `err:13` in
the `eden top` output which is a bit of a PITA.  This diff pulls the data
from `/proc/PID/cmdline` instead of `/proc/PID/exe`; the former is world
readable always while the latter is restricted to process owner readable.

Reviewed By: chadaustin

Differential Revision: D13342789

fbshipit-source-id: d4e395b318107e873189a1e2039329015c4c38f8
2018-12-05 13:15:20 -08:00
Chad Austin
cb4d5fed5c add a CoverageSet for tracking which parts of a blob have been read
Summary: Add a CoverageSet type that tracks non-overlapping intervals so FileInode will be able to tell when the entire blob has been read by FUSE.

Reviewed By: strager

Differential Revision: D12947146

fbshipit-source-id: fbcfd9c19b09d4a7b5364671dcdbd39b53e6d186
2018-12-05 12:34:11 -08:00
Scott Wolchok
3db36918c8 Don't include FBVector.h in String.h
Summary: No need for String to import fbvector.

Reviewed By: yfeldblum

Differential Revision: D13007715

fbshipit-source-id: c61639a04273f14dd3daf230ee6ed9ade93d058e
2018-11-29 11:52:37 -08:00
Puneet Kaushik
060d62f3c6 Add string conversion functions for Windows
Summary:
Backing store works with eden strings(UTF8 + Unix path separator). The path strings we receive on Windows from FS and cli are Windows paths
 (Win path separator and/or UTF16). Adding the functions to convert one to another.

Reviewed By: strager

Differential Revision: D13091788

fbshipit-source-id: f7fc8a79e360e964cf4619dfa540b57f1f18d283
2018-11-26 08:19:47 -08:00
Chad Austin
4c1ad47d20 replace folly::Baton in existing benchmarks with StartingGate
Summary:
Now that we have a standardized StartingGate for benchmarks, use it
everywhere we used to use folly::Baton.

(Note: this ignores all push blocking failures!)

Differential Revision: D13012244

fbshipit-source-id: 5841ab74cfa408e87d021fe5591557e79e677e5c
2018-11-13 15:27:51 -08:00
Chad Austin
60dccd2e38 standardize some of the benchmark infrastructure
Summary:
As we start to build out both FUSE and Thrift benchmarks, we'll want a
standard library. Introduce a benchharness and have both the thrift
sha-1 and parallel_open_close benchmarks use it.

(Note: this ignores all push blocking failures!)

Differential Revision: D12969306

fbshipit-source-id: 89c8bbcc37d53560decffb9281af4aba20345787
2018-11-13 15:27:50 -08:00
Chad Austin
5f75647224 microoptimize unique ID generation - hot path is six instructions
Summary:
yfeldblum were talking about whether this code might make sense in
folly. That led to polishing it a bit more. The hot path is only six
instructions now. It's not any faster in a tight generateUniqueID loop
but uses only one thread_local slot and a bit less global storage.

Reviewed By: strager

Differential Revision: D12927275

fbshipit-source-id: 94a5872c61dfe9dd441f1f34fab65f93c12997d8
2018-11-10 11:12:45 -08:00
Chad Austin
46441b3765 make generateUniqueID noexcept
Summary:
In a later diff, I needed generateUniqueID to be
noexcept. folly::ThreadLocal does not guarantee that (and it allocates
the first time a thread calls get()), so use C++ thread_local
instead. Bonus: it's about half a nanosecond faster now.

Reviewed By: strager

Differential Revision: D12914625

fbshipit-source-id: 9ddbe65d0ba1d317907f821c03dea5a207a73a68
2018-11-10 11:12:45 -08:00
Adam Simpkins
0824d0280c update all C++ unit tests to use the new temporary file functions
Summary:
Update all of the C++ unit tests that create temporary files and directories
to use the new `facebook::eden::makeTempFile()` and
`facebook::eden::makeTempDir()` functions.

Note that this likely changes the behavior of some code paths in meaningful
ways: `/dev/shm` normally does not support `getxattr()`, and Eden's overlay
code attempts to store the SHA-1 for materialized files as using extended
attributes.  This means that the tests will now typically hit the fallback
code path and will not store SHA-1 data in the overlay.

Reviewed By: chadaustin, strager

Differential Revision: D12971162

fbshipit-source-id: 6cc5eba2e04be7e9a13a30e90883feadfb78f9ce
2018-11-09 14:29:17 -08:00
Wez Furlong
19d6dd41d9 add pathFuncs expandUser() for tilde expansion
Summary:
This function behaves similarly to the python `os.path.expanduser`
function, except that it is restricted to expanding only information for the
current user.

Use this new function to process the hgcache path returned via the
rust config parsing code.

In the longer term I want to centralize and add accessors for
the rust config and move this stuff into EdenConfig, but for
now this is the one place that does this and it is OK to
process it this way here.

Reviewed By: strager

Differential Revision: D12988902

fbshipit-source-id: 96b10640359c3b8c0adac1e14cd42dd592023c3d
2018-11-09 11:24:37 -08:00
Chad Austin
d2b8fabdc3 add a benchmark for generateUniqueID
Summary:
In a later diff, I needed to make generateUniqueID() noexcept. This
made me think that C++'s thread_local might be a little faster than
folly::ThreadLocal. So I added this benchmark.

Reviewed By: yfeldblum

Differential Revision: D12914249

fbshipit-source-id: 2c4acfff2162f66d13f456439d91df2ecb4167e3
2018-11-07 15:45:50 -08:00
Dan Schatzberg
41faae94c0 Add lightweight tracing infrastructure
Summary:
In order to get better insights into where time is spent on
various requests, some tracing infrastructure is helpful. This will
record tracepoints into a per-thread ring-buffer which can then be
dumped out-of-band.

The trace format is quite simple, a trace is composed of blocks with
begin and end points and each block may have a parent block. We can
then translate this format to many other formats as we desire.

Reviewed By: chadaustin, strager

Differential Revision: D10384071

fbshipit-source-id: f9e0f11521c68b96ab40d517c7a83cf89375b101
2018-11-01 08:09:19 -07:00
Chad Austin
2a6dd2879d folly::Optional -> std::optional
Summary: Eden's on C++17 so fully cross the rubicon!

Reviewed By: strager

Differential Revision: D10498200

fbshipit-source-id: 4e2af5a8d5cef9a106e8c05e6f93ea9e5b8e696e
2018-10-23 18:51:59 -07:00
Chad Austin
bb420d70a2 folly::Optional -> std::optional
Summary: Eden's on C++17 so fully cross the rubicon!

Reviewed By: strager

Differential Revision: D10498031

fbshipit-source-id: 207f9fb38d8a422606d82b71f9545c7010220b3f
2018-10-23 17:05:11 -07:00
Chad Austin
d5a0a0d063 folly::Optional -> std::optional
Summary: Eden's on C++17 so fully cross the rubicon!

Reviewed By: strager

Differential Revision: D10496796

fbshipit-source-id: 3b0b8e10a93830c0e76dbc5baf95cf69a1f080af
2018-10-23 17:05:11 -07:00
Adam Simpkins
dacc8787f3 convert some deprecated Future::then() calls
Summary:
Convert deprecated `folly::Future::then()` calls to `thenTry()` or
`thenValue()` as appropriate.

Reviewed By: chadaustin

Differential Revision: D10503906

fbshipit-source-id: abc0f6f588ad7edd0dd2576544875f4ad0263b83
2018-10-23 13:42:12 -07:00
Chad Austin
078d57c4ee add a cheap unique ID generator
Summary:
Add a very cheap unique ID allocator designed for extremely
low-latency uses like D10384071.

Differential Revision: D10501712

fbshipit-source-id: 15a0b7a2d344c0f6100082850dd967c585f3e2da
2018-10-23 10:42:45 -07:00
Matt Glazar
1f15d7e2fd Delete stale comment
Summary: D3376727 removed the `+1` from `AbsolutePathBase::paths`, but did not remove the comment referring to the `+1`. Remove the stale comment.

Reviewed By: pkaush

Differential Revision: D10394249

fbshipit-source-id: 3b2dc27f7083fe8a8706bac38275249dd4969d11
2018-10-22 20:27:25 -07:00
Chad Austin
65453a7ab2 fix memory error in relativize()
Summary:
relativize() returns an AbsolutePathPiece into its argument which is a
temporary AbsolutePath. The tests and ASAN didn't catch this because
they asserted the result's value before the temporary was destroyed, I
assume. Also the test strings fit into the SSO so there was no actual
memory allocation.

Reviewed By: simpkins

Differential Revision: D10261332

fbshipit-source-id: 912ffe6a46845cdd625e6dffbf65f0a0f8f89d0f
2018-10-09 16:39:45 -07:00
Chad Austin
d99eef5354 add a splitFirst() function to PathFuncs
Summary:
Add a splitFirst() function that, if you think about a path as a linked list,
splits the head and the tail. Normally you could use the components
iterator, but split() is easier when the iteration is asynchronous and
requires lambda capture.

Reviewed By: pkaush

Differential Revision: D10154746

fbshipit-source-id: 6372a0bbde27f6596659ad1244cc96fa1f9eb6ff
2018-10-09 16:39:45 -07:00
Matt Glazar
bdf73e42de Fix broken build
Summary:
It looks like D9477181 conflicted with D9635507, causing a compile error:

```
eden/fs/utils/ProcessNameCache.cpp:74:15: error: no member named 'names' in 'folly::LockedPtr<folly::Synchronized<facebook::eden::ProcessNameCache::State, folly::SharedMutexImpl<false> >, folly::LockPolicyExclusive>'
        state.names.emplace(pid, ProcessName{detail::readPidName(pid), now});
        ~~~~~ ^
eden/fs/utils/Synchronized.h:48:10: note: in instantiation of function template specialization 'facebook::eden::ProcessNameCache::add(pid_t)::(anonymous class)::operator()<folly::LockedPtr<folly::Synchronized<facebook::eden::ProcessNameCache::State, folly::SharedMutexImpl<false> >, folly::LockPolicyExclusive> >' requested here
  return update(wlock);
         ^
eden/fs/utils/ProcessNameCache.cpp:58:3: note: in instantiation of function template specialization 'facebook::eden::tryRlockCheckBeforeUpdate<folly::Unit, facebook::eden::ProcessNameCache::State, (lambda), (lambda)>' requested here
  tryRlockCheckBeforeUpdate<folly::Unit>(
  ^
eden/fs/utils/ProcessNameCache.cpp:81:15: error: no member named 'waterLevel' in 'folly::LockedPtr<folly::Synchronized<facebook::eden::ProcessNameCache::State, folly::SharedMutexImpl<false> >, folly::LockPolicyExclusive>'
        state.waterLevel += 2;
        ~~~~~ ^
eden/fs/utils/ProcessNameCache.cpp:82:19: error: no member named 'waterLevel' in 'folly::LockedPtr<folly::Synchronized<facebook::eden::ProcessNameCache::State, folly::SharedMutexImpl<false> >, folly::LockPolicyExclusive>'
        if (state.waterLevel > state.names.size()) {
            ~~~~~ ^
3 errors generated.
```

Dereference `state` to fix the error.

Reviewed By: chadaustin

Differential Revision: D9673324

fbshipit-source-id: 5143cd22baf66307e5aacb0a04669de69dde99e8
2018-09-05 21:23:16 -07:00
Chad Austin
b55e4dbb58 introduce a ProcessAccessLog
Summary:
Add a ProcessAccessLog that supports cheaply tracking pids passed
into FUSE. It's a write-many, read-maybe access pattern, so the code
is careful to add as little latency as possible on the hot path.

Reviewed By: strager

Differential Revision: D9477839

fbshipit-source-id: 6928c1d09d55c2b0c0958ac2cb0dc91ec21b370c
2018-09-05 15:06:58 -07:00
Chad Austin
7bc8e0cbe0 add a ProcessNameCache
Summary:
Eden is accessed by many short-lived processes. We want to show their
names in `eden top` so efficiently try to grab the names of pids. This
code will be used in a later diff.

Reviewed By: strager

Differential Revision: D9477181

fbshipit-source-id: 28998ac8bf7b804a3bd4944fbda4c7d1a0918312
2018-09-05 15:06:57 -07:00
Chad Austin
ff5ea60cdb Add a BucketedLog for recording pid accesses by second
Summary:
For `eden top`, we want to count accesses by pid by the second for the
past N seconds. Remembering forever would be too expensive so add a
circular data structure that forgets old entries on insertion and
reads.

Reviewed By: strager

Differential Revision: D9477166

fbshipit-source-id: 7019d441fde0cf40d8f5b08ed8dc13fafe0cbcac
2018-09-05 15:06:57 -07:00
Dan Schatzberg
947a423e72 Make tryRlockCheckBeforeUpdate return an rref
Summary:
Without this, you cannot use this method for non-copyable
types (e.g. Future)

Reviewed By: chadaustin

Differential Revision: D9635506

fbshipit-source-id: e57f1ae79acd544e5db0557d4654b675a419304c
2018-09-05 07:53:57 -07:00
Dan Schatzberg
e80a31de94 Have tryRlockCheckBeforeUpdate pass a LockedPtr
Summary:
By passing a locked ptr instead of a reference directly to
the locked object, the check and update methods can drop the lock
early

Reviewed By: chadaustin

Differential Revision: D9635507

fbshipit-source-id: a881043cfd2c28f6f53eb12e1494fcbc5f7f8e08
2018-09-05 07:53:57 -07:00
Lee Howes
c0a837ec7d Future<T>::then Future<T>::then(not-try-task) -> Future<T>::thenValue(task).
Summary:
Overall plan to modify Future<T>::then to be r-value qualified and use Future<T>::thenTry or Future<T>::thenValue.

The goal is to disambiguate folly::Future and to improve type and lifetime safety of Future and its methods.

Codemod:
 * future<T>.then(callable with operator()(not-a-try)) to future<T>.thenValue(callable with operator()(not-a-try)).
 * future<T>.then(callable with operator()()) to future<T>.thenValue(callable with operator()(auto&&)).
 * future<T>.then(callable with operator()(auto)) to future<T>.thenValue(callable with operator()(auto)).

Reviewed By: yfeldblum

Differential Revision: D9512177

fbshipit-source-id: daa3581611dcd9f32d9314bae1c5fa0f966613f3
2018-08-26 22:52:34 -07:00
Puneet Kaushik
eeaf1c0025 Started Eden for Windows and integrated hg store with it.
Summary:
This diff is first in the series to make Eden work on Windows. It includes:

1. HG backing store and Object store, which provides the capability to talk to mercurial and fetch the file and folder contents on Windows.
2. Subprocess and Pipe definition for Windows.
3. The Visual studio solution and projects files to compile Eden and scm datapack.

Few Important points:

1. Most of the changes to existing code is done under a macro EDEN_WIN so that it doesn't impact on other platform.
2. Sqlite is used for caching the fetched contents. We are not using Rocksdb on Windows.
3. The main function only calls some test code and exit after printing the output.
4. The initializeMononoke code is disabled for Windows because it needs Proxygen to talk HTTP. Will enable this once I get Proxygen and other dependencies working.
5. HgImporter pass Windows handles to hg_import_helper as command line args. The code to convert these handles into fds is in a separate diff.

Reviewed By: wez

Differential Revision: D8653992

fbshipit-source-id: 52a3c3750425fb92c2a7158c2c214a9372661e13
2018-08-21 17:53:38 -07:00
Chad Austin
bfc189cc92 Use a deterministic executor in TestMount
Summary:
As a prerequisite to running inode unloading code in a background
queue, use a deterministic executor in TestMount to make sequencing in
unit tests reliable.

Reviewed By: simpkins

Differential Revision: D9323878

fbshipit-source-id: 0b85632c1637a8cf83d6f238675e5b6bbb6923c7
2018-08-21 12:23:00 -07:00
Zeyi Fan
96c7bb1c5f read use-mononoke and client-certificate in edenfs
Summary: This commit let `HgImporter` pick up configuration values from `EdenConfig`.

Reviewed By: chadaustin

Differential Revision: D9346293

fbshipit-source-id: cb63f7d13a86058e9bf076eddb52212560a64cb1
2018-08-20 11:22:14 -07:00
Marshall Cline
dfac9dda4a use rvalue-qual Future::ensure(): pass 2
Summary:
This is part of "the great r-valuification of folly::Future":

* This is something we should do for safety in general.
* Several of folly::Future's methods are lvalue-qualified even though they act as though they are rvalue-qualified, that is, they provide a postcondition that says, in effect, callers should act as though the method invalidated its `this` object (regardless of whether that invalidation was actual or logical).
* This violates the C++ principle to "Express ideas directly in code" (see Core Guidelines), and generally makes it more confusing for callers as well as hiding the actual semantics from tools (linters, compilers, etc.).
* This dichotomy and confusion has manifested itself by some failures around D7840699 since lvalue-qualification hides that operation's move-out semantics - leads to some use of future operations that are really not correct, but are not obviously incorrect.
* The goal of rvalueification is to make sure methods that are logically rvalue-qualified are actually rvalue-qualified, which forces callsites to acknowledge that rvalueification, e.g., `std::move(f).ensure(...)` instead of `f.ensure(...)`. This syntactic change in the callsites forces callers to acknowledge the method's rvalue semantics.

This diff started as a Codemod, then required manual fixes. Here were the codemod steps:

* expr.ensure(...) ==> std::move(expr).ensure(...)  // if expr is not already an xvalue
* expr->ensure(...) ==> std::move(*expr).ensure(...)

Note: operator precedence of that last step is safe - no need to parenthesize `expr`. Reason: `->` binds more tightly than unary `*`.

Reviewed By: yfeldblum

Differential Revision: D9332070

fbshipit-source-id: 882121fe82c05fdb196ce676db686b6bc254974b
2018-08-16 20:37:45 -07:00
Zeyi Fan
6f997c4d3f Use MononokeBackingStore when fetching trees
Summary:
This commit integrates Mononoke API Server with eden:

* Added two new command line options: `--client_certificate` and `--use_mononoke`.
* Added two new config values: `ssl.client-certificate` and `mononoke.use-mononoke`.
* Made `HgImporter` return the repo name along with treemanifest options.
* Make `HgImporter` ask Mononoke API Server for tree data when the desired tree is not present in local Mercurial store.

Reviewed By: chadaustin

Differential Revision: D9183035

fbshipit-source-id: e328fb3237d10c545c8af71f856007ad6c487061
2018-08-07 13:52:29 -07:00
Chad Austin
5d54a799c9 Rename UnboundedQueueThreadPool to UnboundedQueueExecutor and add a ManualExecutor variant
Summary:
To improve the determinism of our C++ tests, I am planning to switch
TestMount to a ManualExecutor. This adds a ManualExecutor constructor
to UnboundedQueueExecutor.

In Rust, I'd use a trait, but a simple class with two constructors works fine.

Reviewed By: strager

Differential Revision: D8846553

fbshipit-source-id: c52752105255503d26f1e65494c32b3f62882e44
2018-08-03 13:21:59 -07:00
Lee Howes
2b4e4f861e Future<T>::then 1/n: Future<T>::then(try-task) -> Future<T>::thenTry(task).
Summary:
Overall plan to modify Future<T>::then to be r-value qualified and use
Future<T>::thenTry or Future<T>::thenValue.

1/n: Codemod rvalue-future<T>.then(callable with operator()(Try<T>)) to rvalue-future<T>.thenTry(callable with operator()(Try<T>)).

Reviewed By: simpkins

Differential Revision: D8961903

fbshipit-source-id: ff17b7833d240c221197cdf0bf914b8a39f80b07
2018-07-23 18:51:38 -07:00
Marshall Cline
d71a100be2 use rvalue-qual Future::get(): pass 5
Summary:
This is part of "the great r-valuification of folly::Future":

* This is something we should do for safety in general.
* Context: `Future::get(...)` means both `Future::get()` and `Future::get(Duration)`
* Using lvalue-qualified `Future::get(...)` has caused some failures around D7840699 since lvalue-qualification hides that operation's move-out semantics - leads to some use of future operations that are really not correct, but are not obviously incorrect.
* Problems with `Future::get(...) &`: it moves-out the result but doesn't invalidate the Future - the Future remains (technically) valid even though it actually is partially moved-out. Callers can subsequently access that moved-out result via things like `future.get(...)`, `future.result()`, `future.value()`, etc. - these access an already-moved-out result which is/can be surprising.
* Reasons `Future::get(...) &&` is better: its semantics are more obvious and user-testable. It moves-out the Future, leaving it with `future.valid() == false`.

Reviewed By: yfeldblum

Differential Revision: D8711368

fbshipit-source-id: fbfcb731097cdf9d8d98583956bc7fe614157a6b
2018-07-02 07:05:52 -07:00
Adam Simpkins
3f99298e67 teach edenfs to create directories it needs
Summary:
Update the C++ edenfs code to ensure that the .eden and
.eden/storage/rocks-db directories exist, rather than requiring the python CLI
code create these directories as part of `eden start`

Reviewed By: strager

Differential Revision: D8508488

fbshipit-source-id: 358521b4f5eed1d19bf37903900ca50718e2c35c
2018-06-26 12:07:08 -07:00
Eamonn Kent
8821a6fe66 Support reporting of additional statistics
Summary:
Expand the data we collect in fb 303 collector. Currently we extract data from
procprint it is only reliable for a day (or so).

Here we add:

- memory vm rss bytes (from /proc/self/status)
- memory private bytes (from /proc/self/smaps)

Reviewed By: chadaustin

Differential Revision: D8380917

fbshipit-source-id: dca6fac7af44321c7a6615edb0fde0cb7c8827d0
2018-06-20 09:06:16 -07:00
Adam Simpkins
011cc21e52 update privhelper code to use the UnixSocket helper class
Summary:
This updates the privhelper code to use the UnixSocket class for performing
I/O.  This reduces the number of separate implementations of code we have for
sending file descriptors across Unix domain sockets, and also makes the
privhelper APIs non-blocking.

This will make it easier to clean up some of the initialization ordering in
the future.  It will also make it easier to send file descriptors to the
privhelper server, instead of just receiving them.  This may be helpful for
passing a file descriptor to use for logging to the privhelper process, which
will make it easier to fork the privhelper before logging redirection has
occurred.

Reviewed By: bolinfest

Differential Revision: D8053422

fbshipit-source-id: 1f8fdf22afc797eead0213be1352ea530762140d
2018-06-11 18:32:25 -07:00
Chad Austin
aba341244a remove Allocator template parameter from PathMap
Summary:
We don't use the Allocator template parameter and it makes forward
declaring PathMap harder, so remove it.

Reviewed By: simpkins

Differential Revision: D8231982

fbshipit-source-id: 5c0faed8f61dc7699c8bb6660292f255feb10e29
2018-06-01 12:23:31 -07:00
Sergey Zhupanov
419a57b1bc Enabled additional compiler warnings in Eden.
Summary:
1. Enabled a number of additional C++ compiler warnings in Eden.
2. Fixed warnings-turned-errors that resulted from this change.

Reviewed By: simpkins

Differential Revision: D8132543

fbshipit-source-id: 2290ffaaab55024d582e29201a1bcaa1152e6b3e
2018-06-01 11:39:01 -07:00
Chad Austin
0797ee3a35 to satisfy secfs validation suite, limit path components to 255 bytes
Summary:
Most filesystems limit path components to 255. To remain consistent,
let's have Eden do the same, at least for write operations.

Reviewed By: simpkins

Differential Revision: D8151020

fbshipit-source-id: 251da94a076f5765111c8e3d9d8a25c37682e2e3
2018-05-30 23:11:28 -07:00
Orvid King
5e124cc05f Change calls from collectAll to collectAllSemiFuture
Summary: We are changing `folly::collectAll` to return `SemiFuture` rather than `Future` and this is needed as an interim step. After all calls to `collectAll` are changed to `collectAllSemiFuture`, we'll be renaming it back to `collectAll`.

Reviewed By: yfeldblum

Differential Revision: D8157548

fbshipit-source-id: 27b768ac7ff0d6572bde57f01601045a1fd5d5e5
2018-05-26 14:01:37 -07:00
Adam Simpkins
163d92d617 add attachEventBase()/detachEventBase() to UnixSocket
Summary:
Add methods to UnixSocket and FutureUnixSocket to attach and detach from an
EventBase.  This makes it possible to construct a UnixSocket object without
having an EventBase yet and then attach it to an EventBase later.

Reviewed By: bolinfest

Differential Revision: D8053423

fbshipit-source-id: c4de00166dbc0e075b4e4cd81c3dd5b377ea9a52
2018-05-23 11:51:59 -07:00
Chad Austin
d0b1ad675d remove last ulock from eden
Summary:
I'd misunderstood the point of SharedMutex's upgrade locks -
unless they're used in rare paths, they don't allow for increased
concurrency. This diff and D7885245 remove all of Eden's ulocks,
replacing them with a helper which checks once with an rlock held, and
if the check fails, switches to a wlock (and checks again).

Reviewed By: yfeldblum

Differential Revision: D7886046

fbshipit-source-id: 545bb0dbb4898cbb71412efc6222ef12e4ee374e
2018-05-18 15:21:16 -07:00
Adam Simpkins
684fa29593 update folly::Init to call folly::initLogging()
Summary:
Update the folly::Init code to define a `--logging` command line flag, and call
`folly::initLoggingOrDie()` with the value of this command line during
initialization.

This is similar to the existing code that initializes the glog library.
(Programs can use both glog and folly logging together in the same program, and
I expect that many programs will do so as parts get converted to folly::logging
and parts remain using glog.)

Reviewed By: yfeldblum

Differential Revision: D7827344

fbshipit-source-id: 8aa239fbad43bc0b551cbe40cad7b92fa97fcdde
2018-05-15 12:38:01 -07:00
Chad Austin
72be488e3d add convenient operator literals for the various path piece types
Summary:
I got tired of typing PathComponentPiece{"..."} in tests so here are
some operator literals.

Reviewed By: simpkins

Differential Revision: D7956732

fbshipit-source-id: 85d9f3fd725853a54da9e70fc659bd7eb9e0862c
2018-05-11 14:52:07 -07:00
Chad Austin
c51fea6a85 add support for migrating MappedDiskVector record formats
Summary:
simpkins was curious how data format migrations would be handled in
the upcoming InodeTable. This diff implements the bulk of the logic
which is largely at the MappedDiskVector level. The existing file
format supported record version negotiation and this diff hooks it up
with some type-level operations.

Reviewed By: simpkins

Differential Revision: D7836249

fbshipit-source-id: 00e36bc67068c7524956e908b3872c80a79241c0
2018-05-09 16:50:52 -07:00
Chad Austin
04d873a27a add EdenBug::throwException
Summary:
I frequently find myself forgetting how to make the compiler see that
non-moved-from EDEN_BUG's destructor is noreturn, so add a simple
throwException function to it.

Reviewed By: simpkins

Differential Revision: D7834182

fbshipit-source-id: f279b9ca24f90efb4ad3ac318606dbd2dd002665
2018-05-01 16:52:06 -07:00
Adam Simpkins
8e3c09a99a move folly/experimental/logging to folly/logging/
Summary:
Promote the folly logging code out of the experimental subdirectory.
We have been using this for several months in a few projects and are pretty
happy with it so far.

After moving it out of the experimental/ subdirectory I plan to update
folly::Init() to automatically support configuring it via a `--logging` command
line flag (similar to the initialization it already does today for glog).

Reviewed By: yfeldblum, chadaustin

Differential Revision: D7755455

fbshipit-source-id: 052db34c97f7516728f7cbb1a5ad959def2f6efb
2018-04-30 21:29:29 -07:00
Adam Simpkins
dea514bbef add CMake build files
Summary: Add CMakeFiles to build Eden.

Reviewed By: wez

Differential Revision: D7479587

fbshipit-source-id: 7e0b4a756005dadc3af5c13c36ce22d1dcc15071
2018-04-30 14:37:46 -07:00
Adam Simpkins
0928e2af18 ensure that we send no more than IOV_MAX iovecs at once
Summary:
Update the UnixSocket code to limit the number of iovecs that we send at one
time to folly::kIovMax.  (This constant is set from from IOV_MAX on platforms
that provide this setting.)

The thrift serializer code emits data into 16kB chunks, so if we had many
megabytes of data to send we could end up with thousands of iovecs.  The kernel
would fail the send with EMSGSIZE in this case.

Reviewed By: chadaustin

Differential Revision: D7665147

fbshipit-source-id: b7a60238d3fca973604b9037f22883cae80891ab
2018-04-18 14:10:03 -07:00
Chad Austin
865f938cf4 bump maximum UnixSocket message size
Summary:
The takeover data for a fully-loaded monorepo was 20 MB.  Two
monorepos was 40 MB, exceeding the previous 32 MiB limit and causing
takeover to fail.  Bump to 512 MiB to minimize the chance of
allocating too much given bogus data while still supporting large
numbers of checkouts.

Reviewed By: simpkins

Differential Revision: D7661637

fbshipit-source-id: 1dc54055e7ac3ce0f6cdbf4a7e5d372c2674dfee
2018-04-18 11:53:01 -07:00
Chad Austin
75b32848c6 refactor UnixSocket in prep for iovec limits
Summary:
UnixSocket traverses the IOBuf chain twice.  Refactor that
into a common function because the next diff caps the size of
individual iovecs.

Reviewed By: simpkins

Differential Revision: D7659062

fbshipit-source-id: 88b7d63669d8189b96434c38a6e499ed3b5ebbe6
2018-04-18 11:31:02 -07:00
Adam Simpkins
f6d6ddf5cc declare the FuseChannel::InvalidationEntry move constructor noexcept
Summary: Add a noexcept specifier to InvalidationEntry's move constructor.

Reviewed By: chadaustin

Differential Revision: D7417324

fbshipit-source-id: c1a9704a61b7a6ce59a7e9dde623f2ef020a7506
2018-03-30 15:16:13 -07:00
Chad Austin
bf31028299 test and fix for takeover bug when trees are referenced across a takeover
Summary:
Verify Eden handles looking up an inode by number after graceful
restart and checkout.

Reviewed By: simpkins

Differential Revision: D7346263

fbshipit-source-id: 876b4837708da9ac31f72c06e7defc797fe126f3
2018-03-23 15:06:22 -07:00
Adam Simpkins
28426f4d29 throw all errno exceptions as std::generic_category
Summary:
Fix the code to generate exceptions based on an errno error using
std::generic_category rather than std::system_category.

Reviewed By: yfeldblum

Differential Revision: D7329997

fbshipit-source-id: 3fe257bbbc7a631c801f31120592c8bdbc25c8bf
2018-03-20 13:38:45 -07:00
Adam Simpkins
a3c582d708 check for std::generic_category when looking for errno errors
Summary:
Add a new utils/SystemError.h header with helper functions to check if a
`std::system_error` contains an errno value.

Most of the code in Eden previously only checked for `std::system_category`
when looking for errno values.  `std::generic_category` is the correct category
to use for errno exceptions, but folly/Exception.h incorrectly throws them as
`std::system_category` today.  This change makes Eden treat either error type
as errno values for now.

Reviewed By: yfeldblum

Differential Revision: D7329999

fbshipit-source-id: 67a3c3ea10371c53a2e34236b7575deac4cbd53a
2018-03-20 13:38:45 -07:00
Wez Furlong
fd553e32b0 fixup presentation of EDEN_BUG message
Summary:
I noticed from the logs that this was funky:

```
C0131 01:55:28.870926 24027 Bug.cpp:55] EDEN_BUG at eden/fs/inodes/InodeMap.cpp425: !!BUG!! InodeMap::save() called with 104957 inodes still loaded; they must all (except the root) have been unloaded for this to succeed!
```

Reviewed By: chadaustin

Differential Revision: D7310995

fbshipit-source-id: 8c7840bbd60e3e5e815c8cef0d50bf4021e89baf
2018-03-16 16:55:25 -07:00
Adam Simpkins
9bd173054b fix incorrect deallocation size in UnixSocket::SendQueueDestructor
Summary:
In some cases we could call `delete` with the wrong size in
`UnixSocket::SendQueueDestructor` when `__cpp_sized_deallocation` is available.

In particular, if the input message data contained some empty buffers in the
IOBuf chain we would allocate room for these elements when initially performing
the allocation in `createSendQueueEntry()`, but we would skip over them in the
`SendQueueEntry` constructor, so `iovCount` did not include them.  The
`SendQueueDestructor` code used `iovCount` to calculate how much space had been
allocated, and so it would undercount the amount of allocated space in this
case.

This updates `createSendQueueEntry()` to also avoid allocating an iovec entry
for the empty buffers, so that `iovCount` should always accurately reflect how
many entries were originally allocated.

Reviewed By: chadaustin

Differential Revision: D7190579

fbshipit-source-id: 422cc737f146adeb1c133b9f3b500038e05bad10
2018-03-08 17:45:57 -08:00
Chad Austin
463d0b4ace Enable O_CLOEXEC on MappedDiskVector
Summary:
This was an in-person code review item I forgot to enable
with the original diff.

Reviewed By: wez

Differential Revision: D7016624

fbshipit-source-id: 91d729772aa3c0b476f6bf8f6ee7e46cdac54626
2018-03-07 23:11:48 -08:00
Adam Simpkins
21d2b6c46d Remove TARGETS files
Summary:
This removes the TARGETS files from the eden github repository.  The
open source buck build has been failing for several months, since buck
removed support for the thrift_library() rule.

I will potentially take a stab at adding CMake build support for Eden
at some point in the future.

Reviewed By: chadaustin

Differential Revision: D6893233

fbshipit-source-id: e6023094a807cf481ac49998c6f21b213be6c288
2018-02-20 19:57:45 -08:00
Sergey Zhupanov
6f40e9a23f replaced std::size_t by size_t in fbcode/eden codebase.
Summary:
Most uses of `size_t` in `eden` are unqualified, but a few are qualified.
As discussed ad nauseum in
  https://stackoverflow.com/questions/5813700/difference-between-size-t-and-stdsize-t
it is totally safe to use unqualified `size_t` with all compilers/platforms.
Since this saves 5 chars per use, and to improve uniformity, I ran:
```
$ find ~/fbsource/fbcode/eden -type f       \
    | egrep '\.(h|cpp)$'                    \
    | xargs sed -i 's/std::size_t/size_t/g'
```

Reviewed By: chadaustin

Differential Revision: D7021980

fbshipit-source-id: da268e62a9a93d2a5168a40b6878795ae7516b7f
2018-02-20 15:30:18 -08:00
Chad Austin
4dadbde38a introduce a MappedDiskVector type
Summary:
Introduces a persistent non-durable storage mechanism backed
by a memory-mapped file with fixed-length records.

Reviewed By: simpkins

Differential Revision: D6877217

fbshipit-source-id: 0ddacb4137cfe43e67c822dce4064356cdf515b5
2018-02-14 17:37:15 -08:00
Adam Simpkins
00a232d868 make Clock::getRealtime() const
Summary: This API seems like it should be const, as it does not modify the clock.

Reviewed By: chadaustin, zhupanov

Differential Revision: D6869719

fbshipit-source-id: c8bf4ccab34538b59e6baeedd0b0ff88b328236e
2018-02-01 11:19:15 -08:00
Wez Furlong
d6adcfc058 add fsattr utility for testing purposes
Summary:
This is the spiritual successor to D3302706 which originally
wanted to solve this by adding a python extension.  That would prove
to be too painful for the opensource build so it was shelved.

We now need to be able to run our tests in an environment that doesn't
have the `attr` rpm installed so this is a good time to fix this
in a more portable way.

This diff adds a little wrapper around the functions that we already
have for consuming extended attribute information and augments them
with another to list attributes.

The utility emits output in json format and is intended to be fed
directly into the helper functions we have in `fs.py`.

Reviewed By: chadaustin

Differential Revision: D6851182

fbshipit-source-id: 3d1d1a351f2e01405645d45658d1c8bc61a659a4
2018-01-30 21:50:39 -08:00
Wez Furlong
be130bc880 add version handshake to takeover protocol
Summary:
Whilst chatting with simpkins we realized that we lost
the handshake portion of the takeover protocol during a refactor.

The handshake is important for a couple of reasons:

1. It prevents unmounting and loosing all the mounts in the case
   that sometime decides to netcat or otherwise connect to the
   socket
2. It gives us an opportunity to short circuit any heavy lifting
   if we know that it will be impossible to succeed.
3. It allows us to rollback to earlier builds with older versions
   of the takeover protocol.

This diff adds a little bit of machinery to enable passing a set of supported
takeover protocol version numbers.  The intent is to retain support for
the two of these at a time; any time we change the encoding/protocol
for takeover we'll bump the version number and add supporting code
to handle the new format, retaining support for the prior version.

Retaining the ability to handle the prior version allows us to downgrade
to an earlier build gracefully if/when the need arises.

I opted to do this here rather than by bumping the `kProtocolID`
constant in `UnixSocket.h` becase we're not really changing the
lowest level of the protocol; just the takeover specific portions.

I haven't actually changed the takeover serialization in this diff,
but do have some work on that happening in D6733406; that diff will
be amended to take advantage and demonstrate how this versioning
scheme works.

A key thing to note about the implementation of this diff is that
the client sends the version number to the server, but doesn't
add any explicit version encoding in the response we receive.
This is deliberate and allows us to upgrade prior builds to
this new scheme.  I'll add a more definitive check for this
situation when I actually rev the format in the following diff.

Reviewed By: simpkins

Differential Revision: D6743065

fbshipit-source-id: c991cebfee918daad098105ca6bcfef76374c0ff
2018-01-30 14:21:18 -08:00
Chad Austin
697eb8a6fd run clang-format across eden
Summary:
```
find . \( -iname '*.cpp' -o -iname '*.h' \) -exec arc lint --apply-patches {} +
```

Differential Revision: D6820436

fbshipit-source-id: 173c0e3b5c023c1c9276f34e17d732f1dd161892
2018-01-26 11:20:31 -08:00
Chad Austin
13176097df bring back fbstring for PathComponent - reduces PathMap memory usage
Summary:
In my benchmarks, using fbstring over std::string for PathMap is
worthwhile.  There are a lot of entries stored in PathMap and the fact
that fbstring is a word smaller than std::string adds up.

Differential Revision: D6820204

fbshipit-source-id: 1ac34a81828891eb8125b13a074de6ed9715edad
2018-01-26 10:51:58 -08:00
Adam Simpkins
83ebf3b228 minor improvements to EDEN_BUG()
Summary:
Switch from glog to folly logging.  Also derive from folly::ColdClass to
indicate that the `EdenBug` class is only ever created on unexpected code
paths.

Reviewed By: wez

Differential Revision: D6609613

fbshipit-source-id: 33621c7bafc946df245224da9b6a559e3dfd58d6
2018-01-05 13:53:23 -08:00
Adam Simpkins
db1f93b2aa add new UnixSocket and UnixSocketFuture helper classes
Summary:
Add new classes that help send data, file descriptors, and credential
information over unix domain sockets.

UnixSocket provides a low-level, raw callback API, similar to that provided by
the classes in folly/io/async/.  UnixSocketFuture is a slightly higher-level
wrapper class that provides a Future-based API on top of this.  I expect that
most places in eden will probably use the UnixSocketFuture API, but callers
that repeatedly wait for new messages (like the privhelper server) may want to
use the raw callback API instead.

This will help simplify several places in eden that communicate over unix
domain sockets.  Both the privhelper code and the takeover code needs to send
file descriptors over unix domain sockets.  They currently each use their own
separate message handling logic for this.  We currently communicate with the
hg_import_helper.py script over a pipe, but this could easily be switched to
use this new UnixSocket class as well.

Reviewed By: wez

Differential Revision: D6494981

fbshipit-source-id: 80bd7f06e5b884fc4148162e1a8a3b478acce209
2018-01-05 13:35:46 -08:00
Sergey Zhupanov
cdc6af4e72 Fixing merge screw-up caught by Adam TYVM
Summary: Fixing merge screw-up in D6597696

Reviewed By: simpkins

Differential Revision: D6662096

fbshipit-source-id: 9d0a615a6991e673c24b591171caf2c7dc19165e
2018-01-04 14:35:26 -08:00
Sergey Zhupanov
14890efd46 Added joinAndNormalize to PathFuncs with test plus minor cleanup.
Summary:
joinAndNormalize() canonicalizes a path string relative to
         a relative path base.

Reviewed By: simpkins

Differential Revision: D6659625

fbshipit-source-id: 0547d93d576fb894b16ad43bec020dc7b9658426
2018-01-04 10:11:38 -08:00
Sergey Zhupanov
29c2999a65 Removed all folly::fbstring uses from eden.
Summary: Removed all folly::fbstring uses from eden.

Reviewed By: wez

Differential Revision: D6597696

fbshipit-source-id: 816ea91fad063eccf9e6a46bf5c5e32bc69c6bf7
2018-01-03 16:41:34 -08:00
Giuseppe Ottaviano
4029be5d7b Remove useless comparator
Summary: Drive-by cleanup. `CompareString` is not used anywhere and `std::less<>` would be better anyway.

Reviewed By: wez

Differential Revision: D6655104

fbshipit-source-id: 0fee22172c93335493400e6317d92f9e1e77b40e
2018-01-03 11:25:52 -08:00
Philip Jameson
8604b8f5b0 Migrate TARGETS files from @/ to //
Summary:
This is a codemod to change from using @/ to // in basic cases.
- TARGETS files with lines starting with @/ (but excluding @/third-party:
- autodeps lines in source and TARGETS files ( (dep|manual)=@/ ), excluding @/third-party
- Targets in string macros

The only thing left of the old format should be @/third-party:foo:bar

drop-conflicts

Reviewed By: ttsugriy

Differential Revision: D6605465

fbshipit-source-id: ae50de2e1edb3f97c0b839d4021f38d77b7ab64c
2017-12-20 16:57:41 -08:00
Adam Simpkins
5ef9928f3b add a normalizeBestEffort() function
Summary:
Add a new function that attempts to normalize a path with `realpath()`, but
falls back to `canonicalPath()` if that fails.  This lets us attempt to resolve
symlinks if possible, but still perform best-effort normalization if that
fails.

Reviewed By: chadaustin

Differential Revision: D6527493

fbshipit-source-id: 9137d517452ca7fd825852c1f60ade07f1ee78fa
2017-12-14 12:41:47 -08:00
Chad Austin
2f22a9f534 introduce a type representing the unbounded eden cpu pool
Summary:
Add EdenCPUThreadPool and UnboundedQueueThreadPool types to make it clearer
that it's always okay for prefetch, deferred diff entry, and hg import to
shuttle work back to the main thread pool.

This diff changes no behavior - it just makes some invariants explicit.

Reviewed By: wez, simpkins

Differential Revision: D6504117

fbshipit-source-id: 3400ad55c00b3719ecba31807fd992442f622cd9
2017-12-12 12:35:35 -08:00
Chad Austin
f91ae520b2 introduce a Clock seam for testability
Summary:
Introduce a Clock seam.  This will allow us to write tests around
ctime, mtime, and atime logic.

Reviewed By: wez

Differential Revision: D6392543

fbshipit-source-id: 1721d76d2364b135b4ef5c078ef60f7f8526259e
2017-12-05 10:06:48 -08:00
Adam Simpkins
c8c1ba5eab remove eden/fs/utils/test/TestChecks.h
Summary:
The gtest macros in this file were moved to folly/test/TestUtils.h
Update everything to just use folly/test/TestUtils.h directly.

Reviewed By: chadaustin

Differential Revision: D6301759

fbshipit-source-id: 7f2841c12d5bea15376f782fb3bf3bfef16039c7
2017-11-15 12:53:55 -08:00
Adam Simpkins
fe8bdcda64 add EXPECT_THROW_RE() and EXPECT_THROW_ERRNO() test macros
Summary:
Add EXPECT_THROW_RE() and EXPECT_THROW_ERRNO() macros to folly/test/TestUtils.h
These allow more precise checks than the basic EXPECT_THROW() macro provided as
part of gtest.

These macros are being moved into folly from Facebook's eden repository
(https://github.com/facebookexperimental/eden)
This will allow us to use them in folly tests and in other projects that depend
on folly.

Reviewed By: yfeldblum

Differential Revision: D6301760

fbshipit-source-id: 1f434fb5bc9b7859f763171264fb0b2e1b4bda62
2017-11-15 12:53:55 -08:00
Chad Austin
8b9261f2a1 run clang-format across all C++ files
Summary:
Per discussion with bolinfest, this brings Eden in line with clang-format.

This diff was generated with `find . \( -iname '*.cpp' -o -iname '*.h' \) -exec bash -c "yes | arc lint {}" \;`

Reviewed By: bolinfest

Differential Revision: D6232695

fbshipit-source-id: d54942bf1c69b5b0dcd4df629f1f2d5538c9e28c
2017-11-03 16:02:03 -07:00
Yedidya Feldblum
9d990e6b6e CodeMod: Replace deps on folly:hash with folly/hash:hash
Summary: CodeMod: Replace deps on `folly:hash` with `folly/hash:hash`.

Reviewed By: meyering

Differential Revision: D6225250

fbshipit-source-id: 413cebd7bb7740ca78516ca816b8ac2ea8fd83a3
2017-11-03 01:30:06 -07:00
Yedidya Feldblum
dc496a363e CodeMod: Replace includes of folly/Hash.h with folly/hash/Hash.h
Summary: CodeMod: Replace includes of `folly/Hash.h` with `folly/hash/Hash.h`.

Reviewed By: luciang

Differential Revision: D6156195

fbshipit-source-id: 0941b3c9cf1d17d7cc62595111e506c06ee51236
2017-10-29 14:13:56 -07:00
James Sedgwick
bead588d50 move Iterator, Enumerate, EvictingCacheMap, Foreach, Merge, and
Summary: this is all non-hphp includes that are going in container/

Reviewed By: mzlee, yfeldblum

Differential Revision: D6121745

fbshipit-source-id: b024bde8835fc7f332686793d75eb8e71591c912
2017-10-23 12:30:26 -07:00
Yedidya Feldblum
1560a5bbf3 Revert D6050464: [Folly] Move folly/Hash.h to folly/hash/
Summary:
This reverts commit 64eb65aac8e3e7cd0126e65ca3998bfe167e2d73

bypass-lint

Differential Revision: D6050464

fbshipit-source-id: 1ed63f30837dc11ae57b316f1f7cb233a210894a
2017-10-19 02:35:00 -07:00
Yedidya Feldblum
5866f01d0d Move folly/Hash.h to folly/hash/
Summary: [Folly] Move `folly/Hash.h` to `folly/hash/`.

Reviewed By: jsedgwick

Differential Revision: D6050464

fbshipit-source-id: 64eb65aac8e3e7cd0126e65ca3998bfe167e2d73
2017-10-19 00:51:37 -07:00
Adam Simpkins
e1c54ad0bc add a new IoFuture helper class
Summary:
Add a helper class for waiting on socket I/O using an EventBase and fulfilling
a folly::Future when I/O is ready.

Reviewed By: bolinfest

Differential Revision: D6003899

fbshipit-source-id: ba9c1be425b102066eb585320fee495e4180e776
2017-10-10 15:51:15 -07:00
Adam Simpkins
bf8bf407ce add new ControlMsg helper class
Summary:
Add a new helper class for working with cmsghdr structs.

This updates the PrivHelperConn code to use this new class, and I will also use
this in the upcoming code for implementing graceful mount point takeover on
edenfs restart.

Reviewed By: bolinfest, wez

Differential Revision: D6003897

fbshipit-source-id: 634e9d8f1dc73010c9e9336872cf1270a344bdd2
2017-10-10 15:51:15 -07:00
Jyothsna Konisa
43f27195b6 Modification of unloadChildrenNow
Summary: Modified `TreeInode::unloadChildrenNow` such that inodes are unloaded whose age is greater than a specific age.

Reviewed By: simpkins

Differential Revision: D5526137

fbshipit-source-id: 91e2364d55e31befedcf43d98c26467e1a472ef9
2017-08-18 14:20:43 -07:00
Adam Simpkins
497a2ae765 update hg import tester to help benchmarking
Summary:
This makes several improvements to the hg import tester script:

- If no --edenDir flag is specified, initialize a new temporary directory to
  keep the RocksDB data store.

- Add a `--rocksdb_options_file` flag to allow controlling the options used for
  the RocksDB store.

- Add an --import_type flag to allow explicitly selecting if we should test
  the flat manifest or tree manifest import code.

- Add a --flat_import_file flag, to allow testing a pre-generated flat manifest
  input data file, rather than retrieving the data from mercurial.  This allows
  benchmarking only the C++ import code, and eliminating the python portion of
  the import.  The input file can be generated by running
  `hg_import_helper.py --manifest <revision>`

Reviewed By: wez

Differential Revision: D5541732

fbshipit-source-id: 340af4fea872412248d41453792b2179f0afa466
2017-08-03 18:00:22 -07:00
Adam Simpkins
61cac1cbea add a new UserInfo class for looking up UID/GID info
Summary:
This adds a new UserInfo class to store the UID, GID, as well as the username
and home directory.  This moves the determineUid() and determineGid() functions
from main.cpp into this new class, and makes the logic somewhat smarter now.

In addition to looking up the UID and GID, we now look up the username.  This
information is not used yet, but will be used in an upcoming diff to set
supplementary groups.

This also stores the home directory in the UserInfo class.  The home directory
is usually necessary to find the user's ~/.edenrc file.  Computing it as part
of UserInfo makes the most sense since we will likely have already looked up
the user's passwd entry.

Reviewed By: bolinfest

Differential Revision: D5501252

fbshipit-source-id: 1cb4be9f6c1493de4362da3393034e78bedd9db2
2017-07-27 19:38:59 -07:00
Adam Simpkins
05288c2b98 put PathFuncs.h in their own library rule
Summary:
This updates the eden/fs/utils/TARGETS file so that PathFuncs.h and
PathFuncs.cpp are in their own separate library.  The existing "utils" library
depends on it, but other users can now depend on PathFuncs.h without pulling in
the other code in utils.

I plan to make some of the privhelper code depend on PathFuncs.h in an upcoming
diff, and this makes it so that privhelper will not need to pull in the rest of
the utils code.

Reviewed By: bolinfest

Differential Revision: D5501253

fbshipit-source-id: 804067785ed663e223977d1c84ebcfc28b3f1642
2017-07-27 13:42:45 -07:00
Victor Gao
a477e9663f comment out unused parameters
Summary: This uses `clang-tidy` to comment out unused parameters (in functions, methods and lambdas) in fbcode. Cases that the tool failed to handle are fixed manually.

Reviewed By: igorsugak

Differential Revision: D5454343

fbshipit-source-id: 5dee339b4334e25e963891b519a5aa81fbf627b2
2017-07-21 15:01:05 -07:00
Christopher Dykes
0970c1e12a Merge StringBase.cpp into String.cpp
Summary: It doesn't need to exist anymore

Reviewed By: yfeldblum

Differential Revision: D5318746

fbshipit-source-id: c70b184f4b3fc12ede4632d6b3d43de16ed758c7
2017-06-29 20:20:11 -07:00
Adam Simpkins
429f737816 format eden/fs TARGETS files with autodeps
Summary:
Format all of the TARGETS files under eden/fs with the autodeps tool.

A few rocksdb include statements require comments so that autodeps can
correctly tell which dependency this include comes from.  The rocksdb library's
source file structure unfortunately does not match the layout of how its header
files get installed, so autodeps cannot figure this out automatically.

Reviewed By: wez

Differential Revision: D5316000

fbshipit-source-id: f8163adca79ee4a673440232d6467fb83e56aa10
2017-06-27 21:20:15 -07:00
Adam Simpkins
b0d1e57975 update logging statements to use folly logging APIs
Summary:
Update eden to log via the new folly logging APIs rather than with glog.

This adds a new --logging flag that takes a logging configuration string.
By default we set the log level to INFO for all eden logs, and WARNING for
everything else.  (I suspect we may eventually want to run with some
high-priority debug logs enabled for some or all of eden, but this seems like a
reasonable default to start with.)

Reviewed By: wez

Differential Revision: D5290783

fbshipit-source-id: 14183489c48c96613e2aca0f513bfa82fd9798c7
2017-06-22 13:50:13 -07:00
Andrew Gallagher
03bdaff954 codemod: format TARGETS with buildifier [4/5] (D5092623)
Reviewed By: igorsugak

fbshipit-source-id: 277a9d2bdc1d7e3ff3075bfe2d7307502fd0a507
2017-06-01 17:52:40 -07:00
wurzel parsons-keir
4e7af57e2d open(O_CREAT): supply required third argument on .cpp/.h files
Summary:
It is an error to not provide mode argument when open is
called with O_CREAT.

Reviewed By: oebeling

Differential Revision: D5020517

fbshipit-source-id: 87665ceb16ebdff797f8bf3d33bea082191e3121
2017-05-10 07:51:04 -07:00
Yedidya Feldblum
d5837dca4b Casing consistency for exception_wrapper::throw_exception
Summary: [Folly] Casing consistency for `exception_wrapper::throw_exception`.

Reviewed By: Orvid

Differential Revision: D4944818

fbshipit-source-id: 72056fb24ab6362e9a0319f73b5bbf8c92d658ca
2017-04-27 01:21:04 -07:00
Adam Simpkins
e9af688f90 fix missing space in EXPECT_THROW_* error messages
Summary:
The error messages for various failure cases in EXPECT_THROW_RE() and
EXPECT_THROW_ERRNO() were missing a space after the statement being executed.

Reviewed By: bolinfest

Differential Revision: D4941175

fbshipit-source-id: e10b4bff7db027acc5cc7ad5c12af248d55c7cd8
2017-04-24 18:20:50 -07:00
Adam Simpkins
a6ae3edab9 move eden/utils and eden/fuse into eden/fs
Summary:
This change makes it so that all of the C++ code related to the edenfs daemon
is now contained in the eden/fs subdirectory.

Reviewed By: bolinfest, wez

Differential Revision: D4889053

fbshipit-source-id: d0bd4774cc0bdb5d1d6b6f47d716ecae52391f37
2017-04-14 11:39:02 -07:00