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

Script: Implicit context cache #81552

Merged
merged 4 commits into from
Dec 8, 2021

Conversation

stu-elastic
Copy link
Contributor

@stu-elastic stu-elastic commented Dec 8, 2021

The script context cache is deprecated.

In 7.16 the default value of script.max_compilation_rate was switched from "use-context",
to "150/5m".

That means uses would have to explicitly set "use-context" to use any of the context cache families of settings:
script.context.*.max_compilations_rate
script.context.*.cache_max_size
script.context.*.cache_expire

On upgrades to 7.16, if the customer was using the default and had set any of those settings without setting
script.max_compilation_rate: "use-context", the upgrade would be fail.

To avoid an unintentional breaking change, the script service will now implicitly use the script context cache if
script.max_compilation_rate is unset and any of the context cache family of settings is set.

The context cache will also be used if script.max_compilation_rate: "use-context", as before.

Fixes: #81486

The script context cache is deprecated.  In 7.16 the default
value of `script.max_compilation_rate` was switched from `"use-context"`,
to `"150/5m".  That means uses would have to explicitly set "use-context"
to use any of the context cache families of settings:
`script.context.*.max_compilations_rate`
`script.context.*.cache_max_size`
`script.context.*.cache_expire`

On upgrades to 7.16, if the customer was using the default and had
set any of those settings without setting
`script.max_compilation_rate: "use-context"`, the upgrade would be
rejected.

To avoid an unintentional breaking change, the script service will
now **implicitly** use the script context cache if `script.max_compilation_rate`
is **unset** and any of the context cache family of settings is set.

The context cache will also be used if
`script.max_compilation_rate: "use-context"`, as before.

Fixes: elastic#81486
@stu-elastic stu-elastic added >bug :Core/Infra/Scripting Scripting abstractions, Painless, and Mustache auto-backport Automatically create backport pull requests when merged labels Dec 8, 2021
@stu-elastic stu-elastic requested a review from jdconrad December 8, 2021 18:52
@elasticsearchmachine
Copy link
Collaborator

Hi @stu-elastic, I've created a changelog YAML for you.

@stu-elastic stu-elastic marked this pull request as ready for review December 8, 2021 19:03
@elasticmachine elasticmachine added the Team:Core/Infra Meta label for core/infra team label Dec 8, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

Copy link
Contributor

@jdconrad jdconrad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick work on this! @stu-elastic walked me through this, and the logic seems sound.

+ "]"
);
if (contextSettings.incompatibleSettings()) {
throw new IllegalArgumentException(contextSettings.incompatibleSettingsMessage());
}
if (SCRIPT_DISABLE_MAX_COMPILATIONS_RATE_SETTING.get(settings)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stu-elastic You mentioned this setting is only used as part of testing. If a user were to set this are there any other problems that may occur?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's an internal, undocumented setting for tests. If they set this they'll never have rate limits, updating other settings with respect to this one is unsupported.

@stu-elastic stu-elastic merged commit ba6c17d into elastic:master Dec 8, 2021
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
8.0
7.16 Commit could not be cherrypicked due to conflicts

You can use sqren/backport to manually backport by running backport --upstream elastic/elasticsearch --pr 81552

stu-elastic added a commit to stu-elastic/elasticsearch that referenced this pull request Dec 8, 2021
The script context cache is deprecated.

In 7.16 the default value of `script.max_compilation_rate` was switched from `"use-context"`,
to `"150/5m"`.

That means uses would have to explicitly set `"use-context"` to use any of the context cache families of settings:
`script.context.*.max_compilations_rate`
`script.context.*.cache_max_size`
`script.context.*.cache_expire`

On upgrades to 7.16, if the customer was using the default and had set any of those settings without setting
`script.max_compilation_rate: "use-context"`, the upgrade would be fail.

To avoid an unintentional breaking change, the script service will now **implicitly** use the script context cache if 
`script.max_compilation_rate` is **unset** and any of the context cache family of settings is set.

The context cache will also be used if `script.max_compilation_rate: "use-context"`, as before.

Fixes: elastic#81486
stu-elastic added a commit to stu-elastic/elasticsearch that referenced this pull request Dec 8, 2021
The script context cache is deprecated.  In 7.16 the default
value of `script.max_compilation_rate` was switched from `"use-context"`,
to `"150/5m".  That means uses would have to explicitly set "use-context"
to use any of the context cache families of settings:
`script.context.*.max_compilations_rate`
`script.context.*.cache_max_size`
`script.context.*.cache_expire`

On upgrades to 7.16, if the customer was using the default and had
set any of those settings without setting
`script.max_compilation_rate: "use-context"`, the upgrade would be
rejected.

To avoid an unintentional breaking change, the script service will
now **implicitly** use the script context cache if `script.max_compilation_rate`
is **unset** and any of the context cache family of settings is set.

The context cache will also be used if
`script.max_compilation_rate: "use-context"`, as before.

Fixes: elastic#81486
Backport: ba6c17d
stu-elastic added a commit that referenced this pull request Dec 8, 2021
The script context cache is deprecated.

In 7.16 the default value of `script.max_compilation_rate` was switched from `"use-context"`,
to `"150/5m"`.

That means uses would have to explicitly set `"use-context"` to use any of the context cache families of settings:
`script.context.*.max_compilations_rate`
`script.context.*.cache_max_size`
`script.context.*.cache_expire`

On upgrades to 7.16, if the customer was using the default and had set any of those settings without setting
`script.max_compilation_rate: "use-context"`, the upgrade would be fail.

To avoid an unintentional breaking change, the script service will now **implicitly** use the script context cache if 
`script.max_compilation_rate` is **unset** and any of the context cache family of settings is set.

The context cache will also be used if `script.max_compilation_rate: "use-context"`, as before.

Fixes: #81486
Backport: ba6c17d
stu-elastic added a commit that referenced this pull request Dec 8, 2021
* [7.16] Script: Implicit context cache (#81552)

The script context cache is deprecated.  In 7.16 the default
value of `script.max_compilation_rate` was switched from `"use-context"`,
to `"150/5m".  That means uses would have to explicitly set "use-context"
to use any of the context cache families of settings:
`script.context.*.max_compilations_rate`
`script.context.*.cache_max_size`
`script.context.*.cache_expire`

On upgrades to 7.16, if the customer was using the default and had
set any of those settings without setting
`script.max_compilation_rate: "use-context"`, the upgrade would be
rejected.

To avoid an unintentional breaking change, the script service will
now **implicitly** use the script context cache if `script.max_compilation_rate`
is **unset** and any of the context cache family of settings is set.

The context cache will also be used if
`script.max_compilation_rate: "use-context"`, as before.

Fixes: #81486
Backport: ba6c17d
@stu-elastic
Copy link
Contributor Author

stu-elastic commented Dec 8, 2021

master (8.1.0): ba6c17d
8.0 (8.0.0): c4b1e8c
7.16 (7.16.1): 7d8f0b3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Automatically create backport pull requests when merged >bug :Core/Infra/Scripting Scripting abstractions, Painless, and Mustache Team:Core/Infra Meta label for core/infra team v7.16.1 v8.0.0-rc2 v8.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Script settings validation breaks mixed version cluster (7.15 + 7.16)
5 participants