diff options
author | Harald Musum <musum@oath.com> | 2017-12-13 14:38:54 +0100 |
---|---|---|
committer | Harald Musum <musum@oath.com> | 2017-12-13 14:38:54 +0100 |
commit | 34886141d8a0a60d84b31d85d5ba2eeaff4744bf (patch) | |
tree | 580d846616fd24c4c632ca409bae8c05302b0179 /configserver | |
parent | d0a2b2f3aec7286e8504278f52135f737b106a3b (diff) |
Set timeout for internal deployment in one place
Use barrier timeout as basis for timeout, in the same way we do for external
deployments.
Diffstat (limited to 'configserver')
3 files changed, 19 insertions, 3 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java b/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java index 13401d4a4a6..a4dd943aa47 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java @@ -112,6 +112,18 @@ public class ApplicationRepository implements com.yahoo.config.provision.Deploye * Creates a new deployment from the active application, if available. * * @param application the active application to be redeployed + * @return a new deployment from the local active, or empty if a local active application + * was not present for this id (meaning it either is not active or active on another + * node in the config server cluster) + */ + public Optional<com.yahoo.config.provision.Deployment> deployFromLocalActive(ApplicationId application) { + return deployFromLocalActive(application, Duration.ofSeconds(configserverConfig.zookeeper().barrierTimeout()).plus(Duration.ofSeconds(5))); + } + + /** + * Creates a new deployment from the active application, if available. + * + * @param application the active application to be redeployed * @param timeout the timeout to use for each individual deployment operation * @return a new deployment from the local active, or empty if a local active application * was not present for this id (meaning it either is not active or active on another @@ -352,7 +364,7 @@ public class ApplicationRepository implements com.yahoo.config.provision.Deploye private void redeployApplication(ApplicationId applicationId, Deployer deployer, ExecutorService deploymentExecutor) { log.log(LogLevel.DEBUG, () -> "Redeploying " + applicationId); - deployer.deployFromLocalActive(applicationId, Duration.ofMinutes(30)) + deployer.deployFromLocalActive(applicationId) .ifPresent(deployment -> deploymentExecutor.execute(() -> { try { deployment.activate(); diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/ConfigServerBootstrapTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/ConfigServerBootstrapTest.java index 384ae0853d8..5d573323bb6 100644 --- a/configserver/src/test/java/com/yahoo/vespa/config/server/ConfigServerBootstrapTest.java +++ b/configserver/src/test/java/com/yahoo/vespa/config/server/ConfigServerBootstrapTest.java @@ -29,7 +29,6 @@ import java.io.File; import java.io.FileReader; import java.time.Clock; import java.util.ArrayList; -import java.util.Optional; import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertFalse; @@ -71,7 +70,7 @@ public class ConfigServerBootstrapTest extends TestWithTenant { VersionState versionState = new VersionState(versionFile); assertTrue(versionState.isUpgraded()); ConfigServerBootstrap bootstrap = - new ConfigServerBootstrap(applicationRepository, rpc, (application, timeout) -> Optional.empty(), versionState, + new ConfigServerBootstrap(applicationRepository, rpc, new MockDeployer(), versionState, new StateMonitor(new HealthMonitorConfig(new HealthMonitorConfig.Builder()), new SystemTimer())); waitUntilStarted(rpc, 60000); assertFalse(versionState.isUpgraded()); diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/deploy/MockDeployer.java b/configserver/src/test/java/com/yahoo/vespa/config/server/deploy/MockDeployer.java index 4fc54943a79..051e7c9a8f9 100644 --- a/configserver/src/test/java/com/yahoo/vespa/config/server/deploy/MockDeployer.java +++ b/configserver/src/test/java/com/yahoo/vespa/config/server/deploy/MockDeployer.java @@ -15,6 +15,11 @@ public class MockDeployer implements com.yahoo.config.provision.Deployer { public ApplicationId lastDeployed; @Override + public Optional<Deployment> deployFromLocalActive(ApplicationId application) { + return deployFromLocalActive(application, Duration.ofSeconds(60)); + } + + @Override public Optional<Deployment> deployFromLocalActive(ApplicationId application, Duration timeout) { lastDeployed = application; return Optional.empty(); |