-
Notifications
You must be signed in to change notification settings - Fork 25.7k
[WIP] ES-11463 Components are notified to updates to per-project settings #131637
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
base: main
Are you sure you want to change the base?
Conversation
|
💚 CLA has been signed |
| Settings oldProjectSettings = oldProjectStateRegistry.getProjectSettings(projectId); | ||
| Settings newProjectSettings = newProjectStateRegistry.getProjectSettings(projectId); | ||
| if (newProjectSettings.equals(oldProjectSettings) == false) { | ||
| try (Releasable ignored = stopWatch.record("applying project 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.
Should we have project id here?
| import java.util.function.BiConsumer; | ||
| import java.util.function.Consumer; | ||
|
|
||
| public abstract class AbstractContextlessScopedSettings extends AbstractScopedSettings<Void> { |
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.
I don't like this name, but didn't manage to find anything better
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.
Can we add Javadoc then? Since the name isn't especially informative.
|
There are still discussions about the design of ProjectScopedSettings and its interoperability with ClusterSettings, so I've marked it as WIP |
|
Pinging @elastic/es-core-infra (Team:Core/Infra) |
|
Thanks for working on this! I am not entirely sure that I like how The current proposal has On the consumer side, we do need the context ( I am probably not updated with all the discussions around this topic. So there maybe strong reasons for the current proposal. I appreciate the progress here regardless of which choice we end up taking. 🙏 |
|
I'm a little unsure where we're heading here. There's some strangeness (as @ywangd touched on) but I don't know whether it's intended to be a temporary state on the way to something else, or an attempt to move in a different than we've had in the past, or something else. To be fair, what we started with was also a bit strange - we've been putting off a bunch of Settings cleanup work for some time. Things that were already a bit weird (please correct me if I've made a mistake here, but the weirdness makes it hard to keep track of how everything works, or is supposed to work)
Now we have another type of per-instance setting: This PR takes a different approach to handling that than the one I think the root of the problem is that
If we split 1 and 3 into different classes, then I think things would be a bit simpler.
But, maybe you have a different plan. Do we have a vision for how we want this to look when we're done? Is this just step 1? |
Yes
Yes, this should be possible.
I agree that it would be better not to expose methods with context parameter in
We were considering this approach, but despite looking similar to what we want to achieve with projects, the approach, as you rightly mentioned, has a lot of problems, so we decided to do project settings differently.
I don't think we have a clear end-to-end vision for settings as a whole right now. There are some improvement ideas, but nothing comprehensive that would clean up the whole system. This PR definitely adds another layer of complexity, but a full redesign would be a huge effort and isn't something we aimed to solve here. |
I definitely agree. I think the issue here is on the consumer side. For indices the things that listen to updates tend to already be per-index, so it makes sense to have things scoped all the way down. For multi-project however, we don't intend to have a lot of per-project components (or at least that's our aim), so following the pattern of
I'm not sure this is avoidable. Components that leverage per-project settings have to be aware of this already. By definition, if they care that the setting is per-project, they are already doing this bookeeping internally. I don't think performing the extra step of "oh, which project is this for" is that big a deal.
Only I think the distinction of "context aware" vs "per-instance" may not be the right one but it's the one we got. It seems (at least in the short term) that the main contention is on how we pass that context. I tend to agree that applying even more complexity on top of the already fragmented settings infra is probably not what we want to do. As @alexey-ivanov-es states, a larger refactoring of all this stuff isn't really on the table at the moment. I'd propose ditching It sort of then begs the question of whether a |
This commit introduces a notification system for components when per-project settings are updated. The implementation refactors the existing settings framework by introducing settings context concept to AbstractScopedSettings. In order to maintain backward-compatibility with existing code it also introduces AbstractContextlessScopedSettings which becomes ancestor for IndexScopedSetting and ClusterSettings.
It also adds additional logic to
ClusterApplierService.applyChanges- when cluster state changes occur, the system compares old and new project settings for each known project and triggers settings updates for any changes detected.