Scripting: Unlimited compilation rate for ingest (#59268)
* `ingest` and `processor_conditional` default to unlimited compilation rate Refs: #50152
This commit is contained in:
parent
1402f787f8
commit
4c04fd1e05
|
@ -19,7 +19,6 @@
|
||||||
|
|
||||||
package org.elasticsearch.script;
|
package org.elasticsearch.script;
|
||||||
|
|
||||||
import org.elasticsearch.common.collect.Tuple;
|
|
||||||
import org.elasticsearch.common.unit.TimeValue;
|
import org.elasticsearch.common.unit.TimeValue;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -33,7 +32,7 @@ public abstract class IngestConditionalScript {
|
||||||
|
|
||||||
/** The context used to compile {@link IngestConditionalScript} factories. */
|
/** The context used to compile {@link IngestConditionalScript} factories. */
|
||||||
public static final ScriptContext<Factory> CONTEXT = new ScriptContext<>("processor_conditional", Factory.class,
|
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. */
|
/** The generic runtime parameters for the script. */
|
||||||
private final Map<String, Object> params;
|
private final Map<String, Object> params;
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
|
|
||||||
package org.elasticsearch.script;
|
package org.elasticsearch.script;
|
||||||
|
|
||||||
import org.elasticsearch.common.collect.Tuple;
|
|
||||||
import org.elasticsearch.common.unit.TimeValue;
|
import org.elasticsearch.common.unit.TimeValue;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -34,7 +33,7 @@ public abstract class IngestScript {
|
||||||
|
|
||||||
/** The context used to compile {@link IngestScript} factories. */
|
/** The context used to compile {@link IngestScript} factories. */
|
||||||
public static final ScriptContext<Factory> CONTEXT = new ScriptContext<>("ingest", Factory.class,
|
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. */
|
/** The generic runtime parameters for the script. */
|
||||||
private final Map<String, Object> params;
|
private final Map<String, Object> params;
|
||||||
|
|
|
@ -248,7 +248,6 @@ public class ScriptCache {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static class CompilationRate {
|
public static class CompilationRate {
|
||||||
public final int count;
|
public final int count;
|
||||||
public final TimeValue time;
|
public final TimeValue time;
|
||||||
|
|
|
@ -29,7 +29,6 @@ public class ScriptCacheTests extends ESTestCase {
|
||||||
public void testCompilationCircuitBreaking() throws Exception {
|
public void testCompilationCircuitBreaking() throws Exception {
|
||||||
final TimeValue expire = ScriptService.SCRIPT_GENERAL_CACHE_EXPIRE_SETTING.get(Settings.EMPTY);
|
final TimeValue expire = ScriptService.SCRIPT_GENERAL_CACHE_EXPIRE_SETTING.get(Settings.EMPTY);
|
||||||
final Integer size = ScriptService.SCRIPT_GENERAL_CACHE_SIZE_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();
|
String settingName = ScriptService.SCRIPT_GENERAL_MAX_COMPILATIONS_RATE_SETTING.getKey();
|
||||||
ScriptCache cache = new ScriptCache(size, expire, new ScriptCache.CompilationRate(1, TimeValue.timeValueMinutes(1)), settingName);
|
ScriptCache cache = new ScriptCache(size, expire, new ScriptCache.CompilationRate(1, TimeValue.timeValueMinutes(1)), settingName);
|
||||||
cache.checkCompilationLimit(); // should pass
|
cache.checkCompilationLimit(); // should pass
|
||||||
|
|
Loading…
Reference in New Issue