-
Notifications
You must be signed in to change notification settings - Fork 25.5k
Consolidate settings consumers for RemoteClusterService
#135722
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
Consolidate settings consumers for RemoteClusterService
#135722
Conversation
Moves the REMOTE_CLUSTER_SKIP_UNAVAILABLE setting into the main AffixSettings list in ClusterSettingsLinkedProjectConfigService, eliminating the need for an extra skip_unavailable specific update method on the LinkedProjectConfigListener interface, simplifying the design. Note that it is not possible to just set REMOTE_CLUSTER_SKIP_UNAVAILABLE in a settings update, the RemoteConnectionEnabled settings validator checks that the required settings for an enabled connection are also present. Resolves: ES-12860
Pinging @elastic/es-distributed-coordination (Team:Distributed Coordination) |
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.
Thanks for working on this. I have some questions.
remote.ensureConnected(listener.map(ignored -> RemoteClusterConnectionStatus.RECONNECTED)); | ||
} else { | ||
if (crossProjectEnabled == false) { | ||
remote.setSkipUnavailable(config.skipUnavailable()); |
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.
To be strictly faithful to existing behaviour, I think this should be something like
remote.setSkipUnavailable(config.skipUnavailable()); | |
if (remote.isSkipUnavailable() != config.skipUnavailable()) { | |
remote.setSkipUnavailable(config.skipUnavailable()); | |
} |
// No changes to connection configuration. | ||
listener.onResponse(RemoteClusterConnectionStatus.UNCHANGED); |
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.
It is a little odd that we report UNCHANGED
when skipUnavailable
changes. It might be useful to add a new enum such as UPDATED
for updating properties on existing connection.
connectionMap.put(clusterAlias, remote); | ||
remote.ensureConnected(listener.map(ignored -> RemoteClusterConnectionStatus.RECONNECTED)); | ||
} else { | ||
if (crossProjectEnabled == false) { |
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.
Is this a new change? The existing code does not seem to check this when updating it? I remember we discussed previously that skipUnavailable
should not be used in CPS. But I forgot exactly what implementation we settled with. It feels that we should block setting it in the first place instead of silently ignore it?
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.
You are right, this would be a new check, I removed this. In #132478 we are adding the setting validator that would reject the setting being configured.
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.
LGTM
var skipUnavailable = randomBoolean(); | ||
applySettingsAndVerify.accept(skipUnavailable, remote1Transport); | ||
|
||
// Change skip_unavailable value, but not seed node, connection should not be rebuilt, but skip_unavailable should be modified. |
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.
It would be great to somehow assert that the connection is the same instance, i.e. no rebuilding.
Moves the
REMOTE_CLUSTER_SKIP_UNAVAILABLE
setting into the mainAffixSetting
s list inClusterSettingsLinkedProjectConfigService
, eliminating the need for an extra skip_unavailable specific update method on theLinkedProjectConfigListener
interface, simplifying the design. Note that it is not possible to just setREMOTE_CLUSTER_SKIP_UNAVAILABLE
in a settings update, theRemoteClusterSettings.RemoteConnectionEnabled
settings validator checks that the required settings for an enabled connection are also present.Resolves: ES-12860