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:
Aliaksandr Valialkin 2024-06-11 17:30:34 +02:00
parent 4ad1f8ee3a
commit 65a97317e4
No known key found for this signature in database
GPG key ID: 52C003EE2BCDB9EB

View file

@ -196,7 +196,7 @@ func (das *dedupAggrShard) flush(ctx *dedupFlushCtx, f func(samples []pushSample
das.m = make(map[string]*dedupAggrSample, len(m))
das.sizeBytes.Store(0)
das.itemsCount.Store(0)
das.samplesBuf = das.samplesBuf[:0]
das.samplesBuf = make([]dedupAggrSample, 0, len(das.samplesBuf))
}
das.mu.Unlock()