-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Fix enrich cache size setting name (#117575) The enrich cache size setting accidentally got renamed from `enrich.cache_size` to `enrich.cache.size` in #111412. This commit updates the enrich plugin to accept both names and deprecates the wrong name. * Remove `UpdateForV10` annotation
- Loading branch information
1 parent
ec59206
commit 6315198
Showing
3 changed files
with
121 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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 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 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; | ||
} | ||
} |