diff --git a/CHANGELOG.md b/CHANGELOG.md index 34794f4da93..84f6a1f710d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## v0.9.0-rc27 [unreleased] + +### Bugfixes +- [#2370](https://github.com/influxdb/influxdb/pull/2370): Fix data race in openTSDB endpoint. + ## v0.9.0-rc26 [04-21-2015] ### Features diff --git a/cmd/influxd/server_integration_test.go b/cmd/influxd/server_integration_test.go index f28057b3fbc..db096c84547 100644 --- a/cmd/influxd/server_integration_test.go +++ b/cmd/influxd/server_integration_test.go @@ -1877,7 +1877,7 @@ func Test_ServerOpenTSDBIntegration(t *testing.T) { createDatabase(t, testName, nodes, "opentsdb") createRetentionPolicy(t, testName, nodes, "opentsdb", "raw", len(nodes)) - // Connect to the graphite endpoint we just spun up + // Connect to the openTSDB endpoint we just spun up host := nodes[0].node.OpenTSDBServer.Addr().String() conn, err := net.Dial("tcp", host) if err != nil { @@ -1933,7 +1933,7 @@ func Test_ServerOpenTSDBIntegration_WithTags(t *testing.T) { createDatabase(t, testName, nodes, "opentsdb") createRetentionPolicy(t, testName, nodes, "opentsdb", "raw", len(nodes)) - // Connect to the graphite endpoint we just spun up + // Connect to the openTSDB endpoint we just spun up host := nodes[0].node.OpenTSDBServer.Addr().String() conn, err := net.Dial("tcp", host) if err != nil { @@ -1992,7 +1992,7 @@ func Test_ServerOpenTSDBIntegration_BadData(t *testing.T) { createDatabase(t, testName, nodes, "opentsdb") createRetentionPolicy(t, testName, nodes, "opentsdb", "raw", len(nodes)) - // Connect to the graphite endpoint we just spun up + // Connect to the openTSDB endpoint we just spun up host := nodes[0].node.OpenTSDBServer.Addr().String() conn, err := net.Dial("tcp", host) if err != nil { diff --git a/opentsdb/opentsdb.go b/opentsdb/opentsdb.go index 16f7e2175e1..848735458a1 100644 --- a/opentsdb/opentsdb.go +++ b/opentsdb/opentsdb.go @@ -37,6 +37,8 @@ type Server struct { listener *net.TCPListener wg sync.WaitGroup + + addr net.Addr } func NewServer(w SeriesWriter, retpol string, db string) *Server { @@ -50,7 +52,7 @@ func NewServer(w SeriesWriter, retpol string, db string) *Server { } func (s *Server) Addr() net.Addr { - return s.listener.Addr() + return s.addr } func (s *Server) ListenAndServe(listenAddress string) { @@ -68,6 +70,8 @@ func (s *Server) ListenAndServe(listenAddress string) { return } + s.addr = s.listener.Addr() + s.wg.Add(1) go func() { defer s.wg.Done()