diff options
Diffstat (limited to 'node-repository')
2 files changed, 3 insertions, 8 deletions
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/History.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/History.java index 3228e6ca17e..df21950c69f 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/History.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/History.java @@ -63,7 +63,8 @@ public class History { /** Returns a copy of this history with a record of this state transition added, if applicable */ public History recordStateTransition(Node.State from, Node.State to, Agent agent, Instant at) { - if (from == to) return this; + // If the event is a re-reservation, allow the new one to override the older one. + if (from == to && from != Node.State.reserved) return this; switch (to) { case provisioned: return this.with(new Event(Event.Type.provisioned, agent, at)); case ready: return this.withoutApplicationEvents().with(new Event(Event.Type.readied, agent, at)); diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/persistence/CuratorDatabaseClient.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/persistence/CuratorDatabaseClient.java index 78be6fe57d1..4e4b29c8098 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/persistence/CuratorDatabaseClient.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/persistence/CuratorDatabaseClient.java @@ -210,13 +210,7 @@ public class CuratorDatabaseClient { } private History recordStateTransition(Node node, Node.State toState, Agent agent) { - History history = node.history(); - // When a node is re-reserved we want to update the reservation instant, we do this by removing the existing - // event and recording a new one - if (node.state() == Node.State.reserved && toState == Node.State.reserved) { - history = history.without(History.Event.Type.reserved); - } - return history.recordStateTransition(node.state(), toState, agent, clock.instant()); + return node.history().recordStateTransition(node.state(), toState, agent, clock.instant()); } private Status newNodeStatus(Node node, Node.State toState) { |