-
Notifications
You must be signed in to change notification settings - Fork 25.3k
Allow follower indices to override leader settings #58103
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 follower indices to override leader settings #58103
Conversation
Today when creating a follower index via the put follow API, or via an auto-follow pattern, it is not possible to specify settings overrides for the follower index. Instead, we copy all of the leader index settings to the follower. Yet, there are cases where a user would want some different settings on the follower index such as the number of replicas, or allocation settings. This commit addresses this by allowing the user to specify settings overrides when creating follower index via manual put follower calls, or via auto-follow patterns. Note that not all settings can be overrode (e.g., index.number_of_shards) so we also have detection that prevents attempting to override settings that must be equal between the leader and follow index. Note that we do not even allow specifying such settings in the overrides, even if they are specified to be equal between the leader and the follower index. Instead, the must be implicitly copied from the leader index, not explicitly set by the user.
Pinging @elastic/es-distributed (:Distributed/CCR) |
.put(IndexMetadata.SETTING_INDEX_PROVIDED_NAME, request.getFollowerIndex()) | ||
.put(CcrSettings.CCR_FOLLOWING_INDEX_SETTING.getKey(), true); | ||
.put(CcrSettings.CCR_FOLLOWING_INDEX_SETTING.getKey(), true) | ||
.put(request.getSettings()) |
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 the crux of the change, where the request settings are propagated to the follower index. The rest of this change is just ceremony around this, parsing the settings from the request, validating that they are not including any settings that must be propagated from the leader index, and tests around this.
@elasticmachine update branch |
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.
I think we should add "index.routing.allocation.*" to the list of the non-replicated settings. But let's do it in a follow up. (We already do it :).
Today when creating a follower index via the put follow API, or via an auto-follow pattern, it is not possible to specify settings overrides for the follower index. Instead, we copy all of the leader index settings to the follower. Yet, there are cases where a user would want some different settings on the follower index such as the number of replicas, or allocation settings. This commit addresses this by allowing the user to specify settings overrides when creating follower index via manual put follower calls, or via auto-follow patterns. Note that not all settings can be overrode (e.g., index.number_of_shards) so we also have detection that prevents attempting to override settings that must be equal between the leader and follow index. Note that we do not even allow specifying such settings in the overrides, even if they are specified to be equal between the leader and the follower index. Instead, the must be implicitly copied from the leader index, not explicitly set by the user.
…Is (#4947) (#4966) Relates: elastic/elasticsearch#58103 Co-authored-by: Russ Cam <russ.cam@elastic.co>
…Is (#4947) (#4965) Relates: elastic/elasticsearch#58103 Co-authored-by: Russ Cam <russ.cam@elastic.co>
Today when creating a follower index via the put follow API, or via an auto-follow pattern, it is not possible to specify settings overrides for the follower index. Instead, we copy all of the leader index settings to the follower. Yet, there are cases where a user would want some different settings on the follower index such as the number of replicas, or allocation settings. This commit addresses this by allowing the user to specify settings overrides when creating follower index via manual put follower calls, or via auto-follow patterns. Note that not all settings can be overrode (e.g., index.number_of_shards) so we also have detection that prevents attempting to override settings that must be equal between the leader and follow index. Note that we do not even allow specifying such settings in the overrides, even if they are specified to be equal between the leader and the follower index. Instead, the must be implicitly copied from the leader index, not explicitly set by the user.