|
|
@ -473,7 +473,7 @@ func (t *tieredStorage) loadChunkAroundTime(iterator leveldb.Iterator, frontier
|
|
|
|
Fingerprint: fingerprint.ToDTO(),
|
|
|
|
Fingerprint: fingerprint.ToDTO(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
foundKey model.SampleKey
|
|
|
|
foundKey model.SampleKey
|
|
|
|
foundValue *dto.SampleValueSeries
|
|
|
|
foundValues model.Values
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// Limit the target key to be within the series' keyspace.
|
|
|
|
// Limit the target key to be within the series' keyspace.
|
|
|
@ -510,9 +510,9 @@ func (t *tieredStorage) loadChunkAroundTime(iterator leveldb.Iterator, frontier
|
|
|
|
rewound = true
|
|
|
|
rewound = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
foundValue, err = extractSampleValues(iterator)
|
|
|
|
foundValues, err = extractSampleValues(iterator)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// If we rewound, but the target time is still past the current block, return
|
|
|
|
// If we rewound, but the target time is still past the current block, return
|
|
|
@ -520,33 +520,25 @@ func (t *tieredStorage) loadChunkAroundTime(iterator leveldb.Iterator, frontier
|
|
|
|
if rewound {
|
|
|
|
if rewound {
|
|
|
|
foundKey, err = extractSampleKey(iterator)
|
|
|
|
foundKey, err = extractSampleKey(iterator)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
currentChunkLastTime := foundKey.LastTimestamp
|
|
|
|
currentChunkLastTime := foundKey.LastTimestamp
|
|
|
|
|
|
|
|
|
|
|
|
if ts.After(currentChunkLastTime) {
|
|
|
|
if ts.After(currentChunkLastTime) {
|
|
|
|
sampleCount := len(foundValue.Value)
|
|
|
|
sampleCount := len(foundValues)
|
|
|
|
chunk = append(chunk, model.SamplePair{
|
|
|
|
chunk = append(chunk, foundValues[sampleCount-1])
|
|
|
|
Timestamp: time.Unix(*foundValue.Value[sampleCount-1].Timestamp, 0),
|
|
|
|
|
|
|
|
Value: model.SampleValue(*foundValue.Value[sampleCount-1].Value),
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
// We know there's a next block since we have rewound from it.
|
|
|
|
// We know there's a next block since we have rewound from it.
|
|
|
|
iterator.Next()
|
|
|
|
iterator.Next()
|
|
|
|
|
|
|
|
|
|
|
|
foundValue, err = extractSampleValues(iterator)
|
|
|
|
foundValues, err = extractSampleValues(iterator)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Now append all the samples of the currently seeked block to the output.
|
|
|
|
// Now append all the samples of the currently seeked block to the output.
|
|
|
|
for _, sample := range foundValue.Value {
|
|
|
|
chunk = append(chunk, foundValues...)
|
|
|
|
chunk = append(chunk, model.SamplePair{
|
|
|
|
|
|
|
|
Timestamp: time.Unix(*sample.Timestamp, 0),
|
|
|
|
|
|
|
|
Value: model.SampleValue(*sample.Value),
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|