Unpin any already loaded chunks upon preloading error.

Change-Id: Ib451136e3ef21bce8b814c21b66eaab727ab341b
This commit is contained in:
Julius Volz 2014-08-20 15:05:58 +02:00 committed by Bjoern Rabenstein
parent fd01d07589
commit 15929eece2

View file

@ -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 {