From b07878c292cf3ea8b403b5e5bd69a0ef22099926 Mon Sep 17 00:00:00 2001 From: Mark Juggurnauth-Thomas Date: Mon, 4 Mar 2024 02:48:42 -0800 Subject: [PATCH] hg_mutation_store: simplify fetching of all predecessors Summary: Currently we fetch the target mutation entries and then expand them out to their predecessors. This is left over from the method that used primordial lookups, but is no longer necessary as the recursive CTE can return all that we need. Reviewed By: mitrandir77 Differential Revision: D54375207 fbshipit-source-id: d7da1f48ac5a3545ba192c171b513bad338b2cf6 --- eden/mononoke/mercurial/mutation/src/store.rs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/eden/mononoke/mercurial/mutation/src/store.rs b/eden/mononoke/mercurial/mutation/src/store.rs index 38bed69e1f3eb..769efdec206ef 100644 --- a/eden/mononoke/mercurial/mutation/src/store.rs +++ b/eden/mononoke/mercurial/mutation/src/store.rs @@ -430,13 +430,10 @@ impl SqlHgMutationStore { connection: &Connection, sql_perf_counter: PerfCounterType, entry_set: &mut HgMutationEntrySet, + changesets: &HashSet, ) -> Result<()> { - if entry_set.entries.is_empty() { - return Ok(()); - } - let chunks = entry_set - .entries - .keys() + let chunks = changesets + .iter() .chunks(SELECT_CHAIN_CHUNK_SIZE) .into_iter() .map(|chunk| chunk.copied().collect::>()) @@ -605,7 +602,7 @@ impl HgMutationStore for SqlHgMutationStore { let (connection, sql_perf_counter) = self .read_connection_for_changesets(ctx, &changeset_ids) .await?; - self.fetch_by_successor( + self.fetch_all_predecessors( ctx, connection, sql_perf_counter, @@ -613,8 +610,6 @@ impl HgMutationStore for SqlHgMutationStore { &changeset_ids, ) .await?; - self.fetch_all_predecessors(ctx, connection, sql_perf_counter, &mut entry_set) - .await?; let changeset_count = changeset_ids.len(); let entries = entry_set.into_all_predecessors_by_changeset(changeset_ids); debug!(