Skip to content

Commit 9b6903b

Browse files
authored
Receiver: Handle storage exemplar multi-error (#5502)
* Handle exemplar store errors as conflict Signed-off-by: Matej Gera <[email protected]> * Adjust tests Signed-off-by: Matej Gera <[email protected]> * Update CHANGELOG Signed-off-by: Matej Gera <[email protected]>
1 parent 1e64191 commit 9b6903b

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re
1212
- [#5453](https://github.com/thanos-io/thanos/pull/5453) Compact: Skip erroneous empty non `*AggrChunk` chunks during 1h downsampling of 5m resolution blocks.
1313

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

1617
### Added
1718

pkg/receive/handler.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -815,6 +815,9 @@ func isConflict(err error) bool {
815815
err == storage.ErrDuplicateSampleForTimestamp ||
816816
err == storage.ErrOutOfOrderSample ||
817817
err == storage.ErrOutOfBounds ||
818+
err == storage.ErrDuplicateExemplar ||
819+
err == storage.ErrOutOfOrderExemplar ||
820+
err == storage.ErrExemplarLabelLength ||
818821
status.Code(err) == codes.AlreadyExists
819822
}
820823

pkg/receive/handler_test.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,16 @@ func TestDetermineWriteErrorCause(t *testing.T) {
104104
threshold: 1,
105105
exp: errConflict,
106106
},
107+
{
108+
name: "matching multierror (exemplar error)",
109+
err: errutil.NonNilMultiError([]error{
110+
storage.ErrExemplarLabelLength,
111+
errors.New("foo"),
112+
errors.New("bar"),
113+
}),
114+
threshold: 1,
115+
exp: errConflict,
116+
},
107117
{
108118
name: "matching but below threshold multierror",
109119
err: errutil.NonNilMultiError([]error{
@@ -139,6 +149,19 @@ func TestDetermineWriteErrorCause(t *testing.T) {
139149
threshold: 2,
140150
exp: errNotReady,
141151
},
152+
{
153+
name: "matching multierror many, one above threshold (exemplar error)",
154+
err: errutil.NonNilMultiError([]error{
155+
tsdb.ErrNotReady,
156+
tsdb.ErrNotReady,
157+
storage.ErrDuplicateExemplar,
158+
storage.ErrDuplicateSampleForTimestamp,
159+
storage.ErrExemplarLabelLength,
160+
errors.New("foo"),
161+
}),
162+
threshold: 2,
163+
exp: errConflict,
164+
},
142165
{
143166
name: "matching multierror many, both above threshold, conflict have precedence",
144167
err: errutil.NonNilMultiError([]error{

0 commit comments

Comments
 (0)