-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Allow affix settings to specify dependencies #27161
Changes from all commits
c398ff0
ddd564c
9417ac6
278f416
9ef0b0f
9c0d9de
7ea1849
e8e25fb
f3cf5a8
a5d5135
da2878e
b73286e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,6 +54,7 @@ | |
import java.util.Locale; | ||
import java.util.Map; | ||
import java.util.Set; | ||
import java.util.function.Predicate; | ||
|
||
import static org.elasticsearch.action.support.ContextPreservingActionListener.wrapPreservingContext; | ||
|
||
|
@@ -163,7 +164,7 @@ public void updateSettings(final UpdateSettingsClusterStateUpdateRequest request | |
Settings.Builder settingsForOpenIndices = Settings.builder(); | ||
final Set<String> skippedSettings = new HashSet<>(); | ||
|
||
indexScopedSettings.validate(normalizedSettings); | ||
indexScopedSettings.validate(normalizedSettings, false); // don't validate dependencies here we check it below | ||
// never allow to change the number of shards | ||
for (String key : normalizedSettings.keySet()) { | ||
Setting setting = indexScopedSettings.get(key); | ||
|
@@ -240,7 +241,9 @@ public ClusterState execute(ClusterState currentState) { | |
if (preserveExisting) { | ||
indexSettings.put(indexMetaData.getSettings()); | ||
} | ||
metaDataBuilder.put(IndexMetaData.builder(indexMetaData).settings(indexSettings)); | ||
Settings finalSettings = indexSettings.build(); | ||
indexScopedSettings.validate(finalSettings.filter(k -> indexScopedSettings.isPrivateSetting(k) == false), true); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. question: private settings are internal only, hence we want to get them out of the validation? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah |
||
metaDataBuilder.put(IndexMetaData.builder(indexMetaData).settings(finalSettings)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was wondering if this second step wasn't enough, compared to the first validation step that doesn't look at dependencies. Why have the two steps? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. one happens before we pass on to a clusterstate update task we should validate as soon as we can. but we have to do it here again |
||
} | ||
} | ||
} | ||
|
@@ -254,7 +257,9 @@ public ClusterState execute(ClusterState currentState) { | |
if (preserveExisting) { | ||
indexSettings.put(indexMetaData.getSettings()); | ||
} | ||
metaDataBuilder.put(IndexMetaData.builder(indexMetaData).settings(indexSettings)); | ||
Settings finalSettings = indexSettings.build(); | ||
indexScopedSettings.validate(finalSettings.filter(k -> indexScopedSettings.isPrivateSetting(k) == false), true); | ||
metaDataBuilder.put(IndexMetaData.builder(indexMetaData).settings(finalSettings)); | ||
} | ||
} | ||
} | ||
|
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.
"must be consistent on their own?"
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.
"we can't allow dependencies between the two"?
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.
what if you have setting A to be transient and then it disappears on a full cluster restart?
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.
sure I agree, I was just suggesting to rephrase the comment :)