From e036a85d5bc9c9fc149e645ce255529c7ba93166 Mon Sep 17 00:00:00 2001 From: Ben Ye Date: Tue, 6 Jun 2023 15:47:01 -0700 Subject: [PATCH] fix lint Signed-off-by: Ben Ye --- pkg/store/bucket.go | 2 -- pkg/store/bucket_e2e_test.go | 1 - pkg/store/cache/cache.go | 2 +- pkg/store/cache/inmemory.go | 2 +- 4 files changed, 2 insertions(+), 5 deletions(-) diff --git a/pkg/store/bucket.go b/pkg/store/bucket.go index 175e73578ae..81d8c57f4b8 100644 --- a/pkg/store/bucket.go +++ b/pkg/store/bucket.go @@ -2545,8 +2545,6 @@ func (r *bucketIndexReader) fetchPostings(ctx context.Context, keys []labels.Lab return err } - dataToCache := pBytes - // Reencode postings before storing to cache. If that fails, we store original bytes. // This can only fail, if postings data was somehow corrupted, // and there is nothing we can do about it. diff --git a/pkg/store/bucket_e2e_test.go b/pkg/store/bucket_e2e_test.go index 920a9b014f0..886536fae9e 100644 --- a/pkg/store/bucket_e2e_test.go +++ b/pkg/store/bucket_e2e_test.go @@ -70,7 +70,6 @@ func (c *swappableCache) StoreExpandedPostings(blockID ulid.ULID, matchers []*la c.ptr.StoreExpandedPostings(blockID, matchers, v) } -// FetchExpandedPostings fetches expanded postings. func (c *swappableCache) FetchExpandedPostings(ctx context.Context, blockID ulid.ULID, matchers []*labels.Matcher) ([]byte, bool) { return c.ptr.FetchExpandedPostings(ctx, blockID, matchers) } diff --git a/pkg/store/cache/cache.go b/pkg/store/cache/cache.go index 7014743e9b8..043ec895297 100644 --- a/pkg/store/cache/cache.go +++ b/pkg/store/cache/cache.go @@ -42,7 +42,7 @@ type IndexCache interface { // StoreExpandedPostings stores expanded postings for a set of label matchers. StoreExpandedPostings(blockID ulid.ULID, matchers []*labels.Matcher, v []byte) - // FetchExpandedPostings fetches expanded postings. + // FetchExpandedPostings fetches expanded postings and returns cached data and a boolean value representing whether it is a cache hit or not. FetchExpandedPostings(ctx context.Context, blockID ulid.ULID, matchers []*labels.Matcher) ([]byte, bool) // StoreSeries stores a single series. diff --git a/pkg/store/cache/inmemory.go b/pkg/store/cache/inmemory.go index f17e6448416..73ee1192e5f 100644 --- a/pkg/store/cache/inmemory.go +++ b/pkg/store/cache/inmemory.go @@ -324,7 +324,7 @@ func (c *InMemoryIndexCache) StoreExpandedPostings(blockID ulid.ULID, matchers [ c.set(cacheTypeExpandedPostings, cacheKey{block: blockID.String(), key: cacheKeyExpandedPostings(labelMatchersToString(matchers))}, v) } -// FetchExpandedPostings fetches expanded postings. +// FetchExpandedPostings fetches expanded postings and returns cached data and a boolean value representing whether it is a cache hit or not. func (c *InMemoryIndexCache) FetchExpandedPostings(_ context.Context, blockID ulid.ULID, matchers []*labels.Matcher) ([]byte, bool) { if b, ok := c.get(cacheTypeExpandedPostings, cacheKey{blockID.String(), cacheKeyExpandedPostings(labelMatchersToString(matchers))}); ok { return b, true