From 4ad0c6a8b262abeb7b92aac4ab8585cd73f0d1c2 Mon Sep 17 00:00:00 2001 From: Valerij Fredriksen Date: Thu, 13 Jan 2022 17:39:40 +0100 Subject: Use unique ID from node-repo --- .../vespa/hosted/node/admin/nodeadmin/NodeAdminImpl.java | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'node-admin') diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeadmin/NodeAdminImpl.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeadmin/NodeAdminImpl.java index 3d7a3b73ccd..dff72fe81f1 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeadmin/NodeAdminImpl.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeadmin/NodeAdminImpl.java @@ -79,7 +79,7 @@ public class NodeAdminImpl implements NodeAdmin { @Override public void refreshContainersToRun(Set nodeAgentContexts) { Map nodeAgentContextsByHostname = nodeAgentContexts.stream() - .collect(Collectors.toMap(NodeAdminImpl::nodeAgentId, Function.identity())); + .collect(Collectors.toMap(ctx -> ctx.node().id(), Function.identity())); // Stop and remove NodeAgents that should no longer be running diff(nodeAgentWithSchedulerByHostname.keySet(), nodeAgentContextsByHostname.keySet()) @@ -222,14 +222,4 @@ public class NodeAdminImpl implements NodeAdmin { NodeAgent nodeAgent = nodeAgentFactory.create(contextManager, context); return new NodeAgentWithScheduler(nodeAgent, contextManager); } - - private static String nodeAgentId(NodeAgentContext nac) { - // NodeAgentImpl has some internal state that should not be reused when the same hostname is re-allocated - // to a different application/cluster, solve this by including reservation timestamp in the key. - return nac.hostname().value() + "-" + nac.node().events().stream() - .filter(event -> "reserved".equals(event.type())) - .findFirst() - .map(event -> Long.toString(event.at().toEpochMilli())) - .orElse(""); - } } -- cgit v1.2.3