Skip to content

Commit

Permalink
shards: use selectRepoSet in List
Browse files Browse the repository at this point in the history
Currently we have unindexed search asking Zoekt what commit it has for a
very specific repository. In normal search we use selectRepoSet to avoid
searching shards which are unrelated to the query. This uses the same
optimization in List.

Test Plan: go test
  • Loading branch information
keegancsmith committed Mar 26, 2024
1 parent 4c883fd commit c926740
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion shards/shards.go
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,17 @@ func (ss *shardedSearcher) List(ctx context.Context, r query.Q, opts *zoekt.List
Repos: []*zoekt.RepoListEntry{},
}

shards := loaded.shards
// PERF: Select the subset of shards that we will search over for the given
// query. A common List query only asks for a specific repo, so this is an
// important optimization.
tr.LazyPrintf("before selectRepoSet shards:%d", len(loaded.shards))
shards, r := selectRepoSet(loaded.shards, r)
tr.LazyPrintf("after selectRepoSet shards:%d %s", len(shards), r)

if len(shards) == 0 {
return &agg, nil
}

shardCount := len(shards)
all := make(chan shardListResult, shardCount)
tr.LazyPrintf("shardCount: %d", len(shards))
Expand Down

0 comments on commit c926740

Please sign in to comment.