summaryrefslogtreecommitdiffstats
path: root/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/controller/ClusterControllerClientImpl.java
diff options
context:
space:
mode:
Diffstat (limited to 'orchestrator/src/main/java/com/yahoo/vespa/orchestrator/controller/ClusterControllerClientImpl.java')
-rw-r--r--orchestrator/src/main/java/com/yahoo/vespa/orchestrator/controller/ClusterControllerClientImpl.java46
1 files changed, 17 insertions, 29 deletions
diff --git a/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/controller/ClusterControllerClientImpl.java b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/controller/ClusterControllerClientImpl.java
index 467b534f809..46440682fa0 100644
--- a/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/controller/ClusterControllerClientImpl.java
+++ b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/controller/ClusterControllerClientImpl.java
@@ -1,6 +1,7 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.orchestrator.controller;
+import com.google.common.util.concurrent.UncheckedTimeoutException;
import com.yahoo.vespa.jaxrs.client.JaxRsStrategy;
import com.yahoo.vespa.orchestrator.OrchestratorContext;
@@ -15,23 +16,6 @@ public class ClusterControllerClientImpl implements ClusterControllerClient{
public static final String REQUEST_REASON = "Orchestrator";
- // On setNodeState calls against the CC ensemble.
- //
- // We'd like to set a timeout for the request to the first CC such that if the first
- // CC is faulty, there's sufficient time to send the request to the second and third CC.
- // The timeouts would be:
- // timeout(1. request) = SHARE_REMAINING_TIME * T
- // timeout(2. request) = SHARE_REMAINING_TIME * T * (1 - SHARE_REMAINING_TIME)
- // timeout(3. request) = SHARE_REMAINING_TIME * T * (1 - SHARE_REMAINING_TIME)^2
- //
- // Using a share of 50% gives approximately:
- // timeout(1. request) = T * 0.5
- // timeout(2. request) = T * 0.25
- // timeout(3. request) = T * 0.125
- //
- // which seems fine
- public static final float SHARE_REMAINING_TIME = 0.5f;
-
private final JaxRsStrategy<ClusterControllerJaxRsApi> clusterControllerApi;
private final String clusterName;
@@ -52,20 +36,22 @@ public class ClusterControllerClientImpl implements ClusterControllerClient{
ClusterControllerNodeState wantedState) throws IOException {
ClusterControllerStateRequest.State state = new ClusterControllerStateRequest.State(wantedState, REQUEST_REASON);
ClusterControllerStateRequest stateRequest = new ClusterControllerStateRequest(state, ClusterControllerStateRequest.Condition.SAFE);
+ ClusterControllerClientTimeouts timeouts = context.getClusterControllerTimeouts(clusterName);
try {
return clusterControllerApi.apply(api -> api.setNodeState(
clusterName,
storageNodeIndex,
- context.getSuboperationTimeoutInSeconds(SHARE_REMAINING_TIME),
- stateRequest)
- );
- } catch (IOException e) {
+ timeouts.getServerTimeoutOrThrow().toMillis() / 1000.0f,
+ stateRequest),
+ timeouts);
+ } catch (IOException | UncheckedTimeoutException e) {
String message = String.format(
- "Giving up setting %s for storage node with index %d in cluster %s",
+ "Giving up setting %s for storage node with index %d in cluster %s: %s",
stateRequest,
storageNodeIndex,
- clusterName);
+ clusterName,
+ e.getMessage());
throw new IOException(message, e);
}
@@ -79,16 +65,18 @@ public class ClusterControllerClientImpl implements ClusterControllerClient{
@Override
public ClusterControllerStateResponse setApplicationState(
OrchestratorContext context,
- final ClusterControllerNodeState wantedState) throws IOException {
- final ClusterControllerStateRequest.State state = new ClusterControllerStateRequest.State(wantedState, REQUEST_REASON);
- final ClusterControllerStateRequest stateRequest = new ClusterControllerStateRequest(state, ClusterControllerStateRequest.Condition.FORCE);
+ ClusterControllerNodeState wantedState) throws IOException {
+ ClusterControllerStateRequest.State state = new ClusterControllerStateRequest.State(wantedState, REQUEST_REASON);
+ ClusterControllerStateRequest stateRequest = new ClusterControllerStateRequest(state, ClusterControllerStateRequest.Condition.FORCE);
+ ClusterControllerClientTimeouts timeouts = context.getClusterControllerTimeouts(clusterName);
try {
return clusterControllerApi.apply(api -> api.setClusterState(
clusterName,
- context.getSuboperationTimeoutInSeconds(SHARE_REMAINING_TIME),
- stateRequest));
- } catch (IOException e) {
+ timeouts.getServerTimeoutOrThrow().toMillis() / 1000.0f,
+ stateRequest),
+ timeouts);
+ } catch (IOException | UncheckedTimeoutException e) {
final String message = String.format(
"Giving up setting %s for cluster %s",
stateRequest,