Commit Graph

1944 Commits

Author SHA1 Message Date
Chad Austin
e9c0426e53 add read-only support on macOS
Summary:
Plumb the read-only mount flag into FUSE on macOS. This fixes a build
warning and enables the --read-only mount flag.

Reviewed By: wez

Differential Revision: D20634119

fbshipit-source-id: a5e68cd163e36ceb6d86fd753844718ee9a5727f
2020-03-24 18:58:29 -07:00
Ratnadeep Joshi
17fd33424d Move py/ directory from eden/ to eden/fs
Summary: [edenfs] Move py/ directory from eden/ to eden/fs

Reviewed By: simpkins

Differential Revision: D20479925

fbshipit-source-id: 36abf7fe208c283f01c9bf415e2fcb1a8f4bdbae
2020-03-24 11:45:37 -07:00
Chad Austin
68aa376681 switch getFileInformation to semifuture
Summary:
Instead of explicitly running results on the Thrift thread manager
executor, use the semifuture implementation of the Thrift method which
does the same thing automatically.

Reviewed By: fanzeyi

Differential Revision: D20481540

fbshipit-source-id: 5f23c0193514fce20d80e3292bfa7402f4448e38
2020-03-23 19:38:03 -07:00
Wez Furlong
0be26944f7 eden: fix some unreferenced variable warnings on Windows
Summary: the exception object is unused in each of these catch blocks.

Reviewed By: chadaustin

Differential Revision: D20562251

fbshipit-source-id: 12502429e47f5603b73cfc88b10dda0db5daeb93
2020-03-20 14:00:33 -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
Wez Furlong
9972789892 eden: make bitfield usage in DirEntry.h more portable
Summary:
the type of `mode_t` that we were using for this on Windows
recently changed in the folly portability layer, resulting in a padding/alignment
problem that breaks our assumption at the size of this struct.

I don't believe that we were using bitfields correctly here; in my experience
all of the members must have the same type in order to get packed in the
struct correctly, because the standard doesn't define much in the way
of bitfield behavior beyond the syntax.

This commit uses an unsigned integer type for all of the bitfields
and takes a stab at using a cast when returning the actual mode
member for macOS.  This may not be right; I'm just throwing up this
diff first in order to be able to get it on a mac machine.

Reviewed By: simpkins

Differential Revision: D20529006

fbshipit-source-id: e9362bf263fab03d51cc8aa97f94f00806650618
2020-03-20 10:56:07 -07:00
Pádraig Brady
2fc5cacddc mononoke: adjust test to newer curl error code
Summary:
s/CURLE_SSL_CONNECT_ERROR/CURLE_RECV_ERROR/.
Note CURLE_SSL_CONNECT_ERROR is not explicitly checked in
code in the eden hierarchy (or anywhere else significant in fbcode).

Reviewed By: meyering

Differential Revision: D20490844

fbshipit-source-id: be4a66f49eb4a9eabaf73785f9a203f0aa6905a4
2020-03-17 08:59:27 -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
8e8cf7412c eden: enable HgQueuedBackingStore
Summary:
Replacing `HgBackingStore` with `HgQueuedBackingStore`.

This does not really improve anything except that all the caller of `getBlob`/`getTree` on this store is generating a `HgImportRequest` and getting a `SemiFuture` from the Promise associated with the request back.

Reviewed By: chadaustin

Differential Revision: D19184822

fbshipit-source-id: a8aef6b0d7392a6c407d311e8e1982754e736e9f
2020-03-17 02:31:24 -07:00
Zeyi (Rice) Fan
1bcaac2f19 eden: add HgQueuedBackingStore that implements a naive queue & worker
Summary: This diff implements `HgQueuedBackingStore` that uses `HgImportRequestQueue` to provide SCM data importing with priorities. This can allow us to customize how we import things and batch importing.

Reviewed By: chadaustin

Differential Revision: D19184826

fbshipit-source-id: da579b5bbff0b1449e9689e2c0159d4a3a475a83
2020-03-17 02:31:24 -07:00
Zeyi (Rice) Fan
0521a41147 add HgImportRequestQueue
Summary: This diff adds `HgImportRequestQueue` that is responsible for managing incoming requests by their priorities. This queue is later used in the `HgQueuedBackingStore` to prioritize works to the workers of the backing store.

Reviewed By: chadaustin

