From 99da67007d6d9e11606c89c295f9b395ea6b249e Mon Sep 17 00:00:00 2001 From: Cory LaNou Date: Wed, 30 Sep 2015 12:10:09 -0500 Subject: [PATCH] no more shutdown --- cmd/influxd/run/server.go | 20 -------------------- meta/store.go | 31 +++++++++---------------------- 2 files changed, 9 insertions(+), 42 deletions(-) diff --git a/cmd/influxd/run/server.go b/cmd/influxd/run/server.go index 408e274972..5104d1095c 100644 --- a/cmd/influxd/run/server.go +++ b/cmd/influxd/run/server.go @@ -382,9 +382,6 @@ func (s *Server) Open() error { go s.startServerReporting() } - // Watch the meta store for a remote shutdown - go s.monitorShutdown(s.MetaStore.MonitorShutdown()) - return nil }(); err != nil { @@ -395,23 +392,6 @@ func (s *Server) Open() error { return nil } -func (s *Server) monitorShutdown(c <-chan struct{}) { - // TODO corylanou stop the server from coming back up - for { - select { - case <-c: - err := s.Close() - if err != nil { - log.Println(err) - os.Exit(1) - } - os.Exit(0) - case <-s.closing: - return - } - } -} - // Close shuts down the meta and data stores and all services. func (s *Server) Close() error { stopProfile() diff --git a/meta/store.go b/meta/store.go index 360b48262f..77f0424a24 100644 --- a/meta/store.go +++ b/meta/store.go @@ -82,12 +82,11 @@ type Store struct { raftState raftState - ready chan struct{} - err chan error - closing chan struct{} - wg sync.WaitGroup - changed chan struct{} - shutdown chan struct{} + ready chan struct{} + err chan error + closing chan struct{} + wg sync.WaitGroup + changed chan struct{} // clusterTracingEnabled controls whether low-level cluster communcation is logged. // Useful for troubleshooting @@ -140,11 +139,10 @@ func NewStore(c *Config) *Store { peers: c.Peers, data: &Data{}, - ready: make(chan struct{}), - err: make(chan error), - closing: make(chan struct{}), - changed: make(chan struct{}), - shutdown: make(chan struct{}), + ready: make(chan struct{}), + err: make(chan error), + closing: make(chan struct{}), + changed: make(chan struct{}), clusterTracingEnabled: c.ClusterTracing, retentionAutoCreate: c.RetentionAutoCreate, @@ -576,9 +574,6 @@ func (s *Store) Ready() <-chan struct{} { return s.ready } // Err returns a channel for all out-of-band errors. func (s *Store) Err() <-chan error { return s.err } -// MonitorShutdown returns a channel to monitor when this node has been told to shut down remotely -func (s *Store) MonitorShutdown() <-chan struct{} { return s.shutdown } - // IsLeader returns true if the store is currently the leader. func (s *Store) IsLeader() bool { s.mu.RLock() @@ -1697,15 +1692,7 @@ func (fsm *storeFSM) applyRemovePeerCommand(cmd *internal.Command) interface{} { // ignore the error, as it's likely just telling you it's not the leader, and that's fine fsm.raftState.removePeer(addr) } - go func(id uint64, addr string) { - // Give the cluster some time to responsd - time.Sleep(time.Second) - fsm.Logger.Printf("shutting down local node '%d'", id) - close(fsm.shutdown) - }(id, addr) - } - return nil }