Skip to content

Commit 59d8af6

Browse files
authored
profileStore: fix unlocking rowsLock (#3422)
There is an error check of err value from cutRowGroup call. If cutRowGroup returns err, the rowsLock seem to be never released
1 parent dd0aa0c commit 59d8af6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/phlaredb/profile_store.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,8 @@ func (s *profileStore) cutRowGroup(count int) (err error) {
284284
// held for long as it only performs in-memory operations,
285285
// although blocking readers.
286286
s.rowsLock.Lock()
287+
// After the lock is released, rows/profiles should be read from the disk.
288+
defer s.rowsLock.Unlock()
287289
s.rowsFlushed += uint64(n)
288290
s.rowGroups = append(s.rowGroups, rowGroup)
289291
// Cutting the index is relatively quick op (no I/O).
@@ -303,8 +305,6 @@ func (s *profileStore) cutRowGroup(count int) (err error) {
303305

304306
level.Debug(s.logger).Log("msg", "cut row group segment", "path", path, "numProfiles", n)
305307
s.metrics.sizeBytes.WithLabelValues(s.Name()).Set(float64(currentSize))
306-
// After the lock is released, rows/profiles should be read from the disk.
307-
s.rowsLock.Unlock()
308308
return nil
309309
}
310310

0 commit comments

Comments
 (0)