Differential Revision: D20197069

fbshipit-source-id: 246bbc086054a8021226e9ba6ab26d3bf0cfb7a3
2020-03-17 02:31:24 -07:00
Zeyi (Rice) Fan
7f0b3a77d4 eden: add HgImportRequest to represent an Hg import request
Summary:
This class is used to represent an import request that will be used later in the queue implementation.

When the EdenFS needs to import a blob, it creates an instance of this request and send it to the worker. Then it waits for the promise associated with the request.

In the future, we should be able to change the owned `Promise` into a non-owned `SemiFuture` to a `Promise` somewhere else for merging repetitive import requests.

Reviewed By: chadaustin

Differential Revision: D19184824

fbshipit-source-id: 823aabbed1156acf6306b7aefc76580a540d310d
2020-03-17 02:31:23 -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
Zeyi (Rice) Fan
2fad7731c1 introduce ImportPriority
Summary:
This diff introduces a `Priority` type for EdenFS. This type is used to pass along the priority of a request.

The priority class itself contains two parts, `kind` and `offset`. `kind` uses the first 4-bytes and the reset 12-bytes are used to store offset. The idea is that we can roughly assign a priority kind to most of the requests and offset is used to dynamically tweak the priority of some particular requests. For example, when we saw a process is generate millions of requests we can use this to express "normal priority but less important than other process's normal priority".

Reviewed By: chadaustin

Differential Revision: D20287652

fbshipit-source-id: 9a849fb6cc6ba5e443fea978d5b4dc3ab8ca906a
2020-03-17 02:31:22 -07:00
Chad Austin
97f2921deb fix an assertion violation in GlobBenchmark
Summary:
In dev mode, the glob benchmark failed inside of
folly::Range::operator[] because asserting null termination
technically violates the bounds check.

Reviewed By: simpkins

Differential Revision: D20268416

fbshipit-source-id: ee9b16a6eb9882e850631aa9d83fffe7b6fb67c3
2020-03-16 13:28:24 -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
Genevieve Helsel
3d6aecb849 don't allow checkout calls to queue
Summary: We should disallow `checkout` calls to queue. In practice, this is hard to encounter because of the Mercurial repository lock, but edge cases can slip through (user running a long `hg up` and control-cing the command and then running `hg up` again). There is not a use case in which `checkout` calls should queue, and keeping the Thrift queue clear of unnecessary (possibly) expensive commands should generally help user experience.

Reviewed By: simpkins

Differential Revision: D19894583

fbshipit-source-id: 2b6f0d6bd1f801872fa6fa66dc7728dc9c83d158
2020-03-11 09:28:22 -07:00
Puneet Kaushik
9fad6af978 Cleaning up second definitions of dtype_t
Summary: Missed cleaning up the other definition in D19956272.

Reviewed By: chadaustin

Differential Revision: D20199689

fbshipit-source-id: 9a00cb7b640f71edc034632e354fb61112a74bc1
2020-03-10 12:27:51 -07:00
Puneet Kaushik
ef671b4e4e Add BlobCache to Windows EdenMount
Reviewed By: simpkins

Differential Revision: D19956271

fbshipit-source-id: d5a88ea8570421a1c61900fbad8a0f9d3e311458
2020-03-10 12:27:50 -07:00
Puneet Kaushik
db5d20b303 Move Windows EdenMount and RepoConfig to fs/inodes/win
Summary: Moving these two files to integrate them better with rest of the Inodes code.

Reviewed By: simpkins

Differential Revision: D19956267

fbshipit-source-id: 5bf8165a6dc70a0c03f71f3f73b383991f21eb56
2020-03-10 12:27:50 -07:00
Puneet Kaushik
aed430d676 Add mode_t size in DirEntry
Summary: Windows sdk doesn't define mode_t. On Windows we use mode to store the file type info which should fix in 16 bits - S_FMT is defined as 0xf000.

Reviewed By: simpkins

Differential Revision: D19956270

fbshipit-source-id: 81acd2cd708f1c82674b8b75cd607d4f5b41a156
2020-03-10 12:27:50 -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
Victor Zverovich
639073cdd0 Make errnoStr return std::string instead of fbstring
Summary:
The result of `errnoStr` is often converted to `std::string` so returning `fbstring` adds an extra copy. Make it return `std::string` instead. This will also allow removing dependency between `String.h` and `FBString.h`.

