Skip to content

Commit

Permalink
Fix panic when droppping measurement while writing to it concurrently
Browse files Browse the repository at this point in the history
Fixes #2608
jwilder committed Jun 29, 2015

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 3f0b951 commit 3fa348d
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -42,6 +42,7 @@
- [#3155](https://github.com/influxdb/influxdb/pull/3155): Instantiate UDP batcher before listening for UDP traffic, otherwise a panic may result.
- [#2678](https://github.com/influxdb/influxdb/issues/2678): Server allows tags with an empty string for the key and/or value
- [#3061](https://github.com/influxdb/influxdb/issues/3061): syntactically incorrect line protocol insert panics the database
- [#2608](https://github.com/influxdb/influxdb/issues/2608): drop measurement while writing points to that measurement has race condition that can panic

## v0.9.0 [2015-06-11]

6 changes: 6 additions & 0 deletions tsdb/shard.go
Original file line number Diff line number Diff line change
@@ -243,6 +243,12 @@ func (s *Shard) WritePoints(points []Point) error {
s.mu.RLock()
mf := s.measurementFields[p.Name()]
s.mu.RUnlock()

// If a measurement is dropped while writes for it are in progress, this could be nil
if mf == nil {
return ErrFieldNotFound
}

data, err := mf.codec.EncodeFields(p.Fields())
if err != nil {
return err

0 comments on commit 3fa348d

Please sign in to comment.