Commit Graph

5059 Commits

Author SHA1 Message Date
Andres Suarez
51fc649c56 unfork and update toml-5
Reviewed By: jsgf

Differential Revision: D46369474

fbshipit-source-id: 2905c96f24f3a6963c69ed89572ce36e564443d6
2023-06-02 08:04:49 -07:00
Jeremy Fitzhardinge
1ae4f69513 third-party/rust: update text_placeholder with https://github.com/bernardoamc/text-placeholder/pull/7
Summary: Added `fill_from_function` which makes it much more useful

Reviewed By: fanzeyi

Differential Revision: D46342378

fbshipit-source-id: 9bc8c01dcb10806a03f1eab628f9763c4e5edc81
2023-06-02 03:29:24 -07:00
Xavier Deguillard
b26ca0d334 store: properly time ObjectStore::getBlobMetadata
Summary:
Our telemetry was showing that starting mid-April the cost of
ObjectStore::getBlobmetadata went down significantly but investigating the root
cause of the improvement didn't seem to yield any results. It turns out the
root cause was that the code no longer timed the cost of the future.

Reviewed By: kmancini

Differential Revision: D46369667

fbshipit-source-id: 0c7d997c93d94498384e27b3447a9c736dcce3b2
2023-06-01 15:51:45 -07:00
Xavier Deguillard
1c20e574cc telemetry: fix typo in counter name
Summary:
Both the getBlobMetadata and fetchBlobMetadata were publishing to the same counter, making them indistinguishable.

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

Reviewed By: genevievehelsel

Differential Revision: D46343472

fbshipit-source-id: 04e09372c21dd5cb09336259ff34a5394d10d3b4
2023-05-31 20:38:26 -07:00
Xavier Deguillard
61b02f8f86 Back out "linearize control flow in EdenServer::mount"
Summary:
We've seen crashes on Windows when the mount is initialized but a later step at
mount time fails. In between these 2 events, if a write to the working copy
happens the ProjectedFS code assumes that the InodeMap is initialized and thus
tries to access the rootInode. This assumption is unfortunately broken by the
call to mountFinished and the code should instead follow the regular unmount
code path to make sure that no pending notifications are inflight.

I suspect NFS and FUSE also would exhibit the same issue.

Reviewed By: kmancini

Differential Revision: D46169999

fbshipit-source-id: ed1eb17dc2f084acb7e2d88c555150b3b8c6662e
2023-05-31 12:15:03 -07:00
Barys Skarabahaty
cecd3a9582 Adding a possibility to configure the blake3 key
Summary: Adding a way to configure the blake3 key for blake3 hashing

Reviewed By: chadaustin

Differential Revision: D44499469

fbshipit-source-id: 344edd91cfc867c8a49d0db9369dfe2132e86c77
2023-05-30 23:10:10 -07:00
Genevieve (Genna) Helsel
d3ae451c74 allow using SqliteOverlay on non-Windows
Summary: allow using `SqliteOverlay` on non-Windows, since  OverlayChecker has now been updated to work with it.

Reviewed By: chadaustin

Differential Revision: D44105360

fbshipit-source-id: 5f78e6c9b5323faeee394da4a51d7e84f8d44a2f
2023-05-29 22:38:14 -07:00
Xavier Deguillard
71eebd2356 store: fix a nullptr derefence in LocalStoreCachedBackingStore
Summary:
In the rare case where fetching both the BlobMetadata and the Blob failed, the
LocalStoreCachedBackingStore would still try to dereference the nullptr Blob,
leading to a crash.

Reviewed By: chadaustin

Differential Revision: D46211469

fbshipit-source-id: f98dd215dbda432507f3823439d354d3d662dc6f
2023-05-26 09:16:16 -07:00
Xavier Deguillard
fdbf7eadfb store: add telemetry for LocalStore operations
Summary:
We've seen a case where a large `hg update` was taking an absurdly long time in
`ObjectStore::getTree` but the telemetry was showing us that most of the time
wasn't spent fetching trees from Mercurial! The suspicion is that most of the
time was spent in the LocalStore but with no evidence to prove it.

Let's thus add some timing telemetry to various LocalStore read requests to
fill this gap.

