Skip to content

Commit

Permalink
bucket verify: sort metas by MinTime before overlap check
Browse files Browse the repository at this point in the history
  • Loading branch information
mreichardt95 committed Mar 23, 2019
1 parent e756fe1 commit e814dfa
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/verifier/overlapped_blocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package verifier

import (
"context"

"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
"github.com/improbable-eng/thanos/pkg/block"
Expand All @@ -11,6 +10,7 @@ import (
"github.com/oklog/ulid"
"github.com/pkg/errors"
"github.com/prometheus/tsdb"
"sort"
)

const OverlappedBlocksIssueID = "overlapped_blocks"
Expand Down Expand Up @@ -66,6 +66,11 @@ func fetchOverlaps(ctx context.Context, logger log.Logger, bkt objstore.Bucket)

overlaps := map[string]tsdb.Overlaps{}
for k, groupMetas := range metas {

sort.Slice(groupMetas, func(i, j int) bool {
return groupMetas[i].MinTime < groupMetas[j].MinTime
})

o := tsdb.OverlappingBlocks(groupMetas)
if len(o) > 0 {
overlaps[k] = o
Expand Down

0 comments on commit e814dfa

Please sign in to comment.