mirror of
https://github.com/prometheus/prometheus
synced 2024-12-26 00:23:18 +00:00
fix: return a corruption error when iterator function find a chunk that is out of sequence (#7855)
Signed-off-by: sunyukun <sunyukun@didiglobal.com> Co-authored-by: sunyukun <sunyukun@didiglobal.com>
This commit is contained in:
parent
267dd17fe7
commit
cfd4e05c9e
@ -633,6 +633,11 @@ func (cdm *ChunkDiskMapper) IterateAllChunks(f func(seriesRef, chunkRef uint64,
|
||||
}
|
||||
|
||||
if err := f(seriesRef, chunkRef, mint, maxt, numSamples); err != nil {
|
||||
if cerr, ok := err.(*CorruptionErr); ok {
|
||||
cerr.Dir = cdm.dir.Name()
|
||||
cerr.FileIndex = segID
|
||||
return cerr
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
@ -736,7 +736,9 @@ func (h *Head) loadMmappedChunks() (map[uint64][]*mmappedChunk, error) {
|
||||
slice := mmappedChunks[seriesRef]
|
||||
if len(slice) > 0 {
|
||||
if slice[len(slice)-1].maxTime >= mint {
|
||||
return errors.Errorf("out of sequence m-mapped chunk for series ref %d", seriesRef)
|
||||
return &chunks.CorruptionErr{
|
||||
Err: errors.Errorf("out of sequence m-mapped chunk for series ref %d", seriesRef),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user