Skip to content

Commit

Permalink
fix: correctly handle PartialWriteError (#23098)
Browse files Browse the repository at this point in the history
Check for the correctly returned PartialWriteError
in (*shard).validateSeriesAndFields, allow partial
writes.

closes #23096
  • Loading branch information
davidby-influx authored Feb 2, 2022
1 parent 2a957c9 commit b8ccf5b
Showing 1 changed file with 6 additions and 3 deletions.
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

0 comments on commit b8ccf5b

Please sign in to comment.