Commit Graph

3258 Commits

Author SHA1 Message Date
Zhengchao Liu
06b507912f add inode number to NFS trace event
Summary: This adds inode number to NFS trace event so that we can use it in ActivityRecorder to show the filename of the FS request.

Reviewed By: xavierd

Differential Revision: D30849770

fbshipit-source-id: 580faf5fccb1a225399d9aec843e23eae1874e87
2021-09-14 10:44:46 -07:00
Katie Mancini
1e10a6efd5 raise indulde dot files to a command arg
Summary:
We have an option on GlobFiles for listing hidden files, but we don't have a
cli option. We default to false in the cli. Let's pipe this option all the way through.
so that we can control this flag from the cli.

Reviewed By: xavierd

Differential Revision: D30915118

fbshipit-source-id: 28b91d4fd2dd4bdf9e342929f570f64db14e8ad0
2021-09-14 10:02:33 -07:00
Katie Mancini
11da6c1027 prefetch option to only list files
Summary:
`eden prefetch` and `eden glob` return lists that despite being called
"maching files" actually contains both files and directories.

In some cases, we only want the list of files and it introduces unnessecary
overhead on our clients for them to have to stat all the files in the list to
filter out the dirs. Let's add an option to just list files.

Reviewed By: chadaustin

Differential Revision: D30816193

fbshipit-source-id: 6e264142162ce03e560c969a0c0dbbc2f418d7b9
2021-09-14 10:02:33 -07:00
Genevieve Helsel
0fba1ca036 fix error message in performBindMounts
Summary: The error message that currently exists here does not correspond to the command ran, its just missing the "redirect" part

Reviewed By: xavierd

Differential Revision: D30914616

fbshipit-source-id: 866ab7d494b728af13fbb3656edb8740a399755f
2021-09-14 09:58:00 -07:00
Xavier Deguillard
de4be2df48 utils: mark SpawnedProcess as being waited when waitpid fails
Summary: This is a similar diff to D30915090, but for EdenFS.

Differential Revision: D30915126

fbshipit-source-id: 9a718e47237924ebe20176c522a1b1193224236c
2021-09-13 20:00:45 -07:00
Chad Austin
7ef95f6d82 add an ObjectId type
Summary:
To eliminate the need for proxy hashes, we need variable-width object
IDs. Introduce an ObjectId type much like RootId.

Reviewed By: genevievehelsel

Differential Revision: D30819412

fbshipit-source-id: 07a185ba6b866b475c92f811e70aa00a8a9f895f
2021-09-13 17:21:01 -07:00
Genevieve Helsel
21c2410a6d pretty print rage sections and normalize underlining
Summary: the rage summary is getting hard to quickly parse, so this underlines each section header, as well as unifies underline looks (with `eden stats`). This adopts the underline code from `eden du` and makes it a util function for shareability.

Differential Revision: D30857773

fbshipit-source-id: 66b5b06f5b0125304d45d3465a8bc2248693b791
2021-09-10 23:54:48 -07:00
Genevieve Helsel
bae2745023 add more information in unloadedInodes check
Summary: I think it would be helpful to see the path of the inode that causes this check to fail

Reviewed By: kmancini

Differential Revision: D30880645

fbshipit-source-id: 08cad2277484568a6e325b1db7a89a9cf0fe1d3f
2021-09-10 23:50:35 -07:00
Genevieve Helsel
67fb93bf79 print eden config in rage report
Summary: it would be helpful to see a user's or sandcastle job's eden config, especially in the case of a gated feature rollout / staged feature rollout.

Differential Revision: D30857763

fbshipit-source-id: ee2a311ee643fc9db5acef1b02017564c51d2362
2021-09-10 16:27:17 -07:00
Genevieve Helsel
9207e03331 fix typo in cli comment
Summary:
just a typo fix

Created from CodeHub with https://fburl.com/edit-in-codehub

Reviewed By: fanzeyi

Differential Revision: D30849172

fbshipit-source-id: 9779832870c909d080548ec71ecf86aa53767dbc
2021-09-10 16:27:16 -07:00
Jeremy Fitzhardinge
cbceb08640 third-party/rust: local patch to tracing-subscriber
Summary:
Add impls for Layer for Box/Arc<L: Layer> and <dyn Layer>. Also a pile of other
updates in git which haven't been published to crates.io yet, including proper
level filtering of trace events being fed into log.

Reviewed By: dtolnay

Differential Revision: D30829927

fbshipit-source-id: c01c9369222df2af663e8f8bf59ea78ee12f7866
2021-09-09 22:38:25 -07:00
Jeremy Fitzhardinge
fd03bff2e2 third-party/rust: bump tracing versions in preparation for patching
Summary:
Bump all the versions on crates.io to highest to make migration to github
versions in next diff work.

Reviewed By: dtolnay

Differential Revision: D30829928

fbshipit-source-id: 09567c26f275b3b1806bf8fd05417e91f04ba2ef
2021-09-09 22:38:25 -07:00
Zhengchao Liu
601f99b118 support FS events logging in NFS mounts
Summary: This adds the support for FS events logging for NFS. For context, each type of event is assigned a sampling group that determines its sampling rate. In TraceBus subscription callback, events are sent to `FsEventLogger` to be sampled and logged through `HiveLogger`.

Reviewed By: xavierd

Differential Revision: D30843863

fbshipit-source-id: 65394d31b1197efd69c7fd4c1b24562f5abd5785
2021-09-09 16:29:53 -07:00
Zeyi (Rice) Fan
369861a9ee windows: invalidate negative path cache during start
Summary:
In certain situations, users may cause EdenFS to falsely return a path not exist result while the path is available. Windows will cache that and causing subsequent access to that file to automatically return a file not exist error.

We currently only invalidate this negative cache during checkout and rebooting the machine as the cache is even kept during EdenFS restarts. In this diff, we starts to invalidate the negative path cache at startup so if the user ever had issues an `eden restart` would be sufficient to fix.

Reviewed By: xavierd

Differential Revision: D30814059

fbshipit-source-id: 53283f471702762b2eed0c5d0f6a9cc49f4db739
2021-09-09 10:48:53 -07:00
David Tolnay
5e9b8cd4b2 third-party/rust: Update thiserror from 1.0.23 to 1.0.29
Summary:
Release notes:

- https://github.com/dtolnay/thiserror/releases/tag/1.0.24
- https://github.com/dtolnay/thiserror/releases/tag/1.0.25
- https://github.com/dtolnay/thiserror/releases/tag/1.0.26
- https://github.com/dtolnay/thiserror/releases/tag/1.0.27
- https://github.com/dtolnay/thiserror/releases/tag/1.0.28
- https://github.com/dtolnay/thiserror/releases/tag/1.0.29

The pertinent feature is 1.0.29 adding support for inferred trait bounds on error types that contain generic type parameters. I remember someone asking for this in fbcode but I forget what project it was for.

```
use thiserror::Error;

#[derive(Error, Debug)]
pub enum MyError<E, F, G> {
    #[error("thing {0} ({0:?})")]
    Variant(E),
    #[error("some error")]
    Delegate(#[source] SomeError<F>),
    #[error("err 0o{val:o}")]
    Octal { val: G },
}
```

```
// generated

impl<E, F, G> std::error::Error for MyError<E, F, G>
where
    SomeError<F>: std::error::Error + 'static,  //'
    Self: std::fmt::Debug + std::fmt::Display;

impl<E, F, G> std::fmt::Display for MyError<E, F, G>
where
    E: std::fmt::Debug + std::fmt::Display,
    G: std::fmt::Octal;
```

Reviewed By: zertosh

Differential Revision: D30758449

fbshipit-source-id: b3afe08fe8c8affa26693df9cbb63e04632ea1d3
2021-09-08 20:49:35 -07:00
Adam Simpkins
adb0571dcc add an EDEN_HAVE_USAGE_SERVICE config macro
Summary:
Put code using the usage service behind an `EDEN_HAVE_USAGE_SERVICE` macro.
Previously the C++ code was simply guarded by a `__linux__` check, and the
CMake code did not have a guard at all.  This caused builds from the GitHub
repository to fail on Linux, since the code attempted to use the usage service
client which was not available.

