Commit Graph

689 Commits

Author SHA1 Message Date
Xavier Deguillard
11c0481570 store: remove LocalStore usage from BackingStore::getRootTree
Summary:
Writing to the LocalStore is purely the responsability of the
LocalStoreCachedBackingStore and not of the individual BackingStore. Thus, they
cannot assume that the root Tree is actually stored in it and should just
directly import it.

Reviewed By: chadaustin

Differential Revision: D31340206

fbshipit-source-id: 0f485ceb9fa71f7a7bdc8aaefaa850540075c88c
2021-10-05 19:59:27 -07:00
Andrey Chursin
ae684f3993 explicit Hash20 instead of Hash [proxy hash removal 2/n]
Summary:
This is fairly mechanical diff that finalizes split of Hash into ObjectId and Hash20.

More specifically this diff does two things:
* Replaces `Hash` with `Hash20`
* Removes alias `using Hash = Hash20`

Reviewed By: chadaustin

Differential Revision: D31324202

fbshipit-source-id: 780b6d2a422ddf6d0f3cfc91e3e70ad10ebaa8b4
2021-10-01 12:43:26 -07:00
Andrey Chursin
0af2511a3f separate out ObjectId [proxy hash removal 1/n]
Summary:
The goal of this stack is to remove Proxy Hash type, but to achieve that we need first to address some tech debt in Eden codebase.

For the long time EdenFs had single Hash type that was used for many different use cases.

One of major uses for Hash type is identifies internal EdenFs objects such as blobs, trees, and others.

We seem to reach agreement that we need a different type for those identifiers, so we introduce separate ObjectId type in this diff to denote new identifier type and replace _some_ usage of Hash with ObjectId.

We still retain original Hash type for other use cases.

Roughly speaking, this is how this diff separates between Hash and ObjectId:

**ObjectId**:
* Everything that is stored in local store(blobs, trees, commits)

**Hash20**:
* Explicit hashes(Sha1 of the blob)
* Hg identifiers: manifest id and blob hg ig

For now, in this diff ObjectId has exactly same content as Hash, but this will change in the future diffs. Doing this way allows to keep diff size manageable, while migrating to new ObjectId right away would produce insanely large diff that would be both hard to make and review.

There are few more things that needs to be done before we can get to the meat of removing proxy hashes:

1) Replace include Hash.h with ObjectId.h where needed
2) Remove Hash type, explicitly rename rest of Hash usages to Hash20
3) Modify content of ObjectId to support new use cases
4) Modify serialized metadata and possibly other places that assume ObjectId size is fixed and equal to Hash20 size

Reviewed By: chadaustin

Differential Revision: D31316477

fbshipit-source-id: 0d5e4460a461bcaac6b9fd884517e129aeaf4baf
2021-10-01 10:25:46 -07:00
Xavier Deguillard
aac8694067 store: remove ObjectStore::updateBlobMetadataStats
Summary:
Functions that only takes boolean arguments are fairly confusing and error
prone. Here, since we only ever pass a single true value to it, we could simply
inline setting the right counter in the caller. This makes the code easier to
read, and less error prone.

Reviewed By: genevievehelsel

Differential Revision: D31188413

fbshipit-source-id: 64c019ff52b1ff5644e5bea11a361e586044403f
2021-09-28 16:02:13 -07:00
Genevieve Helsel
a2518bc3d8 fix dynamic cast on backing store for getting tracebus
Summary: fix the dynamic casting for getting a tracebus for the trace hg entrypoint. dynamic cast still makes sense at this point since `trace hg` should only be called on hg backed mounts

Reviewed By: chadaustin

Differential Revision: D31214737

fbshipit-source-id: 65e018e6658d934d8ecd3434bdfc3d72f6873d2b
2021-09-27 17:30:29 -07:00
Genevieve Helsel
55378444c8 remove dynamic cast on backing store for getting the repo name
Summary: instead of dynamic casting to find the repo name, all backing stores can return an optional reponame, and can check if the optional is set.

Reviewed By: zhengchaol

Differential Revision: D31214723

fbshipit-source-id: 9d10114ff6bde13254d3a3caaf2401f87d07ffd7
2021-09-27 17:30:29 -07:00
Xavier Deguillard
7d4cd5f0dd store: remove a superfluous LocalStore read in HgBackingStore::getTreeForRootTreeImpl
Summary:
There is no need to read from the LocalStore twice, the tree is either present
in it, or not.