(Note: this ignores all push blocking failures!)

Reviewed By: yfeldblum

Differential Revision: D20195395

fbshipit-source-id: 0dc65f1566911156be3fcb715dd105c58f2a8822
2020-03-10 10:50:44 -07:00
Adam Simpkins
e1490e631c add a counter to report the number of mount failures during startup
Summary:
Add a counter to report the number of mounts that we failed to remount during
startup.  Mount failures do not prevent EdenFS startup from proceeding.  It is
useful to have a metric to report if these errors did occur even though the
start-up as a whole still proceeded otherwise.

Reviewed By: chadaustin

Differential Revision: D20319512

fbshipit-source-id: fd503a1ccc91b476cc9dc2bc6323501bbbeaf2c5
2020-03-09 17:41:34 -07:00
Hezi Zhang
d7fa579a9c Track readlink() requests during checkout and status
Summary: Pass a valid ObjectFetchContext down into certain untracked requests.

Reviewed By: chadaustin

Differential Revision: D20243575

fbshipit-source-id: e7112c3bab1265803a26130c4d72905c25f2e729
2020-03-06 11:58:25 -08:00
Katie Mancini
b0a5ffb100 Expose number of imports queued
Summary: expose the counters for number of pending imports (blobs, trees, prefetches) to allow use in tooling

Reviewed By: chadaustin

Differential Revision: D20269853

fbshipit-source-id: d2b7e2110520290751699c4a891d41ebd5b374cf
2020-03-06 09:28:55 -08:00
Katie Mancini
4f0c4a1b04 Track number of imports queued
Summary:
adds a counter to track the imports queued to enable more statistics exposure.

- Add a counters to track the number of blob, tree, prefetch  imports that are in the pending

- have the counters increment (increment in constructor of wrapper struct) when the import is about to be queued

- have counters decrement once the load has completed (decrement in destructor of wrapper struct)

Reviewed By: chadaustin

Differential Revision: D20256410

fbshipit-source-id: 5536b46307b30fc19dc5747414727a86961c78e1
2020-03-05 09:03:06 -08:00
Katie Mancini
3a035094f8 Record Mercurial tree import time
Summary: - added logging only around the import tree call to capture non-queue related wait time

Reviewed By: chadaustin, fanzeyi

Differential Revision: D20207472

fbshipit-source-id: d88bb34ce224a26ff2be100d7789ddeff608006d
2020-03-03 11:44:28 -08:00
Katie Mancini
52e211fe8e Record Mercurial file import time
Summary:
- added logging only around the import blob call to capture non-queue related wait time
- added to `test_reading_file_gets_file_from_hg` in `integration.stats_test.HgBackingStoreStatsTest`  to test import blob logging in addition to the get blob loging

(not yet done for importing trees, will do in next diff)

Reviewed By: chadaustin

Differential Revision: D20201215

fbshipit-source-id: c89281fe7d3d6e89d111ac8cce9014adff44ac40
2020-03-03 11:44:27 -08:00
Adam Simpkins
3d18d04475 change the process name for the privhelper to "edenfs_privhelp"
Summary:
Call `folly::setThreadName()` in the privhelper process when it starts.  This
changes the command name reported in `/proc/PID/comm` and in `ps`

The process name is limited to 15 bytes, so this shows up as `edenfs_privhelp`

Reviewed By: fanzeyi

Differential Revision: D20199409

fbshipit-source-id: a5349bfab9230174aaa99c87f0db73fe31659186
2020-03-02 15:35:21 -08:00
Shai Szulanski
42456710dd Add some missing transitive dependencies
Summary:
A bunch of files include folly/executors/GlobalExecutors.h transitively through thrift/lib/cpp2/async/Stream.h, which is going away. Explicitly include the header (and add dependency to target) in preparation for deleting Stream.h
drop-conflicts

Reviewed By: vitaut

Differential Revision: D20141838

fbshipit-source-id: 21c58cf82136287fc2d84ba5badec6b872106015
2020-03-02 08:54:49 -08:00
Adam Simpkins
0642f1618d report the fb303 status in the getDaemonInfo() result
Summary:
Update the thrift `getDaemonInfo()` call to also return the fb303 status.
This allows the CLI to make a single thrift call instead of 2 when checking if
the EdenFS daemon is healthy.

Reviewed By: genevievehelsel

