Skip to content

Commit 88e8b34

Browse files
authored
Scripting: Deprecate general cache settings (#55753)
Backport: ef543b0
1 parent 276a489 commit 88e8b34

File tree

23 files changed

+630
-391
lines changed

23 files changed

+630
-391
lines changed

buildSrc/src/main/groovy/org/elasticsearch/gradle/test/ClusterFormationTasks.groovy

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ class ClusterFormationTasks {
222222
if (distro.equals("oss")) {
223223
snapshotProject = "oss-" + snapshotProject
224224
}
225-
225+
226226
BwcVersions.UnreleasedVersionInfo unreleasedInfo = null
227227

228228
if (project.hasProperty('bwcVersions')) {
@@ -420,7 +420,11 @@ class ClusterFormationTasks {
420420
esConfig['cluster.routing.allocation.disk.watermark.flood_stage'] = '1b'
421421
}
422422
// increase script compilation limit since tests can rapid-fire script compilations
423-
esConfig['script.max_compilations_rate'] = '2048/1m'
423+
if (node.nodeVersion.onOrAfter('7.9.0')) {
424+
esConfig['script.disable_max_compilations_rate'] = 'true'
425+
} else {
426+
esConfig['script.max_compilations_rate'] = '2048/1m'
427+
}
424428
// Temporarily disable the real memory usage circuit breaker. It depends on real memory usage which we have no full control
425429
// over and the REST client will not retry on circuit breaking exceptions yet (see #31986 for details). Once the REST client
426430
// can retry on circuit breaking exceptions, we can revert again to the default configuration.

buildSrc/src/main/java/org/elasticsearch/gradle/testclusters/ElasticsearchNode.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1093,7 +1093,11 @@ private void createConfiguration() {
10931093
baseConfig.put("cluster.routing.allocation.disk.watermark.low", "1b");
10941094
baseConfig.put("cluster.routing.allocation.disk.watermark.high", "1b");
10951095
// increase script compilation limit since tests can rapid-fire script compilations
1096-
baseConfig.put("script.max_compilations_rate", "2048/1m");
1096+
if (getVersion().onOrAfter(Version.fromString("7.9.0"))) {
1097+
baseConfig.put("script.disable_max_compilations_rate", "true");
1098+
} else {
1099+
baseConfig.put("script.max_compilations_rate", "2048/1m");
1100+
}
10971101
if (getVersion().getMajor() >= 6) {
10981102
baseConfig.put("cluster.routing.allocation.disk.watermark.flood_stage", "1b");
10991103
}

distribution/docker/docker-compose.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ services:
1515
- cluster.routing.allocation.disk.watermark.low=1b
1616
- cluster.routing.allocation.disk.watermark.high=1b
1717
- cluster.routing.allocation.disk.watermark.flood_stage=1b
18-
- script.max_compilations_rate=2048/1m
1918
- node.store.allow_mmap=false
2019
- xpack.security.enabled=true
2120
- xpack.security.transport.ssl.enabled=true
@@ -55,7 +54,6 @@ services:
5554
- cluster.routing.allocation.disk.watermark.low=1b
5655
- cluster.routing.allocation.disk.watermark.high=1b
5756
- cluster.routing.allocation.disk.watermark.flood_stage=1b
58-
- script.max_compilations_rate=2048/1m
5957
- node.store.allow_mmap=false
6058
- xpack.security.enabled=true
6159
- xpack.security.transport.ssl.enabled=true
@@ -95,7 +93,6 @@ services:
9593
- cluster.routing.allocation.disk.watermark.low=1b
9694
- cluster.routing.allocation.disk.watermark.high=1b
9795
- cluster.routing.allocation.disk.watermark.flood_stage=1b
98-
- script.max_compilations_rate=2048/1m
9996
- node.store.allow_mmap=false
10097
volumes:
10198
- ./build/oss-repo:/tmp/es-repo
@@ -120,7 +117,6 @@ services:
120117
- cluster.routing.allocation.disk.watermark.low=1b
121118
- cluster.routing.allocation.disk.watermark.high=1b
122119
- cluster.routing.allocation.disk.watermark.flood_stage=1b
123-
- script.max_compilations_rate=2048/1m
124120
- node.store.allow_mmap=false
125121
volumes:
126122
- ./build/oss-repo:/tmp/es-repo

docs/reference/migration/index.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ For information about how to upgrade your cluster, see <<setup-upgrade>>.
1111

1212
--
1313

14+
include::migrate_7_9.asciidoc[]
1415
include::migrate_7_8.asciidoc[]
1516
include::migrate_7_7.asciidoc[]
1617
include::migrate_7_6.asciidoc[]
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
[[breaking-changes-7.9]]
2+
== Breaking changes in 7.9
3+
++++
4+
<titleabbrev>7.9</titleabbrev>
5+
++++
6+
7+
This section discusses the changes that you need to be aware of when migrating
8+
your application to {es} 7.9.
9+
10+
See also <<release-highlights>> and <<es-release-notes>>.
11+
12+
* <<breaking_79_script_cache_changes>>
13+
14+
//NOTE: The notable-breaking-changes tagged regions are re-used in the
15+
//Installation and Upgrade Guide
16+
17+
//tag::notable-breaking-changes[]
18+
[discrete]
19+
[[breaking_79_script_cache_changes]]
20+
=== Script cache changes
21+
[[deprecate_general_script_cache_size]]
22+
.The `script.cache.max_size` setting is deprecated.
23+
24+
[%collapsible]
25+
====
26+
*Details* +
27+
The `script.cache.max_size` setting is deprecated. In {es} 8.0.0, this is
28+
set per-context.
29+
30+
*Impact* +
31+
To avoid deprecation warnings, discontinue use of the `script.cache.max_size`
32+
setting. You may use `script.context.$CONTEXT.context_max_size` for the particular context.
33+
For example, for the `ingest` context, use `script.context.ingest.context_max_size`.
34+
35+
====
36+
37+
[discrete]
38+
[[deprecate_general_script_expire]]
39+
.The `script.cache.expire` setting is deprecated.
40+
41+
[%collapsible]
42+
====
43+
*Details* +
44+
The `script.cache.expire` setting is deprecated. In {es} 8.0.0, this is
45+
set per-context.
46+
47+
*Impact* +
48+
To avoid deprecation warnings, discontinue use of the `script.cache.expire`
49+
setting. You may use `script.context.$CONTEXT.cache_expire` for the particular context.
50+
For example, for the `update` context, use `script.context.update.cache_expire`.
51+
52+
====
53+
54+
[discrete]
55+
[[deprecate_general_script_compile_rate]]
56+
.The `script.max_compilations_rate` setting is deprecated.
57+
58+
[%collapsible]
59+
====
60+
*Details* +
61+
The `script.max_compilations_rate` setting is deprecated. In {es} 8.0.0, this is
62+
set per-context.
63+
64+
*Impact* +
65+
To avoid deprecation warnings, discontinue use of the `script.max_compilations_rate`
66+
setting. You may use `script.context.$CONTEXT.max_compilations_rate` for the particular
67+
context. For example, for the `processor_conditional` context, use
68+
`script.context.processor_conditional.max_compilations_rate`.
69+
70+
====
71+
//end::notable-breaking-changes[]

docs/reference/modules/indices/circuit_breaker.asciidoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ within a period of time.
111111
See the "prefer-parameters" section of the <<modules-scripting-using,scripting>>
112112
documentation for more information.
113113

114-
`script.max_compilations_rate`::
114+
`script.context.$CONTEXT.max_compilations_rate`::
115115

116116
Limit for the number of unique dynamic scripts within a certain interval
117-
that are allowed to be compiled. Defaults to 75/5m, meaning 75 every 5
118-
minutes.
117+
that are allowed to be compiled for a given context. Defaults to `75/5m`,
118+
meaning 75 every 5 minutes.

docs/reference/release-notes.asciidoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
This section summarizes the changes in each release.
88

9+
* <<release-notes-7.9.0>>
910
* <<release-notes-7.8.0>>
1011
* <<release-notes-7.7.1>>
1112
* <<release-notes-7.7.0>>
@@ -34,6 +35,7 @@ This section summarizes the changes in each release.
3435

3536
--
3637

38+
include::release-notes/7.9.asciidoc[]
3739
include::release-notes/7.8.asciidoc[]
3840
include::release-notes/7.7.asciidoc[]
3941
include::release-notes/7.6.asciidoc[]
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[[release-notes-7.9.0]]
2+
== {es} version 7.9.0
3+
4+
Also see <<breaking-changes-7.9,Breaking changes in 7.9>>.
5+
6+
[[breaking-7.9.0]]
7+
[float]
8+
=== Breaking changes
9+
10+
Script Cache::
11+
* Script cache size and rate limiting are per-context {pull}55753[#55753] (issue: {issue}50152[#50152])

docs/reference/release-notes/highlights.asciidoc

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33

44
coming[{minor-version}]
55

6-
Here are the highlights of what's new and improved in {es} {minor-version}!
6+
Here are the highlights of what's new and improved in {es} {minor-version}!
77
ifeval::["{release-state}"!="unreleased"]
8-
For detailed information about this release, see the
9-
<<release-notes-{elasticsearch_version}, Release notes >> and
8+
For detailed information about this release, see the
9+
<<release-notes-{elasticsearch_version}, Release notes >> and
1010
<<breaking-changes-{minor-version}, Breaking changes>>.
1111
endif::[]
1212

1313
// Add previous release to the list
14-
Other versions:
15-
{ref-bare}/7.8/release-highlights.html[7.8]
14+
Other versions:
15+
{ref-bare}/7.8/release-highlights.html[7.8]
1616
| {ref-bare}/7.7/release-highlights.html[7.7]
1717
| {ref-bare}/7.6/release-highlights-7.6.0.html[7.6]
1818
| {ref-bare}/7.5/release-highlights-7.5.0.html[7.5]
@@ -24,17 +24,17 @@ Other versions:
2424

2525

2626

27-
// Use the notable-highlights tag to mark entries that
27+
// Use the notable-highlights tag to mark entries that
2828
// should be featured in the Stack Installation and Upgrade Guide:
29-
// tag::notable-highlights[]
29+
// tag::notable-highlights[]
3030
// [discrete]
3131
// === Heading
3232
//
33-
// Description.
33+
// Description.
3434
// end::notable-highlights[]
3535

3636
// Omit the notable highlights tag for entries that only need to appear in the ES ref:
37-
// [float]
37+
// [float]
3838
// === Heading
3939
//
40-
// Description.
40+
// Description.

docs/reference/scripting/using.asciidoc

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,11 @@ second version is only compiled once.
9898
9999
If you compile too many unique scripts within a small amount of time,
100100
Elasticsearch will reject the new dynamic scripts with a
101-
`circuit_breaking_exception` error. By default, up to 15 inline scripts per
102-
minute will be compiled. You can change this setting dynamically by setting
103-
`script.max_compilations_rate`.
101+
`circuit_breaking_exception` error. By default, up to 75 scripts per
102+
5 minutes will be compiled for most contexts and 375 scripts per 5 minutes
103+
for `ingest` contexts. You can change these settings dynamically by setting
104+
`script.context.$CONTEXT.max_compilations_rate` e.g.,
105+
`script.context.field.max_compilations_rate=100/10m`.
104106
105107
========================================
106108

@@ -135,7 +137,7 @@ The same script in the normal form:
135137
Scripts may be stored in and retrieved from the cluster state using the
136138
`_scripts` end-point.
137139

138-
If the {es} {security-features} are enabled, you must have the following
140+
If the {es} {security-features} are enabled, you must have the following
139141
privileges to create, retrieve, and delete stored scripts:
140142

141143
* cluster: `all` or `manage`
@@ -241,9 +243,17 @@ templating language]. See <<search-template>> for more information and examples.
241243

242244
All scripts are cached by default so that they only need to be recompiled
243245
when updates occur. By default, scripts do not have a time-based expiration, but
244-
you can change this behavior by using the `script.cache.expire` setting.
245-
You can configure the size of this cache by using the `script.cache.max_size` setting.
246-
By default, the cache size is `100`.
246+
you can configure the size of this cache using the
247+
`script.context.$CONTEXT.cache_expire` setting.
248+
By default, the cache size is `100` for all contexts except the `ingest` and the
249+
`processor_conditional` context, where it is `200`.
250+
251+
|====
252+
| Context | Default Cache Size
253+
| `ingest` | 200
254+
| `processor_conditional` | 200
255+
| default | 100
256+
|====
247257

248258
NOTE: The size of scripts is limited to 65,535 bytes. This can be
249259
changed by setting `script.max_size_in_bytes` setting to increase that soft

0 commit comments

Comments
 (0)