From 97a937dd4bc3819d03f1a94584793106daead60f Mon Sep 17 00:00:00 2001 From: Niels Bauman Date: Tue, 26 Nov 2024 16:45:13 +0100 Subject: [PATCH 1/2] Fix enrich cache size setting name The enrich cache size setting accidentally got renamed from `enrich.cache_size` to `enrich.cache.size` in #111412. This commit ensures we accept both versions, to avoid breaking BWC twice. --- .../xpack/enrich/EnrichPlugin.java | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/EnrichPlugin.java b/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/EnrichPlugin.java index 1a68ada60b6f1..21098307a4ae9 100644 --- a/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/EnrichPlugin.java +++ b/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/EnrichPlugin.java @@ -126,9 +126,9 @@ public class EnrichPlugin extends Plugin implements SystemIndexPlugin, IngestPlu return String.valueOf(maxConcurrentRequests * maxLookupsPerRequest); }, val -> Setting.parseInt(val, 1, Integer.MAX_VALUE, QUEUE_CAPACITY_SETTING_NAME), Setting.Property.NodeScope); - public static final String CACHE_SIZE_SETTING_NAME = "enrich.cache.size"; + public static final String CACHE_SIZE_SETTING_NAME = "enrich.cache_size"; public static final Setting CACHE_SIZE = new Setting<>( - "enrich.cache.size", + CACHE_SIZE_SETTING_NAME, (String) null, (String s) -> FlatNumberOrByteSizeValue.parse( s, @@ -138,12 +138,28 @@ public class EnrichPlugin extends Plugin implements SystemIndexPlugin, IngestPlu Setting.Property.NodeScope ); + public static final String CACHE_SIZE_SETTING_BWC_NAME = "enrich.cache.size"; + public static final Setting CACHE_SIZE_BWC = new Setting<>( + CACHE_SIZE_SETTING_BWC_NAME, + (String) null, + (String s) -> FlatNumberOrByteSizeValue.parse( + s, + CACHE_SIZE_SETTING_BWC_NAME, + new FlatNumberOrByteSizeValue(ByteSizeValue.ofBytes((long) (0.01 * JvmInfo.jvmInfo().getConfiguredMaxHeapSize()))) + ), + Setting.Property.NodeScope, + Setting.Property.Deprecated + ); + private final Settings settings; private final EnrichCache enrichCache; public EnrichPlugin(final Settings settings) { this.settings = settings; FlatNumberOrByteSizeValue maxSize = CACHE_SIZE.get(settings); + if (maxSize == null) { + maxSize = CACHE_SIZE_BWC.get(settings); + } if (maxSize.byteSizeValue() != null) { this.enrichCache = new EnrichCache(maxSize.byteSizeValue()); } else { From bf8b7b8f8522211bf3d3253483c3f590dfc77066 Mon Sep 17 00:00:00 2001 From: Niels Bauman <33722607+nielsbauman@users.noreply.github.com> Date: Tue, 26 Nov 2024 16:48:00 +0100 Subject: [PATCH 2/2] Update docs/changelog/117576.yaml --- docs/changelog/117576.yaml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 docs/changelog/117576.yaml diff --git a/docs/changelog/117576.yaml b/docs/changelog/117576.yaml new file mode 100644 index 0000000000000..ec327ed0a82d0 --- /dev/null +++ b/docs/changelog/117576.yaml @@ -0,0 +1,5 @@ +pr: 117576 +summary: Fix enrich cache size setting name +area: Ingest Node +type: bug +issues: []