Differential Revision: D20130406

fbshipit-source-id: 9d25341e1d5f82fb1a921e1d7b1ebd34bcf19dc8
2020-02-26 21:03:52 -08:00
Zeyi (Rice) Fan
2222dbc1a5 fix HgPrefetchTest
Summary:
The problem is that the datapack files are not flushed to disk when it is prefetched. By having a pair of brackets around the `HgBackingStore`, it will ensure the `HgImporter` is closed by the time when we verify the prefetch with `hg cat` since it will terminate the `debugedenimporthelper` process in its destructor, which flushes the datapack files.

The real cause of the test failure is still unclear but I believe this is the correct way of doing this test.

Reviewed By: xavierd

Differential Revision: D20090249

fbshipit-source-id: 8e3966936a402c92311919433282027846d065e8
2020-02-25 10:14:29 -08:00
Puneet Kaushik
2b19eb7c17 Define directory types for Windows
Summary: Windows SDK doesn't define dirent. Defining it here for adding Inodes support on Edenfs on Windows.

Reviewed By: simpkins

Differential Revision: D19956272

fbshipit-source-id: 1bdf9a7563c194fe38008741b09668242ffa64ee
2020-02-25 10:14:29 -08:00
Puneet Kaushik
ca40c6f0f4 Update log level and remove async
Summary:
Logging on Windows doesn't work when the async is set. We haven't debugged it yet. Removing the async mode flag until we fix that.

Also bumping up the log level to 4. This would help to get more info while we are running in beta.

Reviewed By: simpkins

Differential Revision: D19776609

fbshipit-source-id: ccd6a6ed4d81f4a2edd550c6bb7195ac8b8b4d16
2020-02-25 10:14:28 -08:00
Adam Simpkins
8c9899a197 reduce the glog logging level to info (1)
Summary:
Most of EdenFS's main logging is done through folly::logging, however a number
of libraries that we use do logging through glog.  Previously we set glog's
`--minloglevel` setting to `0`, and we use the default `--v=0` setting.
This enabled glog `VLOG` messages, only for at VLOG level `0` messages.

Now that the Rust backing store code can fetch directly from memcache this now
links in some additional memcache library code that has some `VLOG(0)`
messages that are logged fairly frequently.  These aren't useful for us to
have in our logs, so reduce the `minloglevel` to `1` for now, which disables
all `VLOG` messages.

Reviewed By: genevievehelsel

Differential Revision: D20050589

fbshipit-source-id: 167e301d61e46ae3c19975e0c9233eda371495c0
2020-02-24 11:34:01 -08:00
Luca Niccolini
3e92ce9f77 move AsyncSocket::OptionMap into SocketOptionMap (codemod)
Summary: so that it can be shared more easily with AsyncUDPSocket

Reviewed By: yangchi

Differential Revision: D19851480

fbshipit-source-id: ec8cdb852519724db6f89cf70c4a4169de5028b6
2020-02-21 17:25:23 -08:00
Zeyi (Rice) Fan
d58863bde2 make hgcache direct read as default
Summary: It seems to be stable and not causing issues. Let's make it default everywhere.

Reviewed By: wez

Differential Revision: D19896738

fbshipit-source-id: cf6abe8f536e570017742b3a0674213a932a6a4d
2020-02-20 16:58:10 -08:00
James Zuo
73e1521a4e Remove deprecated method createStreamPublisher in EdenServiceHandler
Summary: Remove deprecated method createStreamPublisher with apache::thrift::ServerStream<T>::createPublisher()

Reviewed By: iahs

Differential Revision: D19961754

fbshipit-source-id: 915645f1aff648d65f54246e008fbc4454b71684
2020-02-20 09:33:07 -08:00
Chad Austin
c82a570d32 report conflicts when tree containing modified files is removed
Summary:
Eden SCM expects that DRY_RUN reports the same conflicts as a normal
checkout, but EdenFS would skip traversing deleted trees in dry run
mode. Fix that and add a test.

Reviewed By: genevievehelsel

Differential Revision: D19782543

fbshipit-source-id: 7a269e67a41b7ad6ce6c54fde37e8f74fcc1ef51
2020-02-19 11:20:55 -08:00
Puneet Kaushik
b6af823950 Fixing Windows build by removing shutdown event logging
Reviewed By: genevievehelsel

