Code Review: Swap ordering of watermark getting.

A test for Julius.
pull/311/head
Matt T. Proud 12 years ago
parent ee840904d2
commit 5daa0a09ea

@ -311,6 +311,16 @@ func (t *TieredStorage) seriesTooOld(f *model.Fingerprint, i time.Time) (bool, e
wm, cacheHit := t.wmCache.Get(f)
if !cacheHit {
if t.memoryArena.HasFingerprint(f) {
samples := t.memoryArena.CloneSamples(f)
if len(samples) > 0 {
newest := samples[0].Timestamp
t.wmCache.Set(f, &Watermarks{High: newest})
return newest.Before(i), nil
}
}
value := &dto.MetricHighWatermark{}
diskHit, err := t.DiskStorage.MetricHighWatermarks.Get(f.ToDTO(), value)
if err != nil {
@ -320,21 +330,10 @@ func (t *TieredStorage) seriesTooOld(f *model.Fingerprint, i time.Time) (bool, e
if diskHit {
wmTime := time.Unix(*value.Timestamp, 0).UTC()
t.wmCache.Set(f, &Watermarks{High: wmTime})
return wmTime.Before(i), nil
}
if !t.memoryArena.HasFingerprint(f) {
return true, nil
}
samples := t.memoryArena.CloneSamples(f)
if len(samples) == 0 {
return true, nil
return wmTime.Before(i), nil
}
newest := samples[0].Timestamp
t.wmCache.Set(f, &Watermarks{High: newest})
return false, nil
}

Loading…
Cancel
Save