Skip to content

Commit

Permalink
Remove unnecessary seriesHashCache interface
Browse files Browse the repository at this point in the history
Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>
  • Loading branch information
dimitarvdimitrov committed Dec 15, 2022
1 parent c92d53d commit fd30b11
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
3 changes: 2 additions & 1 deletion pkg/storegateway/bucket_index_postings.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/storage"
"github.com/prometheus/prometheus/tsdb/encoding"
"github.com/prometheus/prometheus/tsdb/hashcache"
"github.com/prometheus/prometheus/tsdb/index"

"github.com/grafana/mimir/pkg/storage/sharding"
Expand Down Expand Up @@ -156,7 +157,7 @@ func (it *bigEndianPostings) length() int {
// filterPostingsByCachedShardHash filters the input postings by the provided shard. It filters only
// postings for which we have their series hash already in the cache; if a series is not in the cache,
// postings will be kept in the output.
func filterPostingsByCachedShardHash(ps []storage.SeriesRef, shard *sharding.ShardSelector, seriesHashCache seriesHashCache) (filteredPostings []storage.SeriesRef, stats queryStats) {
func filterPostingsByCachedShardHash(ps []storage.SeriesRef, shard *sharding.ShardSelector, seriesHashCache *hashcache.BlockSeriesHashCache) (filteredPostings []storage.SeriesRef, stats queryStats) {
writeIdx := 0
stats.seriesHashCacheRequests = len(ps)

Expand Down
10 changes: 1 addition & 9 deletions pkg/storegateway/series_refs.go
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ type loadingSeriesChunkRefsSetIterator struct {
ctx context.Context
postingsSetIterator *postingsSetsIterator
indexr *bucketIndexReader
seriesHashCache seriesHashCache
seriesHashCache *hashcache.BlockSeriesHashCache
indexCache indexcache.IndexCache
stats *safeQueryStats
blockID ulid.ULID
Expand Down Expand Up @@ -905,18 +905,10 @@ type seriesHasher interface {
Hash(seriesID storage.SeriesRef, lset labels.Labels, stats *queryStats) uint64
}

type seriesHashCache interface {
Fetch(seriesID storage.SeriesRef) (uint64, bool)
}

type cachedSeriesHasher struct {
cache *hashcache.BlockSeriesHashCache
}

func (b cachedSeriesHasher) Fetch(seriesID storage.SeriesRef) (uint64, bool) {
return b.cache.Fetch(seriesID)
}

func (b cachedSeriesHasher) Hash(id storage.SeriesRef, lset labels.Labels, stats *queryStats) uint64 {
stats.seriesHashCacheRequests++

Expand Down

0 comments on commit fd30b11

Please sign in to comment.