Skip to content

Commit c05fe0b

Browse files
authored
Fix labelset race condition (#6573)
Signed-off-by: SungJin1212 <[email protected]>
1 parent 8accaa9 commit c05fe0b

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Diff for: CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* [ENHANCEMENT] Querier: Apply bytes limiter to LabelNames and LabelValuesForLabelNames. #6568
77
* [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
88
* [BUGFIX] Ingester: Avoid error or early throttling when READONLY ingesters are present in the ring #6517
9+
* [BUGFIX] Ingester: Fix labelset data race condition. #6573
910

1011
## 1.19.0 in progress
1112

Diff for: pkg/ingester/user_state.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,14 @@ func (m *labelSetCounter) canAddSeriesForLabelSet(ctx context.Context, u *userTS
131131

132132
func (m *labelSetCounter) backFillLimit(ctx context.Context, u *userTSDB, forceBackfill bool, allLimits []validation.LimitsPerLabelSet, limit validation.LimitsPerLabelSet, s *labelSetCounterShard) (int, error) {
133133
s.Lock()
134+
defer s.Unlock()
134135
// If not force backfill, use existing counter value.
135136
if !forceBackfill {
136137
if r, ok := s.valuesCounter[limit.Hash]; ok {
137-
s.Unlock()
138138
return r.count, nil
139139
}
140140
}
141141

142-
defer s.Unlock()
143142
ir, err := u.db.Head().Index()
144143
if err != nil {
145144
return 0, err

0 commit comments

Comments
 (0)