mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-25 21:54:10 -08:00
Protect NewOOOCompactionHead from an unitialized wbl
Signed-off-by: Jesus Vazquez <jesus.vazquez@grafana.com>
This commit is contained in:
parent
36b04efc7b
commit
f269077855
|
@ -276,16 +276,18 @@ type OOOCompactionHead struct {
|
|||
// All the above together have a bit of CPU and memory overhead, and can have a bit of impact
|
||||
// on the sample append latency. So call NewOOOCompactionHead only right before compaction.
|
||||
func NewOOOCompactionHead(head *Head) (*OOOCompactionHead, error) {
|
||||
newWBLFile, err := head.wbl.NextSegmentSync()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ch := &OOOCompactionHead{
|
||||
chunkRange: head.chunkRange.Load(),
|
||||
mint: math.MaxInt64,
|
||||
maxt: math.MinInt64,
|
||||
lastWBLFile: newWBLFile,
|
||||
lastWBLFile: 0,
|
||||
}
|
||||
if head.wbl != nil {
|
||||
lastWBLFile, err := head.wbl.NextSegmentSync()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ch.lastWBLFile = lastWBLFile
|
||||
}
|
||||
|
||||
ch.oooIR = NewOOOHeadIndexReader(head, math.MinInt64, math.MaxInt64)
|
||||
|
|
Loading…
Reference in a new issue