Commit Graph

56 Commits

Author SHA1 Message Date
Xavier Deguillard
2da5fa967a add .clang-format
Summary:
For a while now, `arc lint` wouldn't properly format the code on Windows, the reason is due to the fact that the default sparse profile doesn't include fbcode/.clang-format.

However, adding this file to the sparse profile wouldn't help as it is a symbolink link to fbsource/tools/clang-format/clang-format.ini, and as we all know, Mercurial will not create symbolic links on Windows, instead a plain file is created and its content is the link destination. The main issue with this is that clang-format simply doesn't understand what this means, and thus fails to format any code :(.

Now, it turns out with recent enough version of Windows (every Windows version we support at FB do support it) being an administrator is not a requirement to create symlinks (D21258136), once this lands. I believe that once this lands, and Mercurial is taught to properly create symlinks on Windows, this change will no longer be necessary and we can revert it. In the short term, let's make our life slightly easier by copying the fbsource clang-format configuration.

Reviewed By: simpkins

Differential Revision: D21258015

fbshipit-source-id: 21b4fda3a28bd397244b0fc9ca730ced775e96f0
2020-04-28 08:42:03 -07:00
Chad Austin
95fdcd29d5 flip EDEN_WIN_NOMONONOKE to EDEN_HAVE_MONONOKE
Summary: Using a positive meaning rather than a double negative makes the build a tad simpler.

Reviewed By: wez

Differential Revision: D17000782

fbshipit-source-id: ef6c7b64708aa9b1f50c7ad4086c492a90c944f4
2019-08-27 17:04:19 -07:00
Chad Austin
fcb10e77de flip EDEN_WIN_NO_RUST_DATAPACK to EDEN_HAVE_RUST_DATAPACK
Summary: Using a positive meaning rather than a double negative makes the build a tad simpler.

Reviewed By: strager

Differential Revision: D17000620

fbshipit-source-id: ff27eb8098786b8ed6ed1ba81166b51e29e62d47
2019-08-27 17:04:19 -07:00
Jon Maltiel Swenson
a56edd2812 Kill legacySubscribe method for establishing streams
Summary:
watchman/eden have been using the new Thrift streaming for nearly a year now and are the last users of the old
Thrift streaming. This diff kills the fallback `legacySubscribe` method, which complete's migration to the new Thrift
streaming and unblocks the complete removal of wangle-based streaming from Thrift and fbcode.

Reviewed By: wez

Differential Revision: D15878892

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

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

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

Reviewed By: strager

Differential Revision: D15428934

fbshipit-source-id: 63f6614595c1aaa08c0d03633c6d1b53ca5bf3d5
2019-06-11 13:08:28 -07:00
Adam Simpkins
e6c07128a4 add a new PeriodicTask helper class
Summary:
Add a new class for running periodic tasks on the main EventBase thread.

We already have several tasks that we run periodically:
- Flushing thread local stats (every 1s)
- Reporting memory stats (every 30s)
- Unloading unused inodes (configurable, but disabled by default)

I plan to add some new periodic tasks soon:
- Report LocalStore stats and perform garbage collection if needed
- Check if the config files have been updated and need to be re-read

This new class should make it easier to add periodic tasks with configurable
intervals, and make the intervals at which they run controllable from the
configuration file.

Reviewed By: strager

Differential Revision: D15492165

fbshipit-source-id: c1d2663da3c08851b60ba64d7a1e38ccca709b8a
2019-05-30 15:11:11 -07:00
Puneet Kaushik
d97ca252b6 Make Tree::getEntryPtr() do a case insensitive lookup on Windows
Summary: getEntryPtr() does a case sensitive lookup because of which few Ovrsource builds were failing. Ovrsource code is including header files with the wrong case.

Reviewed By: strager

Differential Revision: D15344850

fbshipit-source-id: 3d5d658a49cdafc07dc9a18a2f3d2073306e8f40
2019-05-17 11:48:37 -07:00
Andres Suarez
410b7cd112 Text lint all .gitignore files
Reviewed By: scottrice, pallotron

Differential Revision: D15353820

fbshipit-source-id: 74f9eaadc90363a958692259f5cb66cef91ac8ef
2019-05-15 11:35:00 -07:00
Puneet Kaushik
9e24d970a8 Replace EDEN_WIN with _WIN32 for Windows only code
Reviewed By: chadaustin

Differential Revision: D15228464

fbshipit-source-id: 08b30f535fa17a5bcda906e640cc036cd0d59d02
2019-05-09 16:33:08 -07:00
Puneet Kaushik
d991894164 Moving Edenfs's Windows code to eden/fs
Reviewed By: wez

Differential Revision: D15224021

fbshipit-source-id: d046da829a6bceb73c7f05c62a77a0ef9a39e4bc
2019-05-09 16:33:08 -07:00
Adam Simpkins
d824184669 move the ConfigSetting code to its own module
Summary:
Move the `ConfigSetting` template and related classes from `EdenConfig.h` to a
new `ConfigSetting.h` header file.

Reviewed By: chadaustin

Differential Revision: D15162815

fbshipit-source-id: 34fba0b8b0e8e50714f622bae642d20d77050673
2019-05-07 17:41:37 -07:00
Adam Simpkins
b4ca002c0c move the FieldConverter code to its own file
Summary:
Move the `FieldConverter` logic out of EdenConfig.h/cpp and into its own
module.

Reviewed By: chadaustin

Differential Revision: D15162816

fbshipit-source-id: f30d81329139e5827b81a609e83baddf71b6af5e
2019-05-07 17:41:36 -07:00
Adam Simpkins
53496dcdd3 rename ClientConfig to CheckoutConfig
Summary:
Rename the `ClientConfig` class to `CheckoutConfig`, to help further progress
on updating our terminology from "client" to "checkout".

Reviewed By: chadaustin

Differential Revision: D15162814

fbshipit-source-id: 3575958f1161d5842c6f0ee9e2d2d20ab20b7372
2019-05-07 17:41:36 -07:00
Adam Simpkins
51641fffc5 turn ReloadableConfig into an implementation class
Summary:
Move the `ReloadableConfig` implementation out of `ServerState` and into the
`ReloadableConfig` class itself.  This also updates `ServerState` to simply
contain a `ReloadableConfig` member variable rather than inheriting from
`ReloadableConfig`.

This makes it easier to build other utilities that need a `ReloadableConfig`
object but do not have a full `ServerState` object, such as the
`eden_store_util` class and the `zero_blob` helper tool used by the
integration tests.

Reviewed By: chadaustin

Differential Revision: D15162813

fbshipit-source-id: 1ebc0ac6c475f4aa1090dd933ebce16bc222674c
2019-05-07 17:41:36 -07:00
Puneet Kaushik
bfd0882aba Use the original log level instead of extended.
Summary: In the past we used different log level to get more logs. Going back to the original log level. In future, we will be able to set it from the cli.

Reviewed By: chadaustin

Differential Revision: D15159110

fbshipit-source-id: 115718ed667d9896bbd60653f586ae5665598df9
2019-05-02 09:59:40 -07:00
Puneet Kaushik
0ad7318ae3 Parallelize the code to get the file size.
Summary:
Currently we get the file size one after the other - parallelizing it.

Performance numbers:

On my quadcore laptop, there is a 70% improvement when there is a no cache and the trees need to be fetched across the network. There is no real difference when the contents are fetched from the cache.

Before:
Without both hgcache and SQLite cache
PS C:\edenrepos\fbsource25\fbcode\scm> Measure-Command {dir -r}

TotalSeconds      : 356.8000769

Before:
With both hgcache and SQLite cache
PS C:\edenrepos\fbsource25\fbcode\scm> Measure-Command {dir -r}

TotalSeconds      : 3.7510672

After:
Without both hgcache and SQLite cache
PS C:\edenrepos\fbsource26\fbcode\scm> Measure-Command {dir -r}

TotalSeconds      : 104.3658952

After:
With both hgcache and SQLite cache
PS C:\edenrepos\fbsource26\fbcode\scm> Measure-Command {dir -r}

TotalSeconds      : 3.8377893

PS C:\edenrepos\fbsource26\fbcode\scm> Measure-Command {dir -r}

TotalSeconds      : 3.7362488

Reviewed By: chadaustin

Differential Revision: D15151463

fbshipit-source-id: f771281592162471717b971d1b858c5047e886f5
2019-04-30 17:21:26 -07:00
Puneet Kaushik
18f99f1a6c Fetch the correct file size for the directory entries.
Summary: For the POC, we hardcoded file size. Fixing that now.

Reviewed By: chadaustin

Differential Revision: D14711498

fbshipit-source-id: b5c7f3652a37765f93e245e1bc0d892f0a63afb9
2019-04-30 15:20:37 -07:00
Adam Simpkins
982f1da1d8 add a new EdenStateDir class
Summary:
Add a new class to manage access to the .eden state directory, and move some
logic for managing this director from the `EdenServer` class and into this new
class.

This is largely just a first step.  In the future I think we should move
additional functionality into this class.  For instance, logic to determine
the correct local store type and logic to load the checkout map from
config.json.  In the future it probably also make sense to move this class
from the `service` library into a slightly lower-level library (perhaps
`config` or `store`).

Reviewed By: chadaustin

Differential Revision: D14889617

fbshipit-source-id: 15cb7daa9b97500124152d016bfdd686d3039771
2019-04-16 21:17:10 -07:00
Matt Glazar
11195c2b0b Rename ThreadLocalEdenStats to EdenStats
Summary:
I'm confused by the naming of EdenThreadStats and ThreadLocalEdenStats. For example, when I see "ThreadLocalEdenStats", I think that such objects can only be accessed by one thread. That's definitely not what "ThreadLocalEdenStats" means!

I think the following naming scheme makes more sense:

* **EdenThreadStats**: Statistics which are updated by one thread. Currently called EdenThreadStats.
* **EdenStats**: Statistics for all threads. Provides access to EdenThreadStats. Currently called ThreadLocalEdenStats.

Implement my preferred scheme: rename ThreadLocalEdenStats to EdenStats.

This diff should not change behavior.

Note: Prior to D14822274, EdenThreadStats was called EdenStats.

Reviewed By: simpkins

Differential Revision: D14822271

fbshipit-source-id: bd20179b1010588e3fc16dc9ed0657d458606f16
2019-04-14 20:45:16 -07:00
Zeyi Fan
34762da68d use ServiceAddress in curl implementation
Summary: This diff makes `MononokeCurlBackingStore` uses `ServiceAddress` for getting address of Mononoke service.

Reviewed By: chadaustin

Differential Revision: D14864675

fbshipit-source-id: 5c3d5e82a3bd6b55ff722427b3f44d20a3544a1d
2019-04-12 11:22:25 -07:00
Puneet Kaushik
c85ee98e2d Synchronize the access to enum session map.
Summary: The data structure is being modifed from multiple threads and should be synchronized.

Reviewed By: chadaustin

Differential Revision: D14712053

fbshipit-source-id: 25bbd45695895e6d85a6cc0c0d5321f9ef914d3f
2019-04-06 09:34:11 -07:00
Matt Glazar
d9e4eabc9d Move EdenStats into eden/fs/tracing/
Summary:
I want to use EdenStats in eden/fs/store/. EdenStats currently lives in eden/fs/fuse/, and making eden/fs/store/ depend upon eden/fs/fuse/ is confusing. (It's also confusing that some code in eden/fs/fuse/ is used on Windows.)

Reorganize the code: move EdenStats into eden/fs/tracing/.

This diff should not change behavior.

Reviewed By: chadaustin

Differential Revision: D14677337

fbshipit-source-id: af26d214bcc3a9919920fbd4e59e6098fe4e3834
2019-04-01 17:41:57 -07:00
Puneet Kaushik
1315b73a59 Move Handle class inside Eden namespace.
Summary: Somehow, I missed adding the namespace to the Handle class - fixing it now.

Reviewed By: simpkins

Differential Revision: D14545345

fbshipit-source-id: b6bc8ae83703b04399a73dce3dd63a3aceae7331
2019-03-20 21:37:51 -07:00
Puneet Kaushik
4cdb779016 Added UserInfo for Windows
Reviewed By: strager

Differential Revision: D13360664

fbshipit-source-id: b234fc70e8487b1e38b6b0bdceabbd0bdecf5bb4
2019-03-20 14:16:50 -07:00
Puneet Kaushik
6471e739f4 Add Windows version of FileUtils
Reviewed By: strager

Differential Revision: D14205304

fbshipit-source-id: 964e6b5bf4c456d468b9624ab32ef104fa53c3a8
2019-03-18 10:00:32 -07:00
Adam Simpkins
84349add33 rename some of the files related to main()
Summary:
Rename `main.cpp` to `EdenMain.cpp` now that this contains the `EdenMain`
class rather than the top-level `main()` function, and rename `RunServer.cpp`
to `main.cpp`

Reviewed By: pkaush

Differential Revision: D14435306

fbshipit-source-id: e1528a773e0724c6bd50e31f6b33a1762d7bd49e
2019-03-15 18:13:58 -07:00
Adam Simpkins
be2474ee41 restructure main() link dependency ordering
Summary:
This restructures `main.cpp` to turn our current top-level `main()` into a
method of a virtual class.

This allows us to eliminate the slightly awkward way that `main.cpp` depends
on `RunServer.cpp`.  This required us to list `main.cpp` in the sources
parameter of multiple buck targets rules, which confuses some other tools like
autodeps.  With this new change, `RunServer.cpp` depends on `main.cpp` instead
of the other way around.  The real top-level `main()` function now lives in
`RunServer.cpp`

Reviewed By: pkaush

Differential Revision: D14435309

fbshipit-source-id: 402d00db0d8aa8d473d51a4f0e9d9d80c97a0134
2019-03-15 18:13:58 -07:00
Matt Glazar
65f80da385 Add USER_ID variable for config options
Summary:
The systemctl command requires XDG_RUNTIME_DIR to be configured. If it's not configured, 'eden start' should pick a sane default. The sane default includes the user's UID (e.g. /run/user/6986). I want this default to be configurable via Eden's config files.

Expose the ${USER_ID} token to Eden configs. This will let administrators can customize XDG_RUNTIME_DIR's fallback value in the future.

Reviewed By: wez

Differential Revision: D13811732

fbshipit-source-id: 7933e078dd5f2b3bbbb0299730220a129c257256
2019-03-14 18:19:41 -07:00
Puneet Kaushik
e7a40683c8 Created HResultError class and fixed the exception handling.
Reviewed By: strager

Differential Revision: D13289036

fbshipit-source-id: fa34f5a19916c06b11bafb5162dd4e9d9ebe4543
2019-03-12 16:30:44 -07:00
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
Puneet Kaushik
5635cbdf9f Add FaultInjector to Windows builds
Reviewed By: wez

Differential Revision: D14125842

fbshipit-source-id: 7df348f4ff8ee6b7f466876acba4dafa86e5cc61
2019-02-19 10:50:48 -08:00
Puneet Kaushik
de2f0f7d0e Updated scm datapack source code path.
Reviewed By: wez

Differential Revision: D14125840

fbshipit-source-id: 021c517864c7be482713079dffccc479745905e4
2019-02-19 10:50:48 -08:00
Puneet Kaushik
b87be7c7a3 Removed SDL checks to fix Windows build.
Summary: SDL checks generate errors for using negatives with unsigned ints (for ex x = -uint_var), which we have at few places in Folly and Thrift.

Reviewed By: wez

Differential Revision: D14125841

fbshipit-source-id: 3a9dd0fc36ecde4cdd75473c893c5f7adb450740
2019-02-19 10:50:48 -08:00
Puneet Kaushik
abd11a0711 Added MultiProcessorCompilation flag to the Windows build.
Summary: This would use all the available CPUs and speed up the build process.

Reviewed By: strager

Differential Revision: D13563433

fbshipit-source-id: 18b3862ae0c56ae3865c56864b58cf749c844bd4
2019-02-16 10:56:01 -08:00
Adam Simpkins
48c0d2a0b5 include utils/Bug.{h,cpp} in the Windows build
Summary: This is needed to avoid link errors for code that uses `EDEN_BUG()`

Reviewed By: wez

Differential Revision: D13806142

fbshipit-source-id: a5baea17830629e1271351ddd127118789681470
2019-01-24 13:47:41 -08:00
Chad Austin
fe557ace7c only evict when interest handle is dropped if blob wasn't reloaded
Summary:
There was a bug in BlobCache where, if you had an interest handle to a
blob, but that blob was evicted anyway and then something else caused
it to be reloaded, dropping your interest handle would cause the blob
to be incorrectly evicted since the reference counts were no longer
compatible. Add a version to cache items and only decrement the
reference count on an item if the interest handle and item agree.

Reviewed By: strager

Differential Revision: D13405144

fbshipit-source-id: aee052bf777e7225551c3ae2b8b69a99f4f77691
2018-12-10 19:30:28 -08:00
Puneet Kaushik
5c7838bfa8 Cleaning up the test code from main().
Reviewed By: chadaustin

Differential Revision: D13091787

fbshipit-source-id: 37dc67edd1cd2a629ecb07f4eb8ff828b136b1b7
2018-12-04 18:14:48 -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
Puneet Kaushik
6a552975d7 FS Channel to handle ProjFS requests.
Reviewed By: strager

Differential Revision: D13091784

fbshipit-source-id: aa98615b646932815989be9bf9b723d9233bb595
2018-12-04 15:35:29 -08:00
Puneet Kaushik
a3ed73b23d Adding Eden dispatcher on Windows to handle the FS operations.
Reviewed By: strager

Differential Revision: D13091781

fbshipit-source-id: 7b3296713cf5ca0a5731d1dbb13da7457e2fbeaf
2018-12-04 15:35:29 -08:00
Puneet Kaushik
bdf9f292f6 Adding BlobCache to Windows build.
Reviewed By: chadaustin

Differential Revision: D13204546

fbshipit-source-id: f5ed23db5279e913a474ab7e01a16f45f44f5792
2018-11-26 15:46:20 -08:00
Puneet Kaushik
986eed95d8 Adding an abstraction layer on the backing store to handle the Windows path conversion.
Reviewed By: chadaustin

Differential Revision: D13091782

fbshipit-source-id: da96f3b2f9c8bf0f3d518a7bfbf223434766d207
2018-11-26 08:19:47 -08:00
Puneet Kaushik
f257be1f9a Change the Windows pipe functions to not return until all the bytes are read/written or error.
Summary: Change the Windows pipe read and write functions to read/write in a loop. Plus changed the functions prototype to match the POSIX version.

Reviewed By: strager

Differential Revision: D13091785

fbshipit-source-id: 375b22bd9e62d371a78d410f42068945b966a743
2018-11-26 08:19:47 -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
Puneet Kaushik
55c9854125 Add WinError to create Windows error strings.
Reviewed By: strager

Differential Revision: D13091783

fbshipit-source-id: 1ba7ed5b60ede06bbd51eff1af53363d94b26ad3
2018-11-25 09:45:07 -08:00
Puneet Kaushik
f60a60189f Win: Add tracing to Windows builds
Reviewed By: chadaustin

Differential Revision: D12895179

fbshipit-source-id: ac11da16287f4dc73cbb18d05344d5caa66b56f7
2018-11-01 18:35:54 -07:00
Wez Furlong
1751dcad73 load blobs using hg's rust config and datapack code
Summary:
This diff implements getBlob on top of the mercurial rust
datapack code.  It adds a C++ binding on top of the rust code to
make it easier to use and hooks it up in the hg backing store.

Need to figure this out for our opensource and windows builds:

* Need to teach them how to build and link the rust code
* need to add a windows version of the methods that accept paths;
  this is just a matter of adding a WCHAR version of the functions.

Reviewed By: strager

Differential Revision: D10433450

fbshipit-source-id: 45ce34fb9c383ea6018a0ca858581e0fe11ef3b5
2018-10-31 17:58:01 -07:00
Wez Furlong
b43707234c move SerializedBlobMetadata into its own file
Summary:
I want to reuse this outside the LocalStore implementation
in a later diff.  This has no functional changes.

Reviewed By: chadaustin

Differential Revision: D12814792

fbshipit-source-id: 2cc34b449a93afb2e71bd49ed6587009ebf3e419
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
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