Commit Graph

232 Commits

Author SHA1 Message Date
Xavier Deguillard
e28113b695 mount: move setFsChannel
Summary:
This moves it out of EdenServer and into EdenMount directly. This is closer
to what is happening in the Linux code and thus better.

Reviewed By: fanzeyi

Differential Revision: D21663501

fbshipit-source-id: 84420fcb37586cc2695568f0167b39f91c9bfb63
2020-06-10 19:29:33 -07:00
Xavier Deguillard
74404f1b41 mount: unify EdenMount::start
Summary:
Instead of having 2 different functions for Windows and other unices, let's
only have one. This allows more of the mount code to be shared between both.

Reviewed By: wez

Differential Revision: D21517477

fbshipit-source-id: 185ce864aecdf9a7880a9c705df444ec1e39319a
2020-06-10 19:29:32 -07:00
Genevieve Helsel
2dba19bf43 refactor eden stop during graceful takeover request to remove usage of some thrift functions
Summary: The thrift team is looking to retire `stopWorkers()` and `stopListening()`, so this refactors our code to stop using both of those methods.

Differential Revision: D21851442

fbshipit-source-id: 6d63d435cbd4a51c855bf71a3b2165e35431a4d7
2020-06-03 20:07:29 -07:00
Xavier Deguillard
3f0dcccd42 mount: unify EdenMount::initialize
Summary:
Next step in unifying the mount path, let's make the initialize the same in
Windows and unices. The only difference is now limited to the .eden directory
which we will be able to implement once regular users can create symlinks.

For the takeover code, the #ifdef is pushed down to the actual code that does
it, this allows the rest of the code to not have to bother about Windows vs
other platforms.

Reviewed By: wez

Differential Revision: D21517478

fbshipit-source-id: d40ca2694d23031ff98e319071e610efa306008f
2020-05-15 13:14:55 -07:00
Xavier Deguillard
6d726d574a inodes: enable RemoveTest for Windows
Summary:
Fairly straightforward, one change to the test was necessary as reading an
unlinked file cannot be done on Windows.

Reviewed By: wez

Differential Revision: D21312681

fbshipit-source-id: c8cca5eeca7825983176ef618007c514b8e02140
2020-05-05 18:14:54 -07:00
Xavier Deguillard
6d4a55a3ea win: change the argument order for writeFile
Summary:
This brings it closer to folly::writeFile which should help in avoiding ifdef
whenever we want to use it.

Reviewed By: wez

Differential Revision: D21319020

fbshipit-source-id: 80fbf7fba671b18b5ef68375910e1a2a8869f590
2020-05-05 18:14:54 -07:00
Adam Simpkins
129d87fe23 use the normal PrivHelper.h header file on Windows
Summary:
While EdenFS does not use a separate privhelper process on Windows, it still
defines a stub PrivHelper class.  However, this class was previously defined
in a separate win/utils/Stub.h header file, which led to awkward `#ifdef`s to
include the correct platform-specific header file.

This diff moves the definition of the dummy PrivHelper class in Windows into
the same `PrivHelper.h` header file used on POSIX platforms.  This results in
a few more `ifdef`s in the PrivHelper files, but fewer `ifdef`s in the calling
code, and will make it easier to start unifying more of the `EdenMain` logic
on Windows and non-Windows platforms.

Reviewed By: xavierd

Differential Revision: D21332568

fbshipit-source-id: c63bf2b4a8b7e767d7db7dcda28675f735c23bf8
2020-05-01 14:01:40 -07:00
Adam Simpkins
c55781c666 move UserInfo to eden/fs/utils/
Summary:
Move the `UserInfo` code from `fuse/privhelper` to `utils`, and also unify the
POSIX and Windows implementations of this class.

This code was originally put in the `fuse/privhelper` directory since it was
written at the same time as the privhelper.  However, it's really a
lower-level library that doesn't depend on FUSE or any of the other code in
the `fuse/` subdirectory.

Reviewed By: wez

Differential Revision: D21296594

fbshipit-source-id: f58682f6ce86bba0328472c491bb4c0dc3370319
2020-04-29 17:21:12 -07:00
Adam Simpkins
f04f0388d9 enable the fs/utils tests in the Windows build
Summary:
Enable the unit tests under eden/fs/utils on Windows.

This does comment out a few tests related to `AbsolutePath` that are broken on
Windows.  The AbsolutePath constructor does not enforce that the input path is
actually absolute.  Additionally the `canonicalPath()` function ends up doing
weird things and returning paths that start with `/` followed by a drive
letter (e.g., `/C:/foo`).  These issues should ideally be addressed in
subsequent diffs.

