summaryrefslogtreecommitdiffstats
path: root/node-repository
diff options
context:
space:
mode:
authorvalerijf <valerijf@yahoo-inc.com>2017-06-12 09:24:39 +0200
committervalerijf <valerijf@yahoo-inc.com>2017-06-12 09:24:39 +0200
commit03ce13207ecf8ad0e700a58d1b5e6c1e1751c593 (patch)
treed75a8e3ec9104a64e23249b1e496c466f751026c /node-repository
parentf0444218e1c7d295e2e817c755a8b65d52bb65d8 (diff)
Code review: Added some comments
Diffstat (limited to 'node-repository')
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/NodeRetirer.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/NodeRetirer.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/NodeRetirer.java
index 856b542bdb8..d89a4761b5d 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/NodeRetirer.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/NodeRetirer.java
@@ -129,12 +129,13 @@ public class NodeRetirer extends Maintainer {
if (! replaceableNodes.isEmpty()) nodesToRetireByDeployment.put(deployment.get(), replaceableNodes);
}
- // While under application lock, make sure that the state and the owner of the node has not changed
- // in the mean time, then retire the node and redeploy.
nodesToRetireByDeployment.forEach(((deployment, nodes) -> {
ApplicationId app = nodes.iterator().next().allocation().get().owner();
Set<Node> nodesToRetire;
+ // While under application lock, get up-to-date node, and make sure that the state and the owner of the
+ // node has not changed in the meantime, mutate the up-to-date node (so to not overwrite other fields
+ // that may have changed) with wantToRetire and wantToDeprovision.
try (Mutex lock = nodeRepository().lock(app)) {
nodesToRetire = nodes.stream()
.map(node ->
@@ -156,6 +157,7 @@ public class NodeRetirer extends Maintainer {
});
}
+ // This takes a while, so do it outside of the application lock
if (! nodesToRetire.isEmpty()) deployment.activate();
}));
}