-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Fix enrich cache size setting name #117575
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
c000ac0
Fix enrich cache size setting name
nielsbauman f05890b
Update docs/changelog/117575.yaml
nielsbauman e0e1e82
Merge branch 'main' into enrich-fix-main
nielsbauman 13ed0e6
Add tests and comment
nielsbauman d304e0e
Merge branch 'main' into enrich-fix-main
nielsbauman 8bcc8b2
Add log that points to correct name
nielsbauman e894207
Use deprecation logger
nielsbauman d5da89f
Fix tests
nielsbauman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| pr: 117575 | ||
| summary: Fix enrich cache size setting name | ||
| area: Ingest Node | ||
| type: bug | ||
| issues: [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
x-pack/plugin/enrich/src/test/java/org/elasticsearch/xpack/enrich/EnrichPluginTests.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0; you may not use this file except in compliance with the Elastic License | ||
| * 2.0. | ||
| */ | ||
|
|
||
| package org.elasticsearch.xpack.enrich; | ||
|
|
||
| import org.elasticsearch.common.settings.Settings; | ||
| import org.elasticsearch.test.ESTestCase; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public class EnrichPluginTests extends ESTestCase { | ||
|
|
||
| public void testConstructWithByteSize() { | ||
| final var size = randomNonNegativeInt(); | ||
| Settings settings = Settings.builder().put(EnrichPlugin.CACHE_SIZE_SETTING_NAME, size + "b").build(); | ||
| EnrichPlugin plugin = new EnrichPlugin(settings); | ||
| assertEquals(size, plugin.getMaxCacheSize()); | ||
| } | ||
|
|
||
| public void testConstructWithFlatNumber() { | ||
| final var size = randomNonNegativeInt(); | ||
| Settings settings = Settings.builder().put(EnrichPlugin.CACHE_SIZE_SETTING_NAME, size).build(); | ||
| EnrichPlugin plugin = new EnrichPlugin(settings); | ||
| assertEquals(size, plugin.getMaxCacheSize()); | ||
| } | ||
|
|
||
| public void testConstructWithByteSizeBwc() { | ||
| final var size = randomNonNegativeInt(); | ||
| Settings settings = Settings.builder().put(EnrichPlugin.CACHE_SIZE_SETTING_BWC_NAME, size + "b").build(); | ||
| EnrichPlugin plugin = new EnrichPlugin(settings); | ||
| assertEquals(size, plugin.getMaxCacheSize()); | ||
| } | ||
|
|
||
| public void testConstructWithFlatNumberBwc() { | ||
| final var size = randomNonNegativeInt(); | ||
| Settings settings = Settings.builder().put(EnrichPlugin.CACHE_SIZE_SETTING_BWC_NAME, size).build(); | ||
| EnrichPlugin plugin = new EnrichPlugin(settings); | ||
| assertEquals(size, plugin.getMaxCacheSize()); | ||
| } | ||
|
|
||
| public void testConstructWithBothSettings() { | ||
| Settings settings = Settings.builder() | ||
| .put(EnrichPlugin.CACHE_SIZE_SETTING_NAME, randomNonNegativeInt()) | ||
| .put(EnrichPlugin.CACHE_SIZE_SETTING_BWC_NAME, randomNonNegativeInt()) | ||
| .build(); | ||
| assertThrows(IllegalArgumentException.class, () -> new EnrichPlugin(settings)); | ||
| } | ||
|
|
||
| @Override | ||
| protected List<String> filteredWarnings() { | ||
| final var warnings = super.filteredWarnings(); | ||
| warnings.add("[enrich.cache.size] setting was deprecated in Elasticsearch and will be removed in a future release."); | ||
| warnings.add( | ||
| "The [enrich.cache.size] setting is deprecated and will be removed in a future version. Please use [enrich.cache_size] instead." | ||
| ); | ||
| return warnings; | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are the
Settings.Property.Deprecatedbelow and this@Updatetoo soon?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the
@UpdateForV10is fine, but the deprecated thing I'm not sure about yet. What I don't like about it here is that we can't redirect users back to the setting they should be using (cache_size). Perhaps it'd be worth adding it into the constructor rather than the setting itself? Both is probably fine (the annotation would let us see it in the migration APIs I think)