Reviewed By: xavierd

Differential Revision: D21239886

fbshipit-source-id: ef08d62353ba83b96d9fd79bd4636f4a0f961373
2020-04-29 11:04:21 -07:00
Wez Furlong
28706ca81b eden: implement getFileInformation on windows
Summary:
The operation originally wanted to operate on the fuse `Attr`
structure which we don't have on Windows, so I repurposed the
`InodeBase::getattr` into `InodeBase::stat` and moved the conversion
of `struct stat` to `Dispatcher::Attr` to the `EdenDispatcher::getattr`
method (and a couple of other adhoc places that were doing a similar
conversion).

Reviewed By: chadaustin

Differential Revision: D20562459

fbshipit-source-id: 6b538110038352e9b5590fcb5ff5c33fe84ac1d8
2020-04-28 22:10:15 -07:00
Chad Austin
61e738cd84 use enumValue instead of static_cast<int>
Summary:
Where appropriate, replace uses of `static_cast<int>` with
`enumValue`.

Reviewed By: simpkins

Differential Revision: D20975196

fbshipit-source-id: 581643366ea7eda5d1961238b0693cf45c4eec94
2020-04-28 18:59:34 -07:00
Xavier Deguillard
ad570291e4 enable the checkout tests on Windows
Summary:
While I had to disable a bunch of them at first, this allow them to compile
properly and run. Future diffs will attempt to enable the disabled ones.

Reviewed By: pkaush

Differential Revision: D21188118

fbshipit-source-id: 154fec49c76563b0856fa36e78b2bbd09f0f2381
2020-04-26 21:14:24 -07:00
Puneet Kaushik
4f3b625825 Build the merged TestMounts on Windows
Summary: Now we are building the merged EdenMount on Windows, so we can also start using the new TestMount code.

Reviewed By: simpkins

Differential Revision: D20966556

fbshipit-source-id: a726b13250d6c29872349e1a2f562c719420f3f1
2020-04-24 12:46:17 -07:00
Puneet Kaushik
ca84d255e8 Merge Windows and POSIX version of TestMounts
Summary: This diff is merging the Windows version of MountTest with the POSIX version. The merged MountTest is build and tested later in this stack with the Merged EdenMount.

Reviewed By: simpkins

Differential Revision: D20480864

fbshipit-source-id: 65e9402f1b03c81166835a6a605053a1bf011ddc
2020-04-23 12:41:48 -07:00
Wez Furlong
0a6aa21d77 eden: fix multiply defined symbols issue with ImportPriority
Summary:
This is a rough pass that resolves a linker issue on MSVC by
switching to inline static member functions.

Reviewed By: chadaustin

Differential Revision: D20529163

fbshipit-source-id: 578ed440758c685091d3e039e261638e027db17a
2020-03-20 10:56:08 -07:00
Zeyi (Rice) Fan
fff1c76996 make open calls from fuse high priority
Summary: This diff bumps the open call from FUSE to High priority (which is higher than any other blob open request atm). This has shown improvement on the user experience of EdenFS when it's importing many other things from other channels (thrift, etc.)

Reviewed By: chadaustin

Differential Revision: D20287389

fbshipit-source-id: 319bc44ef8be5c904d7cf0db7cc2f8be28b4760a
2020-03-17 02:31:25 -07:00
Zeyi (Rice) Fan
2da686d315 add priority to BackingStore interface
Summary: This diff adds `Priority` added in the previous diff to the `BackingStore` interface with the default value set to `Priority::Normal`.

Reviewed By: chadaustin

Differential Revision: D20197071

fbshipit-source-id: a92f1b49bb82e3478042e5e3b79b047d834755ea
2020-03-17 02:31:23 -07:00
Ratnadeep Joshi
8e4b04107c Add an option to mount a checkout read-only
Summary: Added option to mount command

Reviewed By: chadaustin

Differential Revision: D20256352

fbshipit-source-id: e52fbd10f318221777b7e2d21ed9ba0a17ce1687
2020-03-11 21:38:48 -07:00
Lee Howes
f15fdeec84 collectX to collectUnsafe
Summary:
Migration from Future-returning executor-erasing collectX forms to
SemiFuture-returning forms, that are less risky in particular with coroutines.

Earlier diffs added SemiFuture and Unsafe versions. This codemod migrates
collect versions to the Unsafe versions to allow the basic collect versions to
be made safe.

Reviewed By: simpkins

Differential Revision: D20331206

