Merge pull request #5511 from seiflotfy/master
Initialize MetaClient before setting it up as a data and/or meta nodepull/5513/head
commit
5a9953eec1
|
@ -35,6 +35,7 @@
|
||||||
- [#5455](https://github.com/influxdata/influxdb/issues/5455): panic: runtime error: slice bounds out of range when loading corrupted wal segment
|
- [#5455](https://github.com/influxdata/influxdb/issues/5455): panic: runtime error: slice bounds out of range when loading corrupted wal segment
|
||||||
- [#5478](https://github.com/influxdata/influxdb/issues/5478): panic: interface conversion: interface is float64, not int64
|
- [#5478](https://github.com/influxdata/influxdb/issues/5478): panic: interface conversion: interface is float64, not int64
|
||||||
- [#5475](https://github.com/influxdata/influxdb/issues/5475): Ensure appropriate exit code returned for non-interactive use of CLI.
|
- [#5475](https://github.com/influxdata/influxdb/issues/5475): Ensure appropriate exit code returned for non-interactive use of CLI.
|
||||||
|
- [#5479](https://github.com/influxdata/influxdb/issues/5479): Bringing up a node as a meta only node causes panic
|
||||||
|
|
||||||
## v0.9.6 [2015-12-09]
|
## v0.9.6 [2015-12-09]
|
||||||
|
|
||||||
|
|
|
@ -363,7 +363,6 @@ func (s *Server) Err() <-chan error { return s.err }
|
||||||
|
|
||||||
// Open opens the meta and data store and all services.
|
// Open opens the meta and data store and all services.
|
||||||
func (s *Server) Open() error {
|
func (s *Server) Open() error {
|
||||||
if err := func() error {
|
|
||||||
// Start profiling, if set.
|
// Start profiling, if set.
|
||||||
startProfile(s.CPUProfile, s.MemProfile)
|
startProfile(s.CPUProfile, s.MemProfile)
|
||||||
|
|
||||||
|
@ -380,7 +379,6 @@ func (s *Server) Open() error {
|
||||||
|
|
||||||
if s.MetaService != nil {
|
if s.MetaService != nil {
|
||||||
s.MetaService.RaftListener = mux.Listen(meta.MuxHeader)
|
s.MetaService.RaftListener = mux.Listen(meta.MuxHeader)
|
||||||
|
|
||||||
// Open meta service.
|
// Open meta service.
|
||||||
if err := s.MetaService.Open(); err != nil {
|
if err := s.MetaService.Open(); err != nil {
|
||||||
return fmt.Errorf("open meta service: %s", err)
|
return fmt.Errorf("open meta service: %s", err)
|
||||||
|
@ -388,11 +386,12 @@ func (s *Server) Open() error {
|
||||||
go s.monitorErrorChan(s.MetaService.Err())
|
go s.monitorErrorChan(s.MetaService.Err())
|
||||||
}
|
}
|
||||||
|
|
||||||
if s.TSDBStore != nil {
|
// initialize MetaClient.
|
||||||
if err := s.initializeDataNode(); err != nil {
|
if err = s.initializeMetaClient(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if s.TSDBStore != nil {
|
||||||
// Append services.
|
// Append services.
|
||||||
s.appendClusterService(s.config.Cluster)
|
s.appendClusterService(s.config.Cluster)
|
||||||
s.appendPrecreatorService(s.config.Precreator)
|
s.appendPrecreatorService(s.config.Precreator)
|
||||||
|
@ -465,12 +464,6 @@ func (s *Server) Open() error {
|
||||||
go s.startServerReporting()
|
go s.startServerReporting()
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
|
||||||
|
|
||||||
}(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -547,6 +540,9 @@ func (s *Server) reportServer() {
|
||||||
|
|
||||||
numMeasurements := 0
|
numMeasurements := 0
|
||||||
numSeries := 0
|
numSeries := 0
|
||||||
|
|
||||||
|
// Only needed in the case of a data node
|
||||||
|
if s.TSDBStore != nil {
|
||||||
for _, di := range dis {
|
for _, di := range dis {
|
||||||
d := s.TSDBStore.DatabaseIndex(di.Name)
|
d := s.TSDBStore.DatabaseIndex(di.Name)
|
||||||
if d == nil {
|
if d == nil {
|
||||||
|
@ -557,6 +553,7 @@ func (s *Server) reportServer() {
|
||||||
numMeasurements += m
|
numMeasurements += m
|
||||||
numSeries += s
|
numSeries += s
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
clusterID := s.MetaClient.ClusterID()
|
clusterID := s.MetaClient.ClusterID()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -603,8 +600,8 @@ func (s *Server) monitorErrorChan(ch <-chan error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// initializeDataNode will set the MetaClient and join the node to the cluster if needed
|
// initializeMetaClient will set the MetaClient and join the node to the cluster if needed
|
||||||
func (s *Server) initializeDataNode() error {
|
func (s *Server) initializeMetaClient() error {
|
||||||
// if the node ID is > 0 then we just need to initialize the metaclient
|
// if the node ID is > 0 then we just need to initialize the metaclient
|
||||||
if s.Node.ID > 0 {
|
if s.Node.ID > 0 {
|
||||||
s.MetaClient = meta.NewClient(s.Node.MetaServers, s.metaUseTLS)
|
s.MetaClient = meta.NewClient(s.Node.MetaServers, s.metaUseTLS)
|
||||||
|
@ -626,17 +623,20 @@ func (s *Server) initializeDataNode() error {
|
||||||
}
|
}
|
||||||
s.MetaClient = meta.NewClient([]string{s.MetaService.HTTPAddr()}, s.metaUseTLS)
|
s.MetaClient = meta.NewClient([]string{s.MetaService.HTTPAddr()}, s.metaUseTLS)
|
||||||
} else {
|
} else {
|
||||||
// join this data node to the cluster
|
// join this node to the cluster
|
||||||
s.MetaClient = meta.NewClient(s.joinPeers, s.metaUseTLS)
|
s.MetaClient = meta.NewClient(s.joinPeers, s.metaUseTLS)
|
||||||
}
|
}
|
||||||
if err := s.MetaClient.Open(); err != nil {
|
if err := s.MetaClient.Open(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if s.TSDBStore != nil {
|
||||||
n, err := s.MetaClient.CreateDataNode(s.httpAPIAddr, s.tcpAddr)
|
n, err := s.MetaClient.CreateDataNode(s.httpAPIAddr, s.tcpAddr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
s.Node.ID = n.ID
|
s.Node.ID = n.ID
|
||||||
|
}
|
||||||
metaNodes, err := s.MetaClient.MetaNodes()
|
metaNodes, err := s.MetaClient.MetaNodes()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in New Issue