influxdb icon indicating copy to clipboard operation
influxdb copied to clipboard

[0.9.1] panic caused by continuous queries

Open CrazyJvm opened this issue 11 years ago • 7 comments

if we select unknown filed, or select tag(no matter known or unknown), influxd will panic :

create database mydb        
use mydb

insert field3,host=serverA,region=2 value=10
insert field3,host=serverA,region=2 value=40

insert field3_test value=10

CREATE CONTINUOUS QUERY field3 ON mydb BEGIN SELECT sum(value) AS val,region INTO field3_test FROM field3 GROUP BY time(30m) END

CrazyJvm avatar Jul 10 '15 06:07 CrazyJvm

I can repro on 0.9.1 with the steps above. Still trying to find the minimal repro case.

beckettsean avatar Jul 10 '15 17:07 beckettsean

Note that after every panic I have to blow away my data in order to keep it from panicking again on startup when the CQs run.

It's not related to the CQ name being the same identifier as the measurement (field3), or at least that is not the immediate cause. It still panics with a unique name for the CQ.

It's also not related to the CQ writing into a series that has had data manually added (panics whether or not field3_test already exists).

If the CQ is created before the data is inserted there is no panic. Writing in the data after the CQ is created doesn't panic but it also appears that the CQ never generates any data. Creating a new CQ with similar query causes an immediate panic.

Inserting the data and running a direct query rather than making a CQ doesn't cause a panic.

> create database mydb
> use mydb
Using database mydb
> insert field3,host=serverA,region=2 value=40
> insert field3,host=serverA,region=2 value=41
> insert field3,host=serverA,region=2 value=42
> insert field3,host=serverA,region=2 value=43
> insert field3,host=serverA,region=2 value=44
> SELECT sum(value) AS val,region FROM field3 GROUP BY time(5s)
ERR: error parsing query: aggregate functions with GROUP BY time require a WHERE time clause
> SELECT sum(value) AS val,region FROM field3 WHERE time > now() - 10m GROUP BY time(5s)
name: field3
tags: region=2
time            val region
----            --- ------
2015-07-10T17:15:15Z    
2015-07-10T17:15:20Z    
2015-07-10T17:15:25Z    

beckettsean avatar Jul 10 '15 17:07 beckettsean

@beckettsean broken CQs can be dropped by temporarily disabling CQs in the config file (under the [continuous_queries] section).

gunnaraasen avatar Jul 10 '15 19:07 gunnaraasen

@beckettsean we've dived into code these days, and actually we already fixed several days ago. we planned to send a PR, but we find more problems with CQ. we are fixing these problems and hopefully will be done within next one or two days.

CrazyJvm avatar Jul 11 '15 03:07 CrazyJvm

@CrazyJvm glad you were able to address the issue. We'd love to take a look at a pull request if you can share your improvements.

beckettsean avatar Jul 13 '15 21:07 beckettsean

Hey @CrazyJvm - Any possible updates on a pull request? I really need to take advantage of the new CQ in the 0.9.x releases, but seeing all these problems makes me think I need to wait until this issue and a couple more are fixed.

NickPadilla avatar Jul 21 '15 15:07 NickPadilla

The original CQ that triggered this no longer parses as valid due to the fix for https://github.com/influxdb/influxdb/issues/3407.

In essence, the combination of an aggregation function and a bare value is no longer valid.

beckettsean avatar Aug 19 '15 00:08 beckettsean