-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
querying a range that includes the past and the future causes a panic #2268
Comments
Thanks for the bug report @neonstalwart -- does it also occur if the future time is specified in absolute terms? |
I was able to reproduce with @neonstalwart 's script...
|
@otoolep what does an absolute time need to look like? i tried to use |
@otoolep no panic if absolute time is used...
|
I think this might be a dupe of #2184. |
confirmed that absolute time is ok now=$(date '+%FT%T.000Z')
tomorrow=$(date -v +1d '+%FT%T.000Z')
tendays=$(date -v +10d '+%F')
echo "creating database"
curl -G -ipv4 http://localhost:8086/query --data-urlencode "q=CREATE DATABASE foo"
echo "creating retention policy"
curl -G -ipv4 http://localhost:8086/query --data-urlencode "q=CREATE RETENTION POLICY bar ON foo DURATION INF REPLICATION 1 DEFAULT"
echo "inserting data"
curl -d "{\"database\" : \"foo\", \"retentionPolicy\" : \"bar\", \"points\": [{\"name\": \"cpu\", \"tags\": {\"region\":\"uswest\",\"host\": \"server01\"},\"timestamp\": \"$now\",\"fields\": {\"value\": 100}}]}" -H "Content-Type: application/json" -ipv4 http://localhost:8086/write
echo "inserting data"
curl -d "{\"database\" : \"foo\", \"retentionPolicy\" : \"bar\", \"points\": [{\"name\": \"cpu\", \"tags\": {\"region\":\"uswest\",\"host\": \"server01\"},\"timestamp\": \"$tomorrow\",\"fields\": {\"value\": 200}}]}" -H "Content-Type: application/json" -ipv4 http://localhost:8086/write
sleep 1
echo "querying data"
curl -G -ipv4 http://localhost:8086/query --data-urlencode "db=foo" --data-urlencode "q=SELECT count(value) FROM \"foo\".\"bar\".cpu"
echo "querying data"
curl -G -ipv4 http://localhost:8086/query --data-urlencode "db=foo" --data-urlencode "q=SELECT count(value) FROM \"foo\".\"bar\".cpu where time > now() - 2d and time < '$tendays'" it may be a dupe of #2184 - if it is then it seems we've narrowed it down to using |
that's an oversimplification because |
There's a bug in the way it creates the AST for |
Parsing: WHERE time > now() - 2d AND time < now() + 10d generated an expression tree that evaluated as: ... AND (time < now()) + 10d instead of: ... AND time < (now() + 10d)
fix #2268: fix expression parsing bug
the following script will cause a panic. the script is similar to the one added in #2159 with an extra
time > now() - 2d
in the where clause of the last query.The text was updated successfully, but these errors were encountered: