diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c6b937cdb..19467b7461 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ * [ENHANCEMENT] Querier: Apply bytes limiter to LabelNames and LabelValuesForLabelNames. #6568 * [ENHANCEMENT] Query Frontend: Add a `too_many_tenants` reason label value to `cortex_rejected_queries_total` metric to track the rejected query count due to the # of tenant limits. #6569 * [BUGFIX] Ingester: Avoid error or early throttling when READONLY ingesters are present in the ring #6517 +* [BUGFIX] Ingester: Fix labelset data race condition. #6573 ## 1.19.0 in progress diff --git a/pkg/ingester/user_state.go b/pkg/ingester/user_state.go index 8518bbb5b8..9ef89d48a9 100644 --- a/pkg/ingester/user_state.go +++ b/pkg/ingester/user_state.go @@ -131,15 +131,14 @@ func (m *labelSetCounter) canAddSeriesForLabelSet(ctx context.Context, u *userTS func (m *labelSetCounter) backFillLimit(ctx context.Context, u *userTSDB, forceBackfill bool, allLimits []validation.LimitsPerLabelSet, limit validation.LimitsPerLabelSet, s *labelSetCounterShard) (int, error) { s.Lock() + defer s.Unlock() // If not force backfill, use existing counter value. if !forceBackfill { if r, ok := s.valuesCounter[limit.Hash]; ok { - s.Unlock() return r.count, nil } } - defer s.Unlock() ir, err := u.db.Head().Index() if err != nil { return 0, err