Add flag to config that disables running CQs
parent
2835c71ce3
commit
0dfec9268d
|
@ -234,6 +234,9 @@ dir = "/tmp/influxdb/development/db"
|
|||
retention-check-enabled = true
|
||||
retention-check-period = "5m"
|
||||
|
||||
[continuous_queries]
|
||||
disable = false
|
||||
|
||||
[cluster]
|
||||
dir = "/tmp/influxdb/development/cluster"
|
||||
`
|
||||
|
|
|
@ -251,6 +251,7 @@ 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())
|
||||
|
|
|
@ -74,6 +74,7 @@ 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
|
||||
|
@ -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
|
||||
// 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()
|
||||
|
||||
|
|
Loading…
Reference in New Issue