mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-25 05:34:05 -08: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 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
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -736,7 +736,9 @@ func (h *Head) loadMmappedChunks() (map[uint64][]*mmappedChunk, error) {
|
||||||
slice := mmappedChunks[seriesRef]
|
slice := mmappedChunks[seriesRef]
|
||||||
if len(slice) > 0 {
|
if len(slice) > 0 {
|
||||||
if slice[len(slice)-1].maxTime >= mint {
|
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 a new issue