diff options
Diffstat (limited to 'configserver/src/main/java/com/yahoo/vespa/config/server/maintenance/ConfigServerMaintenance.java')
-rw-r--r-- | configserver/src/main/java/com/yahoo/vespa/config/server/maintenance/ConfigServerMaintenance.java | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/maintenance/ConfigServerMaintenance.java b/configserver/src/main/java/com/yahoo/vespa/config/server/maintenance/ConfigServerMaintenance.java index 8d5e1fe9dea..dbd30f72c24 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/maintenance/ConfigServerMaintenance.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/maintenance/ConfigServerMaintenance.java @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.config.server.maintenance; import com.yahoo.concurrent.maintenance.Maintainer; @@ -6,7 +6,7 @@ import com.yahoo.vespa.config.server.ApplicationRepository; import com.yahoo.vespa.config.server.application.ConfigConvergenceChecker; import com.yahoo.vespa.config.server.filedistribution.FileDirectory; import com.yahoo.vespa.curator.Curator; -import com.yahoo.vespa.flags.FlagSource; + import java.time.Clock; import java.time.Duration; import java.util.List; @@ -26,7 +26,6 @@ public class ConfigServerMaintenance { private final List<Maintainer> maintainers = new CopyOnWriteArrayList<>(); private final ApplicationRepository applicationRepository; private final Curator curator; - private final FlagSource flagSource; private final ConfigConvergenceChecker convergenceChecker; private final FileDirectory fileDirectory; private final Duration interval; @@ -34,28 +33,21 @@ public class ConfigServerMaintenance { public ConfigServerMaintenance(ApplicationRepository applicationRepository, FileDirectory fileDirectory) { this.applicationRepository = applicationRepository; this.curator = applicationRepository.tenantRepository().getCurator(); - this.flagSource = applicationRepository.flagSource(); this.convergenceChecker = applicationRepository.configConvergenceChecker(); this.fileDirectory = fileDirectory; this.interval = Duration.ofMinutes(applicationRepository.configserverConfig().maintainerIntervalMinutes()); } public void startBeforeBootstrap() { - List<String> otherConfigServersInCluster = getOtherConfigServersInCluster(applicationRepository.configserverConfig()); - if ( ! otherConfigServersInCluster.isEmpty()) - maintainers.add(new ApplicationPackageMaintainer(applicationRepository, curator, Duration.ofSeconds(30), - flagSource, otherConfigServersInCluster)); - maintainers.add(new TenantsMaintainer(applicationRepository, curator, flagSource, interval, Clock.systemUTC())); + if (moreThanOneConfigServer()) + maintainers.add(new ApplicationPackageMaintainer(applicationRepository, curator, Duration.ofSeconds(15))); + maintainers.add(new TenantsMaintainer(applicationRepository, curator, interval, Clock.systemUTC())); } public void startAfterBootstrap() { - maintainers.add(new FileDistributionMaintainer(applicationRepository, - curator, - interval, - flagSource, - fileDirectory)); - maintainers.add(new SessionsMaintainer(applicationRepository, curator, Duration.ofSeconds(30), flagSource)); - maintainers.add(new ReindexingMaintainer(applicationRepository, curator, flagSource, + maintainers.add(new FileDistributionMaintainer(applicationRepository, curator, interval, fileDirectory)); + maintainers.add(new SessionsMaintainer(applicationRepository, curator, Duration.ofSeconds(30))); + maintainers.add(new ReindexingMaintainer(applicationRepository, curator, Duration.ofMinutes(3), convergenceChecker, Clock.systemUTC())); } @@ -66,4 +58,8 @@ public class ConfigServerMaintenance { public List<Maintainer> maintainers() { return List.copyOf(maintainers); } + private boolean moreThanOneConfigServer() { + return ! getOtherConfigServersInCluster(applicationRepository.configserverConfig()).isEmpty(); + } + } |