mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
Code Review: Swap ordering of watermark getting.
A test for Julius.
This commit is contained in:
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)
|
wm, cacheHit := t.wmCache.Get(f)
|
||||||
if !cacheHit {
|
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{}
|
value := &dto.MetricHighWatermark{}
|
||||||
diskHit, err := t.DiskStorage.MetricHighWatermarks.Get(f.ToDTO(), value)
|
diskHit, err := t.DiskStorage.MetricHighWatermarks.Get(f.ToDTO(), value)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -320,21 +330,10 @@ func (t *TieredStorage) seriesTooOld(f *model.Fingerprint, i time.Time) (bool, e
|
||||||
if diskHit {
|
if diskHit {
|
||||||
wmTime := time.Unix(*value.Timestamp, 0).UTC()
|
wmTime := time.Unix(*value.Timestamp, 0).UTC()
|
||||||
t.wmCache.Set(f, &Watermarks{High: wmTime})
|
t.wmCache.Set(f, &Watermarks{High: wmTime})
|
||||||
|
|
||||||
return wmTime.Before(i), nil
|
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
|
|
||||||
}
|
|
||||||
|
|
||||||
newest := samples[0].Timestamp
|
|
||||||
t.wmCache.Set(f, &Watermarks{High: newest})
|
|
||||||
|
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue