-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Enable caching deterministic scripted queries in shard request cache #49466
Labels
Comments
stu-elastic
added
>enhancement
:Core/Infra/Scripting
Scripting abstractions, Painless, and Mustache
v8.0.0
labels
Nov 21, 2019
Pinging @elastic/es-core-infra (:Core/Infra/Scripting) |
stu-elastic
added a commit
to stu-elastic/elasticsearch
that referenced
this issue
Dec 6, 2019
In order to cache script results in the query shard cache, we need to check if scripts are deterministic. This change adds a default method to the script factories, `isResultDeterministic() -> false` which is used by the `QueryShardContext`. Script results were never cached and that does not change here. Future changes will implement this method based on whether the results of the scripts are deterministic or not and therefore cacheable. Refs: elastic#49466
stu-elastic
added a commit
that referenced
this issue
Dec 6, 2019
In order to cache script results in the query shard cache, we need to check if scripts are deterministic. This change adds a default method to the script factories, `isResultDeterministic() -> false` which is used by the `QueryShardContext`. Script results were never cached and that does not change here. Future changes will implement this method based on whether the results of the scripts are deterministic or not and therefore cacheable. Refs: #49466
stu-elastic
added a commit
to stu-elastic/elasticsearch
that referenced
this issue
Dec 6, 2019
In order to cache script results in the query shard cache, we need to check if scripts are deterministic. This change adds a default method to the script factories, `isResultDeterministic() -> false` which is used by the `QueryShardContext`. Script results were never cached and that does not change here. Future changes will implement this method based on whether the results of the scripts are deterministic or not and therefore cacheable. Refs: elastic#49466
stu-elastic
added a commit
that referenced
this issue
Dec 6, 2019
In order to cache script results in the query shard cache, we need to check if scripts are deterministic. This change adds a default method to the script factories, `isResultDeterministic() -> false` which is used by the `QueryShardContext`. Script results were never cached and that does not change here. Future changes will implement this method based on whether the results of the scripts are deterministic or not and therefore cacheable. Refs: #49466 **Backport**
stu-elastic
added a commit
that referenced
this issue
Dec 18, 2019
Cache results from queries that use scripts if they use only deterministic API calls. Nondeterministic API calls are marked in the whitelist with the `@nondeterministic` annotation. Examples are `Math.random()` and `new Date()`. Refs: #49466
stu-elastic
added a commit
to stu-elastic/elasticsearch
that referenced
this issue
Dec 18, 2019
Cache results from queries that use scripts if they use only deterministic API calls. Nondeterministic API calls are marked in the whitelist with the `@nondeterministic` annotation. Examples are `Math.random()` and `new Date()`. Refs: elastic#49466
stu-elastic
added a commit
that referenced
this issue
Dec 18, 2019
Cache results from queries that use scripts if they use only deterministic API calls. Nondeterministic API calls are marked in the whitelist with the `@nondeterministic` annotation. Examples are `Math.random()` and `new Date()`. Refs: #49466
stu-elastic
added a commit
to stu-elastic/elasticsearch
that referenced
this issue
Dec 18, 2019
Avoid backwards incompatible changes for 8.x and 7.6 by removing type restriction on compile and Factory. Factories may optionally implement ScriptFactory. If so, then they can indicate determinism and thus cacheability. Relates: elastic#49466
This was referenced Dec 18, 2019
stu-elastic
added a commit
that referenced
this issue
Dec 19, 2019
Avoid backwards incompatible changes for 8.x and 7.6 by removing type restriction on compile and Factory. Factories may optionally implement ScriptFactory. If so, then they can indicate determinism and thus cacheability. Relates: #49466
stu-elastic
added a commit
to stu-elastic/elasticsearch
that referenced
this issue
Dec 19, 2019
Avoid backwards incompatible changes for 8.x and 7.6 by removing type restriction on compile and Factory. Factories may optionally implement ScriptFactory. If so, then they can indicate determinism and thus cacheability. Relates: elastic#49466
stu-elastic
added a commit
that referenced
this issue
Dec 19, 2019
Avoid backwards incompatible changes for 8.x and 7.6 by removing type restriction on compile and Factory. Factories may optionally implement ScriptFactory. If so, then they can indicate determinism and thus cacheability. **Backport** Relates: #49466
Completed and available in 8.0 and 7.6 |
SivagurunathanV
pushed a commit
to SivagurunathanV/elasticsearch
that referenced
this issue
Jan 23, 2020
In order to cache script results in the query shard cache, we need to check if scripts are deterministic. This change adds a default method to the script factories, `isResultDeterministic() -> false` which is used by the `QueryShardContext`. Script results were never cached and that does not change here. Future changes will implement this method based on whether the results of the scripts are deterministic or not and therefore cacheable. Refs: elastic#49466
SivagurunathanV
pushed a commit
to SivagurunathanV/elasticsearch
that referenced
this issue
Jan 23, 2020
Cache results from queries that use scripts if they use only deterministic API calls. Nondeterministic API calls are marked in the whitelist with the `@nondeterministic` annotation. Examples are `Math.random()` and `new Date()`. Refs: elastic#49466
SivagurunathanV
pushed a commit
to SivagurunathanV/elasticsearch
that referenced
this issue
Jan 23, 2020
Avoid backwards incompatible changes for 8.x and 7.6 by removing type restriction on compile and Factory. Factories may optionally implement ScriptFactory. If so, then they can indicate determinism and thus cacheability. Relates: elastic#49466
This was referenced Feb 3, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Related: #49321
Right now, there is no way to know if scripts are deterministic or not. To ensure correctness, these scripts skip the shard request cache.
Painless scripts are deterministic if they only use deterministic APIs, eg not
randomUUID
. We'll have to evaluate other languages.If a script is deterministic, it's results are cachable.
The text was updated successfully, but these errors were encountered: