mirror of
https://github.com/prometheus/prometheus
synced 2025-01-14 19:02:38 +00:00
Ensure lastMmapRef set to 0 if mmapRefs is empty
Signed-off-by: Carrie Edwards <edwrdscarrie@gmail.com>
This commit is contained in:
parent
79b53bd3de
commit
02f05cbf2c
@ -349,12 +349,17 @@ func NewOOOCompactionHead(ctx context.Context, head *Head) (*OOOCompactionHead,
|
||||
continue
|
||||
}
|
||||
|
||||
var lastMmapRef chunks.ChunkDiskMapperRef
|
||||
mmapRefs := ms.mmapCurrentOOOHeadChunk(head.chunkDiskMapper)
|
||||
if len(mmapRefs) == 0 && len(ms.ooo.oooMmappedChunks) > 0 {
|
||||
// Nothing was m-mapped. So take the mmapRef from the existing slice if it exists.
|
||||
mmapRefs = []chunks.ChunkDiskMapperRef{ms.ooo.oooMmappedChunks[len(ms.ooo.oooMmappedChunks)-1].ref}
|
||||
}
|
||||
lastMmapRef := mmapRefs[len(mmapRefs)-1]
|
||||
if len(mmapRefs) == 0 {
|
||||
lastMmapRef = 0
|
||||
} else {
|
||||
lastMmapRef = mmapRefs[len(mmapRefs)-1]
|
||||
}
|
||||
seq, off := lastMmapRef.Unpack()
|
||||
if seq > lastSeq || (seq == lastSeq && off > lastOff) {
|
||||
ch.lastMmapRef, lastSeq, lastOff = lastMmapRef, seq, off
|
||||
|
Loading…
Reference in New Issue
Block a user