diff --git a/eden/fs/config/EdenConfig.h b/eden/fs/config/EdenConfig.h index 374f7b7fe6..d47534d24b 100644 --- a/eden/fs/config/EdenConfig.h +++ b/eden/fs/config/EdenConfig.h @@ -176,6 +176,13 @@ class EdenConfig : public ConfigSettingManager { return fuseDaemonTimeout_.getValue(); } + /** + * Controls if Eden reads from Mercurial's datapack store. + */ + bool getUseDatapack() const { + return useDatapack_.getValue(); + } + void setUserConfigPath(AbsolutePath userConfigPath); void setSystemConfigDir(AbsolutePath systemConfigDir); @@ -317,6 +324,8 @@ class EdenConfig : public ConfigSettingManager { "fuse:daemon-timeout", std::chrono::nanoseconds::max(), this}; + + ConfigSetting useDatapack_{"hg:use-datapack", false, this}; }; } // namespace eden } // namespace facebook diff --git a/eden/fs/store/hg/HgBackingStore.cpp b/eden/fs/store/hg/HgBackingStore.cpp index 81ddb43278..3a4e5d5f36 100644 --- a/eden/fs/store/hg/HgBackingStore.cpp +++ b/eden/fs/store/hg/HgBackingStore.cpp @@ -664,19 +664,23 @@ folly::Future HgBackingStore::importTreeManifest(const Hash& commitId) { } Future> HgBackingStore::getBlob(const Hash& id) { + auto edenConfig = config_->getEdenConfig(); + // Look up the mercurial path and file revision hash, // which we need to import the data from mercurial HgProxyHash hgInfo(localStore_, id, "importFileContents"); #if EDEN_HAVE_RUST_DATAPACK - if (useDatapackGetBlob_ && datapackStore_) { + if (edenConfig->getUseDatapack() && datapackStore_) { if (auto content = datapackStore_->getBlob(id, hgInfo)) { + XLOG(DBG5) << "importing file contents of '" << hgInfo.path() << "', " + << hgInfo.revHash().toString() << " from datapack store"; return makeFuture(std::move(content)); } } else #endif // Prefer using the above rust implementation over the C++ implementation - if (useDatapackGetBlob_ && unionStore_) { + if (edenConfig->getUseDatapack() && unionStore_) { auto content = getBlobFromUnionStore(*unionStore_->wlock(), id, hgInfo); if (content) { return makeFuture(std::move(content)); diff --git a/eden/fs/store/hg/HgBackingStore.h b/eden/fs/store/hg/HgBackingStore.h index c36be3228b..edd15f7e62 100644 --- a/eden/fs/store/hg/HgBackingStore.h +++ b/eden/fs/store/hg/HgBackingStore.h @@ -198,7 +198,6 @@ class HgBackingStore : public BackingStore { // UnionDatapackStore is alive. std::vector> dataPackStores_; std::unique_ptr> unionStore_; - bool useDatapackGetBlob_{false}; std::string repoName_; folly::Synchronized> mononoke_;