From 89d8467f5c30ce40bccd8a17fa99868c32682c5a Mon Sep 17 00:00:00 2001 From: Fabian Reinartz Date: Mon, 9 Jan 2017 18:07:45 +0100 Subject: [PATCH] Add missing lock --- head.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/head.go b/head.go index a56f3ad2f..07724b965 100644 --- a/head.go +++ b/head.go @@ -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 })