Skip to content

Fixed issue that shuffle sharding planner return error if block is under visit by other compactor #5188

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
* [BUGFIX] Ring: Fix case when dynamodb kv reaches the limit of 25 actions per batch call. #5136
* [BUGFIX] Query-frontend: Fix shardable instant queries do not produce sorted results for `sort`, `sort_desc`, `topk`, `bottomk` functions. #5148, #5170
* [BUGFIX] Querier: Fix `/api/v1/series` returning 5XX instead of 4XX when limits are hit. #5169
* [BUGFIX] Compactor: Fix issue that shuffle sharding planner return error if block is under visit by other compactor. #5188
* [FEATURE] Alertmanager: Add support for time_intervals. #5102

## 1.14.0 2022-12-02
Expand Down
4 changes: 3 additions & 1 deletion pkg/compactor/shuffle_sharding_planner.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"time"

"github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/oklog/ulid"
"github.com/prometheus/client_golang/prometheus"
"github.com/thanos-io/objstore"
Expand Down Expand Up @@ -79,7 +80,8 @@ func (p *ShuffleShardingPlanner) Plan(_ context.Context, metasByMinTime []*metad
return nil, fmt.Errorf("unable to get visit marker file for block %s: %s", blockID, err.Error())
}
if !blockVisitMarker.isVisitedByCompactor(p.blockVisitMarkerTimeout, p.ringLifecyclerID) {
return nil, fmt.Errorf("block %s is not visited by current compactor %s", blockID, p.ringLifecyclerID)
level.Warn(p.logger).Log("msg", "block is not visited by current compactor", "block_id", blockID, "compactor_id", p.ringLifecyclerID)
return nil, nil
}

resultMetas = append(resultMetas, b)
Expand Down
4 changes: 2 additions & 2 deletions pkg/compactor/shuffle_sharding_planner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ func TestShuffleShardingPlanner_Plan(t *testing.T) {
compactorID: otherCompactor,
},
},
expectedErr: fmt.Errorf("block %s is not visited by current compactor %s", block1ulid.String(), currentCompactor),
expected: []*metadata.Meta{},
},
"test should not compact if visit marker file is expired": {
ranges: []int64{2 * time.Hour.Milliseconds()},
Expand All @@ -333,7 +333,7 @@ func TestShuffleShardingPlanner_Plan(t *testing.T) {
compactorID: currentCompactor,
},
},
expectedErr: fmt.Errorf("block %s is not visited by current compactor %s", block1ulid.String(), currentCompactor),
expected: []*metadata.Meta{},
},
}

Expand Down