Merge pull request #270 from prometheus/fix/expression/index-error

Revert "Ensure that all extracted samples are added to view."
This commit is contained in:
Matt T. Proud 2013-05-23 06:27:27 -07:00
commit fe5c70fc61
3 changed files with 13 additions and 13 deletions

View File

@ -200,23 +200,21 @@ func (s *memorySeriesStorage) AppendSample(sample model.Sample) error {
return nil return nil
} }
// Append raw samples, bypassing indexing. Only used to add data to views, // Append raw sample, bypassing indexing. Only used to add data to views, which
// which don't need to lookup by metric. // don't need to lookup by metric.
func (s *memorySeriesStorage) appendSamplesWithoutIndexing(fingerprint *model.Fingerprint, samples model.Values) { func (s *memorySeriesStorage) appendSampleWithoutIndexing(f *model.Fingerprint, timestamp time.Time, value model.SampleValue) {
s.RLock() s.RLock()
series, ok := s.fingerprintToSeries[*fingerprint] series, ok := s.fingerprintToSeries[*f]
s.RUnlock() s.RUnlock()
if !ok { if !ok {
series = newStream(model.Metric{}) series = newStream(model.Metric{})
s.Lock() s.Lock()
s.fingerprintToSeries[*fingerprint] = series s.fingerprintToSeries[*f] = series
s.Unlock() s.Unlock()
} }
for _, sample := range samples { series.add(timestamp, value)
series.add(sample.Timestamp, sample.Value)
}
} }
func (s *memorySeriesStorage) GetFingerprintsForLabelSet(l model.LabelSet) (fingerprints model.Fingerprints, err error) { func (s *memorySeriesStorage) GetFingerprintsForLabelSet(l model.LabelSet) (fingerprints model.Fingerprints, err error) {

View File

@ -348,12 +348,14 @@ func (t *TieredStorage) renderView(viewJob viewJob) {
for op.CurrentTime() != nil && !op.CurrentTime().After(targetTime) { for op.CurrentTime() != nil && !op.CurrentTime().After(targetTime) {
out = op.ExtractSamples(model.Values(currentChunk)) 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. // Throw away standing ops which are finished.
filteredOps := ops{} filteredOps := ops{}
for _, op := range standingOps { for _, op := range standingOps {

View File

@ -105,8 +105,8 @@ type view struct {
*memorySeriesStorage *memorySeriesStorage
} }
func (v view) appendSamples(fingerprint *model.Fingerprint, samples model.Values) { func (v view) appendSample(fingerprint *model.Fingerprint, timestamp time.Time, value model.SampleValue) {
v.memorySeriesStorage.appendSamplesWithoutIndexing(fingerprint, samples) v.memorySeriesStorage.appendSampleWithoutIndexing(fingerprint, timestamp, value)
} }
func newView() view { func newView() view {