Simplify SnapshotsService Cluster State Updates#37966
Closed
original-brownbear wants to merge 8 commits intoelastic:masterfrom
original-brownbear:simplify-new-master-snapshots-service
Closed
Simplify SnapshotsService Cluster State Updates#37966original-brownbear wants to merge 8 commits intoelastic:masterfrom original-brownbear:simplify-new-master-snapshots-service
original-brownbear wants to merge 8 commits intoelastic:masterfrom
original-brownbear:simplify-new-master-snapshots-service
Conversation
Contributor
original-brownbear
commented
Jan 29, 2019
- Dried up redundant conditionals without changing the logic
- Other obvious/static simplifications
* Dried up redundant conditionals without changing the logic * Other obvious/static simplifications
Collaborator
|
Pinging @elastic/es-distributed |
| * Cleans up shard snapshots that were running on removed nodes | ||
| * @param newMaster true if this master was not master in the previous state | ||
| */ | ||
| private void removeFinishedSnapshotFromClusterState(ClusterChangedEvent event) { |
Contributor
Author
There was a problem hiding this comment.
Inlined as a one-liner into applyClusterState
| processSnapshotsOnRemovedNodes(event); | ||
| final boolean newMaster = event.previousState().nodes().isLocalNodeElectedMaster() == false; | ||
| final SnapshotsInProgress snapshotsInProgress = event.state().custom(SnapshotsInProgress.TYPE); | ||
| if (snapshotsInProgress != null) { |
Contributor
Author
There was a problem hiding this comment.
This check was nested in all the operations this condition now covers, much easier to understand that this method pretty much only takes effect when there's a SnapshotsInProgress in the state now imo.
| } | ||
| } | ||
| } | ||
| private static boolean removedNodesCleanupNeeded(SnapshotsInProgress snapshotsInProgress, List<DiscoveryNode> removedNodes, |
Contributor
Author
There was a problem hiding this comment.
Moving all the checks into this method and split up the two cases handled by the loop into separate blocks.
| } | ||
| } | ||
| if (changed) { | ||
| return ClusterState.builder(currentState) |
Contributor
Author
There was a problem hiding this comment.
cleaned up all these verbose instantiations, we're safe escaping entries here imo and not copying to array.
…r-snapshots-service
…r-snapshots-service
…r-snapshots-service
Contributor
Author
|
Jenkins run elasticsearch-ci/2 |
Contributor
Author
|
Closing in favor of #38368 that incorporates this |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.