diff options
author | Jon Marius Venstad <venstad@gmail.com> | 2021-12-15 14:20:07 +0100 |
---|---|---|
committer | Jon Marius Venstad <venstad@gmail.com> | 2021-12-15 14:20:07 +0100 |
commit | 856220a1aa9d0c62ce3b466b5d05babf8caf1076 (patch) | |
tree | 17e6dcd902987eb89a56454aaa3b721b47c45228 /controller-server/src/main | |
parent | d4605ae7d977fe57cc66991035d63c7dfe4a33d0 (diff) |
Wire speed through controller
Diffstat (limited to 'controller-server/src/main')
3 files changed, 13 insertions, 6 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java index 49939f4bfd2..e7e7101aff7 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java @@ -178,8 +178,8 @@ public class ApplicationController { * if no documents types are given, reindexing is triggered for all given clusters; otherwise * reindexing is triggered for the cartesian product of the given clusters and document types. */ - public void reindex(ApplicationId id, ZoneId zoneId, List<String> clusterNames, List<String> documentTypes, boolean indexedOnly) { - configServer.reindex(new DeploymentId(id, zoneId), clusterNames, documentTypes, indexedOnly); + public void reindex(ApplicationId id, ZoneId zoneId, List<String> clusterNames, List<String> documentTypes, boolean indexedOnly, Double speed) { + configServer.reindex(new DeploymentId(id, zoneId), clusterNames, documentTypes, indexedOnly, speed); } /** Returns the reindexing status for the given application in the given zone. */ diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ReindexingTriggerer.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ReindexingTriggerer.java index 34b1ea34227..1ee13bbd0c0 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ReindexingTriggerer.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ReindexingTriggerer.java @@ -32,6 +32,7 @@ import java.util.logging.Logger; public class ReindexingTriggerer extends ControllerMaintainer { static final Duration reindexingPeriod = Duration.ofDays(91); // 13 weeks — four times a year. + static final double speed = 0.2; // Careful reindexing, as this is supposed to be a background operation. private static final Logger log = Logger.getLogger(ReindexingTriggerer.class.getName()); @@ -49,7 +50,7 @@ public class ReindexingTriggerer extends ControllerMaintainer { for (Deployment deployment : deployments) if ( inWindowOfOpportunity(now, id, deployment.zone()) && reindexingIsReady(controller().applications().applicationReindexing(id, deployment.zone()), now)) - controller().applications().reindex(id, deployment.zone(), List.of(), List.of(), true); + controller().applications().reindex(id, deployment.zone(), List.of(), List.of(), true, speed); }); return 1.0; } diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java index 8af26f564a6..73a80a0a94a 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java @@ -139,6 +139,7 @@ import java.util.Comparator; import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Optional; import java.util.OptionalLong; import java.util.Scanner; @@ -1839,10 +1840,14 @@ public class ApplicationApiHandler extends AuditLoggingRequestHandler { .filter(type -> ! type.isBlank()) .collect(toUnmodifiableList()); - controller.applications().reindex(id, zone, clusterNames, documentTypes, request.getBooleanProperty("indexedOnly")); + Double speed = request.hasProperty("speed") ? Double.parseDouble(request.getProperty("speed")) : null; + boolean indexedOnly = request.getBooleanProperty("indexedOnly"); + controller.applications().reindex(id, zone, clusterNames, documentTypes, indexedOnly, speed); return new MessageResponse("Requested reindexing of " + id + " in " + zone + - (clusterNames.isEmpty() ? "" : ", on clusters " + String.join(", ", clusterNames) + - (documentTypes.isEmpty() ? "" : ", for types " + String.join(", ", documentTypes)))); + (clusterNames.isEmpty() ? "" : ", on clusters " + String.join(", ", clusterNames)) + + (documentTypes.isEmpty() ? "" : ", for types " + String.join(", ", documentTypes)) + + (indexedOnly ? ", for indexed types" : "") + + (speed != null ? ", with speed " + speed : "")); } /** Gets reindexing status of an application in a zone. */ @@ -1888,6 +1893,7 @@ public class ApplicationApiHandler extends AuditLoggingRequestHandler { status.state().map(ApplicationApiHandler::toString).ifPresent(state -> statusObject.setString("state", state)); status.message().ifPresent(message -> statusObject.setString("message", message)); status.progress().ifPresent(progress -> statusObject.setDouble("progress", progress)); + status.speed().ifPresent(speed -> statusObject.setDouble("speed", speed)); } private static String toString(ApplicationReindexing.State state) { |