Skip to content
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

Default query end time should be math.MaxInt64 #5047

Closed
pauldix opened this issue Dec 8, 2015 · 10 comments
Closed

Default query end time should be math.MaxInt64 #5047

pauldix opened this issue Dec 8, 2015 · 10 comments
Milestone

Comments

@pauldix
Copy link
Member

pauldix commented Dec 8, 2015

Too many people have reported bugs where they can't see their data because they wrote a data point with a future timestamp. This is because by default we set the query end time to time.Now() if they didn't specify an end time.

We should have the end time default to time.Unix(0, math.MaxInt64)

@otoolep
Copy link
Contributor

otoolep commented Dec 8, 2015

We don't consider this a breaking change? Or we do, but we prepared to take the hit?

@pauldix
Copy link
Member Author

pauldix commented Dec 8, 2015

Most people aren't writing data into the future. Also, it doesn't actually break the API from a client compatibility perspective. So I think it's worth doing. Also, the next release is 0.10.0

@otoolep
Copy link
Contributor

otoolep commented Dec 9, 2015

This should be pretty straightforward one, and a chance to learn some of the parser and query code. It should be pretty clear in the code where the upper bound is set to now, if not explicit set in the query.

Most of the code changes will be in the tests.

@wind0r
Copy link
Contributor

wind0r commented Dec 10, 2015

I think i am wrong but shouldn't changing this line be enough?
Even the test do not fail after changing it to max = time.Unix(0, math.MaxInt64).UnixNano()

@otoolep
Copy link
Contributor

otoolep commented Dec 10, 2015

Yes, that should be all it takes. That's why it's low difficulty. :-)

Sounds like we need some more test coverage. What would be great is some tests added like this one:

https://github.com/influxdb/influxdb/blob/master/cmd/influxd/run/server_test.go#L913

basically a new test (TestServer_Query_NoTimeBounds) that writes a point very far into the future, another point far into the past, and then does a SELECT without specifying any time, and ensure all the data comes back. Today that test will fail, but after your fix, the test will pass. Make sense?

@wind0r
Copy link
Contributor

wind0r commented Dec 10, 2015

OK =)
I will write a test and then create a PR.

@otoolep
Copy link
Contributor

otoolep commented Dec 10, 2015

Great. Make sure your test fails first, before making any changes to the database code, so you can be sure your test is correct.

@beckettsean
Copy link
Contributor

@pauldix this is a dupe of #4461. I'll let you decide which should be closed in favor of the other.

@pauldix
Copy link
Member Author

pauldix commented Dec 15, 2015

@beckettsean ah right. Closed in favor of yours :)

@pauldix pauldix closed this as completed Dec 15, 2015
@beckettsean
Copy link
Contributor

@wind0r FYI we've closed this issue in favor of an older one. That one references both the upper bound and lower bound, so your very welcome PR is only a partial fix. Just mentioning that so we don't close #4461 if #5089 is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants