Skip to content
This repository has been archived by the owner on Sep 29, 2021. It is now read-only.

Commit

Permalink
Undeploy jobs from hosts even if they are DOWN (#1039)
Browse files Browse the repository at this point in the history
If a host is down, we still want the `RollingUndeployPlanner` to attempt
to undeploy from it, and then remove it from the list of removed hosts.

Otherwise, the list of removed hosts for a deployment group can grow
unboundedly.
  • Loading branch information
rohansingh committed Dec 12, 2016
1 parent d963be9 commit 6412fc0
Showing 1 changed file with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -660,22 +660,18 @@ private RollingUpdateOp getInitRollingUpdateOps(final DeploymentGroup deployment

// give precedence to the updateHosts list so we don't end up in a state where we updated a host
// and then removed the job from it (because of buggy logic in the calling method)
final List<String> updateHostsCopy = new ArrayList<>(updateHosts);
final List<String> undeployHostsCopy = new ArrayList<>(undeployHosts);
undeployHostsCopy.removeAll(updateHostsCopy);
final List<String> actualHostsToUndeploy = new ArrayList<>(undeployHosts);
actualHostsToUndeploy.removeAll(updateHosts);

// we only care about hosts that are UP
final List<String> upHostsToUndeploy = undeployHostsCopy.stream()
.filter(host -> checkHostUp(zooKeeperClient, host))
.collect(Collectors.toList());
final List<String> upHostsToDeploy = updateHostsCopy.stream()
// only try to deploy to hosts that are UP
final List<String> hostsToDeploy = updateHosts.stream()
.filter(host -> checkHostUp(zooKeeperClient, host))
.collect(Collectors.toList());

rolloutTasks.addAll(RollingUndeployPlanner.of(deploymentGroup)
.plan(upHostsToUndeploy));
.plan(actualHostsToUndeploy));
rolloutTasks.addAll(RollingUpdatePlanner.of(deploymentGroup)
.plan(upHostsToDeploy));
.plan(hostsToDeploy));

log.info("generated rolloutTasks for deployment-group name={} "
+ "updateHosts={} undeployHosts={}: {}",
Expand Down

0 comments on commit 6412fc0

Please sign in to comment.