diff options
author | Martin Polden <mpolden@mpolden.no> | 2021-12-06 13:30:01 +0100 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2021-12-06 13:30:01 +0100 |
commit | c414208284f642f6186556dfd41eb655f285fe8b (patch) | |
tree | cb63ae3de6409123d4268abf45f626d3cfefd4c8 /configserver/src | |
parent | 73dc82a5149bfdefaba22e85eea09855a6a77965 (diff) |
Skip redeploy if status is unchanged
Diffstat (limited to 'configserver/src')
-rw-r--r-- | configserver/src/main/java/com/yahoo/vespa/config/server/http/v1/RoutingStatusApiHandler.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/http/v1/RoutingStatusApiHandler.java b/configserver/src/main/java/com/yahoo/vespa/config/server/http/v1/RoutingStatusApiHandler.java index 0dc7dbda9a1..48f23a1f7bd 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/http/v1/RoutingStatusApiHandler.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/http/v1/RoutingStatusApiHandler.java @@ -113,13 +113,18 @@ public class RoutingStatusApiHandler extends RestApiRequestHandler<RoutingStatus RestApi.RequestContext.RequestContent requestContent = context.requestContentOrThrow(); Slime requestBody = Exceptions.uncheck(() -> SlimeUtils.jsonToSlime(requestContent.content().readAllBytes())); DeploymentRoutingStatus wantedStatus = deploymentRoutingStatusFromSlime(requestBody, clock.instant()); - DeploymentRoutingStatus currentStatus = deploymentStatus(upstreamNames.iterator().next()); - + List<DeploymentRoutingStatus> currentStatuses = upstreamNames.stream() + .map(this::deploymentStatus) + .collect(Collectors.toList()); + DeploymentRoutingStatus currentStatus = currentStatuses.get(0); // Redeploy application so that a new LbServicesConfig containing the updated status is generated and consumed - // by routing layer. This is required to update weights for application endpoints when routing status for a - // deployment is changed + // by routing layer. This is required to update status of upstreams in application endpoints log.log(Level.INFO, "Changing routing status of " + instance + " from " + currentStatus.status() + " to " + wantedStatus.status()); + boolean needsChange = currentStatuses.stream().anyMatch(status -> status.status() != wantedStatus.status()); + if (!needsChange) { + return new SlimeJsonResponse(toSlime(wantedStatus)); + } changeStatus(upstreamNames, wantedStatus); try { Optional<Deployment> deployment = deployer.deployFromLocalActive(instance, Duration.ofMinutes(1)); |