From 15929eece22f8f7586c9674ed390a12dad246051 Mon Sep 17 00:00:00 2001 From: Julius Volz Date: Wed, 20 Aug 2014 15:05:58 +0200 Subject: [PATCH] Unpin any already loaded chunks upon preloading error. Change-Id: Ib451136e3ef21bce8b814c21b66eaab727ab341b --- storage/local/series.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/storage/local/series.go b/storage/local/series.go index 1d0d4c6f4..f4bac78fe 100644 --- a/storage/local/series.go +++ b/storage/local/series.go @@ -226,7 +226,12 @@ func (s *memorySeries) preloadChunks(indexes []int, p Persistence) (chunkDescs, fp := s.metric.Fingerprint() chunks, err := p.LoadChunks(fp, loadIndexes) if err != nil { - // TODO: unpin all chunks that were already loaded before. + // Unpin any pinned chunks that were already loaded. + for _, cd := range pinnedChunkDescs { + if cd.chunk != nil { + cd.unpin() + } + } return nil, err } for i, c := range chunks {