Reviewed By: chadaustin

Differential Revision: D31187972

fbshipit-source-id: 15bdeef9176b51e6ba3f62ed16550032b0024b94
2021-09-27 09:13:45 -07:00
Xavier Deguillard
6638463109 store: add a LocalStoreCachedBackingStore
Summary:
Some of EdenFS backing store requires EdenFS to cache objects locally to avoid
potentially expensive network fetches, while others already have some form of
local caching. In the past, all backing store fell in the first category, but
thanks to Mercurial's native backing store implementation the LocalStore
caching has become pure overhead for it. Previously, this was worked around by
configuring the LocalStore to not cache blobs locally, but this wasn't done for
trees. This config also conflicts with the need to cache blobs and trees
locally for backing stores in the first category (such as ReCas).

Since we know at construction time what backing store needs local caching, we
can simply wrap these in the newly introduced LocalStoreCachedBackingStore
store.

For now, since the Mercurial backing store always writes a proxy hash to the
LocalStore, bypassing the LocalStore for trees would be a regression due to the
added disk IO. Once proxy hashes are gone for Mercurial, we can remove the
LocalStoreCachedBackingStore wrapper.

Reviewed By: chadaustin

Differential Revision: D31118905

fbshipit-source-id: 4a2958eafeeb8144ee4421ec44dbd30cedceee29
2021-09-27 09:13:45 -07:00
Xavier Deguillard
e6135bbf0a store: return fetch origin from backing store
Summary:
The `ObjectFetchContext::Origin::FromBackingStore` is widely interpreted as
meaning that a network fetch was performed, but for some backing stores, this
isn't true. The Mercurial backing store for instance can either read data from
its on-disk cache, or from the network. Since both have very different
characteristics we shouldn't bundle them in the same enum value.

Since the backing store knows how data was obtained, let's have the backing
store return how it was obtained to enable the ObjectStore to properly record
this information. The `FromBackingStore` is also renamed to make it clearer
what its purpose is.

Reviewed By: zhengchaol

Differential Revision: D31118906

fbshipit-source-id: ee42a0c9d221f870742de07c0df7c732bc79d880
2021-09-23 14:23:30 -07:00
Xavier Deguillard
040ab271cc store: remove storing blob metadata from LocalStore::putBlob
Summary:
The duality of this function is a bit awkward, especially for backing stores
that want metadata caching, but not blob caching. This makes the code in
ObjectStore more complicated that it needs to be.

This will also be used in a future diff.

Reviewed By: chadaustin

Differential Revision: D31090782

fbshipit-source-id: cb7d7fc44d8780f86abad166d0f099675d29e5e7
2021-09-22 11:24:14 -07:00
Xavier Deguillard
c6bb766119 store: reduce copies when fetching trees
Summary:
Similarly to blobs, fetching trees is converting data from HgImportRequest to
individual hashes and proxy hashes vector, making copies of these. This is
inefficient and it makes the code harder to read and understand. Passing the
batch of HgImportRequest directly avoid these copies and makes the code easier
to read.

Reviewed By: fanzeyi

Differential Revision: D30583567

fbshipit-source-id: e85952975141c92f9524095c62418baabf8fefcd
2021-09-22 11:24:14 -07:00
Xavier Deguillard
e74f9524d2 store: eliminate copies from HgDatapackStore::getBlobBatch
Summary:
Both the caller and the function itself are copying data to make sure that the
next function gets the data in the format it desires. This makes the code
complicated to read as well as inefficient as each conversion ends up being a
copy.

We can simply pass the HgImportRequest directly to avoid both of these issues
which removes all the copies.

A similar change will be done for the getTreeBatch function, after which the
HgDatapackStore will be folded onto the HgBackingStore code.

Reviewed By: fanzeyi

Differential Revision: D30563706

fbshipit-source-id: bb392f89e691c22ff9ad4df0d365ddb62077e657
2021-09-22 11:24:14 -07:00
Xavier Deguillard
e9de9e1fe5 backingstore: rename refresh method to flush
Summary:
The intent behind the refresh method is to both read new data from the disk,
but also to flush the in-memory write buffer to disk. The name "flush" is used
in the revisionstore code to mean the latter, thus let's use "flush" in the
rest of the codebase.

