Treat empty chunkDescs properly in preloadChunksForRange.

Change-Id: Ida1bd3fe1f9fb0ea2d5dbb9704be926f0824f873
This commit is contained in:
Bjoern Rabenstein 2014-10-09 12:49:32 +02:00
parent 934d09f738
commit 1c53c09558

View file

@ -403,7 +403,7 @@ func (s *memorySeries) loadChunkDescs(p *persistence) error {
// preloadChunksForRange loads chunks for the given range from the persistence.
// The caller must have locked the fingerprint of the series.
func (s *memorySeries) preloadChunksForRange(from clientmodel.Timestamp, through clientmodel.Timestamp, p *persistence) (chunkDescs, error) {
if !s.chunkDescsLoaded && from.Before(s.chunkDescs[0].firstTime()) {
if !s.chunkDescsLoaded && (len(s.chunkDescs) == 0 || from.Before(s.chunkDescs[0].firstTime())) {
if err := s.loadChunkDescs(p); err != nil {
return nil, err
}