-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Immutable cluster state controller #88224
Closed
Closed
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
df61848
Implement few operator handlers
407fd72
Add few ILM operator handler tests
b78d73f
Merge branch 'master' into operator/state_ilm_handlers
334f39c
Merge master
2836ff7
Rename operator to immutablestate
70f7202
Merge branch 'master' into operator/state_ilm_handlers
2c11e74
Address PR review feedback
c636026
Add ImmutableClusterStateController
da2654c
Merge master
49a1809
Merge branch 'operator/state_ilm_handlers' into operator/controller
3a66114
Merge master
4f54393
Fix test to run the transforms
fcf8ef7
Merge branch 'master' into operator/controller
16c3272
Refactor to split out parsing in handlers
d9273f4
Fix test JSON parsing
d36a968
Merge branch 'master' into operator/controller
925d5e3
Update docs/changelog/88224.yaml
grcevski b9ebb4a
Merge branch 'master' into operator/controller
a316d0e
Merge branch 'operator/controller' of github.com:grcevski/elasticsear…
2834979
Reuse the executors
ebe0a74
Fix tests
ae85833
Merge branch 'master' into operator/controller
c8cb7dd
Apply review feedback on action module
84681f7
Add meta-inf for createExtensions
e55c6c7
Add classloader check
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
pr: 88224 | ||
summary: Immutable cluster state controller | ||
area: Infra/Core | ||
type: enhancement | ||
issues: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,22 +15,22 @@ | |
import org.elasticsearch.common.settings.ClusterSettings; | ||
import org.elasticsearch.immutablestate.ImmutableClusterStateHandler; | ||
import org.elasticsearch.immutablestate.TransformState; | ||
import org.elasticsearch.xcontent.XContentParser; | ||
|
||
import java.io.IOException; | ||
import java.util.HashMap; | ||
import java.util.HashSet; | ||
import java.util.Map; | ||
import java.util.Set; | ||
import java.util.stream.Collectors; | ||
|
||
import static org.elasticsearch.common.util.Maps.asMap; | ||
|
||
/** | ||
* This Action is the immutable state save version of RestClusterUpdateSettingsAction | ||
* <p> | ||
* It is used by the ImmutableClusterStateController to update the persistent cluster settings. | ||
* Since transient cluster settings are deprecated, this action doesn't support updating transient cluster settings. | ||
*/ | ||
public class ImmutableClusterSettingsAction implements ImmutableClusterStateHandler<ClusterUpdateSettingsRequest> { | ||
public class ImmutableClusterSettingsAction implements ImmutableClusterStateHandler<Map<String, Object>> { | ||
|
||
public static final String NAME = "cluster_settings"; | ||
|
||
|
@@ -49,11 +49,12 @@ public String name() { | |
private ClusterUpdateSettingsRequest prepare(Object input, Set<String> previouslySet) { | ||
final ClusterUpdateSettingsRequest clusterUpdateSettingsRequest = Requests.clusterUpdateSettingsRequest(); | ||
|
||
Map<String, ?> source = asMap(input); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor change here in the interface, so that I can split the XContent parsing from the state transformation. |
||
Map<String, Object> persistentSettings = new HashMap<>(); | ||
Set<String> toDelete = new HashSet<>(previouslySet); | ||
|
||
source.forEach((k, v) -> { | ||
Map<String, Object> settings = (Map<String, Object>) input; | ||
|
||
settings.forEach((k, v) -> { | ||
persistentSettings.put(k, v); | ||
toDelete.remove(k); | ||
}); | ||
|
@@ -87,4 +88,9 @@ public TransformState transform(Object input, TransformState prevState) { | |
|
||
return new TransformState(state, currentKeys); | ||
} | ||
|
||
@Override | ||
public Map<String, Object> fromXContent(XContentParser parser) throws IOException { | ||
return parser.map(); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Splitting off the parsing part of handling immutable cluster state, so that we can reuse the immutable cluster state update controller to work with plain Java objects. This will come in handy when plugins/modules will want to save state on initialization.