mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-01 00:19:11 +00:00
SETTINGS: Correctly Identify Noop Updates (#36560)
* We should compare the target value with the to be applied value before interpreting the update as a change * This speeds up the test failing in #36496 considerably by preventing state updates on noop setting updates
This commit is contained in:
parent
c650be72cf
commit
34d7cc13c1
@ -726,7 +726,7 @@ public abstract class AbstractScopedSettings {
|
|||||||
validate(key, toApply, false); // we might not have a full picture here do to a dependency validation
|
validate(key, toApply, false); // we might not have a full picture here do to a dependency validation
|
||||||
settingsBuilder.copy(key, toApply);
|
settingsBuilder.copy(key, toApply);
|
||||||
updates.copy(key, toApply);
|
updates.copy(key, toApply);
|
||||||
changed = true;
|
changed |= toApply.get(key).equals(target.get(key)) == false;
|
||||||
} else {
|
} else {
|
||||||
if (isFinalSetting(key)) {
|
if (isFinalSetting(key)) {
|
||||||
throw new IllegalArgumentException("final " + type + " setting [" + key + "], not updateable");
|
throw new IllegalArgumentException("final " + type + " setting [" + key + "], not updateable");
|
||||||
|
@ -136,6 +136,17 @@ public class ScopedSettingsTests extends ESTestCase {
|
|||||||
assertEquals(1, currentSettings.size());
|
assertEquals(1, currentSettings.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testNoopSettingsUpdate() {
|
||||||
|
String value = "192.168.0.1,127.0.0.1";
|
||||||
|
String setting = "index.routing.allocation.require._ip";
|
||||||
|
Settings currentSettings = Settings.builder().put(setting, value)
|
||||||
|
.build();
|
||||||
|
Settings updates = Settings.builder().put(setting, value).build();
|
||||||
|
IndexScopedSettings settings = new IndexScopedSettings(currentSettings,
|
||||||
|
new HashSet<>(Collections.singletonList(IndexMetaData.INDEX_ROUTING_REQUIRE_GROUP_SETTING)));
|
||||||
|
assertFalse(settings.updateSettings(updates, Settings.builder().put(currentSettings), Settings.builder(), ""));
|
||||||
|
}
|
||||||
|
|
||||||
public void testAddConsumer() {
|
public void testAddConsumer() {
|
||||||
Setting<Integer> testSetting = Setting.intSetting("foo.bar", 1, Property.Dynamic, Property.NodeScope);
|
Setting<Integer> testSetting = Setting.intSetting("foo.bar", 1, Property.Dynamic, Property.NodeScope);
|
||||||
Setting<Integer> testSetting2 = Setting.intSetting("foo.bar.baz", 1, Property.Dynamic, Property.NodeScope);
|
Setting<Integer> testSetting2 = Setting.intSetting("foo.bar.baz", 1, Property.Dynamic, Property.NodeScope);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user