mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-09 23:24:05 -08:00
TSDB: initialize conflicts map only when we need it.
Suggested by @songjiayang. Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
This commit is contained in:
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…
Reference in a new issue