Skip to content

Commit ef543b0

Browse files
committed
Scripting: Deprecate general cache settings (#55038)
* Test: don't modify defaultConfig on upgrade
1 parent 86129fb commit ef543b0

12 files changed

Lines changed: 361 additions & 337 deletions

File tree

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().getMajor() >= 8) {
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
}
Lines changed: 59 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Only used for testing the docker images
2-
version: '3'
2+
version: '3.4'
33
services:
44
elasticsearch-default-1:
55
image: elasticsearch:test
6-
environment:
7-
- node.name=elasticsearch-default-1
6+
environment:
7+
- node.name=elasticsearch-default-1
88
- cluster.initial_master_nodes=elasticsearch-default-1,elasticsearch-default-2
9-
- discovery.seed_hosts=elasticsearch-default-2:9300
9+
- discovery.seed_hosts=elasticsearch-default-2:9300
1010
- cluster.name=elasticsearch-default
1111
- bootstrap.memory_lock=true
1212
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
@@ -15,21 +15,20 @@ 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
19-
- node.store.allow_mmap=false
18+
- node.store.allow_mmap=false
2019
- xpack.security.enabled=true
2120
- xpack.security.transport.ssl.enabled=true
2221
- xpack.security.http.ssl.enabled=true
2322
- xpack.security.authc.token.enabled=true
2423
- xpack.security.audit.enabled=true
25-
- xpack.security.authc.realms.file.file1.order=0
24+
- xpack.security.authc.realms.file.file1.order=0
2625
- xpack.security.authc.realms.native.native1.order=1
2726
- xpack.security.transport.ssl.keystore.path=/usr/share/elasticsearch/config/testnode.jks
2827
- xpack.security.http.ssl.keystore.path=/usr/share/elasticsearch/config/testnode.jks
29-
- xpack.http.ssl.verification_mode=certificate
30-
- xpack.security.transport.ssl.verification_mode=certificate
28+
- xpack.http.ssl.verification_mode=certificate
29+
- xpack.security.transport.ssl.verification_mode=certificate
3130
- xpack.license.self_generated.type=trial
32-
volumes:
31+
volumes:
3332
- ./build/repo:/tmp/es-repo
3433
- ./build/certs/testnode.jks:/usr/share/elasticsearch/config/testnode.jks
3534
- ./build/logs/default-1:/usr/share/elasticsearch/logs
@@ -40,13 +39,22 @@ services:
4039
memlock:
4140
soft: -1
4241
hard: -1
42+
nofile:
43+
soft: 65536
44+
hard: 65536
4345
entrypoint: /docker-test-entrypoint.sh
46+
healthcheck:
47+
start_period: 15s
48+
test: ["CMD", "curl", "-f", "-u", "x_pack_rest_user:x-pack-test-password", "-k", "https://localhost:9200"]
49+
interval: 10s
50+
timeout: 2s
51+
retries: 5
4452
elasticsearch-default-2:
4553
image: elasticsearch:test
46-
environment:
54+
environment:
4755
- node.name=elasticsearch-default-2
4856
- cluster.initial_master_nodes=elasticsearch-default-1,elasticsearch-default-2
49-
- discovery.seed_hosts=elasticsearch-default-1:9300
57+
- discovery.seed_hosts=elasticsearch-default-1:9300
5058
- cluster.name=elasticsearch-default
5159
- bootstrap.memory_lock=true
5260
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
@@ -55,21 +63,20 @@ services:
5563
- cluster.routing.allocation.disk.watermark.low=1b
5664
- cluster.routing.allocation.disk.watermark.high=1b
5765
- cluster.routing.allocation.disk.watermark.flood_stage=1b
58-
- script.max_compilations_rate=2048/1m
59-
- node.store.allow_mmap=false
66+
- node.store.allow_mmap=false
6067
- xpack.security.enabled=true
6168
- xpack.security.transport.ssl.enabled=true
6269
- xpack.security.http.ssl.enabled=true
6370
- xpack.security.authc.token.enabled=true
6471
- xpack.security.audit.enabled=true
65-
- xpack.security.authc.realms.file.file1.order=0
66-
- xpack.security.authc.realms.native.native1.order=1
72+
- xpack.security.authc.realms.file.file1.order=0
73+
- xpack.security.authc.realms.native.native1.order=1
6774
- xpack.security.transport.ssl.keystore.path=/usr/share/elasticsearch/config/testnode.jks
6875
- xpack.security.http.ssl.keystore.path=/usr/share/elasticsearch/config/testnode.jks
69-
- xpack.http.ssl.verification_mode=certificate
70-
- xpack.security.transport.ssl.verification_mode=certificate
76+
- xpack.http.ssl.verification_mode=certificate
77+
- xpack.security.transport.ssl.verification_mode=certificate
7178
- xpack.license.self_generated.type=trial
72-
volumes:
79+
volumes:
7380
- ./build/repo:/tmp/es-repo
7481
- ./build/certs/testnode.jks:/usr/share/elasticsearch/config/testnode.jks
7582
- ./build/logs/default-2:/usr/share/elasticsearch/logs
@@ -80,13 +87,22 @@ services:
8087
memlock:
8188
soft: -1
8289
hard: -1
90+
nofile:
91+
soft: 65536
92+
hard: 65536
8393
entrypoint: /docker-test-entrypoint.sh
94+
healthcheck:
95+
start_period: 15s
96+
test: ["CMD", "curl", "-f", "-u", "x_pack_rest_user:x-pack-test-password", "-k", "https://localhost:9200"]
97+
interval: 10s
98+
timeout: 2s
99+
retries: 5
84100
elasticsearch-oss-1:
85101
image: elasticsearch:test
86-
environment:
87-
- node.name=elasticsearch-oss-1
102+
environment:
103+
- node.name=elasticsearch-oss-1
88104
- cluster.initial_master_nodes=elasticsearch-oss-1,elasticsearch-oss-2
89-
- discovery.seed_hosts=elasticsearch-oss-2:9300
105+
- discovery.seed_hosts=elasticsearch-oss-2:9300
90106
- cluster.name=elasticsearch-oss
91107
- bootstrap.memory_lock=true
92108
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
@@ -95,9 +111,8 @@ services:
95111
- cluster.routing.allocation.disk.watermark.low=1b
96112
- cluster.routing.allocation.disk.watermark.high=1b
97113
- cluster.routing.allocation.disk.watermark.flood_stage=1b
98-
- script.max_compilations_rate=2048/1m
99-
- node.store.allow_mmap=false
100-
volumes:
114+
- node.store.allow_mmap=false
115+
volumes:
101116
- ./build/oss-repo:/tmp/es-repo
102117
- ./build/logs/oss-1:/usr/share/elasticsearch/logs
103118
ports:
@@ -106,12 +121,21 @@ services:
106121
memlock:
107122
soft: -1
108123
hard: -1
124+
nofile:
125+
soft: 65536
126+
hard: 65536
127+
healthcheck:
128+
start_period: 15s
129+
test: ["CMD", "curl", "-f", "http://localhost:9200"]
130+
interval: 10s
131+
timeout: 2s
132+
retries: 5
109133
elasticsearch-oss-2:
110134
image: elasticsearch:test
111-
environment:
135+
environment:
112136
- node.name=elasticsearch-oss-2
113137
- cluster.initial_master_nodes=elasticsearch-oss-1,elasticsearch-oss-2
114-
- discovery.seed_hosts=elasticsearch-oss-1:9300
138+
- discovery.seed_hosts=elasticsearch-oss-1:9300
115139
- cluster.name=elasticsearch-oss
116140
- bootstrap.memory_lock=true
117141
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
@@ -120,9 +144,8 @@ services:
120144
- cluster.routing.allocation.disk.watermark.low=1b
121145
- cluster.routing.allocation.disk.watermark.high=1b
122146
- cluster.routing.allocation.disk.watermark.flood_stage=1b
123-
- script.max_compilations_rate=2048/1m
124-
- node.store.allow_mmap=false
125-
volumes:
147+
- node.store.allow_mmap=false
148+
volumes:
126149
- ./build/oss-repo:/tmp/es-repo
127150
- ./build/logs/oss-2:/usr/share/elasticsearch/logs
128151
ports:
@@ -131,3 +154,9 @@ services:
131154
memlock:
132155
soft: -1
133156
hard: -1
157+
healthcheck:
158+
start_period: 15s
159+
test: ["CMD", "curl", "-f", "http://localhost:9200"]
160+
interval: 10s
161+
timeout: 2s
162+
retries: 5

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/scripting/using.asciidoc

