Merge pull request #2197 from influxdb/server_open_race

Lock server during Open()
pull/2199/head
Philip O'Toole 2015-04-08 09:23:54 -07:00
commit 6c7bda097b
2 changed files with 5 additions and 1 deletions

View File

@ -8,6 +8,7 @@
### Bugfixes
- [#2181](https://github.com/influxdb/influxdb/pull/2181): Fix panic on "SHOW DIAGNOSTICS".
- [#2170](https://github.com/influxdb/influxdb/pull/2170): Make sure queries on missing tags return 200 status.
- [#2197](https://github.com/influxdb/influxdb/pull/2197): Lock server during Open().
## v0.9.0-rc20 [2015-04-04]

View File

@ -172,6 +172,9 @@ func (s *Server) metaPath() string {
// Open initializes the server from a given path.
func (s *Server) Open(path string, client MessagingClient) error {
s.mu.Lock()
defer s.mu.Unlock()
// Ensure the server isn't already open and there's a path provided.
if s.opened() {
return ErrServerOpen
@ -224,7 +227,7 @@ func (s *Server) Open(path string, client MessagingClient) error {
return nil
}
// opened returns true when the server is open.
// opened returns true when the server is open. Must be called under lock.
func (s *Server) opened() bool { return s.path != "" }
// Close shuts down the server.