Reviewed By: kmancini

Differential Revision: D30947873

fbshipit-source-id: c85a6abe770a47d6ce454d6af1fa73e505194a22
2021-09-21 10:22:11 -07:00
Chad Austin
49e49f9fc2 replace most folly:format uses
Summary:
folly:format is deprecated in lieu of fmt and std::format. Migrate
most of EdenFS to fmt instead.

Differential Revision: D31025948

fbshipit-source-id: 82ed674d5e255ac129995b56bc8b9731a5fbf82e
2021-09-20 16:23:22 -07:00
Andrey Chursin
008167cb0e deprecate scs proxy hash
Summary:
The tree metadata fetching evolution goes as follow
(1) (commit, path) scs query
(2) tree manifest scs query [we are here]
(3) eden api manifest query [in development]

Option (1) is no longer used and is the only placed that required scs proxy hash.
Removing it will simplify transition from (2) to (3) and also cleans up bunch of unused code.

It also comes with minor performance improvement, saving about 5% on file access time.
To be precise, this is measured by running fsprobe [this is probably too little to measure in high noise benchmark like running arc focus]:
```
fsprobe.sh run cat.targets --parallel 24
```

Results:
```
W/ scshash:
P24: 0.1044 0.1007 0.1005 (hot) 0.1019 avg

W/o scshash:
P24: 0.0954 0.0964 0.1008 (hot) 0.0975 avg
```

This performance improvement comes from the fact, that even though scs hash was never created or used, we still attempted to load it from scs table, and even though this load always failed it contributed to execution time.

Reviewed By: xavierd

Differential Revision: D30942663

fbshipit-source-id: af84f1e5658e7d8d9fb6853cbb88f02b49cd050b
2021-09-14 19:52:15 -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
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
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
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
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
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
70e58cb755 store: inline HgQueuedBackingStore::recordFetch
Summary:
This is now only used in HgQueuedBackingStore::logBackingStoreFetch, and
manually inlining it allows for the lock to be taken once instead of once per
path, reducing the number of times the lock needs to be acquired.

Differential Revision: D30494771

fbshipit-source-id: 2d59d0343e48051e4d9c4fc196e66bcb79e7ac71
2021-08-23 15:09:05 -07:00
Zhengchao Liu
4fdca8e9ff report imports queue time through fb303
Summary: While `eden trace hg` already prints queue time when it's over 1ms, this diff adds fb303 counters for import tree/block queue time so that we can have the percentiles.

Reviewed By: xavierd

Differential Revision: D30492275

fbshipit-source-id: 3601aeb9b51b2f55f189a0e0a753fd6ef29d7341
2021-08-23 14:20:58 -07:00
Zhengchao Liu
c7f0cb8deb collect tree imports in batch instead of waiting sequentially
Summary: Currently, the store loops through the requests, calls HgImporter, then waits with `getTry`. This diff makes the change to kickoff all tree imports from HgImporter then waits for future fulfillment with `collectAll`.

Reviewed By: xavierd

Differential Revision: D30486459

fbshipit-source-id: 918e52be818a2064cf04d24f455d23c1ca618434
2021-08-23 14:20:57 -07:00
Xavier Deguillard
dff7a4b49e store: deduplicate HgQueuedBackingStore::logBackingStoreFetch a bit
Summary:
Instead of having 2 functions with one taking a single proxy hash, and the
other taking a vector, we can simply have a single function taking a
`folly::Range` and pass a range of one for the single proxy hash case.

Reviewed By: chadaustin

Differential Revision: D30490724

fbshipit-source-id: 5d57f5a5ffc2a5085369c61a2318edd54b24b448
2021-08-23 13:11:51 -07:00
Xavier Deguillard
8127fe0b4b store: make isRecordingFetch_ a relaxed atomic
Summary:
By default, atomics are using the most strict memory ordering forcing barriers
to be used. Since this atomic doesn't need any ordering, we can make it
relaxed.

Reviewed By: chadaustin

Differential Revision: D30459630

fbshipit-source-id: ff50aac919031d9bae8b870b41a6134331546a5f
2021-08-23 11:05:03 -07:00
Xavier Deguillard
ae518f2784 store: devirtualize BackingStore::recordFetch
Summary:
The recordFetch is an implementation detail of a BackingStore and thus we don't
need to explicitely make it virtual.

