mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-26 22:19:40 -08:00
Add missing lock
This commit is contained in:
parent
8c31c6e934
commit
89d8467f5c
4
head.go
4
head.go
|
@ -406,6 +406,8 @@ func (h *HeadBlock) updateMapping() {
|
||||||
h.mapper.mtx.Lock()
|
h.mapper.mtx.Lock()
|
||||||
defer h.mapper.mtx.Unlock()
|
defer h.mapper.mtx.Unlock()
|
||||||
|
|
||||||
|
h.mtx.RLock()
|
||||||
|
|
||||||
if h.mapper.sortable != nil && h.mapper.Len() == len(h.descs) {
|
if h.mapper.sortable != nil && h.mapper.Len() == len(h.descs) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -413,6 +415,8 @@ func (h *HeadBlock) updateMapping() {
|
||||||
cds := make([]*chunkDesc, len(h.descs))
|
cds := make([]*chunkDesc, len(h.descs))
|
||||||
copy(cds, h.descs)
|
copy(cds, h.descs)
|
||||||
|
|
||||||
|
h.mtx.RUnlock()
|
||||||
|
|
||||||
s := slice.SortInterface(cds, func(i, j int) bool {
|
s := slice.SortInterface(cds, func(i, j int) bool {
|
||||||
return labels.Compare(cds[i].lset, cds[j].lset) < 0
|
return labels.Compare(cds[i].lset, cds[j].lset) < 0
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue