Add missing lock

This commit is contained in:
Fabian Reinartz 2017-01-09 18:07:45 +01:00
parent 8c31c6e934
commit 89d8467f5c
1 changed files with 4 additions and 0 deletions

View File

@ -406,6 +406,8 @@ func (h *HeadBlock) updateMapping() {
h.mapper.mtx.Lock()
defer h.mapper.mtx.Unlock()
h.mtx.RLock()
if h.mapper.sortable != nil && h.mapper.Len() == len(h.descs) {
return
}
@ -413,6 +415,8 @@ func (h *HeadBlock) updateMapping() {
cds := make([]*chunkDesc, len(h.descs))
copy(cds, h.descs)
h.mtx.RUnlock()
s := slice.SortInterface(cds, func(i, j int) bool {
return labels.Compare(cds[i].lset, cds[j].lset) < 0
})