Add flag to config that disables running CQs

pull/1724/head
Joseph Rothrock 2015-02-24 13:43:47 -08:00
parent 2835c71ce3
commit 0dfec9268d
3 changed files with 10 additions and 0 deletions

View File

@ -234,6 +234,9 @@ dir = "/tmp/influxdb/development/db"
retention-check-enabled = true retention-check-enabled = true
retention-check-period = "5m" retention-check-period = "5m"
[continuous_queries]
disable = false
[cluster] [cluster]
dir = "/tmp/influxdb/development/cluster" dir = "/tmp/influxdb/development/cluster"
` `

View File

@ -251,6 +251,7 @@ func openServer(config *Config, b *influxdb.Broker, initializing, configExists b
s.RecomputeNoOlderThan = time.Duration(config.ContinuousQuery.RecomputeNoOlderThan) s.RecomputeNoOlderThan = time.Duration(config.ContinuousQuery.RecomputeNoOlderThan)
s.ComputeRunsPerInterval = config.ContinuousQuery.ComputeRunsPerInterval s.ComputeRunsPerInterval = config.ContinuousQuery.ComputeRunsPerInterval
s.ComputeNoMoreThan = time.Duration(config.ContinuousQuery.ComputeNoMoreThan) s.ComputeNoMoreThan = time.Duration(config.ContinuousQuery.ComputeNoMoreThan)
s.ContinuousQueryDisable = config.ContinuousQuery.Disable
if err := s.Open(config.Data.Dir); err != nil { if err := s.Open(config.Data.Dir); err != nil {
log.Fatalf("failed to open data server: %v", err.Error()) log.Fatalf("failed to open data server: %v", err.Error())

View File

@ -74,6 +74,7 @@ type Server struct {
RecomputeNoOlderThan time.Duration RecomputeNoOlderThan time.Duration
ComputeRunsPerInterval int ComputeRunsPerInterval int
ComputeNoMoreThan time.Duration ComputeNoMoreThan time.Duration
ContinuousQueryDisable bool
// This is the last time this data node has run continuous queries. // 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 // Keep this state in memory so if a broker makes a request in another second
@ -2968,6 +2969,11 @@ func (s *Server) applyCreateContinuousQueryCommand(m *messaging.Message) error {
// RunContinuousQueries will run any continuous queries that are due to run and write the // RunContinuousQueries will run any continuous queries that are due to run and write the
// results back into the database // results back into the database
func (s *Server) RunContinuousQueries() error { 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() s.mu.RLock()
defer s.mu.RUnlock() defer s.mu.RUnlock()