aboutsummaryrefslogtreecommitdiffstats
path: root/node-repository
diff options
context:
space:
mode:
authorMartin Polden <mpolden@mpolden.no>2021-12-08 14:19:47 +0100
committerMartin Polden <mpolden@mpolden.no>2021-12-08 14:22:27 +0100
commitc4893805cd382ce1d2483d04e5a488f630952991 (patch)
tree005613d28bc0e31cd29bbc775978b1bf8101cad0 /node-repository
parent18be8326ae33e271781e87b6c3978ed6834d61ff (diff)
Log switch move
Diffstat (limited to 'node-repository')
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/NodeMover.java2
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/SwitchRebalancer.java10
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodeAllocation.java8
3 files changed, 14 insertions, 6 deletions
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/NodeMover.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/NodeMover.java
index 6c103627ad4..57db874fb84 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/NodeMover.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/NodeMover.java
@@ -59,7 +59,7 @@ public abstract class NodeMover<MOVE> extends NodeRepositoryMaintainer {
protected final MOVE findBestMove(NodesAndHosts<? extends NodeList> allNodes) {
HostCapacity capacity = new HostCapacity(allNodes, nodeRepository().resourcesCalculator());
MOVE bestMove = emptyMove;
- // Shuffle nodes so we did not get stuck if the chosen move is consistently discarded. Node moves happen through
+ // Shuffle nodes to not get stuck if the chosen move is consistently discarded. Node moves happen through
// a soft request to retire (preferToRetire), which node allocation can disregard
NodeList activeNodes = allNodes.nodes().nodeType(NodeType.tenant)
.state(Node.State.active)
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/SwitchRebalancer.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/SwitchRebalancer.java
index 7bea671fbac..f01e8ecd301 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/SwitchRebalancer.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/SwitchRebalancer.java
@@ -16,6 +16,7 @@ import java.time.Duration;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import java.util.logging.Logger;
/**
* Ensure that nodes within a cluster a spread across hosts on exclusive network switches.
@@ -24,6 +25,8 @@ import java.util.Set;
*/
public class SwitchRebalancer extends NodeMover<Move> {
+ private static final Logger LOG = Logger.getLogger(SwitchRebalancer.class.getName());
+
private final Metric metric;
private final Deployer deployer;
@@ -40,7 +43,12 @@ public class SwitchRebalancer extends NodeMover<Move> {
NodesAndHosts<NodeList> allNodes = NodesAndHosts.create(nodeRepository().nodes().list()); // Lockless as strong consistency is not needed
if (!zoneIsStable(allNodes.nodes())) return 1.0;
- findBestMove(allNodes).execute(false, Agent.SwitchRebalancer, deployer, metric, nodeRepository());
+ Move bestMove = findBestMove(allNodes);
+ if (!bestMove.isEmpty()) {
+ LOG.info("Trying " + bestMove + " (" + bestMove.fromHost().switchHostname().orElse("<none>") +
+ " -> " + bestMove.toHost().switchHostname().orElse("<none>") + ")");
+ }
+ bestMove.execute(false, Agent.SwitchRebalancer, deployer, metric, nodeRepository());
return 1.0;
}
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodeAllocation.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodeAllocation.java
index 7cc4acc20b0..6c22a26d88a 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodeAllocation.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodeAllocation.java
@@ -99,12 +99,12 @@ class NodeAllocation {
* Note that if unallocated nodes are offered before allocated nodes, this will unnecessarily
* reject allocated nodes due to index duplicates.
*
- * @param nodesPrioritized the nodes which are potentially on offer. These may belong to a different application etc.
+ * @param candidates the nodes which are potentially on offer. These may belong to a different application etc.
* @return the subset of offeredNodes which was accepted, with the correct allocation assigned
*/
- List<Node> offer(List<NodeCandidate> nodesPrioritized) {
+ List<Node> offer(List<NodeCandidate> candidates) {
List<Node> accepted = new ArrayList<>();
- for (NodeCandidate candidate : nodesPrioritized) {
+ for (NodeCandidate candidate : candidates) {
if (candidate.allocation().isPresent()) {
Allocation allocation = candidate.allocation().get();
ClusterMembership membership = allocation.membership();
@@ -121,7 +121,7 @@ class NodeAllocation {
if ((! saturated() && hasCompatibleFlavor(candidate) && requestedNodes.acceptable(candidate)) || acceptToRetire) {
candidate = candidate.withNode();
if (candidate.isValid())
- accepted.add(acceptNode(candidate, shouldRetire(candidate, nodesPrioritized), resizeable));
+ accepted.add(acceptNode(candidate, shouldRetire(candidate, candidates), resizeable));
}
}
else if (! saturated() && hasCompatibleFlavor(candidate)) {