SQL: Make sure now() always uses milliseconds precision#36877
Merged
astefan merged 3 commits intoelastic:masterfrom Dec 20, 2018
Merged
SQL: Make sure now() always uses milliseconds precision#36877astefan merged 3 commits intoelastic:masterfrom
astefan merged 3 commits intoelastic:masterfrom
Conversation
different system clock implementations or different Java versions (for Java 8, milliseconds precision is used; for Java 9+ a system specific clock implementation is used which can have greater precision than what we need here).
Collaborator
|
Pinging @elastic/es-search |
Member
|
Nice find. As this issue is fairly obscure and we might bump into it again, it might make sense to move the clock or now function into the |
Contributor
Author
|
@elasticmachine run default distro tests |
astefan
added a commit
that referenced
this pull request
Dec 20, 2018
* This change is to account for different system clock implementations or different Java versions (for Java 8, milliseconds precision is used; for Java 9+ a system specific clock implementation is used which can have greater precision than what we need here). (cherry picked from commit 1236461)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is fix for a CI failure reproducible for Java 9+ versions.
What is specific to these versions (as opposed to Java 8) is that the Clock implementation uses system's best clock implementation, whereas in Java 8
System.currentTimeMillis()is always used. To account for these differences, this solution defines a new Clock which will offer a value fornow()set to always have milliseconds precision.Fixes #35683.