Differential Revision: D30459635

fbshipit-source-id: 34f847ca906f81924c99c26b4e8af646e91fd735
2021-08-23 11:05:03 -07:00
Xavier Deguillard
98235fe149 store: speed up batching by checking the access logging config only once
Summary:
When prefetching a large number of blobs, repeatly checking whether we should
log accesses to files can become expensive. Since the state of the config isn't
expected to change in the entire batch, we can simply test it once and bail if
logging isn't enabled.

Reviewed By: chadaustin

Differential Revision: D30458698

fbshipit-source-id: b48b9e0ad24585a76d8ce5948f5831db27e08eab
2021-08-23 11:05:03 -07:00
Xavier Deguillard
8a6c320d1e config: remove telemetry:log-object-fetch-path
Summary: Looks like we never use this, thus let's simply remove it.

Differential Revision: D30454812

fbshipit-source-id: 28242a2144da4bab9d24debc1a60eeebcdcbaad5
2021-08-23 11:05:02 -07:00
Xavier Deguillard
6f1f1ba653 store: on prefetch query RocksDB concurrently
Summary:
When a prefetch request is transformed into many blob requests, we query
RocksDB sequentially for all the proxy hashes, this can be quite expensive and
is also far less efficient than querying RocksDB concurrently with all the
hashes.

As a bonus, this also futurize the code a bit.

Reviewed By: chadaustin

Differential Revision: D30454068

fbshipit-source-id: 5fd238b752a662919e739451c0c1e92f66919ebf
2021-08-23 11:05:02 -07:00
Xavier Deguillard
86fe6e5486 store: convert some futures to semifuture
Summary:
Since these are always used as SemiFuture, let's simply make them SemiFuture
from the get go.

Differential Revision: D30452901

fbshipit-source-id: b0863f363ce0cdb921a73d02c43fc82c1614a3dc
2021-08-23 11:05:02 -07:00
Xavier Deguillard
fe0ea26fdf store: avoid copying proxy hashes during prefetch
Summary:
Looking at strobelight when performing an `eden prefetch` shows that a lot of
time is spent copying data around. The list of hash to prefetch is for instance
copied 4 times, let's reduce this to only one time when converting Hash to a
ByteRange.

Reviewed By: chadaustin

Differential Revision: D30433285

fbshipit-source-id: 922e6e5c095bd700ee133e9bb219904baf2ae1ac
2021-08-23 11:05:02 -07:00
Xavier Deguillard
f23abe309f store: reduce critical section for HgImportRequestQueue::markImportAsFinished
Summary:
Once the request has been dequeued, we no longer need to hold the lock, thus
let's release it to allow other threads to enqueue/dequeue requests.

Differential Revision: D30409797

fbshipit-source-id: a527c67a6bd9f47da5a3930364fd8fae0d1bc427
2021-08-23 11:05:02 -07:00
Yipu Miao
ff67f9214e Pass getTreeEntryForRootId to ObjectStore
Summary: This will add the same getTreeEntryForRootId to ObjectStore

Reviewed By: chadaustin

Differential Revision: D29920475

fbshipit-source-id: 15bfc6a2ba70cce2095dfcf1f434fd7087605e04
2021-08-20 17:11:23 -07:00
Yipu Miao
a721dd3ef3 Add getTreeEntryForRootId API to BackingStore to get a tree entry by RootId
Summary: Add a new method to backingstore so we can get TreeEntry by rootID

Reviewed By: chadaustin

Differential Revision: D29889482

fbshipit-source-id: 93e63624e75c7d559c4de6f68821a8efa0e0c184
2021-08-20 17:11:23 -07:00
Xavier Deguillard
a9cfd737ac store: do not sanitize the RelativePath stored in ProxyHash
Summary:
The RelativePath is always built from a valid valid one, thus re-validating it
is not necessary.

Reviewed By: chadaustin

Differential Revision: D30410686

fbshipit-source-id: 3e46359f68b1693a0a2af310466fc73d105cf2c0
2021-08-19 15:13:48 -07:00
Xavier Deguillard
b2d658e98d store: speedup EdenAPI blob prefetch
Summary:
By default, a prefetch will always go through the Mercurial importer, but
when store:use-eden-native-prefetch is set, prefetch is simply pushing tons of
blob requests to the HgQueuedBackingStore, and the internal batching takes care
of efficiently fetching.

