Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix enrich cache size setting name #117576

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/changelog/117576.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 117576
summary: Fix enrich cache size setting name
area: Ingest Node
type: bug
issues: []
Original file line number Diff line number Diff line change
Expand Up @@ -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<FlatNumberOrByteSizeValue> CACHE_SIZE = new Setting<>(
"enrich.cache.size",
CACHE_SIZE_SETTING_NAME,
(String) null,
(String s) -> FlatNumberOrByteSizeValue.parse(
s,
Expand All @@ -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";
nielsbauman marked this conversation as resolved.
Show resolved Hide resolved
public static final Setting<FlatNumberOrByteSizeValue> 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) {
nielsbauman marked this conversation as resolved.
Show resolved Hide resolved
maxSize = CACHE_SIZE_BWC.get(settings);
}
if (maxSize.byteSizeValue() != null) {
this.enrichCache = new EnrichCache(maxSize.byteSizeValue());
} else {
Expand Down