-
Notifications
You must be signed in to change notification settings - Fork 25.5k
Use latest setting value when initializing setting watch #134091
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
When new cluster settings are applied, consumers watchings are notified. The consumer should see the latest value at the time of initializing a watch. However, only the node settings were ever used in finding the value to initialize the consumer. This commit fixes the consumer to use the value from latest applied if it exists. closes elastic#133701
Pinging @elastic/es-core-infra (Team:Core/Infra) |
Hi @rjernst, I've created a changelog YAML for you. |
assert setting.getProperties().contains(Setting.Property.NodeScope) : "Can only watch node settings"; | ||
consumer.accept(setting.get(settings)); | ||
|
||
// this mimics the combined settings of last applied and node settings, without building a new settings object |
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.
With this comment I understand you are trying to avoid doing
Settings.builder().put(this.settings).put(this.lastSettingsApplied).build()
like in other functions, correct?
Is there an advantage? Is it correct? (is lastSettingsApplied
always a superset of settings
?)
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.
Building a combined Settings object is heavyweight. It requires combing the internal maps that each Settings object contains.
If the latter settings object contains a setting we are looking for, it would have overridden the value when combined, so looking at the latter first should mimic the combined behavior.
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.
Building a combined Settings object is heavyweight. It requires combing the internal maps that each Settings object contains.
I understand that, but I was wondering if it really matters in this case - I might be mistaken, but this is an initialization method, so probably it's not on a hot path.
As long as it's correct I like the optimization though.
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.
this is an initialization method
While true, it's also called for every setting that is watched, currently 43 uses. Seems silly to reconstruct the same settings object 43 times (but also not worth the complexity to cache it in a threadsafe way).
) When new cluster settings are applied, consumers watchings are notified. The consumer should see the latest value at the time of initializing a watch. However, only the node settings were ever used in finding the value to initialize the consumer. This commit fixes the consumer to use the value from latest applied if it exists. closes elastic#133701
) When new cluster settings are applied, consumers watchings are notified. The consumer should see the latest value at the time of initializing a watch. However, only the node settings were ever used in finding the value to initialize the consumer. This commit fixes the consumer to use the value from latest applied if it exists. closes elastic#133701
) When new cluster settings are applied, consumers watchings are notified. The consumer should see the latest value at the time of initializing a watch. However, only the node settings were ever used in finding the value to initialize the consumer. This commit fixes the consumer to use the value from latest applied if it exists. closes elastic#133701
) When new cluster settings are applied, consumers watchings are notified. The consumer should see the latest value at the time of initializing a watch. However, only the node settings were ever used in finding the value to initialize the consumer. This commit fixes the consumer to use the value from latest applied if it exists. closes elastic#133701
…134315) When new cluster settings are applied, consumers watchings are notified. The consumer should see the latest value at the time of initializing a watch. However, only the node settings were ever used in finding the value to initialize the consumer. This commit fixes the consumer to use the value from latest applied if it exists. closes #133701
…134314) When new cluster settings are applied, consumers watchings are notified. The consumer should see the latest value at the time of initializing a watch. However, only the node settings were ever used in finding the value to initialize the consumer. This commit fixes the consumer to use the value from latest applied if it exists. closes #133701
…134313) When new cluster settings are applied, consumers watchings are notified. The consumer should see the latest value at the time of initializing a watch. However, only the node settings were ever used in finding the value to initialize the consumer. This commit fixes the consumer to use the value from latest applied if it exists. closes #133701
) When new cluster settings are applied, consumers watchings are notified. The consumer should see the latest value at the time of initializing a watch. However, only the node settings were ever used in finding the value to initialize the consumer. This commit fixes the consumer to use the value from latest applied if it exists. closes elastic#133701
…134316) When new cluster settings are applied, consumers watchings are notified. The consumer should see the latest value at the time of initializing a watch. However, only the node settings were ever used in finding the value to initialize the consumer. This commit fixes the consumer to use the value from latest applied if it exists. closes #133701
) (elastic#134316) When new cluster settings are applied, consumers watchings are notified. The consumer should see the latest value at the time of initializing a watch. However, only the node settings were ever used in finding the value to initialize the consumer. This commit fixes the consumer to use the value from latest applied if it exists. closes elastic#133701
) (elastic#134316) When new cluster settings are applied, consumers watchings are notified. The consumer should see the latest value at the time of initializing a watch. However, only the node settings were ever used in finding the value to initialize the consumer. This commit fixes the consumer to use the value from latest applied if it exists. closes elastic#133701
When new cluster settings are applied, consumers watchings are notified. The consumer should see the latest value at the time of initializing a watch. However, only the node settings were ever used in finding the value to initialize the consumer. This commit fixes the consumer to use the value from latest applied if it exists.
closes #133701