Skip to content

Conversation

@original-brownbear
Copy link
Contributor

  • Dried up redundant conditionals without changing the logic
  • Other obvious/static simplifications

* Dried up redundant conditionals without changing the logic
* Other obvious/static simplifications
@elasticmachine
Copy link
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) {
Copy link
Contributor Author

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) {
Copy link
Contributor Author

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,
Copy link
Contributor Author

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)
Copy link
Contributor Author

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.

@original-brownbear
Copy link
Contributor Author

Jenkins run elasticsearch-ci/2

@original-brownbear
Copy link
Contributor Author

Closing in favor of #38368 that incorporates this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants