Commit Graph

2222 Commits

Author SHA1 Message Date
Katie Mancini
8d32611a23 add data fetch logger
Summary:
We have seen that eden will unexpectedly fetch data, we want to know why.

This adds the plumbing to interact with edens current logging to be able to
log when eden fetches data from the server and what caused eden to do this
fetch. Later changes will use the classes created here to log the cause of data
fetches.

Reviewed By: chadaustin

Differential Revision: D22051013

fbshipit-source-id: 27d377d7057e66f3e7a304cd7004f8aa44f8ba62
2020-06-23 10:02:41 -07:00
Katie Mancini
fdb1af8bc9 add cause info to objectFetchContext
Summary:
Recently the server team added an un-used directory to test that eden would not
fetch these as a test for the upcoming repo merge. They saw that these files
were fetched a non trivial number of times. We want to know why eden is causing
these fetches.

This adds the pid and interface through which the client is interacting with eden to
ObjectFetchContext for this purpose. This information will be logged in later
changes.

note: currently this is only for fetches through Fuse (thrift interface to follow).

Reviewed By: chadaustin

Differential Revision: D22050919

fbshipit-source-id: 49b93257a0e6d910f48b1e8ec6471527e056d22a
2020-06-23 10:02:40 -07:00
Katie Mancini
a0b05b4bf0 thread ObjectFetchContext to backing store
Summary:
This passes ObjectFetchContext into the backing store to prepare for adding
logging for the cause of server fetches.

In following changes I will add logging in the HgQueuedBackingStore.
Ultimately we will want to move this logging to be closer to the data fetching
(in HgDatapackStore and HgImporter), but I plan to temporarily add logging to
the HgQueuedBackingStore to simplify so that we can more quickly roll out.

Reviewed By: chadaustin

Differential Revision: D22022992

fbshipit-source-id: ccb428458cbf7a1e33aaf9be9d0d766c45acedb3
2020-06-23 10:02:40 -07:00
Katie Mancini
480277e328 refactor - move ObjectFetchContext to its own file
Summary:
In following changes I will be threading ObjectFetchContext into the backing
store importing process, since this will start to be used more outside of the
ObjectStore, I am moving this class into its own files.

Reviewed By: chadaustin

Differential Revision: D22022488

fbshipit-source-id: 1a291fea6e0fd56855936962363dfc9f6de8533d
2020-06-23 10:02:40 -07:00
Chad Austin
65e7a01d6f allow async subcmd run functions
Summary: In advance of peppering async everywhere, allow subcmd's run method to be async.

Reviewed By: genevievehelsel

Differential Revision: D21892187

fbshipit-source-id: f611faacf95649d8bb5588aeefc4546bd5f63984
2020-06-22 11:27:11 -07:00
Ailin Zhang
cec1cf648c make ObjectStore manage a PID-fetchCounts map
Summary: This diff adds a PID-fetchCounts map to `ObjectStore` and makes `ObjectStore` update that map after every `didFetch`

Reviewed By: kmancini

Differential Revision: D22100413

fbshipit-source-id: 740342c7b4a453fe482344c2db9542381c3772e4
2020-06-19 21:07:49 -07:00
Xavier Deguillard
51df752a46 cli: support re-mounting a repo on Windows
Summary:
On Windows, we can't rely on the .eden directory to not be present to decide if
the repository is mounted. Instead, we can just let edenfs decide and catch the
exception if it tells us that it's already mounted.

Reviewed By: fanzeyi

Differential Revision: D21934538

fbshipit-source-id: 60ed9f530456b627091f95f7387dc4b8f3a8dc5c
2020-06-19 18:13:20 -07:00
Xavier Deguillard
7862d8fde0 mount: enable unmount
Summary:
All the unification of the mount code lead to this point, where supporting
unmount is merely just removing the various #ifdef.

Reviewed By: fanzeyi

Differential Revision: D21797078

fbshipit-source-id: 7602eb85e3fa276b72daebda36ae269ec38cde66
2020-06-19 18:13:19 -07:00
Xavier Deguillard
4fcdd44819 prjfschannel: add a stop promise
Summary:
On unmount, the code relies on the channel (fuse/prjfs) to set a promise, while
not strictly required on Windows as the interface is synchronous, this will
enable unmount to be the same between on all platforms.

Reviewed By: fanzeyi

Differential Revision: D21797081

fbshipit-source-id: c3eac448d2b13ef49db7a7d1f36bb084130ea63a
2020-06-19 18:13:19 -07:00
Xavier Deguillard
ffb214384d mount: unify channelMount
Summary:
Most of what fuseMount does can be shared between fuse and prjfs, so let's
rename it and start using it on Windows.

Reviewed By: fanzeyi

Differential Revision: D21797079

fbshipit-source-id: b92a36ecc702ee72df8ebdf9534add42bea9b97e
2020-06-19 18:13:19 -07:00
Chad Austin
6d79d2559a fall back on the subprocess telemetry logger when necessary
Summary:
When the scuba telemetry logger is unavailable, fall back on the
subprocess.

Reviewed By: genevievehelsel

Differential Revision: D21687855

fbshipit-source-id: c58a4bc1b34974add35d194c8aafdaac7ed47fdb
2020-06-19 15:15:26 -07:00
Xavier Deguillard
baa6894151 store: reap importer when the importer thread dies
Summary:
On Windows (haven't verified on other platforms), ThreadLocalPtr don't appear
to be releasing resources when a thread die. This means that when the importer
thread dies, the actual importer (hg.real) would still run and use resources,
with no way of talking to it.

To fix this, let's manually reset it when the main thread function returns,
this forces the importer to be destroyed and therefore the various handles to
hg.real to be released, effectively terminating it.

I'm not sure if this is the proper fix, but delving into folly feels a bit
daunting. Keeping a TODO for later to go back to it and fix it properly in
folly.

Reviewed By: chadaustin

Differential Revision: D22012540

fbshipit-source-id: 99f994bb5128b38ccf8474031763b8a21055759a
2020-06-18 20:41:53 -07:00
Zeyi (Rice) Fan
6700fa7d08 adding ObjectFetchContext to lookup
Summary:
This diff makes `lookup` to use `RequestData` as `ObjectFetchContext` in `getattr` calls.

This will make sure we correctly record backing store fetches in `eden top`

Reviewed By: chadaustin

Differential Revision: D21780969

fbshipit-source-id: 468e2fadcebf4a00477bc5de434e6c658b99d1ce
2020-06-18 10:40:41 -07:00
Zeyi (Rice) Fan
b9332b3673 adding ObjectFetchContext to getattr
Summary: This diff teaches `getattr` to accept `ObjectFetchContext` and pass along.

Reviewed By: chadaustin

Differential Revision: D21780970

fbshipit-source-id: 0f4b1295753281420323a3b33ce76af0ff386587
2020-06-18 10:40:41 -07:00
Zeyi (Rice) Fan
ec622e8e1c start to accept ObjectFetchContext to InodeBase::stat()
Summary: This diff makes `InodeBase::stat()` to be able to accept `ObjectFetchContext` as a parameter.

Reviewed By: chadaustin

Differential Revision: D21780883

fbshipit-source-id: 9b1db2e2268cb98663bcf902ea61897da593ea05
2020-06-18 10:40:41 -07:00
Zeyi (Rice) Fan
7c483e1c02 use RequestData as ObjectFetchContext in read()
Summary: This diff starts to use `RequestData` as `ObjectFetchContext` in our `read()` methods. This ensures EdenFS could track backing store fetches happened in FUSE requests.

Reviewed By: chadaustin

Differential Revision: D21792503

fbshipit-source-id: 9509a1bc8f28100a0dfe196e312c4785c7842345
2020-06-18 10:40:41 -07:00
Zeyi (Rice) Fan
ae0d08f884 record backing store import in RequestData
Summary:
Previously we check if a request is a fuse request when we fetch anything from backing store, so we can collect number of fetches happened for each process in eden top.

This is creating a dependency from store to fuse, which is a little awkward. Instead, we could make `RequestData` a `ObjectFetchContext` and record the fetches when that happens.

Similarly in the future we should also have something equivalent in our Thrift layer.

Reviewed By: kmancini

Differential Revision: D21775919

fbshipit-source-id: 95056830ddbe7c999051c43e0d8eca9a67350904
2020-06-18 10:40:40 -07:00
Ailin Zhang
41df657be1 update eden du backing repos printing
Summary:
This diff updated the `eden du` command. Instead of printing
```Reclaim space from the LFS cache directory by running:

hg -R /data/users/akushner/eden-repos/opsfiles gc

Reclaim space from the LFS cache directory by running:

hg -R /data/users/akushner/eden-repos/megarepo_test gc

Reclaim space from the LFS cache directory by running:

hg -R /data/users/akushner/eden-repos/instagram-server_test gc
```
We now print "Reclaim.." only once and put available commands together
```
LFS cache detected in backing repo. To reclaim space from the LFS cache directory, run:

hg -R /data/users/akushner/eden-repos/opsfiles gc
hg -R /data/users/akushner/eden-repos/megarepo_test gc
hg -R /data/users/akushner/eden-repos/instagram-server_test gc
```
and did the same for working copy under backing repositories.

Reviewed By: fanzeyi

Differential Revision: D22038555

fbshipit-source-id: c19869db6f91e90a0627b3bb4b4f7e95142ae198
2020-06-15 11:57:29 -07:00
Ailin Zhang
2c52eed9e4 update eden du summary printing
Summary: This diff fixed small problems in previous `eden du` summary printing and added a reminder of option `--clean` to users.

Reviewed By: fanzeyi

Differential Revision: D22038552

fbshipit-source-id: 7dbac858b74833e59d8d3f1c6fb1f5d8944935d0
2020-06-15 11:40:04 -07:00
Ailin Zhang
ec906443ea print fsck to stdout
Summary: This diff passes a callback function `progressCallback` from `EdenServer` to make `OverlayChekcer` print fsck messages to stdout.

Reviewed By: fanzeyi

Differential Revision: D21966060

fbshipit-source-id: 317b2c8954c718b51b5295c9f8d7698eb203906e
2020-06-12 12:34:55 -07:00
Chad Austin
6185a90dc6 fix warnings on macOS
Summary: Fix a couple warnings in the macOS build.

Reviewed By: genevievehelsel

Differential Revision: D21992085

fbshipit-source-id: 578adb3b95d29177740debbce4dc4626ba9eed64
2020-06-12 10:28:28 -07:00
Genevieve Helsel
ca1da512bf store force restart action as its own flag
Summary: In its current state, FORCE is a restart mode that cannot be combined with other modes (specifically `graceful`). Removing this coupling from `force` will allow us to at first attempt a graceful restart, but if the daemon is not healthy, then do a force restart, all within one call.

Reviewed By: wez

Differential Revision: D21873166

fbshipit-source-id: 079a777ff6e7b219198cbef15335244b9865f5f3
2020-06-11 17:40:51 -07:00
Jun Wu
277933aad8 enable remotenames extension in cpp tests
Summary:
The remotenames extension was enabled everywhere in production. It is
unsupported if remotenames is disabled.

Ideally the cpp tests should use the in-repo configuration instead of
maintaining its own hardcoded hgrc. For now I just did the minimal change to
unblock tests.

Reviewed By: fanzeyi

Differential Revision: D21986274

fbshipit-source-id: b632da074baf4026f331381ae8f2f8479a34e1b3
2020-06-10 22:36:10 -07:00
Zeyi (Rice) Fan
ab26fb2b83 fix eden rage on Windows
Summary:
This diff fixes `eden rage` command on Windows.

`eden doctor` and `eden redirect` related rage items are disabled as they are not implemented on Windows yet.

Reviewed By: chadaustin

Differential Revision: D21962673

fbshipit-source-id: 14399a89c26eead8fe5114e0a3764644ee86a1ed
2020-06-10 19:29:52 -07:00
Chad Austin
a06da8f73c ensure that EdenError messages are always valid UTF-8
Summary:
Some Thrift clients require that values of type `string` must contain
valid UTF-8, and fail to decode otherwise. Ensure that EdenError's
message is always valid UTF-8.

Reviewed By: fanzeyi

Differential Revision: D21890761

fbshipit-source-id: 93b554e0bc6648c685f5fa54612576bd95d95ae5
2020-06-10 19:29:51 -07:00
Chad Austin
ab3b2be7bf add some utf-8 helper functions
Summary:
Add some functions for validating and producing valid UTF-8 to be used
in an upcoming diff.

Reviewed By: fanzeyi

Differential Revision: D21890510

fbshipit-source-id: b25144a34f1df91c72e8ed776b1ee7c1d68344c8
2020-06-10 19:29:51 -07:00
Xavier Deguillard
4b8809c786 win: handle moving files in and out of the repo
Summary:
The documentation for PRJ_NOTIFICATION_FILE_RENAMED points out that the
filenames can be empty strings to represent files moved to and from the
repository itself. By not special casing this we were trying to create and/or
remove an empty file at the root of the repo which would lead to an overlay
corruption.

Reviewed By: genevievehelsel

Differential Revision: D21961579

fbshipit-source-id: fbfd872ca0377cb90224eba5505ff406812d51a7
2020-06-10 19:29:50 -07:00
Ailin Zhang
1b159d58b9 fix __isset deprecated problem
Summary: This diff fixes `'__isset' is deprecated` problem when building `//eden/fs/service:edenfs`

Reviewed By: simpkins

Differential Revision: D21966922

fbshipit-source-id: c3b12134f3f84db0a97f3975dae5d64a2c98641a
2020-06-10 19:29:49 -07:00
Chad Austin
7e4835f677 rename eden.thrift Python module to eden.thrift.legacy
Summary:
The Python 2-and-3 Thrift API is sort of deprecated and does not
handle binary data in `binary` fields. In advance of migrating to the
modern Python 3 API, remane eden.thrift to eden.thrift.legacy.

Reviewed By: fanzeyi

Differential Revision: D21889697

fbshipit-source-id: a745ee8977999acbfb383a4edebe81d8deb1734e
2020-06-10 19:29:42 -07:00
Xavier Deguillard
8822c2bfaf prjfsChannel: do not store the mount path
Summary:
The mount path is required in 2 places: at mount time, and when deleting files.
It turns out that the second one doesn't require it as PrjDeleteFile specify
the filename to be: "A null-terminated Unicode string specifying the path,
relative to the virtualization root, to the file or directory to be deleted."

Thus, we only need it during mount time, so let's pass it to the start method.

Reviewed By: fanzeyi

Differential Revision: D21797080

fbshipit-source-id: 27f5d18841ac077c81ad3f6b3686e20917505c41
2020-06-10 19:29:36 -07:00
Xavier Deguillard
d40d5360b0 prjfschannel: do not do IO in the constructor
Summary:
This will simplify some later diffs where the channel construction doesn't
change any state.

Reviewed By: fanzeyi

Differential Revision: D21797077

fbshipit-source-id: 67d9ee693b067a08986e9bd33f9d91f9a1dadac1
2020-06-10 19:29:36 -07:00
Xavier Deguillard
c5b06ecc0f prjfschannel: remove re-creation of mount directory
Summary: This is already created, no need for re-recreating it.

Reviewed By: fanzeyi

Differential Revision: D21676314

fbshipit-source-id: 8e3eecfb6069f9bed5bfec7ad6631ed8830d796d
2020-06-10 19:29:35 -07:00
Xavier Deguillard
e83578d0b6 prjfschannel: move the static function out of the class
Summary:
These are pure implementation details of ProjectedFs, and don't need to be in
the class, let's move them onto an anonymous namespace in the cpp file.

Reviewed By: chadaustin

Differential Revision: D21676315

fbshipit-source-id: 4fa7088a10256581d7eed2c7cbd90c30a7fef3d2
2020-06-10 19:29:35 -07:00
Xavier Deguillard
7baa3c3bc0 prjfschannel: inline initialize the notification mapping
Summary:
I find this approach to be slighly less error prone due to not having
to manually specify the array size in advance. We lose the field names,
but they should be pretty self explanatory.

Reviewed By: chadaustin

Differential Revision: D21676319

fbshipit-source-id: db4dc993d3dd2a502ae188b08b8d4230939c0415
2020-06-10 19:29:35 -07:00
Xavier Deguillard
3f7a0c519f prjfschannel: use RelativePathPiece instead of wchar_t*
Summary:
This moves the edenToWinPath inside Windows specific files and makes
the interface clear about the kind of path that is expected.

Reviewed By: fanzeyi

Differential Revision: D21676318

fbshipit-source-id: d153bb543da5f481e94f83d52e45c6cc871d1f54
2020-06-10 19:29:34 -07:00
Xavier Deguillard
a29cd80510 mount: remove the need for setFsChannel in tests
Summary:
The only reason tests need to set an FsChannel is for calling
cleanupPrjfsCache. For consistency sake, let's do the same as what we do on
unices: verify if we have a valid channel first.

Reviewed By: wez

Differential Revision: D21676316

fbshipit-source-id: 022ca91d32a7ab047a79acccd7d17dfd7906d527
2020-06-10 19:29:34 -07:00
Xavier Deguillard
d559d2d217 mount: remove most of the ifdef in EdenServer::mount
Summary:
The only missing piece on Windows is the bind mount/redirection due to
folly::Subprocess not being present on Windows.

Reviewed By: wez

Differential Revision: D21676313

fbshipit-source-id: a5ba09be04c94b66edf9d40884753afa3865def2
2020-06-10 19:29:34 -07:00
Xavier Deguillard
1844b98457 mount: rename the various mount/unmount promises
Summary:
We want to use these on Windows too, so let's rename them to not be FUSE
specific.

Reviewed By: wez

Differential Revision: D21676317

fbshipit-source-id: 9f1bde9e0467d8828d4168a69581c8fea54669cd
2020-06-10 19:29:33 -07:00
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
Ailin Zhang
e9e6f94b92 update eden du to display a summary and display warnings with color
Summary: This diff updated `eden du` to display a summary and display warnings and cleaning information with colors.

Reviewed By: kmancini

Differential Revision: D21885051

fbshipit-source-id: be127b81c92bea1051a80715682cdbccf22f22e3
2020-06-10 19:29:26 -07:00
Ailin Zhang
a2a754b6f0 update eden du to display an aggregated result of all mounts.
Summary: This diff updated  `eden du` to display an aggregated result of all mounts instead of showing all details for each mount, as users generally just want to reduce disk usage but don't really care about details.

Reviewed By: genevievehelsel

Differential Revision: D21877178

fbshipit-source-id: dde43e51e96a5c2569c9fe21ab06cc7ea4295866
2020-06-10 19:29:25 -07:00
Zeyi (Rice) Fan
3754c14ec3 batch imports blobs from Rust stores from EdenAPI
Summary:
NOTE: This stack works together, they are separated for easier reviewing. Check D21723465 if you want to read this stack in one place.

This diff finally connects EdenAPI with EdenFS. Previously we only had basic EdenAPI implemented but the performance was not acceptable. This is largely due to overheads in talking with the remote server. Now EdenFS is able to import multiple files at once, we efficiently use EdenAPI to import these data now.

Reviewed By: chadaustin

Differential Revision: D21576569

fbshipit-source-id: a45e832ec63d057730138551393ff7547fa2c22f
2020-06-10 19:29:25 -07:00
Chad Austin
11d569b04d refactor EdenClient construction
Summary:
I am planning to start migrating Eden's CLI to the new Python 3 Thrift
implementation. In preparation, slightly clean up the interface and
implementation of our Python 2 Thrift wrapper.

Reviewed By: genevievehelsel

Differential Revision: D21854539

fbshipit-source-id: d398dd3f324c12288871cf0c9db41e64ed4cf7ed
2020-06-10 19:29:23 -07:00
Xavier Deguillard
16bbe5baa2 win: only inherit the pipe handles
Summary:
The CreateProcess API allows inheritable handles to be available in the spawned
process by passing a flag to it. What the documentation for this API leave to
the imagination is what happens when processes are spawned concurrently in
multiple threads and handles are opened and made inheritable while doing this.
The answer is obvious but the consequences aren't: they are inherited.

When anonymous Pipes are used, one end needs to be inheritable for the spawned
process to being able use it, but if one is created concurrently with spawning
a process, that other process may have an open handle to that unrelated pipe.
And since to detect that a pipe is closed, all handles to the other end needs
to be closed, this can lead to never being able to detect that it is closed...

This scenario is exactly what is happening in eden when spawning the Mercurial
process, and when one of these processes would die, eden would just hang trying
to write to the pipe, not knowing that the process was already gone. To unblock
eden, all the hg.real processes had to be killed, as this would close all the
pipe handles, and then eden would detect that the pipe was closed and re-spawn
Mercurial (only for the exact same thing to happen).

In order to fix this, we need to tell CreateProcess to only inherit the pipes
handles, and nothing else.

Reviewed By: wez

Differential Revision: D21895537

fbshipit-source-id: 3c84a1d0316b50b5750f554fa20f72f59a718882
2020-06-10 19:29:18 -07:00
Chad Austin
e2d26877d6 enable py3 thrift language
Summary:
The old `py` Thrift language support doesn't correctly handle string
vs. bytes, which causes an exception to be thrown when deserializing
paths or blobs that aren't UTF-8.

We will eventually want to migrate to the py3 language implementation,
which supports streaming.

Reviewed By: genevievehelsel

Differential Revision: D21693082

fbshipit-source-id: 0ea10fd3960f5acba353bccb83b5cf539e7eeffb
2020-06-10 19:29:17 -07:00
Xavier Deguillard
93ad242d60 packaging: use scheduled tasks
Summary:
In order to start EdenFS automatically at boot, a template service was used
previously, but due to several issues, we decided to move away from it.
Thankfully microsoft supports several other ways of starting tasks at startup,
one of which is the "Task Scheduler" itself.

One of the weird part of the task scheduler is that there isn't a good way
to tell it to not show a console for a non-graphical application, and thus
plainly executing edenfsctl start in it would create a cmd window, which
would then disappear a couple of seconds later. To avoid this, a "graphical"
version of Python is used (pythonw.exe) to start edenfsctl.

Reviewed By: fanzeyi

Differential Revision: D21732281

fbshipit-source-id: 87ef3a2d5569302392bd30a4b9e7fc48807ee316
2020-06-10 19:29:15 -07:00
Katie Mancini
137b6d984f add OS release version to eden rage
Summary:
When I was debugging the multithreaded bug issue it came up that the issue would
only affect certain versions of macos. There may be other bugs that come up
affecting only certain os versions. Having the os version in eden rage could be
helpful to identify such issues.

Reviewed By: chadaustin

Differential Revision: D21776154

fbshipit-source-id: a493e7da1823075ca4a845bd73b21716ce884911
2020-06-10 19:29:14 -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
Ailin Zhang
c44c95441f update eden du to look at all mounts by default
Summary: This diff made `eden du` able to run under any directory and gives statistics for every EdenFS mount on disk by default.

Reviewed By: fanzeyi

Differential Revision: D21846894

fbshipit-source-id: 2d421db8a4a0202419aa7a41e620d92f6ebdea2e
2020-06-02 21:12:27 -07:00