Reviewed By: mshroyer

Differential Revision: D46154456

fbshipit-source-id: b439ac48889ed3db71db136ff6c1cc91f48c926a
2023-05-25 15:48:11 -07:00
Genevieve (Genna) Helsel
006d26a094 extend FsckTest to test SqliteOverlay
Summary:
Extends `FsckTest` to test `SqliteOverlay`. Two major changes were made to non-test files:
1) `loadInodeInfo` was moved from `OverlayChecker` into `InodeCatalog`
2) `getAllParentInodeNumbers` was added to facilitate `OverlayChecker::readInodes`

Reviewed By: chadaustin

Differential Revision: D45447172

fbshipit-source-id: 9ad291a0c4c34f1e44e1f05c1fdbf2ac7ea7d309
2023-05-25 13:50:56 -07:00
Genevieve (Genna) Helsel
e95b17e5a6 move OverlayChecker into eden/fs/inodes/overlay
Summary: This will no longer be tied to the fscatalog, so it makes more sense to live in a more general location

Reviewed By: chadaustin

Differential Revision: D44980396

fbshipit-source-id: 3cabf00d87df7eb00671c2b82b04c8f12283e394
2023-05-25 10:10:08 -07:00
Xavier Deguillard
e73ab91be0 store: add telemetry for where Tree were obtained from
Summary:
Telemetry exist for where Blob and BlobMetadata are coming from, but not for
Tree. Let's bring the Tree telemetry up to par.

Reviewed By: genevievehelsel

Differential Revision: D46154455

fbshipit-source-id: ab3c31d55b6a91009289b3b07853fa574bbaa137
2023-05-24 17:08:42 -07:00
Katie Mancini
5dac894df8 remove debugGetScmBlobMetadata
Summary:
I migrated the last caller of debugGetScmBlobMetadata to debugGetBlobMetadata
in the last diff. Let's delete the old method.

I am not really concerned about waiting for that lower diff to rollout and all
because this is a debugging command that we only sparingly ask users to run
(As far as I know like maybe 3 times).

Reviewed By: chadaustin

Differential Revision: D45972617

fbshipit-source-id: 6d4689a225fee972f8e3a802115852043f0bade8
2023-05-24 16:41:02 -07:00
Katie Mancini
5458cd7045 migrate last debugGetScmBlobMetadata call to debugGetBlobMetadata
Summary:
I created debugGetBlobMetadata a while ago and this is the last caller of
debugGetScmBlobMetadata. Let's migrate it to the new endpoint so we can delete
the old one.

Reviewed By: chadaustin

Differential Revision: D45972618

fbshipit-source-id: cbb0977260f9a1543d3bf0a31bf7b948c2f35143
2023-05-24 16:41:02 -07:00
Katie Mancini
b981977a84 remove debugGetScmBlob
Summary:
I created debugGetBlob a while ago and there are no more callers of
debugGetScmBlob from code search, so let's delete this.

Reviewed By: chadaustin

Differential Revision: D45972619

fbshipit-source-id: 97276ec2182fbe7d9022a06e9a0df34ae4e80235
2023-05-24 16:41:02 -07:00
Genevieve (Genna) Helsel
23832acbf3 default to using buffered overlay
Reviewed By: chadaustin

Differential Revision: D45541124

fbshipit-source-id: bc6392cfd6ae8aa592a5e5546bd7d14df394a6dc
2023-05-24 13:11:13 -07:00
Xavier Deguillard
c88363c998 store: remove BlobMetadata computation/caching when getting blob
Summary:
EdenFS contains several layers of caching for BlobMetadata:
 - In the hgcache,
 - In the in-memory BlobMetadata cache,
 - In the LocalStore (configurable),
 - In the FileInode,
 - In the TreeEntry,

All of the above must be filled prior to reading a blob, therefore computing
the sha1+size when reading a blob is likely not needed and superfluous.

Alternatively, we could move the code to be done in the background in the
LocalStoreCachedBackingStore to avoid blocking reading the blob. Reviewers
opinions are welcome!

Reviewed By: chadaustin

Differential Revision: D45625432

fbshipit-source-id: ad7d897c32cbfd590dce5a3a9c8073349e9b70c8
2023-05-24 10:26:51 -07:00
Chad Austin
e858234e94 add OBJECT_ID attribute to getAttributesFromFilesV2
Summary:
For tools that want to take advantage of the same fast-path logic when
directories don't change across updates, expose a semistable ID they
can use to cache derived data or get a rough understand when a
directory has changed its contents.

Reviewed By: kmancini, xavierd

Differential Revision: D45974142

fbshipit-source-id: 7b2b482876b07e73514a936e198de2dc31ed1597
2023-05-23 19:12:06 -07:00
Genevieve (Genna) Helsel
1148997dcb migrate edenfsctl fsck to C++
Reviewed By: chadaustin

Differential Revision: D44473843

fbshipit-source-id: 01c46e1cd50b73e6c0d13d00fd42a7da81abc01c
2023-05-23 13:33:07 -07:00
Pedro Rittner
e8e3ea7d20 Upgrade rustls to 0.21 across all third party packages
Summary:
rustls 0.21.0 finally has support for IP addresses in certs.

Lots of other crates have (in)direct dependencies on rustls so I have to upgrade those too:

* hyper, reqwest, and auxiliary crates for those have been updated
* tonic has been updated and our local patch removed (since the relevant PR was merged upstream)

Reviewed By: zertosh

Differential Revision: D45989949

fbshipit-source-id: 658c11d29859d6d36368a412dab05e3c99313ee0
2023-05-19 12:39:46 -07:00
Andres Suarez
cde0feed40 update clap-3 and clap_complete-3
Summary: Update to latest versions.

Reviewed By: AndreasBackx

Differential Revision: D45947093

fbshipit-source-id: 64ac9ac86a3180e0de57b79408829ef920706c0c
2023-05-19 06:51:50 -07:00
Xavier Deguillard
2e9cce82d5 store: make BackingStore return shared_ptr instead of unique_ptr
Summary:
In both the ObjectStore and in the hg BackingStore, copies of the unique_ptr
were being made. For large blobs this is particularly inefficient as
potentially several MB (if not more) of data needs to be copied. Let's fix this
by changing the BackingStore API to return a shared_ptr.

In order to make the code easier to read and write, also define 3 types:
TreePtr, BlobPtr and BlobMetadataPtr and use them in the BackingStore code.
Future changes should be done at a later point to convert the whole codebase to
using these.

Reviewed By: chadaustin

Differential Revision: D45967102

fbshipit-source-id: 6086f95456232db48a5cbec47b7cf8b14e4424ed
2023-05-18 12:30:08 -07:00
Chad Austin
c01b1fda33 remove redundant mount lookups in getEntryAttributes
Summary:
getEntryAttributes did a mount lookup for every single path. That's
unnecessary: have the Thrift method do a mount lookup, ensure the
mount stays alive, and pass it down.

Reviewed By: kmancini

Differential Revision: D45973970

fbshipit-source-id: 68c5038b229b5b2e4946e6a34dd6ceaabd3fcf11
2023-05-18 09:44:50 -07:00
Chad Austin
7cf357b00f use lookupMount for all of the mount ID Thrift types
Summary:
We have three ways to look up a mount in a Thrift handler: by MountId,
with a Thrift field reference, and as a string parameter. Add
`lookupMount` overloads that handle all of them.

Reviewed By: kmancini

Differential Revision: D45973903

fbshipit-source-id: fb6d6ac1bf5001dbc111875aa4aa257d1bcccc59
2023-05-18 09:44:50 -07:00
Chad Austin
22a21ebb09 remove a conditional include
Summary:
We have several legacy conditional includes that are no longer
necessary. Remove another.

Reviewed By: xavierd

Differential Revision: D45927567

fbshipit-source-id: 05bea9a94b249104c26893cfc0017fa472643ce5
2023-05-18 09:44:50 -07:00
Chad Austin
33a05c1def remove some unused includes
Reviewed By: xavierd

Differential Revision: D45924539

fbshipit-source-id: 441271fbfa63578b6f237ab792fa9fc52092157b
2023-05-18 09:44:50 -07:00
Chad Austin
8730a7299a migrate to lookupMount and have it return EdenMountHandle
Summary:
Remove a class of boilerplate by introducing a lookupMount function
that takes the two common Thrift mount identifiers and returns an
EdenMountHandle.

Reviewed By: kmancini

Differential Revision: D45924483

fbshipit-source-id: 2f919c4525ba8c82018d9b7c2ca4ee361d924791
2023-05-18 09:44:50 -07:00
Chad Austin
1e39c10150 move EdenMountHandle into its own sources
Summary:
I want to use EdenMountHandle in EdenServiceHandler without pulling in
EdenServer.h.

Reviewed By: xavierd

Differential Revision: D45924297

fbshipit-source-id: 2043374d513c01423cd6f785b2c4e2b36d937676
2023-05-18 09:44:50 -07:00
Chad Austin
8c7994003d break EdenServer.h's dependency on EdenMount.h
Reviewed By: kmancini

Differential Revision: D45924234

fbshipit-source-id: e979f7e3c4e902c48c7ea8b9ea8eb0bc5565a572
2023-05-18 09:44:50 -07:00
Chad Austin
a82565ae2d remove some includes from EdenServer.h
Summary: I keep noticing unnecessarily recompilations when I change files.

Reviewed By: kmancini

Differential Revision: D45924117

fbshipit-source-id: 445590fae6be11ef35d40c7295e64493d8c57160
2023-05-17 19:16:48 -07:00
Chad Austin
75a5678622 remove some ifdefs by introducing a platform-independent UsageService class
Summary:
Naming the concept allows us to decouple implementation details and
imagine future implementations.

Reviewed By: kmancini

Differential Revision: D45917739

