From 4b30fb86b41729e0a3c2b289534fb007abf57b33 Mon Sep 17 00:00:00 2001 From: "Matt T. Proud" Date: Thu, 23 May 2013 13:36:22 +0200 Subject: [PATCH] Revert "Ensure that all extracted samples are added to view." This reverts commit 008314b5a8c099f7e2d191da85c53d2a235db518. By running an automated git bisection described in https://gist.github.com/matttproud-soundcloud/22a371a8d2cba382ea64 this commit was found. --- storage/metric/memory.go | 14 ++++++-------- storage/metric/tiered.go | 8 +++++--- storage/metric/view.go | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/storage/metric/memory.go b/storage/metric/memory.go index 3dea6946e..136423652 100644 --- a/storage/metric/memory.go +++ b/storage/metric/memory.go @@ -200,23 +200,21 @@ func (s *memorySeriesStorage) AppendSample(sample model.Sample) error { return nil } -// Append raw samples, bypassing indexing. Only used to add data to views, -// which don't need to lookup by metric. -func (s *memorySeriesStorage) appendSamplesWithoutIndexing(fingerprint *model.Fingerprint, samples model.Values) { +// Append raw sample, bypassing indexing. Only used to add data to views, which +// don't need to lookup by metric. +func (s *memorySeriesStorage) appendSampleWithoutIndexing(f *model.Fingerprint, timestamp time.Time, value model.SampleValue) { s.RLock() - series, ok := s.fingerprintToSeries[*fingerprint] + series, ok := s.fingerprintToSeries[*f] s.RUnlock() if !ok { series = newStream(model.Metric{}) s.Lock() - s.fingerprintToSeries[*fingerprint] = series + s.fingerprintToSeries[*f] = series s.Unlock() } - for _, sample := range samples { - series.add(sample.Timestamp, sample.Value) - } + series.add(timestamp, value) } func (s *memorySeriesStorage) GetFingerprintsForLabelSet(l model.LabelSet) (fingerprints model.Fingerprints, err error) { diff --git a/storage/metric/tiered.go b/storage/metric/tiered.go index 7976d2420..98f9e1d87 100644 --- a/storage/metric/tiered.go +++ b/storage/metric/tiered.go @@ -348,12 +348,14 @@ func (t *TieredStorage) renderView(viewJob viewJob) { for op.CurrentTime() != nil && !op.CurrentTime().After(targetTime) { out = op.ExtractSamples(model.Values(currentChunk)) - - // Append the extracted samples to the materialized view. - view.appendSamples(scanJob.fingerprint, out) } } + // Append the extracted samples to the materialized view. + for _, sample := range out { + view.appendSample(scanJob.fingerprint, sample.Timestamp, sample.Value) + } + // Throw away standing ops which are finished. filteredOps := ops{} for _, op := range standingOps { diff --git a/storage/metric/view.go b/storage/metric/view.go index 1330e6eac..a0ef8af7f 100644 --- a/storage/metric/view.go +++ b/storage/metric/view.go @@ -105,8 +105,8 @@ type view struct { *memorySeriesStorage } -func (v view) appendSamples(fingerprint *model.Fingerprint, samples model.Values) { - v.memorySeriesStorage.appendSamplesWithoutIndexing(fingerprint, samples) +func (v view) appendSample(fingerprint *model.Fingerprint, timestamp time.Time, value model.SampleValue) { + v.memorySeriesStorage.appendSampleWithoutIndexing(fingerprint, timestamp, value) } func newView() view {