summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHÃ¥kon Hallingstad <hakon.hallingstad@gmail.com>2022-10-11 16:32:15 +0200
committerGitHub <noreply@github.com>2022-10-11 16:32:15 +0200
commit12a1252225e3dd606066250699789b0c342980a3 (patch)
tree7ca994d92209f8ca44f800f6ade23d0eded6815f
parent0d6d4159ba109f78fd9fea0c6b5e8d940ffc7e90 (diff)
parentf7b0b128574681a62aeb7530ca28ad633bad4bde (diff)
Merge pull request #24392 from vespa-engine/freva/archive-uri-update-hide-trace
Avoid long trace when failing to update archive URI
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ArchiveUriUpdater.java34
1 files changed, 22 insertions, 12 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ArchiveUriUpdater.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ArchiveUriUpdater.java
index 42821ea8fe2..0c8a50fa821 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ArchiveUriUpdater.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ArchiveUriUpdater.java
@@ -8,6 +8,7 @@ import com.yahoo.vespa.hosted.controller.Controller;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.NodeRepository;
import com.yahoo.vespa.hosted.controller.application.SystemApplication;
import com.yahoo.vespa.hosted.controller.archive.CuratorArchiveBucketDb;
+import com.yahoo.yolean.Exceptions;
import java.net.URI;
import java.time.Duration;
@@ -15,6 +16,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
+import java.util.logging.Level;
/**
* Updates archive URIs for tenants in all zones.
@@ -51,20 +53,28 @@ public class ArchiveUriUpdater extends ControllerMaintainer {
}
}
- tenantsByZone.forEach((zone, tenants) -> {
- Map<TenantName, URI> zoneArchiveUris = nodeRepository.getArchiveUris(zone);
- for (TenantName tenant : tenants) {
- archiveBucketDb.archiveUriFor(zone, tenant, true)
- .filter(uri -> !uri.equals(zoneArchiveUris.get(tenant)))
- .ifPresent(uri -> nodeRepository.setArchiveUri(zone, tenant, uri));
- }
+ int failures = 0;
+ for (ZoneId zone : tenantsByZone.keySet()) {
+ try {
+ Map<TenantName, URI> zoneArchiveUris = nodeRepository.getArchiveUris(zone);
+
+ for (TenantName tenant : tenantsByZone.get(zone)) {
+ archiveBucketDb.archiveUriFor(zone, tenant, true)
+ .filter(uri -> !uri.equals(zoneArchiveUris.get(tenant)))
+ .ifPresent(uri -> nodeRepository.setArchiveUri(zone, tenant, uri));
+ }
- zoneArchiveUris.keySet().stream()
- .filter(tenant -> !tenants.contains(tenant))
- .forEach(tenant -> nodeRepository.removeArchiveUri(zone, tenant));
- });
+ zoneArchiveUris.keySet().stream()
+ .filter(tenant -> !tenantsByZone.get(zone).contains(tenant))
+ .forEach(tenant -> nodeRepository.removeArchiveUri(zone, tenant));
+ } catch (Exception e) {
+ log.log(Level.WARNING, "Failed to update archive URI in " + zone + ". Retrying in " + interval() + ". Error: " +
+ Exceptions.toMessageString(e));
+ failures++;
+ }
+ }
- return 1.0;
+ return asSuccessFactor(tenantsByZone.size(), failures);
}
}