fbshipit-source-id: d0d0a023c2d978c8a509af0e7187295b4c9c413b
2023-05-17 19:16:48 -07:00
Dimitris Iliopoulos
12df87352f upgrade packages from toml-5 (0.5.8 fork) -> toml (0.7.3)
Summary:
The fixes bellow are because of one of 4 reasons:
1. [`toml::from_slice`](https://docs.rs/toml/0.5.8/toml/de/fn.from_slice.html) and [`toml::to_vec`](https://docs.rs/toml/0.5.8/toml/ser/fn.to_vec.html)  have been removed and replaced in the current version by [`toml::from_str`](https://docs.rs/toml/0.7.3/toml/fn.from_str.html) and [`toml::to_string`](https://docs.rs/toml/0.7.3/toml/fn.to_string.html)
2. [`toml::Spanned::span`](https://docs.rs/toml/0.7.3/toml/struct.Spanned.html#method.span) now returns a `Range<usize>` and not a `(usize, usize)` like it used to ([here](https://docs.rs/toml/0.5.8/toml/struct.Spanned.html#method.span))
3. The internal representation for parsed TOML via [`toml_edit`](https://docs.rs/toml_edit/latest/toml_edit/) uses `"` instead of `'` for representing string values
4. TOML parsing errors are now multi-line errors and need to be accounted for in tests

Reviewed By: zertosh, shayne-fletcher

Differential Revision: D45896591

fbshipit-source-id: 403790674c7449da9f7322d69ec3030369310aab
2023-05-17 18:52:14 -07:00
Michael Cuevas
61c02ae9ef remove entropy location assumptions from ObjectId hash
Summary:
Having a strict ObjectID format is quite inconvenient. We will need to introduce a new ObjectID format for Eden x Sparse, so it's in our best interest to remove the ObjectID format restrictions before hand.

This will allow us to place the high entropy data (proxy hash in our case) in any location in the ObjectId without causing a ton of hash collisions. This will enable us to introduce FilteredObjectIDs in the form:

`<tree_or_blob_byte><filterset_id><path><ObjectId>`

where the `<ObjectId>` contains the high entropy bits we need to hash.

Reviewed By: xavierd

Differential Revision: D45793298

fbshipit-source-id: 77385e32f63d5f3d1fc37b72b9971f5717cbd872
2023-05-17 17:47:42 -07:00
Michael Cuevas
e691b04a24 Modify ObjectCacheBench to test both long and short IDs
Summary:
We are considering changing the ObjectID hash function to no-longer be constant time. Instead, it might iterate over the bytes of the ID and "mix-in" contents from each 8 byte chunk into a final hash.

In order to measure the performance hit this might have, we need to benchmark both long ObjectIds and short ObjectIDs. This diff introduces a benchmark to test hashing ObjectIDs of length 240 characters long, which is a realistic size of our current ObjectIDs.

Reviewed By: chadaustin

Differential Revision: D45798645

fbshipit-source-id: 988442555f48968edf67517aa25b55ef636de610
2023-05-17 17:47:42 -07:00
Chad Austin
24379db627 enable debugOutstandingNfsCalls on Windows
Summary:
Now that we have NFS support on Windows, we can enable
debugOutstandingNfsCalls.

Reviewed By: genevievehelsel

Differential Revision: D45260222

fbshipit-source-id: 38e7ec6cd38601bd940904695cc69ce2193b98c1
2023-05-17 09:07:32 -07:00
Chad Austin
3f844667ab remove some ifdefs from EdenServiceHandler
Summary:
Now the the ifdefs are isolated to the PrivHelper, we can remove some
from EdenServiceHandler.

Reviewed By: mshroyer

Differential Revision: D45260210

fbshipit-source-id: d0394e45320c516290a6c4323400cc054e76d612
2023-05-17 09:07:32 -07:00
Chad Austin
c508cc8302 use the same PrivHelper interface on all platforms
Summary:
We already had a pretend PrivHelper on Windows. Remove the stub
methods on Windows and provide a Windows implementation of PrivHelper
where most methods are no-ops but the mounts throw a NOT_IMPLEMENTED
error.

Reviewed By: kmancini

Differential Revision: D45260187

fbshipit-source-id: 87ca8679947372e484c345acdd708a17dbb8235e
2023-05-17 09:07:32 -07:00
Chad Austin
85735aed3d cmake: sort subdirectories
Summary:
I was hoping this would shake out some dependency issues, but they
must be triggered by a later diff in the stack.

Reviewed By: xavierd

Differential Revision: D45927428

fbshipit-source-id: ec29b331f561f9bcfe1daa6856ac8cca67e01d39
2023-05-16 20:14:36 -07:00
Chad Austin
5915548f7e cmake: disallow circular dependencies
Summary:
I ended up in a crazy situation where the CMake build was failing to
link because `target_link_libraries` had a cycle. Fix that by
preventing cycles in the first place. CMake is the gift that keeps on
giving.

Reviewed By: xavierd

Differential Revision: D45927359

fbshipit-source-id: 6a378f7935195e42b3446249091898370d6e2ee5
2023-05-16 20:14:36 -07:00
Chad Austin
6fcf6fa3a2 fix a 'control reaches end of non-void function' warning
Summary:
enums can contain arbitrary values, so gcc (and older clang?) complain
about the possibility that none of these cases match.

Reviewed By: xavierd

Differential Revision: D45927298

fbshipit-source-id: 0cd0a946d0faf7442a1a8d5de388a7d4b6dbb274
2023-05-16 20:14:36 -07:00
Chad Austin
5dbf02a176 add VirtualInode::getObjectId
Summary: Add a function to query the (optional) ObjectId from VirtualInode.

Reviewed By: kmancini

Differential Revision: D45673165

fbshipit-source-id: 72dadaf4cbd5120c75548734aca2bb8ae715b8e2
2023-05-16 18:13:53 -07:00
Chad Austin
0a45ac1ddd add an InodeBase::getObjectId accessor
Summary:
Add a function to query the (optional) ObjectId from an arbitrary
inode.

Reviewed By: kmancini

Differential Revision: D45673053

fbshipit-source-id: 23630638ba94bbd1925a39193fa125df04abebad
2023-05-16 18:13:53 -07:00
Chad Austin
598baa101c use EdenMountHandle in getMount
Summary:
I noticed some situations where we don't hold the root inode for the
duration of an asynchronous operation. To make that easier, I
introduced an EdenMountHandle.

Port EdenServer::getMount() to return EdenMountHandle, which
simplifies some Thrift service handlers.

Reviewed By: kmancini

Differential Revision: D45891887

fbshipit-source-id: 99dfaa4aaf609c8b237cceeaa15b91bd26981d02
2023-05-16 15:26:07 -07:00
Chad Austin
ddd3282c61 allow scheduleCallbackOnMainEventBase to run on any thread
Summary:
Localizing knowledge of EventBase implementation details makes logic
easier to follow. Allow calling scheduleCallbackOnMainEventBase on any
thread.

Reviewed By: kmancini

Differential Revision: D45837412

fbshipit-source-id: c169f380ee7b41b38f025eae299a3135bf643fdb
2023-05-16 15:26:07 -07:00
Chad Austin
f6b3196b58 introduce EdenMountHandle
Summary:
Asynchronous operations that must ensure an EdenMount (and its root)
are usable for the duration must hold a reference to the root's
InodePtr, even if they only need the EdenMount.

To make this relationship less implicit, introduce an EdenMountHandle
which is effectively the same as the previous
`pair<EdenMountPtr, TreeInodePtr>`, but more clearly documents the intent
is to preserve the usability of EdenMount and its root inode.

This also allows us to decouple that relationship in the future,
should we want to.

For now, only use EdenMountHandle in getMountPoints. Next, I'll switch
`getMount` to use it.

Reviewed By: kmancini

Differential Revision: D45830176

fbshipit-source-id: 832dd96b9a6fe04fabbb5af0ecbed0173f9d2a2b
2023-05-16 15:26:07 -07:00
Xavier Deguillard
6b40cc2ac9 inodes: remove an implicit lifetime of ObjectStore
Summary:
The EdenMount::getObjectStore gave the assumption to callers that the
ObjectStore lived longer than the EdenMount. Since this assumption is implicit
and not explicit, there is no way to guarantee it by just reading the code in a
local fashion. It forces the reader/auditor to understand the code in its
entirety. Unfortunately, EdenFS contains more of these than can be kept in
memory which leads to bugs and use-after-free.

This can be avoided by breaking the implicit lifetime assumption and simply
returning the shared_ptr. If the caller needs to keep the ObjectStore around,
they can do so explicitely which makes reading the code easier.

Reviewed By: chadaustin

Differential Revision: D45831168

fbshipit-source-id: 8bdb8e708308a8a220e3130d2fc51854c8556cb1
2023-05-15 15:34:14 -07:00
Xavier Deguillard
780fa33138 inodes: move TreeLookupProcessor out of EdenMount.cpp
Summary:
This will be used in a later diff outside of EdenMount.cpp, thus let's move it
to its own file.

Reviewed By: chadaustin

Differential Revision: D45831170

fbshipit-source-id: 1cc55e1ae580ee7f02e3d9c6a717da4751c955e6
2023-05-15 15:34:14 -07:00
Xavier Deguillard
ce5f49e4d7 store: don't deep copy nullptr
Summary:
When a BlobMetadata fails to fetch, the fetch promise is set to a `nullptr` to
force the higher level BackinStore to fetch the full blob. Unfortunately,
`HgImportRequestQueue::markImportAsFinished` attempts to deep copy that
`nullptr` leading to a crash.

Reviewed By: chadaustin

Differential Revision: D45873681

fbshipit-source-id: 3f5b777a3671cf53dd9d605dca2e119eabe3e625
2023-05-15 13:35:12 -07:00
Chad Austin
bf5660efc1 fix a typo and clean up some grammar in eden rm
Summary:
I noticed this special path in `eden rm` misspelled "still". I also
cleaned up the grammar. Sentence fragments aren't capitalized and, to
make the path clearer, I removed the trailing period and split the
message across multiple lines.

(Separately, I think this is special path is not hit as often as was
intended.)

Reviewed By: xavierd

Differential Revision: D45828487

fbshipit-source-id: 183ccde081cb022abbc9e972f00bae8e5b9f33c0
2023-05-14 10:47:25 -07:00
Chad Austin
bd050e06b3 remove the config setting for using our custom kext on macOS
Summary:
We don't have a kext on macOS anymore, so we can remove the
configuration setting that enables it.

If we ever build our own kernel module on Linux, we can bring this back.

Reviewed By: kmancini

Differential Revision: D45260142

fbshipit-source-id: 6f99bdfb3fce236b7a17a665818327f00b5884c0
2023-05-11 18:29:21 -07:00