-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Simplify SnapshotsService Cluster State Updates #37966
Simplify SnapshotsService Cluster State Updates #37966
Conversation
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
Pinging @elastic/es-distributed |
*/ | ||
private void removeFinishedSnapshotFromClusterState(ClusterChangedEvent event) { |
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.
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) { |
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 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, |
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.
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) |
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.
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
Jenkins run elasticsearch-ci/2 |
Closing in favor of #38368 that incorporates this |