Skip to content

Commit

Permalink
hg_mutation_store: simplify fetching of all predecessors
Browse files Browse the repository at this point in the history
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
  • Loading branch information
markbt authored and facebook-github-bot committed Mar 4, 2024
1 parent b79e0f6 commit b07878c
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions eden/mononoke/mercurial/mutation/src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -430,13 +430,10 @@ impl SqlHgMutationStore {
connection: &Connection,
sql_perf_counter: PerfCounterType,
entry_set: &mut HgMutationEntrySet,
changesets: &HashSet<HgChangesetId>,
) -> 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::<Vec<_>>())
Expand Down Expand Up @@ -605,16 +602,14 @@ 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,
&mut entry_set,
&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!(
Expand Down

0 comments on commit b07878c

Please sign in to comment.