-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Fixed inconsistent Setting.exist() #46603
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
Conversation
Setting.exist will no longer return true if there's setting in keystore with the same name. Also removed synchronization on keySet to lower congestion, possibly constructing keySet multiple times, which should be cheap though. Closes elastic#41830
|
Pinging @elastic/es-core-infra |
|
I think having this alternate version of |
|
I've seen the comments there, but I don't see how we can get both
|
|
I'm ok with the keySet method as in this PR, but I don't think it needs to be public? The Settings class for a node is a representation of all settings across elasticsearch.yml and the keystore. This is an implementation detail only necessary to get correct behavior for this one method. |
|
@rjernst you were right that there is option to reuse current methods, using reversed check from |
rjernst
left a comment
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.
One more nit, then LGTM
| public boolean exists(final Settings settings) { | ||
| return settings.keySet().contains(getKey()); | ||
| SecureSettings secureSettings = settings.getSecureSettings(); | ||
| return settings.keySet().contains(getKey()) && (secureSettings == null || !secureSettings.getSettingNames().contains(getKey())); |
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 prefer to use == false for negations because it is easier to visually spot than !
|
@elasticmachine test this please |
|
@elasticmachine run elasticsearch-ci/2 |
|
@elasticmachine run elasticsearch-ci/bwc |
|
@elasticmachine run elasticsearch-ci/default-distro |
|
@elasticmachine run elasticsearch-ci/docs |
Setting.exist() will no longer return true if there's setting in keystore with the same name.
Closes #41830