Reviewed By: xavierd

Differential Revision: D30797846

fbshipit-source-id: 32a0905d0e1d594c3cfb04a466aea456d0bd6ca1
2021-09-08 19:50:44 -07:00
Chad Austin
0b47b645fe remove dead code from serializeTree
Summary:
LocalStore no longer special-cases Tree objects with kZeroHash
ids. Instead, unconditionally write into LocalStore with the Tree's
hash.

Reviewed By: xavierd

Differential Revision: D29155470

fbshipit-source-id: aee3840fe8dfd7aa46305b6db6f7950efb2e41d2
2021-09-08 16:27:10 -07:00
Chad Austin
a4ba22dc48 rename Hash to Hash20
Summary:
In preparation for expanding to variable-width hashes, rename the
existing hash type to Hash20.

Reviewed By: genevievehelsel

Differential Revision: D28967365

fbshipit-source-id: 8ca8c39bf03bd97475628545c74cebf0deb8e62f
2021-09-08 16:27:10 -07:00
Zhengchao Liu
b93c23d25c assign FS events to sampling groups
Summary:
As title, sampling group determines the sampling rate at which an FS event is logged. The higher the sampling group the more heavily its events are dropped, thus, more frequent events are assigned to the higher sampling groups.
I ran activity recorders on a few workflows, buck build, getdepts, and vscode editing and came up with the following assignment. Note that only a subset of events are assigned to a sampling group (so events not included will not be logged) as we just start to tune the sampling rates and these events should be good for a start.
```
Group1 (1/10)
FUSE_MKDIR
FUSE_RMDIR
FUSE_CREATE
FUSE_RENAME

Group2 (1/100)
FUSE_WRITE
FUSE_LISTXATTR
FUSE_SETATTR

Group3 (1/1000)
FUSE_GETXATTR
FUSE_GETATTR
FUSE_READ
FUSE_READDIR

Group4 (1/10000)
FUSE_LOOKUP
```

For reference, here are the counts of FS events of a cold buck build. The frequencies of other workflows are similar.
```
FUSE_LOOKUP 60.09 98733
FUSE_READ 12.80 21037
FUSE_GETXATTR 8.91 14645
FUSE_FORGET 8.01 13162
FUSE_GETATTR 5.55 9116
FUSE_READDIR 3.21 5270
FUSE_LISTXATTR 0.59 969
FUSE_READLINK 0.54 892
FUSE_STATFS 0.21 338
FUSE_WRITE 0.04 64
FUSE_CREATE 0.02 28
FUSE_RENAME 0.01 23
FUSE_SETATTR 0.01 13
FUSE_UNLINK 0.00 6
FUSE_RMDIR 0.00 1
FUSE_MKDIR 0.00 1
FUSE_MKNOD 0.00 1
```

Reviewed By: xavierd

Differential Revision: D30770533

fbshipit-source-id: 90be881ddbeba2113bbb190bdb1e300a68f500a0
2021-09-08 11:40:22 -07:00
CodemodService Bot
0c85a38fc1 Daily common/rust/cargo_from_buck/bin/autocargo
Reviewed By: krallin

Differential Revision: D30802656

fbshipit-source-id: 32e9e908571daf7ee111b07d47b5314ec632e7df
2021-09-08 03:36:02 -07:00
Xavier Deguillard
17b9e71972 store: add HgQueuedBackingStore::periodicManagementTask
Summary:
Since this method wasn't overriden, EdenFS would never periodically flush data
to disk.

Reviewed By: fanzeyi

Differential Revision: D30784400

fbshipit-source-id: d88e535250a476582868dd82e57137a0ac38f921
2021-09-07 14:34:43 -07:00
Zeyi (Rice) Fan
8616cd90b1 switch to new fbthrift_ext
Reviewed By: xavierd

Differential Revision: D30703434

fbshipit-source-id: 74c1c577a330913e411b58d3a128a28cfed621a2
2021-09-07 13:31:02 -07:00
Zeyi (Rice) Fan
934975a668 generate Cargo.toml - take 2
Summary: Original commit changeset: 025ea455c51b

Differential Revision: D30740404