fbshipit-source-id: efc8dff487d45f7d53ee55e8c4696bd3eed0e6da
2020-03-10 11:36:09 -07:00
Chad Austin
fc07c3b6e6 add an ObjectFetchContext interface
Summary:
Add a fetch context interface to ObjectStore that allows tracing cache
hits, backing store fetches, and fetch durations in the context of a
diff or checkout operation.

Reviewed By: simpkins

Differential Revision: D19135625

fbshipit-source-id: d0d8f134b1c89f7ba4971a404a46a69a1704ba5c
2020-02-05 13:15:01 -08:00
Chad Austin
daaeb5012a replace some uses of memset
Summary: Easier to zero initialize structs with braces, which defines that even padding is zeroed.

Reviewed By: wez

Differential Revision: D19655675

fbshipit-source-id: 2fd12383324029646707e93008cf9ad34e9f1dce
2020-01-31 10:50:48 -08:00
Zeyi (Rice) Fan
071a3682fd eden: semi-futurify BackingStore::getTree
Summary: D18669664

Reviewed By: chadaustin

Differential Revision: D18670157

fbshipit-source-id: 74c8c3e2fae16973079e5d3d3bc2fe18adf088a7
2019-12-20 16:14:22 -08:00
Zeyi (Rice) Fan
99c2a6ca2e eden: semi-futurify BackingStore::getTreeForCommit
Summary: Same as D18669664.

Reviewed By: chadaustin

Differential Revision: D18669966

fbshipit-source-id: 54974528259a91f8f222bd60e897d28f41675351
2019-12-20 16:14:22 -08:00
Zeyi (Rice) Fan
aeaa26c274 eden: semi-futurify BackingStore::getTreeForManifest
Summary: see D19107687

Reviewed By: genevievehelsel

Differential Revision: D19107687

fbshipit-source-id: 652084ad0e64884d6273a4206d26d572915e3a51
2019-12-20 16:14:22 -08:00
Zeyi (Rice) Fan
068ff196bd eden: SemiFuture-ify BackingStore::getBlob
Summary:
This diff turns the return type of `BackingStore::getBlob` from `folly::Future` into `folly::SemiFuture` to prevent executor leaks.

This also enable us to remove the need of holding `serverThreadPool` from backing stores.

----

**Changes**

* `ObjectStore` now needs to hold a `folly::Executor::KeepAlive` that is used to turn `SemiFuture`s it gets from backing stores into `Future`.
* Signature changes of the implementations of `BackingStore` class.
* For tests, I chose to use `QueuedImmediateExecutor` in place of `UnboundedQueueExecutor` as it will basically execute tasks inline. I'm concerned introducing thread pool executor in tests may turn tests flaky.

Reviewed By: wez

Differential Revision: D18669664

fbshipit-source-id: 0cae89f365dcf8b345b49d64469a530cf25d4ac5
2019-12-20 16:14:21 -08:00
Chad Austin
844b569d2a make EdenMount::getRootTree return a future
Summary:
EdenMount offered both getRootTree and getRootTreeFuture. Replace the
former with the latter and adjust remaining callers.

Reviewed By: genevievehelsel

Differential Revision: D18666585

fbshipit-source-id: 961361a1fb545e48db0ece970bb5e6ffbca8efef
2019-12-20 16:14:18 -08:00
Chad Austin
b75b10bc33 kill ObjectStore::getBlobMetadata
Summary:
The last remaining user of ObjectStore::getBlobMetadata was a debug
Thrift call. Remove it and update the Thrift call to use getBlobSize
and getBlobSha1.

Reviewed By: pkaush

Differential Revision: D18663376

fbshipit-source-id: 86baefc9004a07aac4ddf5849870431be04c75f2
2019-12-20 16:14:18 -08:00
Puneet Kaushik
4c720d12c1 hg status tests for Eden Windows
Summary: This diff contains the tests for hg status. This is not comprehensive list of tests but the tests that we have working at this time. More tests will be added as we test and fix issues.

Reviewed By: simpkins

Differential Revision: D18454851

fbshipit-source-id: 80e3ff4d24873016dc420f202fbfe53fcffc24f2
2019-12-10 14:07:26 -08:00
Genevieve Helsel
504a255355 add getTreeForManifest
Summary: Adds a function which takes both the manifestID and the commitID to get a Tree. This will be used in `checkOutRevision()` and this allows us to skip looking up the manifestID since the caller can just pass it in themselves.

Reviewed By: wez

Differential Revision: D18719405

fbshipit-source-id: 919f0a7c84bff4a2f0bc20110c45bd272f9e9107
2019-12-09 16:25:27 -08:00
Genevieve Helsel
c8bdf32bc9 introduce EdenMount::loadFileContentsFromPath
Summary: Adds a helper function that can take a path to an Inode and load a file by simply getting the Inode then calling the existing `loadFile()` function

