From db076c8e9e196991f87cb04a68a7320dc87a7d53 Mon Sep 17 00:00:00 2001 From: Filip Petkovski Date: Tue, 1 Aug 2023 08:53:10 +0200 Subject: [PATCH] Use index header to read labels Signed-off-by: Filip Petkovski --- pkg/store/bucket.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/pkg/store/bucket.go b/pkg/store/bucket.go index e886139dea..20ec05072a 100644 --- a/pkg/store/bucket.go +++ b/pkg/store/bucket.go @@ -1670,16 +1670,13 @@ func (s *BucketStore) LabelNames(ctx context.Context, req *storepb.LabelNamesReq func (s *BucketStore) UpdateLabelNames() { newSet := stringset.New() for _, b := range s.blocks { - indexr := b.indexReader() - defer runutil.CloseWithLogOnErr(b.logger, indexr, "label names") - - res, err := indexr.block.indexHeaderReader.LabelNames() + labelNames, err := b.indexHeaderReader.LabelNames() if err != nil { level.Warn(s.logger).Log("msg", "error getting label names", "block", b.meta.ULID, "err", err.Error()) s.updateLabelNamesSet(stringset.AllStrings()) return } - for _, l := range res { + for _, l := range labelNames { newSet.Insert(l) } }