From 4dfc7a2e774cb85ca68494ce6dc414cf998e35f3 Mon Sep 17 00:00:00 2001 From: Ganesh Vernekar <15064823+codesome@users.noreply.github.com> Date: Tue, 8 Oct 2019 11:17:40 +0530 Subject: [PATCH] Remove unnecessary lock in loadWAL (#6107) Signed-off-by: Ganesh Vernekar --- tsdb/head.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/tsdb/head.go b/tsdb/head.go index 495532cdb8..99ed5f241e 100644 --- a/tsdb/head.go +++ b/tsdb/head.go @@ -331,11 +331,10 @@ func (h *Head) loadWAL(r *wal.Reader, multiRef map[uint64]uint64) (err error) { // They are connected through a ring of channels which ensures that all sample batches // read from the WAL are processed in order. var ( - wg sync.WaitGroup - multiRefLock sync.Mutex - n = runtime.GOMAXPROCS(0) - inputs = make([]chan []record.RefSample, n) - outputs = make([]chan []record.RefSample, n) + wg sync.WaitGroup + n = runtime.GOMAXPROCS(0) + inputs = make([]chan []record.RefSample, n) + outputs = make([]chan []record.RefSample, n) ) wg.Add(n) @@ -394,9 +393,7 @@ func (h *Head) loadWAL(r *wal.Reader, multiRef map[uint64]uint64) (err error) { if !created { // There's already a different ref for this series. - multiRefLock.Lock() multiRef[s.Ref] = series.ref - multiRefLock.Unlock() } if h.lastSeriesID < s.Ref {