summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHåkon Hallingstad <hakon@verizonmedia.com>2020-01-29 10:52:45 +0100
committerHåkon Hallingstad <hakon@verizonmedia.com>2020-01-29 10:52:45 +0100
commitf27ddf9d7c74f7278111c1e3e28c5f7e9ea8f2fd (patch)
tree8064fa99498bbe7e8ef6fd45a3fdfd8fe144218f
parente6eabff97807c911c7ef7d4b19f7ac420acf593b (diff)
Make new host-status canonical
In moving from old host-status-service/APP/hosts to new host-status/APP/hosts: 1. Currently and before this PR, the ALLOWED_TO_BE_DOWN hosts are the union of the hosts in new and old. Other hosts are NO_REMARKS. 2. With this PR, we'll stop writing ALLOWED_TO_BE_DOWN in old, but still remove them. This PR is not supposed to have any user-visible effect for clients of the Orchestrator. Once this PR has rolled out, A. The remaining code accessing old can be removed B. All data in old can be removed.
-rw-r--r--orchestrator/src/main/java/com/yahoo/vespa/orchestrator/status/ZookeeperStatusService.java35
1 files changed, 3 insertions, 32 deletions
diff --git a/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/status/ZookeeperStatusService.java b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/status/ZookeeperStatusService.java
index ecf3a161c83..4f96c4e1e0e 100644
--- a/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/status/ZookeeperStatusService.java
+++ b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/status/ZookeeperStatusService.java
@@ -179,17 +179,15 @@ public class ZookeeperStatusService implements StatusService {
HostStatus status) {
String hostAllowedDownPath = hostAllowedDownPath(applicationInstanceReference, hostName);
- boolean modified;
+ boolean modified = false;
try {
switch (status) {
case NO_REMARKS:
+ // Deprecated: Remove once 7.170 has rolled out to infrastructure
modified = deleteNode_ignoreNoNodeException(hostAllowedDownPath, "Host already has state NO_REMARKS, path = " + hostAllowedDownPath);
break;
- case ALLOWED_TO_BE_DOWN:
- modified = createNode_ignoreNodeExistsException(hostAllowedDownPath, "Host already has state ALLOWED_TO_BE_DOWN, path = " + hostAllowedDownPath);
- break;
default:
- throw new IllegalArgumentException("Unexpected status '" + status + "'.");
+ // ignore, e.g. ALLOWED_TO_BE_DOWN should NOT create a new deprecated znode.
}
modified |= setHostInfoInZk(applicationInstanceReference, hostName, status);
@@ -257,14 +255,6 @@ public class ZookeeperStatusService implements StatusService {
}
}
- private void updateNodeInZk(String path, byte[] bytes) throws Exception {
- curator.framework().setData().forPath(path, bytes);
- }
-
- private void createNodeInZk(String path, byte[] bytes) throws Exception {
- curator.framework().create().creatingParentsIfNeeded().forPath(path, bytes);
- }
-
@Override
public HostInfo getHostInfo(ApplicationInstanceReference applicationInstanceReference, HostName hostName) {
return hostInfosCache.getHostInfos(applicationInstanceReference).get(hostName);
@@ -300,25 +290,6 @@ public class ZookeeperStatusService implements StatusService {
})));
}
- // For backwards compatibility we'll add HostInfos from the old hosts-allowed-down ZK path,
- // using the creation time as the since path. The new hosts ZK path should contain a subset of
- // the hostnames under hosts-allowed-down ZK path. Eventually these sets should be identical.
- // Once that's true we can stop writing to hosts-allowed-down, remove this code, and all
- // data in hosts-allowed-down can be removed.
- Set<HostName> legacyHostsDown = hostsDownFor(application);
- Map<HostName, HostInfo> legacyHostInfos = legacyHostsDown.stream()
- .filter(hostname -> !hostInfos.containsKey(hostname))
- .collect(Collectors.toMap(
- hostname -> hostname,
- hostname -> {
- Stat stat = uncheck(() -> curator.framework()
- .checkExists()
- .forPath(hostsAllowedDownPath(application) + "/" + hostname.s()));
- return HostInfo.createSuspended(HostStatus.ALLOWED_TO_BE_DOWN, Instant.ofEpochMilli(stat.getCtime()));
- }
- ));
-
- hostInfos.putAll(legacyHostInfos);
return new HostInfos(hostInfos);
}