diff options
author | Jon Bratseth <bratseth@verizonmedia.com> | 2019-02-25 14:02:41 +0100 |
---|---|---|
committer | Jon Bratseth <bratseth@verizonmedia.com> | 2019-02-25 14:02:41 +0100 |
commit | 9660bf36f0381e8611213e0158fe61c67bc36fa3 (patch) | |
tree | 197cbb0132b47c3ce8093494cac408b0b8314921 /configserver | |
parent | c56762bf17bf337c38f8a32728fbc068290a8e65 (diff) |
Set healt status to down when we decide to go out of rotation
Diffstat (limited to 'configserver')
-rw-r--r-- | configserver/src/main/java/com/yahoo/vespa/config/server/ConfigServerBootstrap.java | 4 | ||||
-rw-r--r-- | configserver/src/test/java/com/yahoo/vespa/config/server/ConfigServerBootstrapTest.java | 27 |
2 files changed, 17 insertions, 14 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/ConfigServerBootstrap.java b/configserver/src/main/java/com/yahoo/vespa/config/server/ConfigServerBootstrap.java index e8a5f1708a1..d631cc18d75 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/ConfigServerBootstrap.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/ConfigServerBootstrap.java @@ -40,7 +40,7 @@ import static com.yahoo.vespa.config.server.ConfigServerBootstrap.RedeployingApp * applications. If that is done successfully the RPC server will start and the health status code will change from * 'initializing' to 'up'. If VIP status mode is VIP_STATUS_PROGRAMMATICALLY the config server * will be put into rotation (start serving status.html with 200 OK), if the mode is VIP_STATUS_FILE a VIP status - * file is created or removed ny some external pgrogram based on the health status code. + * file is created or removed ny some external program based on the health status code. * * @author Ulf Lilleengen * @author hmusum @@ -176,12 +176,10 @@ public class ConfigServerBootstrap extends AbstractComponent implements Runnable } private void up() { - stateMonitor.status(StateMonitor.Status.up); vipStatus.setInRotation(true); } private void down() { - stateMonitor.status(StateMonitor.Status.down); vipStatus.setInRotation(false); } 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 df295b2d38b..2e7b5a1f4d9 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 @@ -72,9 +72,10 @@ public class ConfigServerBootstrapTest { RpcServer rpcServer = createRpcServer(configserverConfig); // Take a host away so that there are too few for the application, to verify we can still bootstrap provisioner.allocations().values().iterator().next().remove(0); - VipStatus vipStatus = createVipStatus(); + StateMonitor stateMonitor = new StateMonitor(); + VipStatus vipStatus = createVipStatus(stateMonitor); ConfigServerBootstrap bootstrap = new ConfigServerBootstrap(tester.applicationRepository(), rpcServer, - versionState, createStateMonitor(), + versionState, stateMonitor, vipStatus, INITIALIZE_ONLY, VIP_STATUS_PROGRAMMATICALLY); assertFalse(vipStatus.isInRotation()); bootstrap.start(); @@ -102,9 +103,10 @@ public class ConfigServerBootstrapTest { assertTrue(versionState.isUpgraded()); RpcServer rpcServer = createRpcServer(configserverConfig); - VipStatus vipStatus = createVipStatus(); + StateMonitor stateMonitor = new StateMonitor(); + VipStatus vipStatus = createVipStatus(stateMonitor); ConfigServerBootstrap bootstrap = new ConfigServerBootstrap(tester.applicationRepository(), rpcServer, - versionState, createStateMonitor(), + versionState, stateMonitor, vipStatus, INITIALIZE_ONLY, VIP_STATUS_FILE); assertTrue(vipStatus.isInRotation()); // default is in rotation when using status file @@ -132,16 +134,17 @@ public class ConfigServerBootstrapTest { .resolve("sessions/2/services.xml")); RpcServer rpcServer = createRpcServer(configserverConfig); - VipStatus vipStatus = createVipStatus(); + StateMonitor stateMonitor = new StateMonitor(); + VipStatus vipStatus = createVipStatus(stateMonitor); ConfigServerBootstrap bootstrap = new ConfigServerBootstrap(tester.applicationRepository(), rpcServer, versionState, - createStateMonitor(), + stateMonitor, vipStatus, INITIALIZE_ONLY, VIP_STATUS_PROGRAMMATICALLY); assertFalse(vipStatus.isInRotation()); // Call method directly, to be sure that it is finished redeploying all applications and we can check status bootstrap.start(); // App is invalid, bootstrapping was unsuccessful. Status should be 'initializing', // rpc server should not be running and it should be out of rotation - assertEquals(StateMonitor.Status.initializing, bootstrap.status()); + assertEquals(StateMonitor.Status.initializing, stateMonitor.status()); assertFalse(rpcServer.isRunning()); assertFalse(vipStatus.isInRotation()); @@ -174,9 +177,10 @@ public class ConfigServerBootstrapTest { curator.set(Path.fromString("/config/v2/tenants/" + applicationId.tenant().value() + "/sessions/2/version"), Utf8.toBytes("1.2.2")); RpcServer rpcServer = createRpcServer(configserverConfig); - VipStatus vipStatus = createVipStatus(); + StateMonitor stateMonitor = createStateMonitor(); + VipStatus vipStatus = createVipStatus(stateMonitor); ConfigServerBootstrap bootstrap = new ConfigServerBootstrap(tester.applicationRepository(), rpcServer, versionState, - createStateMonitor(), vipStatus, + stateMonitor, vipStatus, BOOTSTRAP_IN_SEPARATE_THREAD, VIP_STATUS_PROGRAMMATICALLY); waitUntil(rpcServer::isRunning, "failed waiting for Rpc server running"); waitUntil(() -> bootstrap.status() == StateMonitor.Status.up, "failed waiting for status 'up'"); @@ -229,9 +233,10 @@ public class ConfigServerBootstrapTest { return new Host(hostname, Collections.emptyList(), Optional.empty(), Optional.of(com.yahoo.component.Version.fromString(version))); } - private VipStatus createVipStatus() { + private VipStatus createVipStatus(StateMonitor stateMonitor) { return new VipStatus(new QrSearchersConfig.Builder().build(), - new ClustersStatus()); + new ClustersStatus(), + stateMonitor); } public static class MockRpc extends com.yahoo.vespa.config.server.rpc.MockRpc { |