diff options
author | Ola Aunrønning <olaa@yahooinc.com> | 2023-03-01 15:55:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-01 15:55:57 +0100 |
commit | 18695b67dbcdf96ef1c7b17afb637e427598bba1 (patch) | |
tree | ef5fe215f7372e626b47b4dd7155aa6f5045ee24 /controller-server | |
parent | ef504401235699f40e6f699f765d5f4d8852359d (diff) | |
parent | 72112b07ac8542ea0ee0518c0d4b9ef6f8332563 (diff) |
Merge pull request #26254 from vespa-engine/olaa/check-child-retirement-status
Check retirement status of host and its children
Diffstat (limited to 'controller-server')
-rw-r--r-- | controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/VcmrMaintainer.java | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/VcmrMaintainer.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/VcmrMaintainer.java index 45b3e4ef5dd..da0fa890960 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/VcmrMaintainer.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/VcmrMaintainer.java @@ -192,17 +192,15 @@ public class VcmrMaintainer extends ControllerMaintainer { } if (shouldRetire(changeRequest, hostAction)) { - if (!node.wantToRetire()) { + if (!wantToRetireRecursive(zoneId, node)) { LOG.info(Text.format("Retiring %s due to %s", node.hostname().value(), changeRequest.getChangeRequestSource().getId())); // TODO: Remove try/catch once retirement is stabilized try { setWantToRetire(zoneId, node, true); } catch (Exception e) { LOG.warning("Failed to retire host " + node.hostname() + ": " + Exceptions.toMessageString(e)); - // Check if retirement actually failed - if (!nodeRepository.getNode(zoneId, node.hostname().value()).wantToRetire()) { - return hostAction; - } + // Will retry next maintenance run + return hostAction; } } return hostAction.withState(State.RETIRING); @@ -225,6 +223,13 @@ public class VcmrMaintainer extends ControllerMaintainer { return hostAction; } + // Determines if a host and all its children are retiring + private boolean wantToRetireRecursive(ZoneId zoneId, Node node) { + var children = nodeRepository.list(zoneId, NodeFilter.all().parentHostnames(node.hostname())); + return node.wantToRetire() && + children.stream().allMatch(Node::wantToRetire); + } + // Dirty host iff the parked host was retired by this maintainer private void recycleNode(ZoneId zoneId, Node node, HostAction hostAction) { if (hostAction.getState() == State.RETIRED && |