TSDB: initialize conflicts map only when we need it.

Suggested by @songjiayang.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
pull/13040/head
Bryan Boreham 1 year ago
parent e6c0f69f98
commit 65a443e6e3

@ -1707,6 +1707,9 @@ func (m seriesHashmap) set(hash uint64, s *memSeries) {
m.unique[hash] = s
return
}
if m.conflicts == nil {
m.conflicts = make(map[uint64][]*memSeries)
}
l := m.conflicts[hash]
for i, prev := range l {
if labels.Equal(prev.lset, s.lset) {
@ -1786,7 +1789,7 @@ func newStripeSeries(stripeSize int, seriesCallback SeriesLifecycleCallback) *st
for i := range s.hashes {
s.hashes[i] = seriesHashmap{
unique: map[uint64]*memSeries{},
conflicts: map[uint64][]*memSeries{},
conflicts: nil, // Initialized on demand in set().
}
}
return s

Loading…
Cancel
Save