mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/streamaggr: prevent from data race inside dedupAggrShard when samplesBuf can be updated in pushSamples() while their values are read in the flush() loop without das.mu lock
This issue has been introduced in the commit 253c0cffbe
This commit is contained in:
parent
4ad1f8ee3a
commit
65a97317e4
1 changed files with 1 additions and 1 deletions
|
@ -196,7 +196,7 @@ func (das *dedupAggrShard) flush(ctx *dedupFlushCtx, f func(samples []pushSample
|
||||||
das.m = make(map[string]*dedupAggrSample, len(m))
|
das.m = make(map[string]*dedupAggrSample, len(m))
|
||||||
das.sizeBytes.Store(0)
|
das.sizeBytes.Store(0)
|
||||||
das.itemsCount.Store(0)
|
das.itemsCount.Store(0)
|
||||||
das.samplesBuf = das.samplesBuf[:0]
|
das.samplesBuf = make([]dedupAggrSample, 0, len(das.samplesBuf))
|
||||||
}
|
}
|
||||||
|
|
||||||
das.mu.Unlock()
|
das.mu.Unlock()
|
||||||
|
|
Loading…
Reference in a new issue