diff options
author | Martin Polden <mpolden@mpolden.no> | 2021-12-06 14:26:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-06 14:26:11 +0100 |
commit | 659e1966d01b196de9308bda8405d4af1a8e2c58 (patch) | |
tree | c625e4455e53402ddcad4ba223708bb248bcd979 /configserver | |
parent | 8072a49a023e19d5bf1246c5ce46205d2bc10631 (diff) | |
parent | c414208284f642f6186556dfd41eb655f285fe8b (diff) |
Merge pull request #20373 from vespa-engine/mpolden/check-if-status-changed
Skip redeploy if status is unchanged
Diffstat (limited to 'configserver')
-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)); |