Skip to content
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

Receiver: Handle storage exemplar multi-error #5502

Merged
merged 3 commits into from
Jul 14, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re
- [#5453](https://github.com/thanos-io/thanos/pull/5453) Compact: Skip erroneous empty non `*AggrChunk` chunks during 1h downsampling of 5m resolution blocks.

### Fixed
- [#5502](https://github.com/thanos-io/thanos/pull/5502) Receive: Handle exemplar storage errors as conflict error.

### Added

Expand Down
3 changes: 3 additions & 0 deletions pkg/receive/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,9 @@ func isConflict(err error) bool {
err == storage.ErrDuplicateSampleForTimestamp ||
err == storage.ErrOutOfOrderSample ||
err == storage.ErrOutOfBounds ||
err == storage.ErrDuplicateExemplar ||
err == storage.ErrOutOfOrderExemplar ||
err == storage.ErrExemplarLabelLength ||
status.Code(err) == codes.AlreadyExists
}

Expand Down
23 changes: 23 additions & 0 deletions pkg/receive/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,16 @@ func TestDetermineWriteErrorCause(t *testing.T) {
threshold: 1,
exp: errConflict,
},
{
name: "matching multierror (exemplar error)",
err: errutil.NonNilMultiError([]error{
storage.ErrExemplarLabelLength,
errors.New("foo"),
errors.New("bar"),
}),
threshold: 1,
exp: errConflict,
},
{
name: "matching but below threshold multierror",
err: errutil.NonNilMultiError([]error{
Expand Down Expand Up @@ -139,6 +149,19 @@ func TestDetermineWriteErrorCause(t *testing.T) {
threshold: 2,
exp: errNotReady,
},
{
name: "matching multierror many, one above threshold (exemplar error)",
err: errutil.NonNilMultiError([]error{
tsdb.ErrNotReady,
tsdb.ErrNotReady,
storage.ErrDuplicateExemplar,
storage.ErrDuplicateSampleForTimestamp,
storage.ErrExemplarLabelLength,
errors.New("foo"),
}),
threshold: 2,
exp: errConflict,
},
{
name: "matching multierror many, both above threshold, conflict have precedence",
err: errutil.NonNilMultiError([]error{
Expand Down