aboutsummaryrefslogtreecommitdiffstats
path: root/controller-server
diff options
context:
space:
mode:
authorJon Marius Venstad <venstad@gmail.com>2021-12-15 14:20:07 +0100
committerJon Marius Venstad <venstad@gmail.com>2021-12-15 14:20:07 +0100
commit856220a1aa9d0c62ce3b466b5d05babf8caf1076 (patch)
tree17e6dcd902987eb89a56454aaa3b721b47c45228 /controller-server
parentd4605ae7d977fe57cc66991035d63c7dfe4a33d0 (diff)
Wire speed through controller
Diffstat (limited to 'controller-server')
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java4
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ReindexingTriggerer.java3
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java12
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java5
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/ReindexingTriggererTest.java4
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java6
6 files changed, 22 insertions, 12 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) {
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java
index aa53d09be04..e0ce1c060bc 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java
@@ -438,7 +438,7 @@ public class ConfigServerMock extends AbstractComponent implements ConfigServer
}
@Override
- public void reindex(DeploymentId deployment, List<String> clusterNames, List<String> documentTypes, boolean indexedOnly) { }
+ public void reindex(DeploymentId deployment, List<String> clusterNames, List<String> documentTypes, boolean indexedOnly, Double speed) { }
@Override
public ApplicationReindexing getReindexing(DeploymentId deployment) {
@@ -450,7 +450,8 @@ public class ConfigServerMock extends AbstractComponent implements ConfigServer
Instant.ofEpochMilli(567),
ApplicationReindexing.State.FAILED,
"(#`д´)ノ",
- 0.1)))));
+ 0.1,
+ 1.0)))));
}
@Override
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/ReindexingTriggererTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/ReindexingTriggererTest.java
index 8b5a12c8879..76cc9f5773a 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/ReindexingTriggererTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/ReindexingTriggererTest.java
@@ -69,7 +69,7 @@ public class ReindexingTriggererTest {
Map.of("cluster",
new Cluster(Map.of(),
Map.of("type",
- new Status(then, then, null, null, null, null)))));
+ new Status(then, then, null, null, null, null, 1.0)))));
assertFalse("Should not be ready when reindexing is already running",
reindexingIsReady(reindexing, now));
@@ -77,7 +77,7 @@ public class ReindexingTriggererTest {
Map.of("cluster",
new Cluster(Map.of("type", 123L),
Map.of("type",
- new Status(then, then, now, null, null, null)))));
+ new Status(then, then, now, null, null, null, 1.0)))));
assertTrue("Should be ready when reindexing is no longer running",
reindexingIsReady(reindexing, now));
}
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java
index b6aa2313ab3..8eaa190e9fa 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java
@@ -597,8 +597,10 @@ public class ApplicationApiTest extends ControllerContainerTest {
// POST a 'reindex application' command
tester.assertResponse(request("/application/v4/tenant/tenant1/application/application1/instance/instance1/environment/prod/region/us-central-1/reindex", POST)
+ .properties(Map.of("indexedOnly", "true",
+ "speed", "10"))
.userIdentity(USER_ID),
- "{\"message\":\"Requested reindexing of tenant1.application1.instance1 in prod.us-central-1\"}");
+ "{\"message\":\"Requested reindexing of tenant1.application1.instance1 in prod.us-central-1, for indexed types, with speed 10.0\"}");
// POST a 'reindex application' command with cluster filter
tester.assertResponse(request("/application/v4/tenant/tenant1/application/application1/instance/instance1/environment/prod/region/us-central-1/reindex", POST)
@@ -626,7 +628,7 @@ public class ApplicationApiTest extends ControllerContainerTest {
// GET to get reindexing status
tester.assertResponse(request("/application/v4/tenant/tenant1/application/application1/instance/instance1/environment/prod/region/us-central-1/reindexing", GET)
.userIdentity(USER_ID),
- "{\"enabled\":true,\"clusters\":[{\"name\":\"cluster\",\"pending\":[{\"type\":\"type\",\"requiredGeneration\":100}],\"ready\":[{\"type\":\"type\",\"readyAtMillis\":345,\"startedAtMillis\":456,\"endedAtMillis\":567,\"state\":\"failed\",\"message\":\"(#`д´)ノ\",\"progress\":0.1}]}]}");
+ "{\"enabled\":true,\"clusters\":[{\"name\":\"cluster\",\"pending\":[{\"type\":\"type\",\"requiredGeneration\":100}],\"ready\":[{\"type\":\"type\",\"readyAtMillis\":345,\"startedAtMillis\":456,\"endedAtMillis\":567,\"state\":\"failed\",\"message\":\"(#`д´)ノ\",\"progress\":0.1,\"speed\":1.0}]}]}");
// POST to request a service dump
tester.assertResponse(request("/application/v4/tenant/tenant1/application/application1/instance/instance1/environment/prod/region/us-central-1/node/host-tenant1:application1:instance1-prod.us-central-1/service-dump", POST)