mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
Add guard against non-monotonic samples in series
This can only happen due to data corruption.
This commit is contained in:
parent
233a25a060
commit
876e5da4f8
|
@ -14,6 +14,7 @@
|
||||||
package local
|
package local
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"sort"
|
"sort"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
@ -496,6 +497,10 @@ func (s *memorySeries) preloadChunksForRange(
|
||||||
if throughIdx == len(s.chunkDescs) {
|
if throughIdx == len(s.chunkDescs) {
|
||||||
throughIdx--
|
throughIdx--
|
||||||
}
|
}
|
||||||
|
if fromIdx > throughIdx {
|
||||||
|
// Guard against nonsensical result. The caller will quarantine the series with a meaningful log entry.
|
||||||
|
return nopIter, fmt.Errorf("fromIdx=%d is greater than throughIdx=%d, likely caused by data corruption", fromIdx, throughIdx)
|
||||||
|
}
|
||||||
|
|
||||||
pinIndexes := make([]int, 0, throughIdx-fromIdx+1)
|
pinIndexes := make([]int, 0, throughIdx-fromIdx+1)
|
||||||
for i := fromIdx; i <= throughIdx; i++ {
|
for i := fromIdx; i <= throughIdx; i++ {
|
||||||
|
|
Loading…
Reference in a new issue