Reviewed By: simpkins

Differential Revision: D18647090

fbshipit-source-id: 89c25bef10a7a0d0ffd660293f85479ac0e9f9a9
2019-12-09 11:33:23 -08:00
Chad Austin
987dd994b6 add a StructuredLogger instance to ServerState
Summary:
Allocate and hook up a StructuredLogger at startup if the EdenConfig
has the appropriate values set.

Reviewed By: simpkins

Differential Revision: D18071821

fbshipit-source-id: 3996b6644bbf0c16bb3b9950d57a79d4619a1656
2019-11-13 15:23:38 -08:00
Genevieve Helsel
d8445bae2c save version number in EdenServer
Summary:
This saves the version number (like 20191014-154333) in the EdenServer. This will be returned to the user in a getScmStatusV2 call later up the stack. This is useful for being able to warn the user if EdenFS is running on an old or known-bad version.

I ended up splitting up `getEdenfsVersion()` and `getEdenfsBuildName()` because I don't think we need to store "edenfs " with every version number in the server / return this from the thrift call of `getScmStatusV2()`. Not sure of the use case of having "edenfs " prepended to the version number returned from the current `getEdenfsBuildName()` so didn't want to change that, but if it seems fine we could remove that prepended edenfs (or if it actually makes sense to return the string with that prepended from the ScmStatus call).

Reviewed By: chadaustin

Differential Revision: D17919528

fbshipit-source-id: 5abdf7851371c4614da862657350a8cc263eb014
2019-10-24 12:48:33 -07:00
Chad Austin
2055da77d0 fix lock ordering issues in eden tests
Summary: Fix Eden's inode tests under TSAN by fixing some lock order violations.

Reviewed By: wez

Differential Revision: D18050868

fbshipit-source-id: bdc4f47f6fcc3b714bd9d6b29364c2f43f899f0f
2019-10-22 10:39:13 -07:00
Joseph Friesen
921cc9d8a8 Merge TreeInode::create/mknod
Summary:
Refactor code to make Dispatch::create call TreeInode::mknod
and remove TreeInode::mknod, as it's redundant

Reviewed By: chadaustin

Differential Revision: D18002213

fbshipit-source-id: d0c73bbd6182226de54a49ef69b63b8fe7a8f9ee
2019-10-18 13:25:46 -07:00
Chad Austin
250c1b77cc remove the dead FileHandle class
Summary:
When we implemented FUSE_NO_OPEN_SUPPORT and FUSE_NO_OPENDIR_SUPPORT,
we forgot to remove the FileHandle and FileHandleBase code.

Reviewed By: pkaush

Differential Revision: D17991710

fbshipit-source-id: dfeb26d512f017cef7710929ccff1f6940cf8641
2019-10-18 12:17:43 -07:00
Genevieve Helsel
0370fab739 refactor fault injection in unit tests
Summary: refactor current test to enable fault injector for TestMount and remove DECLARE in c++ file.

Reviewed By: chadaustin

Differential Revision: D17882339

fbshipit-source-id: 719fcf082a9a1d1ea7a1fadc561b6f368f1ccdff
2019-10-16 09:13:35 -07:00
Chad Austin
4b47257165 remove EdenConfig accessors
Summary:
Instead of having accessors for every config setting in EdenConfig,
just expose the ConfigSettings directly.

Reviewed By: fanzeyi

Differential Revision: D17847805

fbshipit-source-id: 8c6c1010c010113cf859677449797ea916f2a2a5
2019-10-11 17:55:19 -07:00
Chad Austin
8cac2bfe6a Remove dead includes in eden
Reviewed By: wez

Differential Revision: D17877514

fbshipit-source-id: e7f8ed8364bdb7a77f293cbdf4b48e8f15e64c30
2019-10-11 16:45:01 -07:00
Andres Suarez
fbdb46f5cb Tidy up license headers
Reviewed By: chadaustin

Differential Revision: D17872966

fbshipit-source-id: cd60a364a2146f0dadbeca693b1d4a5d7c97ff63
2019-10-11 05:28:23 -07:00
Wez Furlong
3dc580b35e eden: thread configuration through to fuse timeout handling
Summary:
This diff adds a fuse request timeout configuration setting
and threads it through to both the FuseChannel for our internal processing
and to the privhelper so that we can set an appropriate (slightly larger)
value for the kernel level daemon_timeout setting.

Reviewed By: chadaustin

Differential Revision: D16957552

fbshipit-source-id: a0fecc691d72914b5aebaed8a006dc0d6b0d7d12
2019-08-28 09:41:54 -07:00
Jake Crouch
c6253c48e0 Set up keeping track of "global" Journal Stats in EdenStats
Summary: Set up the infrastructure to add in Timeseries to the journal so that we can add in stats for the journal that relate to the whole process. For example, allow us to add in a truncatedRead TimeSeries easily as done in D16017968

Reviewed By: chadaustin

Differential Revision: D16461081

fbshipit-source-id: 964ff32e62aed0369da434793491b857c136b074
2019-07-25 23:36:43 -07:00
Chad Austin
ae35e76c9c add a getDaemonInfo() thrift method
Summary:
Open source fb303 will not have getPid() or getCommandLine(), so
introduce a new method for Eden's tests.

Reviewed By: fanzeyi

Differential Revision: D16292993

fbshipit-source-id: 5cdc006ec0ee15f50a3e1cebe9b46a3ea275ff78
2019-07-17 13:47:02 -07:00
Brian Strauch
3986ddb614 ObjectStore stats
Summary: Added the cli command `eden stats object-store` for querying the counts on what part of the object store was responsible for finding the blob or blob size (local store or backing store). This will tell us how well local and in-memory caching works for different workflows.

Reviewed By: chadaustin

Differential Revision: D15934535

fbshipit-source-id: 70345f11a51c3c6996dc001d4101744395a3d182
2019-07-01 12:49:57 -07:00
Wez Furlong
f5d9a06dc9 eden: add thrift calls for adding/removing bind mounts
Summary:
These allow the cli to setup and tear down mounts and
have the eden server keep track of them.

Reviewed By: strager

Differential Revision: D15707318

fbshipit-source-id: abdb8eaa28c8c67c8211a8af1647efe3a083e998
2019-06-25 18:42:37 -07:00
Adam Simpkins
4bc8682391 update license headers in CMake files
Summary:
Update the copyright & license headers in CMake files to reflect the
relicensing to GPLv2

Reviewed By: wez

Differential Revision: D15487079

fbshipit-source-id: 715e559464c19a0070d6e55a095b3fc7d61ad2f8
2019-06-19 17:02:46 -07:00
Adam Simpkins
aa5e6c7295 update license headers in C++ files
Summary:
Update the copyright & license headers in C++ files to reflect the
relicensing to GPLv2

Reviewed By: wez

Differential Revision: D15487078

fbshipit-source-id: 19f24c933a64ecad0d3a692d0f8d2a38b4194b1d
2019-06-19 17:02:45 -07:00
Adam Simpkins
897764d81c move the ConfigSource enum to a thrift file
Summary:
Move the ConfigSource enum definition to a thrift file.  This will let us
return ConfigSource values over thrift APIs in the future.  This also allows
us to use thrift's `TEnumTraits` functionality to determine the maximum enum
value, rather than having to maintain a separate `kConfigSourceLastIndex`
variable.

As part of this change I also renamed the enum values to be CamelCase to match
our current C++ style recommendations and to avoid possibly conflicting with
macros defined in other headers (`DEFAULT` seemed particularly susceptible to
collision).

Reviewed By: strager

Differential Revision: D15572120

fbshipit-source-id: 8fbd03da221a9f75ef670dee1eb250eb198a5bd0
2019-06-05 11:50:37 -07:00
Brian Strauch
5380c70c14 Removed getInodeBlocking and replaced with Future version
Summary: Developers should be encouraged to use Future-based functions instead of blocking functions in production code. Removing this blocking function makes it less convenient for developers to write blocking code in the future.

Reviewed By: strager

Differential Revision: D15564952

fbshipit-source-id: 3f62db472a59a6487ffe12e48c04178cad84ca61
2019-05-31 18:21:15 -07:00
Adam Simpkins
67cd4bbf45 add a TestServer class
Summary:
Add a helper class for creating an EdenServer in a unit test.

Most of our existing unit tests only create EdenMount objects, without a full
EdenServer.  This new class will make it easier to write tests for
functionality that does require a full EdenServer object.

Reviewed By: chadaustin

Differential Revision: D15492166

fbshipit-source-id: f8b1ce3b78a1160a5d55d305e6bf4b5305cca509
2019-05-28 21:39:39 -07:00
Chad Austin
69d99f5bfc default test repos to treemanifest
Summary:
Some of our tests create Mercurial repositories with default settings
which means they don't support treemanifest. Flip treemanifest on for
them.

Reviewed By: wez

Differential Revision: D15302347

fbshipit-source-id: 34f98b88976b5de1bf2ad07c5272e217e3fe3b0a
2019-05-22 15:57:57 -07:00