fbshipit-source-id: 04c4c2b70105276d586c6aafe1e681549237071a
2021-09-02 17:00:33 -07:00
Genevieve Helsel
62fe933e4e disallow infinite recursion in redirect unmount
Summary: If the bind unmount fails in in the privhelper, theres a possibility of infinite recursion in this method. This adds a flag to indicate if we've tried the bind unmount before.

Differential Revision: D30732857

fbshipit-source-id: 6ee887d211977ee94c8e66531287f076a7e61a2c
2021-09-02 15:00:10 -07:00
Zhengchao Liu
8fe7e16f7c log FS trace events with HiveLogger
Summary: This diff lets `FsEventLogger` send the sample through `HiveLogger`

Reviewed By: genevievehelsel

Differential Revision: D30305695

fbshipit-source-id: 88613dc6c74710cc0f33c44ce4e36c35c58e6406
2021-09-02 10:32:03 -07:00
Xavier Deguillard
69159f20d5 store: split the blob/tree/prefetch queue
Summary:
Having the same queue for all three makes the dequeue code overly complicated
as it needs to keep track of the kind of request that needs to be dequeued.
Incidently, the previous code had a bug where request in "putback" would be
requeued at the end of the queue, even though there were at the beginning of it
if they all had the same priorities.

This is theory should also improve the dequeue performance when the queue has a
mix of blobs/tree requests, but I haven't measured.

Reviewed By: genevievehelsel

Differential Revision: D30560490

fbshipit-source-id: b27e5429105c07e5f9eab482c12e5699ca3413f7
2021-09-01 14:29:27 -07:00
Xavier Deguillard
54de90fa1b service: background actual prefetch of files
Summary:
Since the background condition is before the actual prefetching of files,
specifying the background option would just glob files but not prefetch them
which is equivalent to prefetching all the trees.

Reviewed By: genevievehelsel

Differential Revision: D30618753

fbshipit-source-id: 5533b1c78d614342ac3341ce033795be3850750a
2021-09-01 14:29:27 -07:00
Genevieve Helsel
f90a988fb2 use HiveLogger in EdenLogviewWriter
Differential Revision: D29568132

fbshipit-source-id: a1ef159bfbb5ebacb50274ab68a1585a684e53c9
2021-08-31 17:28:23 -07:00
Zeyi (Rice) Fan
949f565aab Back out "generate Cargo.toml"
Reviewed By: genevievehelsel

Differential Revision: D30679584

fbshipit-source-id: 025ea455c51b5a485cc61abf405e7c06380093fd
2021-08-31 15:25:20 -07:00
Zeyi (Rice) Fan
79517ec184 generate Cargo.toml
Differential Revision: D30670348

fbshipit-source-id: 74655c060cdc584c63e334a22e169705878329b7
2021-08-31 12:28:09 -07:00
Zeyi (Rice) Fan
0d53c14f66 temporarily remove existing Cargo.toml
Differential Revision: D30670349

fbshipit-source-id: 872f847a01ac6e2ff5dd21c5bd7f4a7aa563a494
2021-08-31 09:34:46 -07:00
Genevieve Helsel
c101e56dec add json option to version
Reviewed By: chadaustin

Differential Revision: D30555962

fbshipit-source-id: 50cf7afa0f30242a5d28b112bae04793e9b55ceb
2021-08-30 22:12:15 -07:00
Zhengchao Liu
f2eb6aee68 fix thread safety issues in ActivityRecorder CLI
Summary:
This addressed 2 thread safety issues:
1. holding strong reference to `EdenMount`
2. converting unowned `stringPiece` to `std::string`

Reviewed By: chadaustin

Differential Revision: D30657955

fbshipit-source-id: 870e972d9e0fe3897e021aeca77bf2db8c5fbb20
2021-08-30 19:30:08 -07:00
Genevieve Helsel
19e9cd2f7a allow specifying log path in eden debug log
Summary: Adds an option to print the path to the eden log file. Similar to `eden pid`, this can be used for shell one-liners.

Reviewed By: chadaustin

Differential Revision: D30558294

