store: do not look in the LocalStore when blob caching is disabled

Summary:
Querying RocksDB for a blob that we know is not present is expensive, and will
always construct a StoreResult::missing which does allocate memory for that to
simply be dropped. We can revamp the StoreResult a bit, but for now let's
simply not query RocksDB.

In theory, if RocksDB is populated with blobs this can be a loss as more
request will need to go to the hgcache, in practice, RocksDB local caching has
been disabled for so long that we'll always get cache misses.

Reviewed By: fanzeyi

Differential Revision: D28592666

fbshipit-source-id: 49f48097e81eddb4f9c3eba7af774baf018b0821
This commit is contained in:
Xavier Deguillard 2021-05-21 19:25:42 -07:00 committed by Facebook GitHub Bot
parent b73674c009
commit 73cba2becc

View File

@ -109,6 +109,10 @@ folly::Future<std::unique_ptr<Tree>> LocalStore::getTree(const Hash& id) const {
}
folly::Future<std::unique_ptr<Blob>> LocalStore::getBlob(const Hash& id) const {
if (!enableBlobCaching) {
return std::unique_ptr<Blob>(nullptr);
}
return getFuture(KeySpace::BlobFamily, id.getBytes())
.thenValue([id](StoreResult&& data) {
if (!data.isValid()) {