Skip to content

Commit

Permalink
Fix Master Failover and DataNode Leave Blocking Snapshot (#38460)
Browse files Browse the repository at this point in the history
* Closes #38447
  • Loading branch information
original-brownbear committed Feb 5, 2019
1 parent 79a45b4 commit 34f2cc7
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -687,8 +687,9 @@ public void applyClusterState(ClusterChangedEvent event) {
if (event.localNodeMaster()) {
// We don't remove old master when master flips anymore. So, we need to check for change in master
final SnapshotsInProgress snapshotsInProgress = event.state().custom(SnapshotsInProgress.TYPE);
final boolean newMaster = event.previousState().nodes().isLocalNodeElectedMaster() == false;
if (snapshotsInProgress != null) {
if (removedNodesCleanupNeeded(snapshotsInProgress, event.nodesDelta().removedNodes())) {
if (newMaster || removedNodesCleanupNeeded(snapshotsInProgress, event.nodesDelta().removedNodes())) {
processSnapshotsOnRemovedNodes();
}
if (event.routingTableChanged() && waitingShardsStartedOrUnassigned(snapshotsInProgress, event)) {
Expand All @@ -704,7 +705,7 @@ public void applyClusterState(ClusterChangedEvent event) {
|| entry.state() != State.INIT && completed(entry.shards().values())
).forEach(this::endSnapshot);
}
if (event.previousState().nodes().isLocalNodeElectedMaster() == false) {
if (newMaster) {
finalizeSnapshotDeletionFromPreviousMaster(event);
}
}
Expand Down

0 comments on commit 34f2cc7

Please sign in to comment.