fbshipit-source-id: ca70addaef2093e10f0321bae0cff3b1bfc7dc75
2021-08-30 14:16:35 -07:00
Genevieve Helsel
fdb1fe42c6 turn eden debug logs upload into a flag
Summary: `eden debug log --upload` fits in better with the format of the other cli tools (rather than `eden debug log upload`)

Differential Revision: D30557691

fbshipit-source-id: 32e47e1487703560f2adb5f0f79f1002d29eea93
2021-08-30 14:16:35 -07:00
Zhengchao Liu
aa4566ece6 check hgcache before enqueue import tree request
Summary: Currently, tree imports are queued regardless of whether they are in the `hgcache`. This adds unnecessary delay, especially if the queue is busy (importer takes a long time and causes queue to backlog). This diff adds the logic to check if the tree is in `hgcache` before enqueuing a tree import request.

Reviewed By: xavierd

Differential Revision: D30514871

fbshipit-source-id: eb23f64b7f059832571f957fb67d18c3821d2844
2021-08-27 13:08:59 -07:00
Xavier Deguillard
49619add41 store: allow extracting a slice of the Hash stored in HgProxyHash
Summary:
Some code in the HgDatapackStore is overly complicated due to the fact that
revHash returns a owned Hash and this forces the code to thus copy it onto a
temporary vector. By having a method that can directly return a slice to the
hash, this issue disappears, thus let's add it.

Reviewed By: chadaustin

Differential Revision: D30582458

fbshipit-source-id: dc102117bc82ab72378293c0abfe9acfd862e9e6
2021-08-27 10:05:48 -07:00
Andrey Chursin
aae0a37a7f use metadata cache to skip hash recalculation
Summary:
I noticed that every time we fetch blob from hg, we calculate sha hash and put it into metadata table.
Both calculating sha1 of content and writing it to rocks is fairly expensive, and it would be nice if we can skip doing so in some cases.

In this diff I use inexpensive cache check to see if we already calculated metadata for given blob and skip recalculation

In terms of performance, it reduces blob access time in hot case from **0.62 ms to 0.22 ms**.
[still need to do some testing with buck, but I think this should not block the diff since it seem farily trivial]

This is short-medium term fix, the longer term solution will be keeping hashes in mercurial and fetching them via eden api, but this will take some time to implement

Reviewed By: chadaustin, xavierd

Differential Revision: D30587132

fbshipit-source-id: 3b24ec88fb02e1ea514568b4e2c8f9fd784a0f10
2021-08-26 17:30:17 -07:00
Xavier Deguillard
87545e26b2 benchmarks: add HgImportRequestQueue::dequeue benchmark
Summary: Similarly to the enqueue benchmark, let's have a dequeue benchmark.

Differential Revision: D30560489

fbshipit-source-id: ae18f7e283e4bab228aaa0f58bff2e6f2cfa3021
2021-08-26 12:28:51 -07:00
Xavier Deguillard
edfc14fa97 store: use Hash instead of HgProxyHash to speedup enqueue 1.6x
Summary:
In order to enqueue and find an element in a hash table, the key needs to be
hashed. Hashing a HgProxyHash relies on hashing a string which is significantly
more expensive than hashing a Hash directly. Note that they both represent the
same data and thus there shouldn't be more collisions.

Reviewed By: chadaustin

Differential Revision: D30520223

fbshipit-source-id: 036007c445c28686f777aa170d0344346e7348b0
2021-08-26 12:28:50 -07:00
Xavier Deguillard
f3dc469957 store: remove an allocation in enqueue to speed it up 1.25x
Summary:
Allocations are expensive, especially when done under a lock as this increase
the critical section, reducing the potential concurrency. While this yields to
a 1.25x speedup, this is more of a sideway improvement as the allocation is now
done prior to enqueuing. This also means that de-duplicating requests is now
more expensive, as no allocation would be done before, but at the same time,
de-duplication is the non-common code path, so the tradeoff is worthwhile.

Reviewed By: chadaustin

Differential Revision: D30520228

fbshipit-source-id: 99dea65e828f9c896fdfca6b308106554c989282
2021-08-26 12:28:50 -07:00
Xavier Deguillard
882713319c store: use an F14 map to speed up HgImportRequestQueue::enqueue 1.3x
Summary: The F14 hashmap are significantly faster than the std::unordered_map.

Reviewed By: chadaustin

Differential Revision: D30520225

fbshipit-source-id: d986908c5eac17f66ae2c7589f134c430a3c656e
2021-08-26 12:28:50 -07:00
Xavier Deguillard
a3d6554a8c store: speed up HgImportRequestQueue::enqueue 1.5x
Summary:
When turning on the native prefetch, EdenFS will enqueue tons of blob requests
to the import request queue. The expectation is then that the threads will
dequeue batch of requests and run them. What is being observed is however
vastly different: the dequeued batches are barely bigger than 10, far lower
than the batch capacity, leading to fetching inefficiencies. The reason for
this is that enqueuing is too costly.

The first step in making enqueuing less costly is to reduce the number of times
the lock needs to be acquired by moving the de-duplication inside the enqueue
function itself. On top of reducing the number of times the lock is held, it
also halves the number of allocation done under the lock.

Reviewed By: chadaustin

Differential Revision: D30520226

fbshipit-source-id: 52f6e3c1ec45caa5c47e3fd122b3a933b0448e7c
2021-08-26 12:28:50 -07:00
Xavier Deguillard
7eb4db22db store: convert back some SemiFuture to Future
Summary:
It turns out that we do want to use a Future to make sure that the tracebus and
watches are completed on the producer and not on the consumer of the future. We
could use a `.via(inline executor)` but the code becomes less readable, so
let's just revert the diff.

Reviewed By: chadaustin

Differential Revision: D30545721

fbshipit-source-id: 524033ab4dbd16be0c377647f7f81f7cd57c206d
2021-08-26 12:28:50 -07:00
Katie Mancini
6b315d5578 setup buck integration testing
Reviewed By: scottcao, xavierd

Differential Revision: D30003787

fbshipit-source-id: fcf387ba37a7443fdbf56520e387fc008be0bf37
2021-08-25 17:32:14 -07:00
Xavier Deguillard
cba417e57e service: revert "normalize mount point in Thrift endpoints"
Summary:
This change has the unintended effect of causing any Thrift calls to
potentially issue a recursive EdenFS call due to symlink resolution requiring
running `readlink` on the root of the repo itself.

Fixing this isn't really possible, thus let's revert the change altogether, we
can force clients to issue a realpath before issuing EdenFS Thrift calls.

Reviewed By: kmancini

Differential Revision: D30550796

fbshipit-source-id: 9494c8e08c8af2392eeb344879f156cb56f93ea6
2021-08-25 14:54:58 -07:00
Xavier Deguillard
f5d10f0c59 store: document HgImportRequestQueue::stop
Summary:
The documentation allows for not having to test in enqueue if the queue is
still running: if called in the destructor of the owner, no enqueue can
logically happen, and thus we do not need to protect against it.

Reviewed By: chadaustin

Differential Revision: D30520227

fbshipit-source-id: 9d6280ccd7fe875cd06b0746151a2897d1f98d61
2021-08-25 14:20:56 -07:00
Xavier Deguillard
752a67e5cd benchmarks: add a benchmark for HgImportRequestQueue::enqueue
Summary:
When trying to push thousands of requestst to the queue, the dequeue side only
manage to pull batches of ~10 requests at most. Let's measure the cost of
enqueue to optimize it.

Reviewed By: chadaustin

Differential Revision: D30503110

fbshipit-source-id: d06ae6741b13b831fa3711fb2dd0e38c3e54193c
2021-08-25 14:20:56 -07:00
Genevieve Helsel
07add0808e return 0 if skipping predictive fetch
Reviewed By: kmancini

Differential Revision: D30546084

fbshipit-source-id: 69b3ab3260e5d3ca56a1b8abd533f793f5d4b62f
2021-08-25 12:39:55 -07:00
Pyre Bot Jr
2b5216e31c suppress errors in fbcode/eden - batch 1
Differential Revision: D30514057

fbshipit-source-id: fba38e972f6dad2ad9e6f2d89a2eef06cf4e2872
2021-08-24 14:30:57 -07:00