Skip to content

Commit

Permalink
Merge pull request #6462 from oldmantaiter/measurement-fields-deadlock
Browse files Browse the repository at this point in the history
Add safer locking to CreateFieldIfNotExists
  • Loading branch information
benbjohnson committed Apr 25, 2016
2 parents c39ff51 + df0e16a commit f608e4c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
- [#6427](https://github.com/influxdata/influxdb/pull/6427): Fix setting uint config options via env vars
- [#6458](https://github.com/influxdata/influxdb/pull/6458): Make it clear when the CLI version is unknown.
- [#3883](https://github.com/influxdata/influxdb/issues/3883): Improve query sanitization to prevent a password leak in the logs.
- [#6462](https://github.com/influxdata/influxdb/pull/6462): Add safer locking to CreateFieldIfNotExists

## v0.12.2 [2016-04-20]

Expand Down
2 changes: 1 addition & 1 deletion tsdb/shard.go
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,7 @@ func (m *MeasurementFields) CreateFieldIfNotExists(name string, typ influxql.Dat
m.mu.RUnlock()

m.mu.Lock()
defer m.mu.Unlock()
if f := m.fields[name]; f != nil {
return nil
}
Expand All @@ -584,7 +585,6 @@ func (m *MeasurementFields) CreateFieldIfNotExists(name string, typ influxql.Dat
}
m.fields[name] = f
m.Codec = NewFieldCodec(m.fields)
m.mu.Unlock()

return nil
}
Expand Down

0 comments on commit f608e4c

Please sign in to comment.