Merge pull request #13007 from zenador/update-tsdb-ooo-head-read-overflow

Very minor refactor of the integer overflow fix
pull/13009/head
Julien Pivotto 1 year ago committed by GitHub
commit 88de3d4491
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -178,42 +178,36 @@ type chunkMetaAndChunkDiskMapperRef struct {
}
func refLessByMinTimeAndMinRef(a, b chunkMetaAndChunkDiskMapperRef) int {
if a.meta.MinTime == b.meta.MinTime {
switch {
case a.meta.Ref < b.meta.Ref:
return -1
case a.meta.Ref > b.meta.Ref:
return 1
default:
return 0
}
}
switch {
case a.meta.MinTime < b.meta.MinTime:
return -1
case a.meta.MinTime > b.meta.MinTime:
return 1
}
switch {
case a.meta.Ref < b.meta.Ref:
return -1
case a.meta.Ref > b.meta.Ref:
return 1
default:
return 0
}
}
func lessByMinTimeAndMinRef(a, b chunks.Meta) int {
if a.MinTime == b.MinTime {
switch {
case a.Ref < b.Ref:
return -1
case a.Ref > b.Ref:
return 1
default:
return 0
}
}
switch {
case a.MinTime < b.MinTime:
return -1
case a.MinTime > b.MinTime:
return 1
}
switch {
case a.Ref < b.Ref:
return -1
case a.Ref > b.Ref:
return 1
default:
return 0
}

Loading…
Cancel
Save