From f03bb13ac9527ac41d49a7346aa5b162f8639833 Mon Sep 17 00:00:00 2001 From: mreichardt95 Date: Sat, 23 Mar 2019 02:50:47 +0100 Subject: [PATCH] bucket verify: sort metas by MinTime before overlap check --- CHANGELOG.md | 1 + pkg/verifier/overlapped_blocks.go | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eae8477f48..ee5ce49057 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ We use *breaking* word for marking changes that are not backward compatible (rel ### Fixed - [#921](https://github.com/improbable-eng/thanos/pull/921) `thanos_objstore_bucket_last_successful_upload_time` now does not appear when no blocks have been uploaded so far +- [#966](https://github.com/improbable-eng/thanos/pull/966) Bucket: verify no longer warns about overlapping blocks, that overlap `0s` ## [v0.3.2](https://github.com/improbable-eng/thanos/releases/tag/v0.3.2) - 2019.03.04 diff --git a/pkg/verifier/overlapped_blocks.go b/pkg/verifier/overlapped_blocks.go index 675442ace7..072fe54aec 100644 --- a/pkg/verifier/overlapped_blocks.go +++ b/pkg/verifier/overlapped_blocks.go @@ -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" @@ -11,6 +10,7 @@ import ( "github.com/oklog/ulid" "github.com/pkg/errors" "github.com/prometheus/tsdb" + "sort" ) const OverlappedBlocksIssueID = "overlapped_blocks" @@ -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