Update tsdb/compact.go

Co-authored-by: George Krajcsovits <krajorama@users.noreply.github.com>
This commit is contained in:
Arve Knudsen 2023-10-09 11:43:46 +02:00 committed by GitHub
parent a7737ab3ac
commit 27d0e12f32
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -233,7 +233,14 @@ func (c *LeveledCompactor) Plan(dir string) ([]string, error) {
func (c *LeveledCompactor) plan(dms []dirMeta) ([]string, error) {
slices.SortFunc(dms, func(a, b dirMeta) int {
return int(a.meta.MinTime - b.meta.MinTime)
switch {
case a.meta.MinTime < b.meta.MinTime:
return -1
case a.meta.MinTime > b.meta.MinTime:
return 1
default:
return 0
}
})
res := c.selectOverlappingDirs(dms)