The one drawback is that prior to pushing a blob request to the queue, getBlob
will query Mercurial to see if a blob is present locally. In the context of a
FUSE access, this is totally expected as this allows for low latency blob
access. But for a prefetch call, throughput matters significantly more and the
local check can negatively affect this.

Reviewed By: genevievehelsel

Differential Revision: D30404965

fbshipit-source-id: 113883993fa641caf7095a5bc8b7dd802f33348d
2021-08-18 15:57:46 -07:00
Xavier Deguillard
819660a10d store: add a comment regarding EdenAPI in the batching code
Summary:
As I'm looking through the code, it took me a bit of time to fully grasp what
the commented code was for, document it for future readers.

Reviewed By: chadaustin

Differential Revision: D30399723

fbshipit-source-id: bdf448b725192d7541b1d7de7e043ff97700dbce
2021-08-18 12:16:05 -07:00
Xavier Deguillard
7ad8a1b6c6 store: remove dead HgBackingStore::getBlob
Summary: This is never called, no need to keep it around.

Reviewed By: chadaustin

Differential Revision: D30399722

fbshipit-source-id: bbc169141b58976031fcae224f24ea23897c6f21
2021-08-18 12:16:05 -07:00
Xavier Deguillard
92e8e76b06 store: replace throwing exceptions with static_assert
Summary:
If a wrong type is passed in, an exception would be thrown at runtime, while
the static_assert would fire at compiled time, reducing the time to find the
error for the developer.

Reviewed By: chadaustin

Differential Revision: D30398255

fbshipit-source-id: fd021f96063565f83c55a9bf3f175bf879afa6ed
2021-08-18 12:16:05 -07:00
Xavier Deguillard
5538bc6dd5 refresh datastore if root tree is not found locally
Summary:
This is a re-submit of D29915585 (6c5c7055ce), I've merely fixed the bug that it introduced,
thus the credit goes to markbt. Below is the original commit message:

If Mercurial asks EdenFS to update to a commit that it has just created, this
can cause a long delay while EdenFS tries to import the commit.

EdenFS needs to get the trees out of the Hg data store.  But these also won't
know about the new trees until the data store is refreshed or synced.

To fix this, call the refresh method on the store if we fail to find the tree,
and try again.  To make this work, we must first only look locally. To keep
things simple, we only do this for the root tree.

However, currently indexedlogdatastore doesn't actually do anything when you
ask it to refresh.

To fix these, we call flush(),  which actually does a sync operation and loads
the latest data from disk, too.

Reviewed By: chadaustin

Differential Revision: D30387805

fbshipit-source-id: 3fdbd27b306f03df53b68a0bcc5ee5dc140326bb
2021-08-18 11:29:53 -07:00
Jessica Vandebon
48629a5aca extend top dirs predictive prefetch option to support optional parameter specification
Summary:
The SmartPlatform service that queries for a user's most used directories allows optional parameters of: os, startTime, endTime, and sandcastleAlias instead of user. This diff extends the current predictive prefetch option which queries based on the current user, mount repository, and a default numResults, to allow specification of all parameters including the optional ones.

If a user and/or repo is not specified these are determined from the server state and mount, respectively. If numResults is not specified, a default value is used (predictivePrefetchProfileSize, currently 10,000).

For sandcastle aliases, we check if the SANDCASTLE_ALIAS environment variable is set, and if so, use the value as a parameter. If a sandcastle alias is specified, the smartservice will ignore the user and query based on the alias, otherwise a user is assumed.

Differential Revision: D30160507

fbshipit-source-id: 174797f0a6f840bb33f669c8d1bb61d76ff7a309
2021-08-18 06:42:17 -07:00
Zeyi (Rice) Fan
9972bda5dd Back out "refresh datastore if root tree is not found locally"
Summary:
Original commit changeset: 34fe02ddf580

We are seeing reports of EdenFS only showing partial directories to our user. Local testing shows this commit seems to be causing the issue. Reverting it for now.

Reviewed By: kmancini

Differential Revision: D30136949

fbshipit-source-id: 7fcc81506c132055a5b639a383b8c9be68118dc5
2021-08-05 14:08:42 -07:00