Skip to content

Commit

Permalink
hg_mutation_store: make mutation length limit configurable and lower …
Browse files Browse the repository at this point in the history
…the default

Summary: Very long mutation chains can cause issues with database overload, and in practice we rarely need to fetch that far back.  Make the limit configurable via justknob and reduce the default.

Reviewed By: liubov-dmitrieva

Differential Revision: D54119114

fbshipit-source-id: a47893d8c8ea7e5de88ebaf13151bdac6f2e7a02
  • Loading branch information
markbt authored and facebook-github-bot committed Feb 28, 2024
1 parent 41bda52 commit a7d0aa1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion eden/mononoke/mercurial/mutation/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use sql_ext::SqlConnections;

use crate::store::SqlHgMutationStore;

const DEFAULT_MUTATION_CHAIN_LIMIT: usize = 500;
const DEFAULT_MUTATION_CHAIN_LIMIT: usize = 20;

#[allow(unused)]
pub struct SqlHgMutationStoreBuilder {
Expand Down
12 changes: 9 additions & 3 deletions eden/mononoke/repo_factory/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1033,11 +1033,17 @@ impl RepoFactory {
repo_config: &ArcRepoConfig,
repo_identity: &ArcRepoIdentity,
) -> Result<ArcHgMutationStore> {
let hg_mutation_store = self
let mut builder = self
.open_sql::<SqlHgMutationStoreBuilder>(repo_config)
.await
.context(RepoFactoryError::HgMutationStore)?
.with_repo_id(repo_identity.id());
.context(RepoFactoryError::HgMutationStore)?;
if let Ok(mutation_limit) = justknobs::get_as::<usize>(
"scm/mononoke:mutation_chain_length_limit",
Some(repo_identity.name()),
) {
builder = builder.with_mutation_limit(mutation_limit);
}
let hg_mutation_store = builder.with_repo_id(repo_identity.id());

if let Some(cache_handler_factory) = self.cache_handler_factory("hg_mutation_store")? {
Ok(Arc::new(CachedHgMutationStore::new(
Expand Down
1 change: 1 addition & 0 deletions eden/mononoke/tests/integration/just_knobs.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"scm/mononoke:derivation_worker_sleep_duration_ms": 250,
"scm/mononoke:commit_graph_prefetch_step_limit": 4,
"scm/mononoke:megarepo_override_squashing_limit": 0,
"scm/mononoke:mutation_chain_length_limit": 20,
"scm/mononoke:repo_client_gettreepack_buffer_size": 1000,
"scm/mononoke:repo_client_max_nodes_in_known_method": 100000,
"scm/mononoke:repo_client_concurrent_blob_uploads": 1000,
Expand Down

0 comments on commit a7d0aa1

Please sign in to comment.