influxdata / influxdata/influxdb
Continuous query are not executed as required
- Dominant language
- Rust
- Stars
- 31.7k
- Forks
- 3.7k
- Avg merge
- 13h 37m
- Merged PRs (30d)
- 8
Description
__Steps to reproduce:__
1. Create any CQ, example:
`CREATE CONTINUOUS QUERY packets_b ON apr RESAMPLE FOR 20s BEGIN SELECT sum(value) AS packets INTO apr."default".packets_b FROM apr."default".b_stats GROUP BY time(10s), packet_type, dc END
`
or
`CREATE CONTINUOUS QUERY packets_b ON apr RESAMPLE EVERY 10s FOR 20s BEGIN SELECT sum(value) AS packets INTO apr."default".packets_b FROM apr."default".b_stats GROUP BY time(10s), packet_type, dc END
`
__Expected behavior:__
CQ are executing every 10sec
__Actual behavior:__
CQ are executing once every 45-60sec
__Environment info:__
* System info: Linux 3.10.0-1160.36.2.el7.x86_64
* InfluxDB version: 1.7.6
__Config:__
```
[continuous_queries]
run-interval = "1s"
```
__Logs:__
Log doesn't have any errors
```Oct 19 14:52:25 srv1 influxd: ts=2021-10-19T11:52:25.463443Z lvl=info msg="Executing continuous query" log_id=0XBQ5Ak0000 service=continuous_querier trace_id=0XI6AbTl000 op_name=continuous_querier_execute name=packets_b db_instance=apr start=2021-10-19T11:50:40.000000Z end=2021-10-19T11:51:40.000000Z
Oct 19 14:52:25 srv1 influxd: ts=2021-10-19T11:52:25.474338Z lvl=info msg="Finished continuous query" log_id=0XBQ5Ak0000 service=continuous_querier trace_id=0XI6AbTl000 op_name=continuous_querier_execute name=packets_b db_instance=apr written=132 start=2021-10-19T11:50:40.000000Z end=2021-10-19T11:51:40.000000Z duration=10ms
Oct 19 14:53:12 srv1 influxd: ts=2021-10-19T11:53:12.142309Z lvl=info msg="Executing continuous query" log_id=0XBQ5Ak0000 service=continuous_querier trace_id=0XI6DSoW000 op_name=continuous_querier_execute name=packets_b db_instance=apr start=2021-10-19T11:51:30.000000Z end=2021-10-19T11:52:30.000000Z
Oct 19 14:53:12 srv1 influxd: ts=2021-10-19T11:53:12.157116Z lvl=info msg="Finished continuous query" log_id=0XBQ5Ak0000 service=continuous_querier trace_id=0XI6DSoW000 op_name=continuous_querier_execute name=packets_b db_instance=apr written=132 start=2021-10-19T11:51:30.000000Z end=2021-10-19T11:52:30.000000Z duration=14ms
Oct 19 14:53:59 srv1 influxd: ts=2021-10-19T11:53:59.119985Z lvl=info msg="Executing continuous query" log_id=0XBQ5Ak0000 service=continuous_querier trace_id=0XI6GKJl000 op_name=continuous_querier_execute name=packets_b db_instance=apr start=2021-10-19T11:52:20.000000Z end=2021-10-19T11:53:10.000000Z
Oct 19 14:53:59 srv1 influxd: ts=2021-10-19T11:53:59.141692Z lvl=info msg="Finished continuous query" log_id=0XBQ5Ak0000 service=continuous_querier trace_id=0XI6GKJl000 op_name=continuous_querier_execute name=packets_b db_instance=apr written=110 start=2021-10-19T11:52:20.000000Z end=2021-10-19T11:53:10.000000Z duration=21ms
Oct 19 14:54:46 srv1 influxd: ts=2021-10-19T11:54:46.463376Z lvl=info msg="Executing continuous query" log_id=0XBQ5Ak0000 service=continuous_querier trace_id=0XI6JDFl000 op_name=continuous_querier_execute name=packets_b db_instance=apr start=2021-10-19T11:53:00.000000Z end=2021-10-19T11:54:00.000000Z
Oct 19 14:54:46 srv1 influxd: ts=2021-10-19T11:54:46.475975Z lvl=info msg="Finished continuous query" log_id=0XBQ5Ak0000 service=continuous_querier trace_id=0XI6JDFl000 op_name=continuous_querier_execute name=packets_b db_instance=apr written=132 start=2021-10-19T11:53:00.000000Z end=2021-10-19T11:54:00.000000Z duration=12ms
Oct 19 14:55:36 srv1 influxd: ts=2021-10-19T11:55:36.041799Z lvl=info msg="Executing continuous query" log_id=0XBQ5Ak0000 service=continuous_querier trace_id=0XI6MEvG000 op_name=continuous_querier_execute name=packets_b db_instance=apr start=2021-10-19T11:53:50.000000Z end=2021-10-19T11:54:50.000000Z
Oct 19 14:55:36 srv1 influxd: ts=2021-10-19T11:55:36.054199Z lvl=info msg="Finished continuous query" log_id=0XBQ5Ak0000 service=continuous_querier trace_id=0XI6MEvG000 op_name=continuous_querier_execute name=packets_b db_instance=apr written=132 start=2021-10-19T11:53:50.000000Z end=2021-10-19T11:54:50.000000Z duration=12ms
```
I don’t understand why the CQs are executed less often than they should.
On the second same server, the same CQs are executed as expected once every 10 seconds.
Contributor guide
Research direction
Start with the continuous_querier execution path and the [continuous_queries] run-interval setting, then compare the logged execution timestamps with the requested 10-second schedule. Done means the provided CREATE CONTINUOUS QUERY examples execute every 10 seconds with the stated configuration, without errors.
Written by the indexing model from the issue text.
Assessment
- Domain
- database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100