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

fix: correctly handle PartialWriteError #23098

Merged
merged 1 commit into from
Feb 2, 2022
Merged
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
9 changes: 6 additions & 3 deletions tsdb/shard.go
Original file line number Diff line number Diff line change
Expand Up @@ -737,14 +737,17 @@ func (s *Shard) validateSeriesAndFields(points []models.Point) ([]models.Point,
var droppedKeys [][]byte
if err := engine.CreateSeriesListIfNotExists(keys, names, tagsSlice); err != nil {
switch err := err.(type) {
// TODO(jmw): why is this a *PartialWriteError when everything else is not a pointer?
// Maybe we can just change it to be consistent if we change it also in all
// the places that construct it.
// (DSB) This was previously *PartialWriteError. Now catch pointer and value types.
case *PartialWriteError:
reason = err.Reason
dropped += err.Dropped
droppedKeys = err.DroppedKeys
s.stats.writesDropped.Add(float64(err.Dropped))
case PartialWriteError:
reason = err.Reason
dropped += err.Dropped
droppedKeys = err.DroppedKeys
s.stats.writesDropped.Add(float64(err.Dropped))
default:
return nil, nil, err
}
Expand Down