aboutsummaryrefslogtreecommitdiffstats
path: root/node-admin
diff options
context:
space:
mode:
authorValerij Fredriksen <valerijf@yahooinc.com>2022-01-13 17:39:40 +0100
committerValerij Fredriksen <valerijf@yahooinc.com>2022-01-13 17:51:42 +0100
commit4ad0c6a8b262abeb7b92aac4ab8585cd73f0d1c2 (patch)
tree4d18a489c65267a593d3b7cc9bf86c6e62d766a3 /node-admin
parentbcfc51b9f1a5fa9e56c894f15a41b45a3735ee41 (diff)
Use unique ID from node-repo
Diffstat (limited to 'node-admin')
-rw-r--r--node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeadmin/NodeAdminImpl.java12
1 files changed, 1 insertions, 11 deletions
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<NodeAgentContext> nodeAgentContexts) {
Map<String, NodeAgentContext> 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("");
- }
}