Scripting: Unlimited compilation rate for ingest (#59268)

* `ingest` and `processor_conditional` default to unlimited compilation rate

Refs: #50152
This commit is contained in:
Stuart Tettemer 2020-07-09 16:34:47 -05:00 committed by GitHub
parent 1402f787f8
commit 4c04fd1e05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 2 additions and 6 deletions

View File

@ -19,7 +19,6 @@
package org.elasticsearch.script;
import org.elasticsearch.common.collect.Tuple;
import org.elasticsearch.common.unit.TimeValue;
import java.util.Map;
@ -33,7 +32,7 @@ public abstract class IngestConditionalScript {
/** The context used to compile {@link IngestConditionalScript} factories. */
public static final ScriptContext<Factory> CONTEXT = new ScriptContext<>("processor_conditional", Factory.class,
200, TimeValue.timeValueMillis(0), new Tuple<>(375, TimeValue.timeValueMinutes(5)));
200, TimeValue.timeValueMillis(0), ScriptCache.UNLIMITED_COMPILATION_RATE.asTuple());
/** The generic runtime parameters for the script. */
private final Map<String, Object> params;

View File

@ -20,7 +20,6 @@
package org.elasticsearch.script;
import org.elasticsearch.common.collect.Tuple;
import org.elasticsearch.common.unit.TimeValue;
import java.util.Map;
@ -34,7 +33,7 @@ public abstract class IngestScript {
/** The context used to compile {@link IngestScript} factories. */
public static final ScriptContext<Factory> CONTEXT = new ScriptContext<>("ingest", Factory.class,
200, TimeValue.timeValueMillis(0), new Tuple<>(375, TimeValue.timeValueMinutes(5)));
200, TimeValue.timeValueMillis(0), ScriptCache.UNLIMITED_COMPILATION_RATE.asTuple());
/** The generic runtime parameters for the script. */
private final Map<String, Object> params;

View File

@ -248,7 +248,6 @@ public class ScriptCache {
}
}
public static class CompilationRate {
public final int count;
public final TimeValue time;

View File

@ -29,7 +29,6 @@ public class ScriptCacheTests extends ESTestCase {
public void testCompilationCircuitBreaking() throws Exception {
final TimeValue expire = ScriptService.SCRIPT_GENERAL_CACHE_EXPIRE_SETTING.get(Settings.EMPTY);
final Integer size = ScriptService.SCRIPT_GENERAL_CACHE_SIZE_SETTING.get(Settings.EMPTY);
ScriptCache.CompilationRate rate = ScriptService.SCRIPT_GENERAL_MAX_COMPILATIONS_RATE_SETTING.get(Settings.EMPTY);
String settingName = ScriptService.SCRIPT_GENERAL_MAX_COMPILATIONS_RATE_SETTING.getKey();
ScriptCache cache = new ScriptCache(size, expire, new ScriptCache.CompilationRate(1, TimeValue.timeValueMinutes(1)), settingName);
cache.checkCompilationLimit(); // should pass