Commit Graph

2167 Commits

Author SHA1 Message Date
Xavier Deguillard
0c4f3b108d revert: Run Eden as a Windows service
Summary:
Wanting to have EdenFS run as a service on Windows cause a couple of issues
on Windows:
 - Needing to log out after installing
 - Forcing Sandcastle to use --foreground, which means the edenfs.log is
   empty, making it impossible to debug anything on Sandcastle,
 - Services can only be started by an elevated user, while the rest of EdenFS
   doesn't have this requirement,
 - Uses undocumented template services

The next diffs in the stack will attempt to solve all of these by starting
EdenFS as a scheduled task instead, which should solve all the above.

Reviewed By: fanzeyi

Differential Revision: D21732280

fbshipit-source-id: b959344da1e77819220d26695ff6634f13ac4e0d
2020-05-28 09:01:03 -07:00
Genevieve Helsel
83079bd6ca use system configs in HgPrefetchTest
Reviewed By: chadaustin

Differential Revision: D21665935

fbshipit-source-id: 31019020769548e01c011d021a39d7e50e288664
2020-05-27 20:19:19 -07:00
Xavier Deguillard
c04037d5aa cli: sys.stdout may be None
Summary:
On Windows, if edenfsctl is started by pythonw, sys.stdout will be None,
check if it is before calling isatty on it.

Reviewed By: fanzeyi

Differential Revision: D21732282

fbshipit-source-id: f0a63094f2c53b026c388f4e5b58433be4397ba9
2020-05-27 11:44:39 -07:00
Xavier Deguillard
f71b9d6381 error: remove unecessary newlines
Summary:
The FormatMessage API isn't very well documented in adding \r\n at the end of
the generated message, and the bit of code that needs to be used to remove
these is not very clear either.

We won't get gratuitous empty lines in the log with this.

Reviewed By: chadaustin

Differential Revision: D21663502

fbshipit-source-id: 203ff5015da6f3cebf7eaee9a8f989db342d096a
2020-05-27 08:53:24 -07:00
TJ Yin
65d6a4d886 Remove thrift setters
Summary:
Thrift setter API is deprecated since it doesn't bring any value over direct assignment. Removing it can reduce build-time and make our codebase more consistent.

If result of `s.set_foo(bar)` is unused, this diff replaces

    s.set_foo(bar);

with

    s.foo_ref() = bar;

Otherwise, it replaces

    s.set_foo(bar)

with

    s.foo_ref().emplace(bar)

Reviewed By: chadaustin

Differential Revision: D21712029

fbshipit-source-id: 3a332b4bf6fac6b3cf396d34e6d5ca4849181a6d
2020-05-26 12:38:37 -07:00
Yedidya Feldblum
ed2c4a65ba Add missing includes of folly/synchronization/Baton.h
Summary: Add missing includes of `folly/synchronization/Baton.h`.

Differential Revision: D21716396

fbshipit-source-id: 8c8fb818f3083b4fe04fd1c62923d7ba698dcedd
2020-05-25 23:13:35 -07:00
Sukwon Chung
abaa62ad33 Handle inaccessible files in redirections in eden du
Summary:
1. Add directory existence checking logic before checking "legacy_bind_mounts_dir"
2. Still print the disk consumption returned by the du command when it fails with an error invoking du -skxc

Reviewed By: chadaustin

Differential Revision: D21683421

fbshipit-source-id: 531b6b289e9ffa445ed691611c9cbf22f393e742
2020-05-21 22:20:17 -07:00
generatedunixname89002005307016
f9358e566a suppress errors in eden - batch 1
Summary:
This diff is auto-generated to upgrade the Pyre version and suppress errors in eden. The upgrade will affect Pyre local configurations in the following directories:
```
eden
```

Differential Revision: D21687853

fbshipit-source-id: baf0d9bc33f86da63ea289690faca6cf4d566588
2020-05-21 19:32:35 -07:00
Zeyi (Rice) Fan
9e87d4da4b check if the file exist locally before pushing to the request queue
Summary: This function won't go ask remote server and is able to produce a result very quick. This avoids the waiting time in the queue.

Reviewed By: chadaustin

Differential Revision: D21586511

fbshipit-source-id: db3793cc4e4e493d1beb6837c0bd91358e7e845f
2020-05-21 16:32:42 -07:00
Zeyi (Rice) Fan
d2facf6118 always use hgcache for data fetching
Summary: Reading from hgcache directly has been rolled out for quite a while now. Let's remove the configuration and make it default behavior.

Reviewed By: chadaustin

Differential Revision: D21585482

fbshipit-source-id: 7f30e262642adf58388a0580aa5a63595fa89155
2020-05-21 16:32:41 -07:00
Chad Austin
e687d9426c fix oss linux build
Summary:
gcc and clang disagree here, so explicitly construct a Future from the
unique_ptr.

Reviewed By: genevievehelsel

Differential Revision: D21687654

fbshipit-source-id: 338174f5d4d051f509faace6e48d1c0fb4d898e1
2020-05-21 12:04:45 -07:00
Genevieve Helsel
f799ca8981 suggest graceful restart in eden doctor version check
Summary: I've updated most messages to suggest a graceful restart, but I overlooked this instance and we got a user question about this. So lets update this message here as well.

Reviewed By: chadaustin

Differential Revision: D21681035

fbshipit-source-id: 32bf5e75b9ad1d98bcd70427101aabeee0be5046
2020-05-21 09:38:58 -07:00
Chad Austin
b653d9cc86 fix gcc compilation issues
Summary: Fix some RVO warnings and a compilation error when compiling with gcc.

Reviewed By: xavierd

Differential Revision: D21481738

fbshipit-source-id: 0621f5886df40c24ef1a6a68ccd957e38f2f4122
2020-05-20 15:49:02 -07:00
Xavier Deguillard
6cdc2782b3 cli: add a startservice.ps1 script
Summary:
This script deals with obtaining the right privilege to start the EdenFS
service. This effectively enables `edenfsctl start`.

Reviewed By: wez

Differential Revision: D21585739

fbshipit-source-id: 7b835434d865fa4c4c8473e13665ae669fd86108
2020-05-19 13:00:54 -07:00
Chad Austin
c2f85710d3 build with Rust datapack support on all platforms
Summary: Now that Rust libraries can be linked into fbcode binaries with mode/mac, enable Rust datapack on all platforms.

Reviewed By: xavierd

Differential Revision: D21241075

fbshipit-source-id: ae2abee25a5ad7b9db9ac5e6b8687c5f79376926
2020-05-19 11:53:51 -07:00
Genevieve Helsel
c8402345af redirect PrivHelper stdin to /dev/null to fully daemonize
Summary: EdenFS doesnt daemonize correctly due to the privhelper not closing fd 0 (see http://www.faqs.org/faqs/unix-faq/programmer/faq/). This redirects stdin to /dev/null/ in order to do so.

Reviewed By: xavierd

Differential Revision: D21602545

fbshipit-source-id: 0aeb589efbf214ef22c0db039fbb6a436a71e360
2020-05-18 10:11:18 -07:00
Adam Simpkins
145320fe96 check in some high-level design documentation for EdenFS
Summary:
This checks in some design documents based on the "EdenFS Internals"
presentation that I've given internally a few times.

Reviewed By: wez

Differential Revision: D21519530

fbshipit-source-id: 3f79d38e8ccf994b2ef303d491809a91fa5b6d95
2020-05-15 18:08:47 -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
b90a9504f0 win: improve getFileSha1 to not trigger a stack overflow
Summary:
In order to build a StringPiece from a C-string, the length of the that
string needs to be known, and a constexp strlen is performed on it. That
strlen is however a recursive one, causing the stack to blow up on big file.

Interestingly enough, this also means that binary files potentially had a
wrong sha1 being computed, potentially causing `hg status` to report some
files as being modified, while they aren't. By switching to using a vector
instead of a string, the intent should of this should be more obvious.

Reviewed By: simpkins

Differential Revision: D21551331

fbshipit-source-id: 2dc1f08d96f49d310593e0e934a03215be2b5cbb
2020-05-13 11:44:30 -07:00
Genevieve Helsel
234383d086 remove version check from redirect fixup
Summary: Nothing should be running with this version, so this check is not needed anymore!

Reviewed By: chadaustin, wez

Differential Revision: D21513269

fbshipit-source-id: 698c9d84e87461cd0484ef997f44dc9169e87a25
2020-05-12 15:43:31 -07:00
Xavier Deguillard
9ffc383307 mount: enable registerStats for Windows
Summary:
While not all stats are supported on Windows, most of them can, let's enable
them. This is a first step in unifying the mount path for Windows and Unices.

Reviewed By: chadaustin

Differential Revision: D21514732

fbshipit-source-id: 00fd89b7499f8ae18c089f98bc18cd43f68538fa
2020-05-12 13:04:27 -07:00
Xavier Deguillard
ea98578570 model: report symlink/executable as regular files on Windows
Summary:
While this isn't the right fix, this is what shipped in our packages, for the
sake of being able to reproduce the package, let's land this as it is. A
future change will remove this ifdef.

Below is pkaush original description:
In Eden Windows we treat all the files as regular files and don't have a
concept of symlinks and executable files. Fixing the TreeEntryType::getType()
to return REGULAR_FILE for executable file and symlink.

Reviewed By: wez

Differential Revision: D20481051

fbshipit-source-id: 0b0c4d7aea28134383ef45aeafc02930b420286b
2020-05-12 08:46:35 -07:00
Genevieve Helsel
12c5a2d221 doctor - fixup redirections
Summary: `eden doctor` should probably fix misconfigured redirections. this is mostly copy pasted from the `eden redirect fixup` command.

Reviewed By: wez

Differential Revision: D21487225

fbshipit-source-id: 69e7fcb446cbc42966cabb6d80ab716533da50a9
2020-05-11 22:13:06 -07:00
Alvaro Leiva Geisse
675b83557e add extra 2 extra type hints for systemd Manager
Summary: add two methods calls as typehints (no real code change).

Reviewed By: zeroxoneb

Differential Revision: D21337646

fbshipit-source-id: 8079883f7f989251965d3308c5374f097023b57a
2020-05-11 20:52:13 -07:00
Jessica Gomes
50022171c9 add uptime field to DaemonInfo
Summary:
- Added uptime field to DaemonInfo thrift struct
- Created startTime member variable in EdenServer
- Made appropriate refactoring changes to EdenMain and EdenServer
- Changed main.py and util.py to use the new uptime value

Reviewed By: genevievehelsel

Differential Revision: D21471140

fbshipit-source-id: 8868de667dfb95de93e3e71b90c0412fb3825388
2020-05-11 11:42:15 -07:00
Xavier Deguillard
1d10a0e1a0 config: add the TomlConfigTest.cpp to CMake
Summary: All the tests are passing.

Reviewed By: wez

Differential Revision: D21319018

fbshipit-source-id: 26335f39d39bdc379c00e65942c2cc7c6853089b
2020-05-09 08:46:36 -07:00
Xavier Deguillard
8220cac785 config: add FileChangeMonitorTest to the CMake build
Summary:
The disabled tests are due to the st_mtime stored in the struct stat only
having a second granularity (as expected), but the tests are changing these
files faster than that, causing them to fail. I'll attempt to fix the file
change detection mechanism on a later diff.

Reviewed By: wez

Differential Revision: D21319025

fbshipit-source-id: a3f2d62a3ce56fea37a62bfad73306ac1556f772
2020-05-09 08:46:35 -07:00
Xavier Deguillard
dd9ec5dffd config: add EdenConfigTest.cpp to CMake
Summary:
Same as the previous one, paths are different on Windows, and thus we need to
test against a different path.

Reviewed By: wez

Differential Revision: D21319021

fbshipit-source-id: 849c86574e69c3f638ea180c3b594aaeae2970ad
2020-05-09 08:46:35 -07:00
Xavier Deguillard
255b6777f9 config: add ConfigSettingTest to CMake
Summary:
The use of realpath is needed to resolve a unix-style path to a Windows style
one. This helps keep the test generic with no `#ifdef _WIN32`

Reviewed By: wez

Differential Revision: D21319019

fbshipit-source-id: b8cdd81f0afdd135849a5b850d854399cef8cef8
2020-05-09 08:46:35 -07:00
Chad Austin
a31f57db1a disable pthread cancellation on the FuseChannel threads
Summary:
In glibc, pthread cancellation support adds two atomic CAS operations
to each "cancellation point" syscall (see pthreads(7)). This includes
read() and write(). We can avoid that overhead by disabling pthread
cancellation at the start of the FUSE worker threads.

This saves two CAS operations (~40 ns) in the critical FUSE request
processing loop.

Reviewed By: simpkins

Differential Revision: D21469690

fbshipit-source-id: 7f28a2a8e831006351657981e901dc572c58cf48
2020-05-08 20:41:50 -07:00
Shannon Zhu
096b35c70b Convert type check targets in eden to use configuration
Summary:
Migrating buck integration to use configurations, which is more performant and is the primary supported way to run Pyre.
Mypy is no longer supported at Facebook, so mypy buck integration is covered in this migration as well.

Configuration target automatically expanded to include all subtargets, expanding type coverage while introducing no more than 2 fixmes per file.

Reviewed By: dkgi

Differential Revision: D21474723

fbshipit-source-id: 2501af8250b4998fe331350b80c9dc8b4ba2dd1a
2020-05-08 15:24:57 -07:00
Chad Austin
0f6e81bbd7 add an eden pid subcommand
Summary:
Sometimes, in shell one-liners, it's convenient to insert the current
eden pid. We print the pid as part of `eden status` (like nginx and
many other daemonizing programs), but that is not useful for shell
substitution. So a pid subcommand that succeeds and prints the pid to
stdout if running and fails if edenfs is not running.

An example use would be `strace -fyp $(eden pid)`

Reviewed By: genevievehelsel

Differential Revision: D21397118

fbshipit-source-id: 06010150557ec882b452180665b84452fa06ebbd
2020-05-08 13:14:38 -07:00
Katie Mancini
5d4975aa02 add help page to eden top
Summary:
The information available in `eden top` is growing and as we add more and
more to eden top, we want to make sure that eden top users can understand
what `eden top` is telling them. Particularly if we want eden end users to be
able to debug themselves, providing them enough context on the
metrics eden top provides is important.

The help page explains what data is included, why this data is helpful and
when this data indicates a concern.

Reviewed By: wez

Differential Revision: D20974262

fbshipit-source-id: caaef70e76d283968bee8533c7c34d63a95c5490
2020-05-08 09:53:06 -07:00
Katie Mancini
fe779826bf add scrolling in eden top
Summary:
this is preperation for adding a help page to eden top (D20974262)

This allows adding a scrollable section to `eden top`. This is particuarly needed
so that the help page is readable when it does not fit all in one screen. This
also allows scrolling the process table on the main page to see all the
processes listed (this is added here).

Reviewed By: chadaustin

Differential Revision: D20974245

fbshipit-source-id: 402409efdc451db32e7a267b0750204f2322dc4f
2020-05-08 09:53:05 -07:00
Katie Mancini
c194bc78be refactor writing to the screen in eden top
Summary:
this is preparation for adding a help page to eden top (D20974262)

This moves all code for writing to the screen to its own class so that
it is not scattered through out the rest of the eden top logic. This is
primarlity so that it is easier to make changes the screen writing logic to
allow scrolling, which is needed so that the full help screen can be read
when it takes up more space than is avaiable.

Reviewed By: chadaustin

Differential Revision: D20965954

fbshipit-source-id: c2690a293579706605d26be9d3bbe491104e6847
2020-05-08 09:53:05 -07:00
Chad Austin
c4db2f39a9 remove some internal uses of the term 'client'
Summary:
Our use of the term "client" to refer to a checkout is
deprecated. Rename some internal functions that use the term client.

Reviewed By: simpkins

Differential Revision: D21395159

fbshipit-source-id: fa96ba593f53b493e5ae816fa686f333a132c232
2020-05-07 22:08:10 -07:00
Adam Simpkins
1cf24c15b5 enable log rotation in edenfs_monitor
Summary:
Add new fields to EdenConfig to control log rotation settings, and update
edenfs_monitor to set up the log rotation strategy using these settings.

Reviewed By: chadaustin

Differential Revision: D20427271

fbshipit-source-id: 9960bdb6f4d077a4e21fb4a6209aa02ab21ad653
2020-05-07 20:05:46 -07:00
Adam Simpkins
603711d314 add log rotation support to edenfs_monitor
Summary:
Update the LogFile class in edenfs_monitor to support log rotation when the
file size exceeds a set limit.

There is a generic API to abstract out the log rotation details.  For now
I have only implemented a relatively straightforward implementation that
appends the current timestamp to the log path, and prunes old log files.

Reviewed By: chadaustin

Differential Revision: D20427310

fbshipit-source-id: f6aefc8f2fe604fdd1d6a72c3d30666612912f41
2020-05-07 20:05:45 -07:00
Chad Austin
1fd889d0f4 short-circuit getxattr security.capability
Summary:
See the comment in FuseChannel.cpp, but it's currently not easy to
avoid the "security.capability" getxattr request for every
write. Since we can't avoid the request, the fastest thing we can do
is branch, strcmp, and fast-path a result on the same thread.

This appears to save three or four microseconds in the 4k random write
benchmark.

Reviewed By: wez

Differential Revision: D21341973

fbshipit-source-id: a23620767f4bdec4daf02ecfe3acb924dd57857a
2020-05-07 19:48:59 -07:00
Xavier Deguillard
97814429bc overlay: check if we're about to save an empty path
Summary:
On Windows, we've had a couple of cases where the overlay is corrupted which
prevent remounting EdenFS. In this case, one entry of a directory was an empty
path. Let's try to catch the error when it happens, instead of after the fact.

Reviewed By: wez

Differential Revision: D21443002

fbshipit-source-id: 47e59aee803cc0b4befd6e0585836d5c68e905b1
2020-05-07 17:56:52 -07:00
Xavier Deguillard
28091f0517 config: add CheckoutConfigTest to CMake build
Summary: They all pass.

Reviewed By: wez

Differential Revision: D21319024

fbshipit-source-id: 1d35490b9361347751b317796fe158635c03caca
2020-05-07 16:38:05 -07:00
Xavier Deguillard
241162beaa config: add CachedParsedFileMonitorTest to CMake build
Summary:
The disabled tests are due to the precision of st_mtime on Windows only being
a second, but the tests are changing the config faster than that.

Reviewed By: wez

Differential Revision: D21319023

fbshipit-source-id: bcdce24f70ce99984cabb290338ac94a2459e9de
2020-05-07 16:38:05 -07:00
Xavier Deguillard
dc0b875615 store: enable more store tests
Summary:
These 3 tests compile without issues on Windows. The RocksDB one is weird,
while it compiles with no hickups, I simply cannot run the resulting test
binary, and I'm not sure how to debug this. The local store one fails in folly.

Reviewed By: chadaustin

Differential Revision: D21393724

fbshipit-source-id: db90bf20a9d116bc8aa493703997c5e8da76eb1f
2020-05-07 10:07:33 -07:00
Xavier Deguillard
a351d8d136 model: add git tests to CMake
Summary: All the tests are passing.

Reviewed By: chadaustin

Differential Revision: D21341730

fbshipit-source-id: 90a3872b190879ec163935ff53703157028f87bc
2020-05-07 10:07:32 -07:00
Xavier Deguillard
e6ac99b269 model: add tests to CMake
Summary:
The modeFromEntryType and treeEntryTypeFromMode tests for symlinks and
executable had to be disabled as these function explicitely do not support
these. Since mode bits are a bit meaningless on Windows, this is probably OK.

Reviewed By: chadaustin

Differential Revision: D21341728

fbshipit-source-id: 86acf24d9ab67a02ecab33b7ebe82a456295fc3c
2020-05-07 10:07:32 -07:00
Xavier Deguillard
eae382e8e9 journal: add tests to CMake
Summary: All of these tests are passing on Windows with no changes.

Reviewed By: chadaustin

Differential Revision: D21341729

fbshipit-source-id: 2b4d52751e74fa953bfe5143dc0c5735de2d34cf
2020-05-07 10:07:31 -07:00
Xavier Deguillard
018da41a93 service: enable several service handlers
Summary:
All of these were simply NOT_IMPLEMENTED on Windows, but the code compiles
and doesn't break any existing tests. The underlying called functions might
have been implemented already, or are NOT_IMPLEMENTED, either way, this reduces
the amount of `#ifdef _WIN32`.

Reviewed By: chadaustin

Differential Revision: D21405622

fbshipit-source-id: bdc2de41d6a57e1c0b532e76eeb2c0c86180d558
2020-05-07 09:52:18 -07:00
Wez Furlong
b29f7a1020 eden: fix compilation on latest vs2017
Summary:
vs2017 is not able to compile the static assertion in KeySpace.cpp.
Previously we thought that this would be resolved in a later release of vs2017
but now that is here it is clear that it hasn't been fixed.

This commit pushes the version requirement to vs2019 (see
https://dev.to/yumetodo/list-of-mscver-and-mscfullver-8nd for a mapping between
product versions and compiler versions), but we cannot build with vs2019
because folly and rangev3 don't compile with vs2019, so this assertion (heh!)
has literally not been tested.

This commit also fixes up an oversight in the gating logic: the intent is that
we perform the assertion on all systems except known broken MSVC.  We were
accidentally restricting it to later versions of MSVC.

Reviewed By: simpkins

Differential Revision: D21432890

fbshipit-source-id: e11ffccc53bf8dffdf2db45ad4f3cf199b1cc70d
2020-05-06 15:05:37 -07:00
Zeyi (Rice) Fan
61f67c044a batch fetch blobs
Summary: Instead of having `HgBackingStore` fetch blobs separately, we now try to read from hgcache and fetch from `HgImporter` as batches.

Reviewed By: chadaustin

Differential Revision: D20903245

fbshipit-source-id: d8e404d6765f1bcbacbf2a39f83eab0a351a3fe0
2020-05-05 20:59:04 -07:00
Zeyi (Rice) Fan
5bf6b58928 clean up HgQueuedBackingStore
Summary: split functions up.

Reviewed By: chadaustin

Differential Revision: D20808045

fbshipit-source-id: 3160566deb763c888a0bf34557d934feccc5ae3b
2020-05-05 20:59:04 -07:00