Add a flag to config that disables CQs

pull/1724/head
Joseph Rothrock 2015-02-24 16:58:58 -08:00
parent 0dfec9268d
commit c96fda2287
2 changed files with 5 additions and 8 deletions

View File

@ -56,7 +56,11 @@ func Run(config *Config, join, version string, logWriter *os.File) (*messaging.B
log.Printf("broker listening on %s", config.BrokerAddr())
// have it occasionally tell a data node in the cluster to run continuous queries
b.RunContinuousQueryLoop()
if config.ContinuousQuery.Disable {
log.Printf("Not running continuous queries. [continuous_queries].disable is set to true.")
} else {
b.RunContinuousQueryLoop()
}
}
// Open server, initialize or join as necessary.
@ -251,7 +255,6 @@ func openServer(config *Config, b *influxdb.Broker, initializing, configExists b
s.RecomputeNoOlderThan = time.Duration(config.ContinuousQuery.RecomputeNoOlderThan)
s.ComputeRunsPerInterval = config.ContinuousQuery.ComputeRunsPerInterval
s.ComputeNoMoreThan = time.Duration(config.ContinuousQuery.ComputeNoMoreThan)
s.ContinuousQueryDisable = config.ContinuousQuery.Disable
if err := s.Open(config.Data.Dir); err != nil {
log.Fatalf("failed to open data server: %v", err.Error())

View File

@ -74,7 +74,6 @@ type Server struct {
RecomputeNoOlderThan time.Duration
ComputeRunsPerInterval int
ComputeNoMoreThan time.Duration
ContinuousQueryDisable bool
// This is the last time this data node has run continuous queries.
// Keep this state in memory so if a broker makes a request in another second
@ -2969,11 +2968,6 @@ func (s *Server) applyCreateContinuousQueryCommand(m *messaging.Message) error {
// RunContinuousQueries will run any continuous queries that are due to run and write the
// results back into the database
func (s *Server) RunContinuousQueries() error {
if s.ContinuousQueryDisable {
log.Printf("Not running continuous queries. [continuous_queries].disable is set to true.")
return nil
}
s.mu.RLock()
defer s.mu.RUnlock()