Lines changed: 5 additions & 3 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` eg.
105+
`script.context.field.max_compilations_rate=100/10m`.
104106
105107
========================================
106108

qa/remote-clusters/docker-compose-oss.yml

Lines changed: 0 additions & 2 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
volumes:
2120
- ./build/oss-repo:/tmp/es-repo
@@ -50,7 +49,6 @@ services:
5049
- cluster.routing.allocation.disk.watermark.low=1b
5150
- cluster.routing.allocation.disk.watermark.high=1b
5251
- cluster.routing.allocation.disk.watermark.flood_stage=1b
53-
- script.max_compilations_rate=2048/1m
5452
- node.store.allow_mmap=false
5553
volumes:
5654
- ./build/oss-repo:/tmp/es-repo

qa/remote-clusters/docker-compose.yml

Lines changed: 0 additions & 2 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
@@ -65,7 +64,6 @@ services:
6564
- cluster.routing.allocation.disk.watermark.low=1b
6665
- cluster.routing.allocation.disk.watermark.high=1b
6766
- cluster.routing.allocation.disk.watermark.flood_stage=1b
68-
- script.max_compilations_rate=2048/1m
6967
- node.store.allow_mmap=false
7068
- xpack.security.enabled=true
7169
- xpack.security.transport.ssl.enabled=true

server/src/main/java/org/elasticsearch/common/settings/ClusterSettings.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,7 @@ public void apply(Settings value, Settings current, Settings previous) {
405405
ScriptService.SCRIPT_GENERAL_MAX_COMPILATIONS_RATE_SETTING,
406406
ScriptService.SCRIPT_CACHE_SIZE_SETTING,
407407
ScriptService.SCRIPT_CACHE_EXPIRE_SETTING,
408+
ScriptService.SCRIPT_DISABLE_MAX_COMPILATIONS_RATE_SETTING,
408409
ScriptService.SCRIPT_MAX_COMPILATIONS_RATE_SETTING,
409410
ScriptService.SCRIPT_MAX_SIZE_IN_BYTES,
410411
ScriptService.TYPES_ALLOWED_SETTING,

0 commit comments

Comments
 (0)