Differential Revision: D19863374

fbshipit-source-id: cf74e323d2e49c8bf9459d585343ba65112dbf55
2020-02-18 16:48:29 -08:00
Puneet Kaushik
69435b554a Moving Notifications out of Windows build
Summary: Notifications is using folly Subprocess which doesn't work on Windows.

Reviewed By: genevievehelsel

Differential Revision: D19863375

fbshipit-source-id: 63b047253c0f8a48b1b0ccc767f5820e77a28d80
2020-02-18 16:48:28 -08:00
Puneet Kaushik
2c67abae24 Adding null ObjectFetchContext to Fixing Windows build
Reviewed By: simpkins

Differential Revision: D19776610

fbshipit-source-id: 89c7aa1b22b9ed6862ad3e1208695ad0e7cf3d46
2020-02-18 13:30:42 -08:00
Genevieve Helsel
9b8960eef4 add success field to daemon start logging
Summary: records if a start was successful or not

Reviewed By: simpkins

Differential Revision: D19817810

fbshipit-source-id: b67253099781bb534b7e2fb26a09ba41c1f0bd69
2020-02-18 08:05:51 -08:00
Puneet Kaushik
8aed2fb637 On Windows verify Windows path seperator in PathComponentSanityCheck
Summary: On Windows we will verify both Windows and POSIX path separators, because we have both types of paths.

Reviewed By: simpkins

Differential Revision: D19562772

fbshipit-source-id: a6d8280e3bae4f6cd32b1f379bb59e22dd584211
2020-02-13 14:19:48 -08:00
Puneet Kaushik
94f7f9bb9c Removed getTreeEntry from WinStore
Summary: There is a bug in WinStore::getTreeEntry(). It fetches the shared_ptr to the Tree and returns the raw pointer to the entry in the Tree. Using the entry without holding the Tree shared_ptr is unsafe. This bug was introduced while refactoring the code in D19377522.

Reviewed By: simpkins

Differential Revision: D19762486

fbshipit-source-id: 6f0a849f0dc9731bada9a56bdc2a6c18740b0b18
2020-02-13 10:52:37 -08:00
Puneet Kaushik
d1bf4a21db Functions to convert widechar to RelativePath, AbsolutePath and PathComponent
Reviewed By: simpkins

Differential Revision: D19561988

fbshipit-source-id: 5e88d3751151b896dd7d01a58e1f5f2d8a8a068b
2020-02-11 11:12:54 -08:00
Genevieve Helsel
f52ee41ae9 log daemon shutdowns
Summary: logs information about daemon shutdowns, including duration, if it was a graceful restart or not, and if it was successful or not.

Reviewed By: fanzeyi

Differential Revision: D19817811

fbshipit-source-id: a851de8872f98952d046fb148a27fbf9f05b2212
2020-02-11 09:04:33 -08:00
Lukasz Piatkowski
542d1f93d3 Manual synchronization of fbcode/eden and facebookexperimental/eden
Summary:
This commit manually synchronizes the internal move of
fbcode/scm/mononoke under fbcode/eden/mononoke which couldn't be
performed by ShipIt automatically.

Reviewed By: StanislavGlebik

Differential Revision: D19722832

fbshipit-source-id: 52fbc8bc42a8940b39872dfb8b00ce9c0f6b0800
2020-02-11 11:42:43 +01:00
Wez Furlong
28f7b4a0b0 eden: show desktop notification for blob/tree fetch errors
Summary:
This commit causes a desktop notification to be shown if we generate
EIO or ETIMEDOUT responses via fuse; the prompt is intended to make it obvious
to the user that they need to connect to the VPN.

The commit by itself doesn't show a notification, it allows configuring a
command that can be run to do something to show a notification.

The test plan includes one such configuration for our corp environment.

* It doesn't trigger for thrift-originated downloads (eg: prefetch), only for
  VFS operations through FUSE.
* Ideally we'd know exactly when we have a network related error in the store
  code and use that to trigger the notification.  However, we have a rather
  convoluted set of importers and fallbacks today, one of which is interpreting
  a generic response returned from a pipe, so it is not especially clear
  exactly where we should locate the logic

Reviewed By: chadaustin

Differential Revision: D17513364

fbshipit-source-id: 45134f3672679cb5580cb0c1bc12a0d6e38525ca
2020-02-10 08:28:49 -08:00